[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/utils/yakuake
From:       Eike Hein <hein () kde ! org>
Date:       2010-05-24 19:08:08
Message-ID: 20100524190808.38C8FAC8BE () svn ! kde ! org
[Download RAW message or body]

SVN commit 1130207 by hein:

Both Yakuake and KRunner used to suffer from the following bug: If there
are two monitors, the top edges of which are alined, and on one of those
monitors (but not the other) is a panel at the top edge, their windows
would appear at a distance away from the top edge equal in height to the
panel when appearing on the monitor without a panel.

This change fixes this bug in Yakuake generating a list of windows which
have top edge struts intersecting the geometry of the current screen, and
then handing that list to the variant of KWindowSystem::workArea() that
takes a list of windows to ignore in computing the work area as parameter.

The same change ought to be applied to KRunner, or a new workArea()
variant that does this should be added to KWindowSystem for convenience.

Thanks to Lubos for useful pointers.

BUG:147601
CCMAIL:plasma-devel@kde.org
CCMAIL:llunak@kde.org


 M  +3 -0      ChangeLog  
 M  +34 -3     app/mainwindow.cpp  


--- trunk/extragear/utils/yakuake/ChangeLog #1130206:1130207
@@ -20,6 +20,9 @@
   if if was the last tab that had been clicked.
 * Fixed a bug causing the title bar corner images of a theme not to be shown
   when they don't have an alpha channel.
+* Fixed a bug causing the window to appear at a distance away from the top
+  edge of the screen matching the height of a panel at the top edge of
+  another screen in a multi-screen setup.
 
 
 Changes in 2.9.6:
--- trunk/extragear/utils/yakuake/app/mainwindow.cpp #1130206:1130207
@@ -961,17 +961,48 @@
 
 QRect MainWindow::getDesktopGeometry()
 {
+    QRect screenGeometry = KApplication::desktop()->screenGeometry(getScreen());
+    
     QAction* action = actionCollection()->action("view-full-screen");
 
     if (action->isChecked())
-        return KApplication::desktop()->screenGeometry(getScreen());
+        return screenGeometry;
 
+    int currentDesktop = KWindowSystem::windowInfo(winId(), \
NET::CurrentDesktop).desktop(); +    
     if (KApplication::desktop()->numScreens() > 1)
-        return KWindowSystem::workArea().intersect(KApplication::desktop()->screenGeometry(getScreen()));
 +    {
+        const QList<WId> allWindows = KWindowSystem::windows();
+        QList<WId> offScreenWindows;
 
-    return KWindowSystem::workArea();
+        QListIterator<WId> i(allWindows);
+
+        while (i.hasNext())
+        {
+            WId windowId = i.next();
+
+            if (KWindowSystem::hasWId(windowId))
+            {
+                KWindowInfo windowInfo = KWindowSystem::windowInfo(windowId, \
NET::WMVisibleName, NET::WM2ExtendedStrut); +                
+                if (windowInfo.valid() && windowInfo.desktop() == currentDesktop)
+                {
+                    NETExtendedStrut strut = windowInfo.extendedStrut();
+
+                    QRect topStrut(strut.top_start, 0, strut.top_end, \
strut.top_width); +
+                    if (!topStrut.intersects(screenGeometry))
+                        offScreenWindows << windowId;
 }
+            }
+        }
 
+        return KWindowSystem::workArea(offScreenWindows, \
currentDesktop).intersect(screenGeometry); +    }
+
+    return KWindowSystem::workArea(currentDesktop);
+}
+
 void MainWindow::whatsThis()
 {
     QWhatsThis::enterWhatsThisMode();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic