summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-24 03:21:22 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-24 03:21:22 +0000
commit9cff39bc34d1f0579b2f9841f55c6cebc87fed57 (patch)
tree3d809111cc494a4e2267a55bb6fd327fd0194830
parent422e6d3a19cb512c83ae4145bb4ffb8cc491f454 (diff)
downloadtdebase-9cff39bc34d1f0579b2f9841f55c6cebc87fed57.tar.gz
tdebase-9cff39bc34d1f0579b2f9841f55c6cebc87fed57.zip
Enable the new display configuration module
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1249201 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--kcontrol/displayconfig/displayconfig.cpp59
-rw-r--r--kcontrol/displayconfig/displayconfig.desktop2
-rw-r--r--kcontrol/displayconfig/displayconfig.h3
-rw-r--r--kcontrol/displayconfig/displayconfigbase.ui16
-rw-r--r--kdm/kfrontend/CMakeLists.txt2
-rw-r--r--kdm/kfrontend/kgapp.cpp14
6 files changed, 92 insertions, 4 deletions
diff --git a/kcontrol/displayconfig/displayconfig.cpp b/kcontrol/displayconfig/displayconfig.cpp
index 7c75df2f2..98285276a 100644
--- a/kcontrol/displayconfig/displayconfig.cpp
+++ b/kcontrol/displayconfig/displayconfig.cpp
@@ -693,7 +693,10 @@ KDisplayConfig::KDisplayConfig(TQWidget *parent, const char *name, const TQStrin
connect(base->systemEnableSupport, TQT_SIGNAL(toggled(bool)), base->monitorDisplaySelectDD, TQT_SLOT(setEnabled(bool)));
+ connect(base->rescanHardware, TQT_SIGNAL(clicked()), TQT_SLOT(rescanHardware()));
+ connect(base->loadExistingProfile, TQT_SIGNAL(clicked()), TQT_SLOT(reloadProfile()));
connect(base->previewConfiguration, TQT_SIGNAL(clicked()), TQT_SLOT(activatePreview()));
+ connect(base->identifyMonitors, TQT_SIGNAL(clicked()), TQT_SLOT(identifyMonitors()));
load();
@@ -720,6 +723,59 @@ void KDisplayConfig::updateExtendedMonitorInformation () {
refreshDisplayedInformation();
}
+void KDisplayConfig::rescanHardware (void) {
+ m_randrsimple->destroyScreenInformationObject(m_screenInfoArray);
+ m_screenInfoArray = m_randrsimple->readCurrentDisplayConfiguration();
+ m_randrsimple->ensureMonitorDataConsistency(m_screenInfoArray);
+ numberOfScreens = m_screenInfoArray.count();
+ refreshDisplayedInformation();
+}
+
+void KDisplayConfig::reloadProfile (void) {
+ // FIXME
+ m_randrsimple->destroyScreenInformationObject(m_screenInfoArray);
+ m_screenInfoArray = m_randrsimple->loadSystemwideDisplayConfiguration("", KDE_CONFDIR);
+ m_randrsimple->ensureMonitorDataConsistency(m_screenInfoArray);
+ numberOfScreens = m_screenInfoArray.count();
+ refreshDisplayedInformation();
+}
+
+void KDisplayConfig::identifyMonitors () {
+ int i;
+
+ TQLabel* idWidget;
+ TQPtrList<TQWidget> widgetList;
+
+ Display *randr_display;
+ ScreenInfo *randr_screen_info;
+ XRROutputInfo *output_info;
+
+ randr_display = XOpenDisplay(NULL);
+ randr_screen_info = m_randrsimple->read_screen_info(randr_display);
+
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ output_info = randr_screen_info->outputs[i]->info;
+ // Look for ON outputs...
+ if (!randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+ SingleScreenData *screendata = m_screenInfoArray.at(i);
+ idWidget = new TQLabel(TQString("Screen\n%1").arg(i+1), (TQWidget*)0, "", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM | Qt::WDestructiveClose);
+ widgetList.append(idWidget);
+ idWidget->resize(150, 100);
+ idWidget->setAlignment(Qt::AlignCenter);
+ TQFont font = idWidget->font();
+ font.setBold( true );
+ font.setPointSize(24);
+ idWidget->setFont( font );
+ idWidget->setPaletteForegroundColor(Qt::white);
+ idWidget->setPaletteBackgroundColor(Qt::black);
+ idWidget->show();
+ KDialog::centerOnScreen(idWidget, i);
+ TQTimer::singleShot(3000, idWidget, SLOT(close()));
+ }
+}
+
void KDisplayConfig::deleteProfile () {
}
@@ -1038,6 +1094,9 @@ void KDisplayConfig::processLockoutControls() {
base->resolutionTab->setEnabled(false);
}
}
+
+ base->loadExistingProfile->setEnabled(false); // Disable this until it works properly!
+ base->loadExistingProfile->hide(); // Same as above
}
void KDisplayConfig::addTab( const TQString name, const TQString label )
diff --git a/kcontrol/displayconfig/displayconfig.desktop b/kcontrol/displayconfig/displayconfig.desktop
index 9fc6a06c4..653e2f002 100644
--- a/kcontrol/displayconfig/displayconfig.desktop
+++ b/kcontrol/displayconfig/displayconfig.desktop
@@ -20,4 +20,4 @@ MimeType=
Name=Monitor and Display
Name[en_US]=Monitor and Display
-NoDisplay=true \ No newline at end of file
+NoDisplay=false \ No newline at end of file
diff --git a/kcontrol/displayconfig/displayconfig.h b/kcontrol/displayconfig/displayconfig.h
index 643ff81af..835f1209a 100644
--- a/kcontrol/displayconfig/displayconfig.h
+++ b/kcontrol/displayconfig/displayconfig.h
@@ -111,6 +111,9 @@ private slots:
void rotationInfoChanged (void);
void refreshInfoChanged (void);
void activatePreview (void);
+ void identifyMonitors (void);
+ void rescanHardware (void);
+ void reloadProfile (void);
};
#endif
diff --git a/kcontrol/displayconfig/displayconfigbase.ui b/kcontrol/displayconfig/displayconfigbase.ui
index 56b5416a6..cbffc91fd 100644
--- a/kcontrol/displayconfig/displayconfigbase.ui
+++ b/kcontrol/displayconfig/displayconfigbase.ui
@@ -249,6 +249,22 @@
<string>&amp;Extend my Trinity desktop onto this monitor.</string>
</property>
</widget>
+ <widget class="KPushButton" row="8" column="0" colspan="1">
+ <property name="name">
+ <cstring>rescanHardware</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Rescan Displays</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="8" column="1" colspan="1">
+ <property name="name">
+ <cstring>loadExistingProfile</cstring>
+ </property>
+ <property name="text">
+ <string>Load &amp;Existing Profile</string>
+ </property>
+ </widget>
<widget class="KPushButton" row="8" column="2" colspan="1">
<property name="name">
<cstring>previewConfiguration</cstring>
diff --git a/kdm/kfrontend/CMakeLists.txt b/kdm/kfrontend/CMakeLists.txt
index 2c47832a8..22e017e46 100644
--- a/kdm/kfrontend/CMakeLists.txt
+++ b/kdm/kfrontend/CMakeLists.txt
@@ -64,7 +64,7 @@ tde_add_executable( kdm_greet AUTOMOC
kfdialog.cpp kgdialog.cpp kchooser.cpp kgverify.cpp
kdmshutdown.cpp kdmadmindialog.cpp kgreeter.cpp
kgapp.cpp
- LINK kdmthemer-static kdeui-shared Xtst
+ LINK kdmthemer-static kdeui-shared Xtst krandr-shared
DESTINATION ${BIN_INSTALL_DIR}
)
diff --git a/kdm/kfrontend/kgapp.cpp b/kdm/kfrontend/kgapp.cpp
index e83b61718..01d44cf63 100644
--- a/kdm/kfrontend/kgapp.cpp
+++ b/kdm/kfrontend/kgapp.cpp
@@ -40,6 +40,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <ksimpleconfig.h>
#include <klocale.h>
#include <kdebug.h>
+#include <libkrandr/libkrandr.h>
#include <tqtimer.h>
#include <tqstring.h>
@@ -230,6 +231,11 @@ kg_main( const char *argv0 )
if (!_GUIStyle.isEmpty())
app->setStyle( _GUIStyle );
+ // Load up systemwide display settings
+ KRandrSimpleAPI *randrsimple = new KRandrSimpleAPI();
+ TQPoint primaryScreenPosition = randrsimple->applySystemwideDisplayConfiguration("", KDE_CONFDIR);
+ delete randrsimple;
+
// Load up the systemwide ICC profile
TQString iccConfigFile = TQString(KDE_CONFDIR);
iccConfigFile += "/kicc/kiccconfigrc";
@@ -273,7 +279,7 @@ kg_main( const char *argv0 )
GSendInt( G_Ready );
- kdDebug() << timestamp() << " main1" << endl;
+ kdDebug() << timestamp() << " main1" << endl;
setCursor( dpy, app->desktop()->winId(), XC_left_ptr );
for (;;) {
@@ -323,8 +329,12 @@ kg_main( const char *argv0 )
dialog = new KStdGreeter;
}
XSetErrorHandler( (XErrorHandler)0 );
- } else
+ } else {
dialog = new KStdGreeter;
+ }
+ dialog->move(primaryScreenPosition.x(), primaryScreenPosition.y());
+ TQPoint oldCursorPos = TQCursor::pos();
+ TQCursor::setPos(oldCursorPos.x() + primaryScreenPosition.x(), oldCursorPos.y() + primaryScreenPosition.y());
if (*_preloader) {
proc2 = new KProcess;
*proc2 << _preloader;