Further work on display configuration tool

Tool is nearly functional at this point but is still disabled pending completion


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1249189 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
parent 67b84c9168
commit 422e6d3a19

@ -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();
updateDisplayedInformation(); refreshDisplayedInformation();
} }
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->refresh_rates.count()); base->resolutionSlider->setMaxValue(screendata->resolutions.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);

@ -109,6 +109,7 @@ private slots:
void updateExtendedMonitorInformation (void); void updateExtendedMonitorInformation (void);
void processLockoutControls (void); void processLockoutControls (void);
void rotationInfoChanged (void); void rotationInfoChanged (void);
void refreshInfoChanged (void);
void activatePreview (void); void activatePreview (void);
}; };

@ -640,8 +640,9 @@ void KRandRSystemTray::slotCycleDisplays()
// resize events when switching screens, so KDE gets stuck in the old resolution // resize events when switching screens, so KDE gets stuck in the old resolution
// This only seems to happen with more than one screen, so check for that condition... // This only seems to happen with more than one screen, so check for that condition...
if (kapp->desktop()->numScreens() > 1) { if (kapp->desktop()->numScreens() > 1) {
currentScreen()->proposeSize(GetHackResolutionParameter()); // currentScreen()->proposeSize(GetHackResolutionParameter());
currentScreen()->applyProposed(); // currentScreen()->applyProposed();
kapp->desktop()->emitResizedSignal(currentScreenIndex());
} }
currentScreen()->proposeSize(GetDefaultResolutionParameter()); currentScreen()->proposeSize(GetDefaultResolutionParameter());

Loading…
Cancel
Save