diff options
Diffstat (limited to 'src/gui/kernel/qdesktopwidget_x11.cpp')
-rw-r--r-- | src/gui/kernel/qdesktopwidget_x11.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/gui/kernel/qdesktopwidget_x11.cpp index 5bc4c0c..ad47709 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 { |