Ticket #7953: 7953-v1.patch
File 7953-v1.patch, 2.3 KB (added by , 14 years ago) |
---|
-
libs/libmythui/mythmainwindow.cpp
102 102 MediaPlayCallback playFn; 103 103 }; 104 104 105 void ImpreciseTimer::run(void) 106 { 107 while (!m_ShouldQuit) 108 { 109 usleep(m_Usec); 110 if (m_Running) 111 emit timeout(); 112 } 113 } 114 105 115 class MythMainWindowPrivate 106 116 { 107 117 public: … … 149 159 150 160 QObject *sysEventHandler; 151 161 152 QTimer *drawTimer;162 ImpreciseTimer *drawTimer; 153 163 QVector<MythScreenStack *> stackList; 154 164 MythScreenStack *mainStack; 155 165 … … 478 488 d->gestureTimer = new QTimer(this); 479 489 connect(d->gestureTimer, SIGNAL(timeout()), this, SLOT(mouseTimeout())); 480 490 481 d->drawTimer = new QTimer(this); 482 connect(d->drawTimer, SIGNAL(timeout()), this, SLOT(animate())); 483 d->drawTimer->start(1000 / 70); 491 d->drawTimer = new ImpreciseTimer(this); 492 connect(d->drawTimer, SIGNAL(timeout()), this, SLOT(animate()), 493 Qt::BlockingQueuedConnection); 494 d->drawTimer->start(); 495 d->drawTimer->startTimer(70); 484 496 485 497 d->AllowInput = true; 486 498 … … 962 974 d->paintwin->raise(); 963 975 d->paintwin->show(); 964 976 965 d->drawTimer->start (1000 /70);977 d->drawTimer->startTimer(70); 966 978 } 967 979 968 980 void MythMainWindow::Show(void) -
libs/libmythui/mythmainwindow_internal.h
2 2 #define MYTHMAINWINDOW_INT 3 3 4 4 #include <QWidget> 5 #include <QThread> 5 6 6 7 class MythMainWindow; 7 8 class MythMainWindowPrivate; … … 52 53 MythMainWindowPrivate *d; 53 54 }; 54 55 56 class ImpreciseTimer : public QThread 57 { 58 Q_OBJECT 59 60 public: 61 ImpreciseTimer(QObject *parent) : QThread(parent), m_Running(false), 62 m_ShouldQuit(false), m_Usec(100000) {} 63 ~ImpreciseTimer() { m_ShouldQuit = true; } 64 void stop(void) { m_Running = false; } 65 void startTimer(double framerate) { m_Usec = 1000000 / framerate; m_Running = true; } 66 67 protected: 68 void run(void); 69 70 signals: 71 void timeout(void); 72 73 private: 74 volatile bool m_Running; 75 volatile bool m_ShouldQuit; 76 volatile useconds_t m_Usec; 77 }; 78 55 79 #endif