summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-08-06 10:17:40 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-08-06 10:18:57 (GMT)
commitcb484634624d227feacc71c0463899968317c2d1 (patch)
treeec779da404ec1831e220c02220baf47bcd9065fe /src
parent69597149e606a3d8a22a2ea7c2964b799751d898 (diff)
downloadQt-cb484634624d227feacc71c0463899968317c2d1.zip
Qt-cb484634624d227feacc71c0463899968317c2d1.tar.gz
Qt-cb484634624d227feacc71c0463899968317c2d1.tar.bz2
Support _NET_WORKAREA on Xinerama setups in QDesktopWidget
Instead of ignoring _NET_WORKAREA, merge it with each screen geometry to give a meaningful availableGeometry() for all screens. Reviewed-by: denis
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qdesktopwidget_x11.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/gui/kernel/qdesktopwidget_x11.cpp
index 1555fc0..8b0c215 100644
--- a/src/gui/kernel/qdesktopwidget_x11.cpp
+++ b/src/gui/kernel/qdesktopwidget_x11.cpp
@@ -285,26 +285,36 @@ const QRect QDesktopWidget::availableGeometry(int screen) const
if (d->workareas[screen].isValid())
return d->workareas[screen];
- if ((d->screenCount == 1 || !isVirtualDesktop())
- && X11->isSupportedByWM(ATOM(_NET_WORKAREA))) {
+ if (X11->isSupportedByWM(ATOM(_NET_WORKAREA))) {
+ int x11Screen = isVirtualDesktop() ? DefaultScreen(X11->display) : screen;
+
Atom ret;
int format, e;
unsigned char *data = 0;
unsigned long nitems, after;
e = XGetWindowProperty(X11->display,
- QX11Info::appRootWindow(screen),
- ATOM(_NET_WORKAREA), 0, 4, False, XA_CARDINAL,
- &ret, &format, &nitems, &after, &data);
+ QX11Info::appRootWindow(x11Screen),
+ ATOM(_NET_WORKAREA), 0, 4, False, XA_CARDINAL,
+ &ret, &format, &nitems, &after, &data);
+ QRect workArea;
if (e == Success && ret == XA_CARDINAL &&
format == 32 && nitems == 4) {
long *workarea = (long *) data;
- d->workareas[screen].setRect(workarea[0], workarea[1],
- workarea[2], workarea[3]);
+ workArea = QRect(workarea[0], workarea[1], workarea[2], workarea[3]);
} else {
- d->workareas[screen] = screenGeometry(screen);
+ workArea = screenGeometry(screen);
+ }
+
+ if (isVirtualDesktop()) {
+ // intersect the workarea (which spawns all Xinerama screens) with the rect for the
+ // requested screen
+ workArea &= screenGeometry(screen);
}
+
+ d->workareas[screen] = workArea;
+
if (data)
XFree(data);
} else {