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 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'tdm/kfrontend/kgapp.cpp') 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 -- cgit v1.2.3