Implement X11 event merging in krandrtray

This closes Bug 758
pull/2/head
Timothy Pearson 13 years ago
parent 0e63b78065
commit f2ef0ca599

@ -28,13 +28,20 @@
KRandRApp::KRandRApp() KRandRApp::KRandRApp()
: m_tray(new KRandRSystemTray(0L, "RANDRTray")) : m_tray(new KRandRSystemTray(0L, "RANDRTray"))
{ {
connect(&m_eventMergingTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(handleX11ConfigChangeEvent()));
m_tray->show(); m_tray->show();
} }
void KRandRApp::handleX11ConfigChangeEvent()
{
m_eventMergingTimer.stop();
m_tray->configChanged();
}
bool KRandRApp::x11EventFilter(XEvent* e) bool KRandRApp::x11EventFilter(XEvent* e)
{ {
if (e->type == m_tray->screenChangeNotifyEvent()) { if (e->type == m_tray->screenChangeNotifyEvent()) {
m_tray->configChanged(); m_eventMergingTimer.start(1000, TRUE);
} }
return KApplication::x11EventFilter( e ); return KApplication::x11EventFilter( e );
} }

@ -19,6 +19,7 @@
#ifndef KRANDRAPP_H #ifndef KRANDRAPP_H
#define KRANDRAPP_H #define KRANDRAPP_H
#include <tqtimer.h>
#include <kuniqueapplication.h> #include <kuniqueapplication.h>
class KRandRSystemTray; class KRandRSystemTray;
@ -32,8 +33,12 @@ public:
virtual bool x11EventFilter(XEvent * e); virtual bool x11EventFilter(XEvent * e);
private slots:
void handleX11ConfigChangeEvent();
private: private:
KRandRSystemTray* m_tray; KRandRSystemTray* m_tray;
TQTimer m_eventMergingTimer;
}; };
#endif #endif

Loading…
Cancel
Save