Major enhancements to desktop screen switching--now switches screens in half the time needed before!

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1120367 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 42980db88e
commit 5669b778e5

@ -117,10 +117,10 @@ void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu)
if (RR_Disconnected != randr_screen_info->outputs[i]->info->connection) {
continue;
}
output_name = output_info->name;
output_id = randr_screen_info->outputs[i]->id;
// Deactivate this display to avoid a crash!
randr_screen_info->cur_crtc = randr_screen_info->outputs[i]->cur_crtc;
randr_screen_info->cur_output = randr_screen_info->outputs[i];
@ -128,10 +128,10 @@ void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu)
randr_screen_info->cur_output->off_set = 1;
output_off(randr_screen_info, randr_screen_info->cur_output);
main_low_apply(randr_screen_info);
screenDeactivated = 1;
}
if (screenDeactivated == 1) {
findPrimaryDisplay();
refresh();
@ -139,8 +139,11 @@ void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu)
// HACK
// This is needed because Qt does not properly generate screen
// resize events when switching screens, so KDE gets stuck in the old resolution
currentScreen()->proposeSize(GetHackResolutionParameter());
currentScreen()->applyProposed();
// This only seems to happen with more than one screen, so check for that condition...
if (kapp->desktop()->numScreens() > 1) {
currentScreen()->proposeSize(GetHackResolutionParameter());
currentScreen()->applyProposed();
}
currentScreen()->proposeSize(GetDefaultResolutionParameter());
currentScreen()->applyProposed();
@ -443,7 +446,7 @@ void KRandRSystemTray::slotCycleDisplays()
if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
continue;
}
output_name = output_info->name;
output_id = randr_screen_info->outputs[i]->id;
current_on_index = i;
@ -462,7 +465,7 @@ void KRandRSystemTray::slotCycleDisplays()
if (randr_screen_info->outputs[i]->cur_crtc) {
continue;
}
output_name = output_info->name;
output_id = randr_screen_info->outputs[i]->id;
if (i > max_index) {
@ -480,7 +483,7 @@ void KRandRSystemTray::slotCycleDisplays()
if (randr_screen_info->outputs[i]->cur_crtc) {
continue;
}
output_name = output_info->name;
output_id = randr_screen_info->outputs[i]->id;
if (i > max_index) {
@ -539,10 +542,10 @@ void KRandRSystemTray::slotCycleDisplays()
if (RR_Disconnected != randr_screen_info->outputs[i]->info->connection) {
continue;
}
output_name = output_info->name;
output_id = randr_screen_info->outputs[i]->id;
// Deactivate this display to avoid a crash!
randr_screen_info->cur_crtc = randr_screen_info->outputs[i]->cur_crtc;
randr_screen_info->cur_output = randr_screen_info->outputs[i];
@ -558,8 +561,11 @@ void KRandRSystemTray::slotCycleDisplays()
// HACK
// This is needed because Qt does not properly generate screen
// resize events when switching screens, so KDE gets stuck in the old resolution
currentScreen()->proposeSize(GetHackResolutionParameter());
currentScreen()->applyProposed();
// This only seems to happen with more than one screen, so check for that condition...
if (kapp->desktop()->numScreens() > 1) {
currentScreen()->proposeSize(GetHackResolutionParameter());
currentScreen()->applyProposed();
}
currentScreen()->proposeSize(GetDefaultResolutionParameter());
currentScreen()->applyProposed();
@ -590,7 +596,7 @@ void KRandRSystemTray::findPrimaryDisplay()
if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
continue;
}
output_name = output_info->name;
output_id = randr_screen_info->outputs[i]->id;
//printf("ACTIVE CHECK: Found output %s\n\r", output_name);
@ -611,7 +617,7 @@ void KRandRSystemTray::addOutputMenu(KPopupMenu* menu)
if (isValid() == true) {
menu->insertTitle(SmallIcon("kcmkwm"), i18n("Output Port"));
for (i = 0; i < randr_screen_info->n_output; i++) {
output_info = randr_screen_info->outputs[i]->info;
// Look for ON outputs
@ -621,19 +627,19 @@ void KRandRSystemTray::addOutputMenu(KPopupMenu* menu)
if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
continue;
}
output_name = output_info->name;
output_id = randr_screen_info->outputs[i]->id;
//printf("ON: Found output %s\n\r", output_name);
lastIndex = menu->insertItem(i18n("%1 (Active)").arg(output_name));
menu->setItemChecked(lastIndex, true);
menu->connectItem(lastIndex, this, SLOT(slotOutputChanged(int)));
menu->setItemParameter(lastIndex, i);
connected_displays++;
}
for (i = 0; i < randr_screen_info->n_output; i++) {
output_info = randr_screen_info->outputs[i]->info;
// Look for CONNECTED outputs....
@ -644,19 +650,19 @@ void KRandRSystemTray::addOutputMenu(KPopupMenu* menu)
if (randr_screen_info->outputs[i]->cur_crtc) {
continue;
}
output_name = output_info->name;
output_id = randr_screen_info->outputs[i]->id;
//printf("CONNECTED, NOT ON: Found output %s\n\r", output_name);
lastIndex = menu->insertItem(i18n("%1 (Connected, Inactive)").arg(output_name));
menu->setItemChecked(lastIndex, false);
menu->connectItem(lastIndex, this, SLOT(slotOutputChanged(int)));
menu->setItemParameter(lastIndex, i);
connected_displays++;
}
for (i = 0; i < randr_screen_info->n_output; i++) {
output_info = randr_screen_info->outputs[i]->info;
// Look for ALL outputs that are not connected....
@ -667,18 +673,18 @@ void KRandRSystemTray::addOutputMenu(KPopupMenu* menu)
if (randr_screen_info->outputs[i]->cur_crtc) {
continue;
}
output_name = output_info->name;
output_id = randr_screen_info->outputs[i]->id;
//printf("DISCONNECTED, NOT ON: Found output %s\n\r", output_name);
lastIndex = menu->insertItem(i18n("%1 (Disconnected, Inactive)").arg(output_name));
menu->setItemChecked(lastIndex, false);
menu->setItemEnabled(lastIndex, false);
menu->connectItem(lastIndex, this, SLOT(slotOutputChanged(int)));
menu->setItemParameter(lastIndex, i);
}
lastIndex = menu->insertItem(SmallIcon("forward"), i18n("Next available output"));
if (connected_displays < 2) {
menu->setItemEnabled(lastIndex, false);
@ -703,7 +709,7 @@ void KRandRSystemTray::slotOutputChanged(int parameter)
if (!randr_screen_info->outputs[i]->cur_crtc) {
continue;
}
num_outputs_on++;
}
@ -738,8 +744,11 @@ void KRandRSystemTray::slotOutputChanged(int parameter)
// HACK
// This is needed because Qt does not properly generate screen
// resize events when switching screens, so KDE gets stuck in the old resolution
currentScreen()->proposeSize(GetHackResolutionParameter());
currentScreen()->applyProposed();
// This only seems to happen with more than one screen, so check for that condition...
if (kapp->desktop()->numScreens() > 1) {
currentScreen()->proposeSize(GetHackResolutionParameter());
currentScreen()->applyProposed();
}
currentScreen()->proposeSize(GetDefaultResolutionParameter());
currentScreen()->applyProposed();
@ -748,4 +757,4 @@ void KRandRSystemTray::slotOutputChanged(int parameter)
KMessageBox::sorry(my_parent, i18n("<b>You are attempting to deactivate the only active output</b><p>You must keep at least one display output active at all times!"), i18n("Invalid Operation Requested"));
}
}
}
}

@ -673,7 +673,7 @@ QRect ExtensionManager::workArea(int XineramaScreen, const ExtensionContainer* e
}
QRect workArea;
if (XineramaScreen == XineramaAllScreens)
if ((XineramaScreen == XineramaAllScreens) || (kapp->desktop()->numScreens() < 2))
{
/* special value for all screens */
workArea = Kicker::the()->kwinModule()->workArea(list);

@ -43,7 +43,7 @@ namespace KWinInternal
*/
void Workspace::desktopResized()
{
printf("Workspace::desktopResized()\n\r");
//printf("Workspace::desktopResized()\n\r");
QRect geom = KApplication::desktop()->geometry();
NETSize desktop_geometry;
desktop_geometry.width = geom.width();
@ -59,7 +59,7 @@ void Workspace::desktopResized()
*/
void Workspace::kDestopResized()
{
printf("Workspace::kDesktopResized()\n\r");
//printf("Workspace::kDesktopResized()\n\r");
QRect geom = KApplication::desktop()->geometry();
NETSize desktop_geometry;
desktop_geometry.width = geom.width();
@ -232,38 +232,53 @@ QRect Workspace::clientArea( clientAreaOption opt, int screen, int desktop ) con
{
if( desktop == NETWinInfo::OnAllDesktops || desktop == 0 )
desktop = currentDesktop();
QDesktopWidget *desktopwidget = KApplication::desktop();
QDesktopWidget *desktopwidget = kapp->desktop();
QRect sarea = screenarea // may be NULL during KWin initialization
? screenarea[ desktop ][ screen ]
: desktopwidget->screenGeometry( screen );
QRect warea = workarea[ desktop ].isNull()
? QApplication::desktop()->geometry()
? kapp->desktop()->geometry()
: workarea[ desktop ];
switch (opt)
{
case MaximizeArea:
if (options->xineramaMaximizeEnabled)
return sarea;
if (desktopwidget->numScreens() < 2)
return warea;
else
return sarea;
else
return warea;
case MaximizeFullArea:
if (options->xineramaMaximizeEnabled)
return desktopwidget->screenGeometry( screen );
if (desktopwidget->numScreens() < 2)
return desktopwidget->geometry();
else
return desktopwidget->screenGeometry( screen );
else
return desktopwidget->geometry();
case FullScreenArea:
if (options->xineramaFullscreenEnabled)
return desktopwidget->screenGeometry( screen );
if (desktopwidget->numScreens() < 2)
return desktopwidget->geometry();
else
return desktopwidget->screenGeometry( screen );
else
return desktopwidget->geometry();
case PlacementArea:
if (options->xineramaPlacementEnabled)
return sarea;
if (desktopwidget->numScreens() < 2)
return warea;
else
return sarea;
else
return warea;
case MovementArea:
if (options->xineramaMovementEnabled)
return desktopwidget->screenGeometry( screen );
if (desktopwidget->numScreens() < 2)
return desktopwidget->geometry();
else
return desktopwidget->screenGeometry( screen );
else
return desktopwidget->geometry();
case WorkArea:
@ -271,7 +286,10 @@ QRect Workspace::clientArea( clientAreaOption opt, int screen, int desktop ) con
case FullArea:
return desktopwidget->geometry();
case ScreenArea:
return desktopwidget->screenGeometry( screen );
if (desktopwidget->numScreens() < 2)
return desktopwidget->geometry();
else
return desktopwidget->screenGeometry( screen );
}
assert( false );
return QRect();

Loading…
Cancel
Save