Ticket #8641: 8641-v2.patch
File 8641-v2.patch, 11.8 KB (added by , 11 years ago) |
---|
-
libs/libmythtv/tv_play.cpp
1037 1037 player.push_back(new PlayerContext(kPlayerInUseID)); 1038 1038 playerActive = 0; 1039 1039 playerLock.unlock(); 1040 1041 GetMythMainWindow()->PushDrawDisabled(__FILE__, __LINE__); 1042 1040 1043 VERBOSE(VB_PLAYBACK, LOC + "ctor -- end"); 1041 1044 } 1042 1045 … … 1169 1172 1170 1173 gCoreContext->removeListener(this); 1171 1174 1172 GetMythMainWindow()-> SetDrawEnabled(true);1175 GetMythMainWindow()->PopDrawDisabled(__FILE__, __LINE__); 1173 1176 1174 1177 if (myWindow) 1175 1178 { … … 1957 1960 VERBOSE(VB_IMPORTANT, "We have a RingBuffer"); 1958 1961 1959 1962 GetMythUI()->DisableScreensaver(); 1960 GetMythMainWindow()->SetDrawEnabled(false);1963 //GetMythMainWindow()->PushDrawDisabled(__FILE__, __LINE__); 1961 1964 1962 1965 if (ctx->playingInfo && StartRecorder(ctx,-1)) 1963 1966 { … … 2023 2026 2024 2027 if (ctx->buffer && ctx->buffer->IsOpen()) 2025 2028 { 2026 GetMythMainWindow()->SetDrawEnabled(false);2029 //GetMythMainWindow()->PushDrawDisabled(__FILE__, __LINE__); 2027 2030 GetMythUI()->DisableScreensaver(); 2028 2031 2029 2032 if (desiredNextState == kState_WatchingRecording) … … 7757 7760 } 7758 7761 } 7759 7762 7760 // we are embedding in a mythui window so show the gui paint window again7761 GetMythMainWindow()-> SetDrawEnabled(true);7763 // We are embedding in a mythui window so show the gui paint window again 7764 GetMythMainWindow()->PopDrawDisabled(__FILE__, __LINE__); 7762 7765 GetMythMainWindow()->GetPaintWindow()->show(); 7763 7766 } 7764 7767 … … 8437 8440 if (message.left(11) == "EPG_EXITING" || 8438 8441 message.left(18) == "PROGFINDER_EXITING" || 8439 8442 message.left(21) == "VIEWSCHEDULED_EXITING" || 8440 message.left(19) 8443 message.left(19) == "PLAYBACKBOX_EXITING" || 8441 8444 message.left(22) == "SCHEDULEEDITOR_EXITING") 8442 8445 { 8443 GetMythMainWindow()-> SetDrawEnabled(false);8446 GetMythMainWindow()->PushDrawDisabled(__FILE__, __LINE__); 8444 8447 // Resize the window back to the MythTV Player size 8445 8448 PlayerContext *actx = GetPlayerReadLock(-1, __FILE__, __LINE__); 8446 8449 PlayerContext *mctx; -
libs/libmythtv/videoout_xv.cpp
2563 2563 2564 2564 void VideoOutputXv::DrawUnusedRects(bool sync) 2565 2565 { 2566 VERBOSE(VB_IMPORTANT, "VideoOutputXv::DrawUnusedRects()"); 2567 2566 2568 // boboff assumes the smallest interlaced resolution is 480 lines - 5% 2567 2569 bool use_bob = (m_deinterlacing && m_deintfiltername == "bobdeint"); 2568 2570 const QRect display_visible_rect = windows[0].GetDisplayVisibleRect(); -
libs/libmythui/mythmainwindow.cpp
15 15 #include <QGLWidget> 16 16 #endif 17 17 18 #include <QWaitCondition> 18 19 #include <QApplication> 19 20 #include <QTimer> 20 21 #include <QDesktopWidget> … … 75 76 76 77 #define GESTURE_TIMEOUT 1000 77 78 79 #define LOC QString("MythMainWindow: ") 80 #define LOC_WARN QString("MythMainWindow, Warning: ") 81 #define LOC_ERR QString("MythMainWindow, Error: ") 82 78 83 class KeyContext 79 84 { 80 85 public: … … 113 118 class MythMainWindowPrivate 114 119 { 115 120 public: 121 MythMainWindowPrivate() : 122 wmult(1.0f), hmult(1.0f), 123 screenwidth(0), screenheight(0), 124 xbase(0), ybase(0), 125 does_fill_screen(false), 126 ignore_lirc_keys(false), 127 ignore_joystick_keys(false), 128 lircThread(NULL), 129 #ifdef USE_JOYSTICK_MENU 130 joystickThread(NULL), 131 #endif 132 133 #ifdef USING_APPLEREMOTE 134 appleRemoteListener(NULL), 135 appleRemote(NULL), 136 #endif 137 exitingtomain(false), 138 popwindows(false), 139 140 m_useDB(true), 141 142 exitmenucallback(NULL), 143 144 exitmenumediadevicecallback(NULL), 145 mediadeviceforcallback(NULL), 146 147 escapekey(0), 148 149 sysEventHandler(NULL), 150 151 drawTimer(NULL), 152 mainStack(NULL), 153 154 painter(NULL), 155 156 #ifdef USE_OPENGL_PAINTER 157 render(NULL), 158 #endif 159 160 AllowInput(true), 161 162 gestureTimer(NULL), 163 164 paintwin(NULL), 165 166 oldpaintwin(NULL), 167 oldpainter(NULL), 168 169 m_drawDisabledDepth(0), 170 m_drawEnabled(true) 171 { 172 } 173 116 174 int TranslateKeyNum(QKeyEvent *e); 117 175 118 176 float wmult, hmult; … … 182 240 QWidget *oldpaintwin; 183 241 MythPainter *oldpainter; 184 242 185 volatile bool m_drawEnabled; 243 QMutex m_drawDisableLock; 244 QMutex m_setDrawEnabledLock; 245 QWaitCondition m_setDrawEnabledWait; 246 uint m_drawDisabledDepth; 247 bool m_drawEnabled; 186 248 }; 187 249 188 250 // Make keynum in QKeyEvent be equivalent to what's in QKeySequence … … 1114 1176 } 1115 1177 /* FIXME: end compatibility */ 1116 1178 1179 uint MythMainWindow::PushDrawDisabled(const char *file, int line) 1180 { 1181 QMutexLocker locker(&d->m_drawDisableLock); 1182 VERBOSE(VB_IMPORTANT, QString("PushDrawDisabled(%1@%2) -- begin") 1183 .arg(file).arg(line)); 1184 d->m_drawDisabledDepth++; 1185 if (d->m_drawDisabledDepth && d->m_drawEnabled) 1186 SetDrawEnabled(false); 1187 VERBOSE(VB_IMPORTANT, QString("PushDrawDisabled(%1@%2) -- end") 1188 .arg(file).arg(line)); 1189 return d->m_drawDisabledDepth; 1190 } 1191 1192 uint MythMainWindow::PopDrawDisabled(const char *file, int line) 1193 { 1194 QMutexLocker locker(&d->m_drawDisableLock); 1195 VERBOSE(VB_IMPORTANT, QString("PopDrawDisabled(%1@%2) -- begin") 1196 .arg(file).arg(line)); 1197 if (d->m_drawDisabledDepth) 1198 { 1199 d->m_drawDisabledDepth--; 1200 if (!d->m_drawDisabledDepth && !d->m_drawEnabled) 1201 SetDrawEnabled(true); 1202 } 1203 VERBOSE(VB_IMPORTANT, QString("PopDrawDisabled(%1@%2) -- end") 1204 .arg(file).arg(line)); 1205 return d->m_drawDisabledDepth; 1206 } 1207 1117 1208 void MythMainWindow::SetDrawEnabled(bool enable) 1118 1209 { 1210 QMutexLocker locker(&d->m_setDrawEnabledLock); 1211 1212 if (!gCoreContext->IsUIThread()) 1213 { 1214 VERBOSE(VB_IMPORTANT, LOC + QString("SetDrawEnabled(%1) -- outside UI") 1215 .arg(enable)); 1216 1217 QCoreApplication::postEvent( 1218 this, new MythEvent( 1219 (enable) ? 1220 MythEvent::kSetDrawEnabledEventType : 1221 MythEvent::kSetDrawDisabledEventType)); 1222 1223 VERBOSE(VB_IMPORTANT, LOC + QString("SetDrawEnabled(%1) -- waiting") 1224 .arg(enable)); 1225 1226 while (QCoreApplication::hasPendingEvents()) 1227 d->m_setDrawEnabledWait.wait(&d->m_setDrawEnabledLock); 1228 1229 VERBOSE(VB_IMPORTANT, LOC + QString("SetDrawEnabled(%1) -- done") 1230 .arg(enable)); 1231 1232 return; 1233 } 1234 1235 static uint ecnt = 0, dcnt = 0; 1236 ecnt += enable ? 1 : 0; 1237 dcnt += enable ? 0 : 1; 1238 1239 VERBOSE(VB_IMPORTANT, LOC + QString("SetDrawEnabled(%1) cnt %2") 1240 .arg(enable).arg(enable?ecnt:dcnt)); 1241 1119 1242 setUpdatesEnabled(enable); 1120 1243 d->m_drawEnabled = enable; 1121 1244 … … 1123 1246 d->drawTimer->start(1000 / 70); 1124 1247 else 1125 1248 d->drawTimer->stop(); 1249 1250 d->m_setDrawEnabledWait.wakeAll(); 1126 1251 } 1127 1252 1128 1253 void MythMainWindow::SetEffectsEnabled(bool enable) … … 1926 2051 } 1927 2052 } 1928 2053 } 1929 else if (ce->type() == MythEvent::k DisableDrawingEventType)2054 else if (ce->type() == MythEvent::kPushDisableDrawingEventType) 1930 2055 { 1931 SetDrawEnabled(false);2056 PushDrawDisabled(__FILE__, __LINE__); 1932 2057 } 1933 else if (ce->type() == MythEvent::k EnableDrawingEventType)2058 else if (ce->type() == MythEvent::kPopDisableDrawingEventType) 1934 2059 { 2060 PopDrawDisabled(__FILE__, __LINE__); 2061 } 2062 else if (ce->type() == MythEvent::kSetDrawEnabledEventType) 2063 { 2064 VERBOSE(VB_IMPORTANT, LOC + "kSetDrawEnabledEvent"); 1935 2065 SetDrawEnabled(true); 1936 2066 } 2067 else if (ce->type() == MythEvent::kSetDrawDisabledEventType) 2068 { 2069 VERBOSE(VB_IMPORTANT, LOC + "kSetDrawDisabledEvent"); 2070 SetDrawEnabled(false); 2071 } 1937 2072 else if ((MythEvent::Type)(ce->type()) == MythEvent::MythEventMessage) 1938 2073 { 1939 2074 MythEvent *me = (MythEvent *)ce; -
libs/libmythui/mythmainwindow.h
113 113 114 114 QWidget *currentWidget(void); 115 115 116 void SetDrawEnabled(bool enable); 116 uint PushDrawDisabled(const char *file, int line); 117 uint PopDrawDisabled(const char *file, int line); 117 118 void SetEffectsEnabled(bool enable); 118 119 119 120 public slots: … … 140 141 141 142 QObject *getTarget(QKeyEvent &key); 142 143 144 void SetDrawEnabled(bool enable); 145 143 146 MythMainWindowPrivate *d; 144 147 }; 145 148 -
libs/libmyth/util.cpp
1277 1277 #endif 1278 1278 bool res = myth_system(command, 1279 1279 MYTH_SYSTEM_DONT_BLOCK_LIRC | 1280 MYTH_SYSTEM_DONT_BLOCK_JOYSTICK_MENU | 1281 MYTH_SYSTEM_DONT_BLOCK_PARENT); 1280 MYTH_SYSTEM_DONT_BLOCK_JOYSTICK_MENU); 1282 1281 return !res; 1283 1282 } 1284 1283 -
libs/libmythdb/mythsystem.cpp
80 80 // since this function could be called inside one of those events. 81 81 if (ready_to_lock && !(flags & MYTH_SYSTEM_DONT_BLOCK_PARENT)) 82 82 { 83 QEvent event(MythEvent::k DisableDrawingEventType);83 QEvent event(MythEvent::kPushDisableDrawingEventType); 84 84 QCoreApplication::sendEvent(gCoreContext->GetGUIObject(), &event); 85 85 } 86 86 … … 216 216 // since this function could be called inside one of those events. 217 217 if (ready_to_lock && !(flags & MYTH_SYSTEM_DONT_BLOCK_PARENT)) 218 218 { 219 QEvent event(MythEvent::k EnableDrawingEventType);219 QEvent event(MythEvent::kPopDisableDrawingEventType); 220 220 QCoreApplication::sendEvent(gCoreContext->GetGUIObject(), &event); 221 221 } 222 222 -
libs/libmythdb/mythevent.h
52 52 static Type MythEventMessage; 53 53 static Type kExitToMainMenuEventType; 54 54 static Type kMythPostShowEventType; 55 static Type kDisableDrawingEventType; 56 static Type kEnableDrawingEventType; 55 static Type kPushDisableDrawingEventType; 56 static Type kPopDisableDrawingEventType; 57 static Type kSetDrawEnabledEventType; 58 static Type kSetDrawDisabledEventType; 57 59 58 60 private: 59 61 QString message; -
libs/libmythdb/mythevent.cpp
6 6 (QEvent::Type) QEvent::registerEventType(); 7 7 QEvent::Type MythEvent::kMythPostShowEventType = 8 8 (QEvent::Type) QEvent::registerEventType(); 9 QEvent::Type MythEvent::k DisableDrawingEventType =9 QEvent::Type MythEvent::kPushDisableDrawingEventType = 10 10 (QEvent::Type) QEvent::registerEventType(); 11 QEvent::Type MythEvent::k EnableDrawingEventType =11 QEvent::Type MythEvent::kPopDisableDrawingEventType = 12 12 (QEvent::Type) QEvent::registerEventType(); 13 QEvent::Type MythEvent::kSetDrawEnabledEventType = 14 (QEvent::Type) QEvent::registerEventType(); 15 QEvent::Type MythEvent::kSetDrawDisabledEventType = 16 (QEvent::Type) QEvent::registerEventType(); 13 17 QEvent::Type ExternalKeycodeEvent::kEventType = 14 18 (QEvent::Type) QEvent::registerEventType();