[PATCH] Move panel to different screens on multihead

Tony Murray murraytony at gmail.com
Sun Jun 1 09:59:33 CEST 2008


This is my first KDE patch so please let me know if coding style/methods
need to be changed.
Aaron poked me into looking into this and I was able to come up with a patch
that moves the panel from one screen to the other.  This patch worked
surprisingly well and I was unable to make it behave badly in testing with
my two screens.

Another bug right now is the panelcontroller doesn't always come up on the
same screen as the panel (when I connect a screen with xrandr, the panel
doens't move to it but the panelcontroller thinks it is on the 2nd screen).
End result, I push the cashew on screen 1 and config bar comes up on screen
2.  After I move the panel to either screen (after applying my patch) it
works ok.  Just the inital attach causes issues.

--- trunk/KDE/kdebase/workspace/plasma/plasma/panelcontroller.cpp.orig
2008-06-01 02:32:00.000000000 -0500
+++ trunk/KDE/kdebase/workspace/plasma/plasma/panelcontroller.cpp
2008-06-01 02:32:26.000000000 -0500
@@ -670,6 +670,14 @@
             return;
         }

+        if (!screenGeom.contains(event->globalPos())) {
+            //move panel to new screen if dragged there
+            QDesktopWidget *desktop = QApplication::desktop();
+            int newScreen = desktop->screenNumber(event->globalPos());
+            kDebug() << "Mouse drag left panel's screen" <<
d->containment->screen() << "to screen" << newScreen;
+            d->containment->setScreen(newScreen);
+        }
+
         Plasma::FormFactor oldFormFactor = d->containment->formFactor();
         Plasma::FormFactor newFormFactor = d->containment->formFactor();
         const Plasma::Location oldLocation = d->containment->location();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/panel-devel/attachments/20080601/a5d59d01/attachment.html 


More information about the Panel-devel mailing list