@ -416,6 +416,7 @@ TQPoint compressTQRectTouchingMonitorRegion(TQRect rect, MonitorRegion region, T
void KDisplayConfig : : updateDraggableMonitorInformation ( int monitor_id ) {
void KDisplayConfig : : updateDraggableMonitorInformation ( int monitor_id ) {
updateDraggableMonitorInformationInternal ( monitor_id , true ) ;
updateDraggableMonitorInformationInternal ( monitor_id , true ) ;
changed ( ) ;
}
}
void KDisplayConfig : : updateDraggableMonitorInformationInternal ( int monitor_id , bool recurse ) {
void KDisplayConfig : : updateDraggableMonitorInformationInternal ( int monitor_id , bool recurse ) {
@ -463,6 +464,7 @@ void KDisplayConfig::updateDraggableMonitorInformationInternal (int monitor_id,
j = i ;
j = i ;
}
}
monitors = base - > monitorPhyArrange - > childrenListObject ( ) ;
monitors = base - > monitorPhyArrange - > childrenListObject ( ) ;
primary_monitor = 0 ;
if ( monitors . count ( ) ) {
if ( monitors . count ( ) ) {
for ( i = 0 ; i < int ( monitors . count ( ) ) ; + + i ) {
for ( i = 0 ; i < int ( monitors . count ( ) ) ; + + i ) {
if ( : : tqqt_cast < DraggableMonitor * > ( TQT_TQWIDGET ( monitors . at ( i ) ) ) ) {
if ( : : tqqt_cast < DraggableMonitor * > ( TQT_TQWIDGET ( monitors . at ( i ) ) ) ) {
@ -473,6 +475,7 @@ void KDisplayConfig::updateDraggableMonitorInformationInternal (int monitor_id,
}
}
}
}
if ( primary_monitor ) {
if ( moved_monitor ! = primary_monitor ) {
if ( moved_monitor ! = primary_monitor ) {
// Run layout rules
// Run layout rules
applyMonitorLayoutRules ( moved_monitor ) ;
applyMonitorLayoutRules ( moved_monitor ) ;
@ -491,6 +494,10 @@ void KDisplayConfig::updateDraggableMonitorInformationInternal (int monitor_id,
// Reset the position of the primary monitor
// Reset the position of the primary monitor
moveMonitor ( primary_monitor , 0 , 0 ) ;
moveMonitor ( primary_monitor , 0 , 0 ) ;
}
}
}
else {
printf ( " [WARNING] Display layout broken... \n \r " ) ; fflush ( stdout ) ;
}
layoutDragDropDisplay ( ) ;
layoutDragDropDisplay ( ) ;
@ -672,6 +679,7 @@ KDisplayConfig::KDisplayConfig(TQWidget *parent, const char *name, const TQStrin
connect ( base - > systemEnableSupport , TQT_SIGNAL ( clicked ( ) ) , TQT_SLOT ( processLockoutControls ( ) ) ) ;
connect ( base - > systemEnableSupport , TQT_SIGNAL ( clicked ( ) ) , TQT_SLOT ( processLockoutControls ( ) ) ) ;
connect ( base - > monitorDisplaySelectDD , TQT_SIGNAL ( activated ( int ) ) , TQT_SLOT ( changed ( ) ) ) ;
connect ( base - > monitorDisplaySelectDD , TQT_SIGNAL ( activated ( int ) ) , TQT_SLOT ( changed ( ) ) ) ;
connect ( base - > rotationSelectDD , TQT_SIGNAL ( activated ( int ) ) , TQT_SLOT ( rotationInfoChanged ( ) ) ) ;
connect ( base - > rotationSelectDD , TQT_SIGNAL ( activated ( int ) ) , TQT_SLOT ( rotationInfoChanged ( ) ) ) ;
connect ( base - > refreshRateDD , TQT_SIGNAL ( activated ( int ) ) , TQT_SLOT ( refreshInfoChanged ( ) ) ) ;
connect ( base - > orientationHFlip , TQT_SIGNAL ( clicked ( ) ) , TQT_SLOT ( rotationInfoChanged ( ) ) ) ;
connect ( base - > orientationHFlip , TQT_SIGNAL ( clicked ( ) ) , TQT_SLOT ( rotationInfoChanged ( ) ) ) ;
connect ( base - > orientationVFlip , TQT_SIGNAL ( clicked ( ) ) , TQT_SLOT ( rotationInfoChanged ( ) ) ) ;
connect ( base - > orientationVFlip , TQT_SIGNAL ( clicked ( ) ) , TQT_SLOT ( rotationInfoChanged ( ) ) ) ;
connect ( base - > resolutionSlider , TQT_SIGNAL ( valueChanged ( int ) ) , TQT_SLOT ( resolutionSliderChanged ( int ) ) ) ;
connect ( base - > resolutionSlider , TQT_SIGNAL ( valueChanged ( int ) ) , TQT_SLOT ( resolutionSliderChanged ( int ) ) ) ;
@ -709,7 +717,7 @@ void KDisplayConfig::updateExtendedMonitorInformation () {
screendata = m_screenInfoArray . at ( base - > monitorDisplaySelectDD - > currentItem ( ) ) ;
screendata = m_screenInfoArray . at ( base - > monitorDisplaySelectDD - > currentItem ( ) ) ;
screendata - > is_extended = base - > isExtendedMonitorCB - > isChecked ( ) ;
screendata - > is_extended = base - > isExtendedMonitorCB - > isChecked ( ) ;
update DisplayedInformation( ) ;
refresh DisplayedInformation( ) ;
}
}
void KDisplayConfig : : deleteProfile ( ) {
void KDisplayConfig : : deleteProfile ( ) {
@ -744,6 +752,7 @@ void KDisplayConfig::selectScreen (int slotNumber) {
void KDisplayConfig : : updateArray ( void ) {
void KDisplayConfig : : updateArray ( void ) {
m_screenInfoArray = m_randrsimple - > readCurrentDisplayConfiguration ( ) ;
m_screenInfoArray = m_randrsimple - > readCurrentDisplayConfiguration ( ) ;
m_randrsimple - > ensureMonitorDataConsistency ( m_screenInfoArray ) ;
numberOfScreens = m_screenInfoArray . count ( ) ;
numberOfScreens = m_screenInfoArray . count ( ) ;
}
}
@ -768,7 +777,7 @@ void KDisplayConfig::updateDisplayedInformation () {
// Update the resolutions for the selected screen
// Update the resolutions for the selected screen
base - > resolutionSlider - > blockSignals ( true ) ;
base - > resolutionSlider - > blockSignals ( true ) ;
base - > resolutionSlider - > setMaxValue ( screendata - > re fresh_rates. count ( ) ) ;
base - > resolutionSlider - > setMaxValue ( screendata - > re solutions. count ( ) - 1 ) ;
setRealResolutionSliderValue ( screendata - > current_resolution_index ) ;
setRealResolutionSliderValue ( screendata - > current_resolution_index ) ;
resolutionSliderTextUpdate ( realResolutionSliderValue ( ) ) ;
resolutionSliderTextUpdate ( realResolutionSliderValue ( ) ) ;
base - > resolutionSlider - > blockSignals ( false ) ;
base - > resolutionSlider - > blockSignals ( false ) ;
@ -864,6 +873,7 @@ void KDisplayConfig::refreshDisplayedInformation () {
void KDisplayConfig : : updateDragDropDisplay ( ) {
void KDisplayConfig : : updateDragDropDisplay ( ) {
// Insert data into the GUI
// Insert data into the GUI
int i ;
int i ;
int j ;
int largest_x_pixels ;
int largest_x_pixels ;
int largest_y_pixels ;
int largest_y_pixels ;
TQObjectList monitors ;
TQObjectList monitors ;
@ -887,8 +897,10 @@ void KDisplayConfig::updateDragDropDisplay() {
// Add the screens to the workspace
// Add the screens to the workspace
// Set the scaling small to start with
// Set the scaling small to start with
base - > monitorPhyArrange - > resize_factor = 0.0625 ; // This always needs to divide by a multiple of 2
base - > monitorPhyArrange - > resize_factor = 0.0625 ; // This always needs to divide by a multiple of 2
for ( j = 0 ; j < 2 ; j + + ) {
for ( i = 0 ; i < numberOfScreens ; i + + ) {
for ( i = 0 ; i < numberOfScreens ; i + + ) {
screendata = m_screenInfoArray . at ( i ) ;
screendata = m_screenInfoArray . at ( i ) ;
if ( ( ( j = = 0 ) & & ( screendata - > is_primary = = true ) ) | | ( j = = 1 ) ) { // This ensures that the primary monitor is always the first one created and placed on the configuration widget
TQString rotationDesired = * screendata - > rotations . at ( screendata - > current_rotation_index ) ;
TQString rotationDesired = * screendata - > rotations . at ( screendata - > current_rotation_index ) ;
bool isvisiblyrotated = ( ( rotationDesired = = " Rotate 90 degrees " ) | | ( rotationDesired = = " Rotate 270 degrees " ) ) ;
bool isvisiblyrotated = ( ( rotationDesired = = " Rotate 90 degrees " ) | | ( rotationDesired = = " Rotate 270 degrees " ) ) ;
DraggableMonitor * m = new DraggableMonitor ( base - > monitorPhyArrange , 0 , WStyle_Customize | WDestructiveClose | WStyle_NoBorder | WX11BypassWM ) ;
DraggableMonitor * m = new DraggableMonitor ( base - > monitorPhyArrange , 0 , WStyle_Customize | WDestructiveClose | WStyle_NoBorder | WX11BypassWM ) ;
@ -902,8 +914,11 @@ void KDisplayConfig::updateDragDropDisplay() {
m - > setFixedSize ( screendata - > current_x_pixel_count * base - > monitorPhyArrange - > resize_factor , screendata - > current_y_pixel_count * base - > monitorPhyArrange - > resize_factor ) ;
m - > setFixedSize ( screendata - > current_x_pixel_count * base - > monitorPhyArrange - > resize_factor , screendata - > current_y_pixel_count * base - > monitorPhyArrange - > resize_factor ) ;
m - > setText ( TQString ( " %1 " ) . arg ( i + 1 ) ) ;
m - > setText ( TQString ( " %1 " ) . arg ( i + 1 ) ) ;
m - > show ( ) ;
m - > show ( ) ;
moveMonitor ( m , screendata - > absolute_x_position , screendata - > absolute_y_position ) ;
updateDraggableMonitorInformation ( i ) ; // Make sure the new monitors don't overlap
updateDraggableMonitorInformation ( i ) ; // Make sure the new monitors don't overlap
}
}
}
}
layoutDragDropDisplay ( ) ;
layoutDragDropDisplay ( ) ;
}
}
@ -967,6 +982,17 @@ void KDisplayConfig::rotationInfoChanged() {
changed ( ) ;
changed ( ) ;
}
}
void KDisplayConfig : : refreshInfoChanged ( ) {
SingleScreenData * screendata ;
screendata = m_screenInfoArray . at ( base - > monitorDisplaySelectDD - > currentItem ( ) ) ;
screendata - > current_refresh_rate_index = base - > refreshRateDD - > currentItem ( ) ;
updateDisplayedInformation ( ) ;
updateDraggableMonitorInformation ( base - > monitorDisplaySelectDD - > currentItem ( ) ) ;
changed ( ) ;
}
TQString KDisplayConfig : : extractFileName ( TQString displayName , TQString profileName ) {
TQString KDisplayConfig : : extractFileName ( TQString displayName , TQString profileName ) {
}
}
@ -985,6 +1011,8 @@ void KDisplayConfig::ensurePrimaryMonitorIsAvailable() {
}
}
screendata = m_screenInfoArray . at ( currentScreenIndex ) ;
screendata = m_screenInfoArray . at ( currentScreenIndex ) ;
screendata - > is_primary = true ;
screendata - > is_primary = true ;
screendata - > is_extended = true ;
updateDragDropDisplay ( ) ;
refreshDisplayedInformation ( ) ;
refreshDisplayedInformation ( ) ;
}
}
@ -1052,7 +1080,7 @@ void KDisplayConfig::load(bool useDefaults )
void KDisplayConfig : : save ( )
void KDisplayConfig : : save ( )
{
{
if ( m_randrsimple - > applySystemwideDisplayConfiguration ( m_screenInfoArray , TRUE ) ) {
if ( m_randrsimple - > applySystemwideDisplayConfiguration ( m_screenInfoArray , TRUE ) ) {
m_randrsimple - > saveSystemwideDisplayConfiguration ( " " , KDE_CONFDIR , m_screenInfoArray ) ;
m_randrsimple - > saveSystemwideDisplayConfiguration ( base - > systemEnableSupport - > isChecked ( ) , " " , KDE_CONFDIR , m_screenInfoArray ) ;
// Write system configuration
// Write system configuration
systemconfig - > setGroup ( NULL ) ;
systemconfig - > setGroup ( NULL ) ;