From 261c0e1f6b9a69442520936ef7f91e1eac9f9514 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 12 Jan 2013 04:30:22 -0600 Subject: Add display hotplug support to TDM Fix displayconfig control module --- tdm/kfrontend/kgapp.cpp | 19 +++++++++++++++++-- tdm/kfrontend/kgapp.h | 6 +++++- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'tdm') diff --git a/tdm/kfrontend/kgapp.cpp b/tdm/kfrontend/kgapp.cpp index bb57b617b..120e20cb4 100644 --- a/tdm/kfrontend/kgapp.cpp +++ b/tdm/kfrontend/kgapp.cpp @@ -100,6 +100,9 @@ GreeterApp::GreeterApp() alarm( pingInterval * 70 ); // sic! give the "proper" pinger enough time startTimer( pingInterval * 60000 ); } + + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(deviceChanged(TDEGenericDevice*))); } GreeterApp::GreeterApp(Display *dpy, Qt::HANDLE visual, Qt::HANDLE colormap) : KApplication(dpy, visual, colormap) @@ -114,6 +117,17 @@ GreeterApp::GreeterApp(Display *dpy, Qt::HANDLE visual, Qt::HANDLE colormap) : K alarm( pingInterval * 70 ); // sic! give the "proper" pinger enough time startTimer( pingInterval * 60000 ); } + + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(deviceChanged(TDEGenericDevice*))); +} + +void GreeterApp::deviceChanged(TDEGenericDevice* device) { + if (device->type() == TDEGenericDeviceType::Monitor) { + KRandrSimpleAPI *randrsimple = new KRandrSimpleAPI(); + randrsimple->applyHotplugRules(KDE_CONFDIR); + delete randrsimple; + } } void @@ -272,13 +286,14 @@ kg_main( const char *argv0 ) Display *dpy = tqt_xdisplay(); - if (!_GUIStyle.isEmpty()) + if (!_GUIStyle.isEmpty()) { app->setStyle( _GUIStyle ); + } // Load up systemwide display settings #ifdef WITH_XRANDR KRandrSimpleAPI *randrsimple = new KRandrSimpleAPI(); - TQPoint primaryScreenPosition = randrsimple->applyDisplayConfiguration("", KDE_CONFDIR); + TQPoint primaryScreenPosition = randrsimple->applyStartupDisplayConfiguration(KDE_CONFDIR); randrsimple->applyHotplugRules(KDE_CONFDIR); delete randrsimple; #endif diff --git a/tdm/kfrontend/kgapp.h b/tdm/kfrontend/kgapp.h index 2c4374f47..4769ff65a 100644 --- a/tdm/kfrontend/kgapp.h +++ b/tdm/kfrontend/kgapp.h @@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define KGAPP_H #include +#include class GreeterApp : public KApplication { Q_OBJECT @@ -41,7 +42,10 @@ class GreeterApp : public KApplication { virtual void timerEvent( TQTimerEvent * ); signals: - void activity(); + void activity(); + + private slots: + void deviceChanged( TDEGenericDevice * ); private: int pingInterval; -- cgit v1.2.1