From 1246e0a69ee389910f7aa31b66dc04e177262eb4 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 6 Oct 2011 21:30:51 +0000 Subject: Force any ICC settings to override gamma sliders Fix application of ICC settings from displayconfig module Disallow dragging of primary monitor in displayconfig module git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1257648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/displayconfig/displayconfig.cpp | 23 +++++++++++++++++++---- kcontrol/displayconfig/displayconfig.h | 3 ++- kcontrol/displayconfig/displayconfigbase.ui | 2 +- kcontrol/displayconfig/monitorworkspace.cpp | 3 ++- kcontrol/displayconfig/monitorworkspace.h | 1 + 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/kcontrol/displayconfig/displayconfig.cpp b/kcontrol/displayconfig/displayconfig.cpp index f42d43923..2b7e7dde2 100644 --- a/kcontrol/displayconfig/displayconfig.cpp +++ b/kcontrol/displayconfig/displayconfig.cpp @@ -471,8 +471,12 @@ void KDisplayConfig::updateDraggableMonitorInformationInternal (int monitor_id, if (::tqqt_cast(TQT_TQWIDGET(monitors.at( i )))) { DraggableMonitor *monitor = static_cast(TQT_TQWIDGET(monitors.at( i ))); if (monitor->screen_id == j) { + monitor->is_primary = true; // Prevent dragging of the primary monitor primary_monitor = monitor; } + else { + monitor->is_primary = false; + } } } } @@ -634,8 +638,13 @@ void KDisplayConfig::moveMonitor(DraggableMonitor* monitor, int realx, int realy for ( i = 0; i < int(monitors.count()); ++i ) { if (::tqqt_cast(TQT_TQWIDGET(monitors.at( i )))) { DraggableMonitor *monitor = static_cast(TQT_TQWIDGET(monitors.at( i ))); - if (monitor->screen_id == j) + if (monitor->screen_id == j) { + monitor->is_primary = true; // Prevent dragging of the primary monitor primary_monitor = monitor; + } + else { + monitor->is_primary = false; + } } } } @@ -728,7 +737,7 @@ void KDisplayConfig::setRealResolutionSliderValue(int index) { /**** KDisplayConfig ****/ KDisplayConfig::KDisplayConfig(TQWidget *parent, const char *name, const TQStringList &) - : KCModule(KDisplayCFactory::instance(), parent, name), m_randrsimple(0), m_gammaApplyTimer(0) + : KCModule(KDisplayCFactory::instance(), parent, name), iccTab(0), m_randrsimple(0), m_gammaApplyTimer(0) { m_randrsimple = new KRandrSimpleAPI(); @@ -793,7 +802,7 @@ KDisplayConfig::KDisplayConfig(TQWidget *parent, const char *name, const TQStrin load(); - addTab( "iccconfig", i18n( "Color Profiles" ) ); // [FIXME[ No way to save settings here yet + iccTab = addTab( "iccconfig", i18n( "Color Profiles" ) ); // [FIXME] No way to save settings here yet processLockoutControls(); } @@ -1415,7 +1424,7 @@ void KDisplayConfig::processLockoutControls() { base->loadExistingProfile->hide(); // Same as above } -void KDisplayConfig::addTab( const TQString name, const TQString label ) +KCModule* KDisplayConfig::addTab( const TQString name, const TQString label ) { // [FIXME] This is incomplete...Apply may not work... TQWidget *page = new TQWidget( base->mainTabContainerWidget, name.latin1() ); @@ -1430,9 +1439,11 @@ void KDisplayConfig::addTab( const TQString name, const TQString label ) connect( kcm, TQT_SIGNAL( changed(bool) ), this, TQT_SLOT( changed() ) ); //m_modules.insert(kcm, false); + return kcm; } else { delete page; + return NULL; } } @@ -1473,6 +1484,10 @@ void KDisplayConfig::save() systemconfig->writeEntry("EnableDisplayControl", base->systemEnableSupport->isChecked()); systemconfig->sync(); + + if (iccTab) { + iccTab->save(); + } emit changed(false); } diff --git a/kcontrol/displayconfig/displayconfig.h b/kcontrol/displayconfig/displayconfig.h index 35cf7fa6c..6c283e308 100644 --- a/kcontrol/displayconfig/displayconfig.h +++ b/kcontrol/displayconfig/displayconfig.h @@ -69,6 +69,7 @@ k_dcop: private: KConfig *config; + KCModule *iccTab; bool _ok; Display *randr_display; ScreenInfo *randr_screen_info; @@ -87,7 +88,7 @@ private: TQPtrList m_screenInfoArray; int realResolutionSliderValue(); void setRealResolutionSliderValue(int index); - void addTab( const TQString name, const TQString label ); + KCModule* addTab( const TQString name, const TQString label ); void moveMonitor(DraggableMonitor* monitor, int realx, int realy); bool applyMonitorLayoutRules(void); bool applyMonitorLayoutRules(DraggableMonitor* primary_monitor); diff --git a/kcontrol/displayconfig/displayconfigbase.ui b/kcontrol/displayconfig/displayconfigbase.ui index a71dca758..161fb81ff 100644 --- a/kcontrol/displayconfig/displayconfigbase.ui +++ b/kcontrol/displayconfig/displayconfigbase.ui @@ -584,7 +584,7 @@ gammaTipText2 - Tip: Most computer software expects a gamma of 2.2. + Tip: Most computer software expects a gamma of 2.2.\nAdditionally, any ICC settings for the selected screen will override the gamma controls available on this tab. diff --git a/kcontrol/displayconfig/monitorworkspace.cpp b/kcontrol/displayconfig/monitorworkspace.cpp index b8907b71d..2b1c4a6f7 100644 --- a/kcontrol/displayconfig/monitorworkspace.cpp +++ b/kcontrol/displayconfig/monitorworkspace.cpp @@ -122,7 +122,8 @@ void DraggableMonitor::mouseMoveEvent(TQMouseEvent *event) if (moveToX > maxX) moveToX = maxX; if (moveToY > maxY) moveToY = maxY; - move(moveToX, moveToY); + if (!is_primary) + move(moveToX, moveToY); } void DraggableMonitor::mouseReleaseEvent(TQMouseEvent *event) diff --git a/kcontrol/displayconfig/monitorworkspace.h b/kcontrol/displayconfig/monitorworkspace.h index 3bbac4968..3dc5da637 100644 --- a/kcontrol/displayconfig/monitorworkspace.h +++ b/kcontrol/displayconfig/monitorworkspace.h @@ -69,6 +69,7 @@ signals: public: int screen_id; + bool is_primary; private: TQPoint lastMousePosition; -- cgit v1.2.1