From f2ef0ca599f2e400b75c1f15bd379647a436bc54 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 6 Jan 2012 19:44:37 -0600 Subject: Implement X11 event merging in krandrtray This closes Bug 758 --- kcontrol/randr/krandrapp.cpp | 9 ++++++++- kcontrol/randr/krandrapp.h | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'kcontrol/randr') diff --git a/kcontrol/randr/krandrapp.cpp b/kcontrol/randr/krandrapp.cpp index 2d773dd22..eab459e8e 100644 --- a/kcontrol/randr/krandrapp.cpp +++ b/kcontrol/randr/krandrapp.cpp @@ -28,13 +28,20 @@ KRandRApp::KRandRApp() : m_tray(new KRandRSystemTray(0L, "RANDRTray")) { + connect(&m_eventMergingTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(handleX11ConfigChangeEvent())); m_tray->show(); } +void KRandRApp::handleX11ConfigChangeEvent() +{ + m_eventMergingTimer.stop(); + m_tray->configChanged(); +} + bool KRandRApp::x11EventFilter(XEvent* e) { if (e->type == m_tray->screenChangeNotifyEvent()) { - m_tray->configChanged(); + m_eventMergingTimer.start(1000, TRUE); } return KApplication::x11EventFilter( e ); } diff --git a/kcontrol/randr/krandrapp.h b/kcontrol/randr/krandrapp.h index 3b8895fc8..766b0056c 100644 --- a/kcontrol/randr/krandrapp.h +++ b/kcontrol/randr/krandrapp.h @@ -19,6 +19,7 @@ #ifndef KRANDRAPP_H #define KRANDRAPP_H +#include #include class KRandRSystemTray; @@ -32,8 +33,12 @@ public: virtual bool x11EventFilter(XEvent * e); +private slots: + void handleX11ConfigChangeEvent(); + private: KRandRSystemTray* m_tray; + TQTimer m_eventMergingTimer; }; #endif -- cgit v1.2.1