diff --git a/effects.cpp b/effects.cpp --- a/effects.cpp +++ b/effects.cpp @@ -932,12 +932,12 @@ int EffectsHandlerImpl::workspaceWidth() const { - return desktopGridWidth() * displayWidth(); + return desktopGridWidth() * screens()->size().width(); } int EffectsHandlerImpl::workspaceHeight() const { - return desktopGridHeight() * displayHeight(); + return desktopGridHeight() * screens()->size().height(); } int EffectsHandlerImpl::desktopAtCoords(QPoint coords) const @@ -958,7 +958,8 @@ QPoint coords = VirtualDesktopManager::self()->grid().gridCoords(id); if (coords.x() == -1) return QPoint(-1, -1); - return QPoint(coords.x() * displayWidth(), coords.y() * displayHeight()); + const QSize displaySize = screens()->size(); + return QPoint(coords.x() * displaySize.width(), coords.y() * displaySize.height()); } int EffectsHandlerImpl::desktopAbove(int desktop, bool wrap) const diff --git a/geometry.cpp b/geometry.cpp --- a/geometry.cpp +++ b/geometry.cpp @@ -355,6 +355,7 @@ desktop = VirtualDesktopManager::self()->current(); if (screen == -1) screen = screens()->current(); + const QSize displaySize = screens()->displaySize(); QRect sarea, warea; @@ -372,7 +373,7 @@ ? screenarea[ desktop ][ screen ] : screens()->geometry(screen); warea = workarea[ desktop ].isNull() - ? QRect(0, 0, displayWidth(), displayHeight()) + ? QRect(0, 0, displaySize.width(), displaySize.height()) : workarea[ desktop ]; } @@ -394,7 +395,7 @@ else return warea; case FullArea: - return QRect(0, 0, displayWidth(), displayHeight()); + return QRect(0, 0, displaySize.width(), displaySize.height()); } abort(); } @@ -955,7 +956,7 @@ // HACK: workarea handling is not xinerama aware, so if this strut // reserves place at a xinerama edge that's inside the virtual screen, // ignore the strut for workspace setting. - if (area == QRect(0, 0, displayWidth(), displayHeight())) { + if (area == QRect(QPoint(0, 0), screens()->displaySize())) { if (stareaL.left() < screenarea.left()) stareaL = QRect(); if (stareaR.right() > screenarea.right()) @@ -997,36 +998,38 @@ { NETExtendedStrut ext = info->extendedStrut(); NETStrut str = info->strut(); + const QSize displaySize = screens()->displaySize(); if (ext.left_width == 0 && ext.right_width == 0 && ext.top_width == 0 && ext.bottom_width == 0 && (str.left != 0 || str.right != 0 || str.top != 0 || str.bottom != 0)) { // build extended from simple if (str.left != 0) { ext.left_width = str.left; ext.left_start = 0; - ext.left_end = displayHeight(); + ext.left_end = displaySize.height(); } if (str.right != 0) { ext.right_width = str.right; ext.right_start = 0; - ext.right_end = displayHeight(); + ext.right_end = displaySize.height(); } if (str.top != 0) { ext.top_width = str.top; ext.top_start = 0; - ext.top_end = displayWidth(); + ext.top_end = displaySize.width(); } if (str.bottom != 0) { ext.bottom_width = str.bottom; ext.bottom_start = 0; - ext.bottom_end = displayWidth(); + ext.bottom_end = displaySize.width(); } } return ext; } StrutRect Client::strutRect(StrutArea area) const { assert(area != StrutAreaAll); // Not valid + const QSize displaySize = screens()->displaySize(); NETExtendedStrut strutArea = strut(); switch(area) { case StrutAreaTop: @@ -1039,14 +1042,14 @@ case StrutAreaRight: if (strutArea.right_width != 0) return StrutRect(QRect( - displayWidth() - strutArea.right_width, strutArea.right_start, + displaySize.width() - strutArea.right_width, strutArea.right_start, strutArea.right_width, strutArea.right_end - strutArea.right_start ), StrutAreaRight); break; case StrutAreaBottom: if (strutArea.bottom_width != 0) return StrutRect(QRect( - strutArea.bottom_start, displayHeight() - strutArea.bottom_width, + strutArea.bottom_start, displaySize.height() - strutArea.bottom_width, strutArea.bottom_end - strutArea.bottom_start, strutArea.bottom_width ), StrutAreaBottom); break; diff --git a/plugins/platforms/x11/standalone/screens_xrandr.h b/plugins/platforms/x11/standalone/screens_xrandr.h --- a/plugins/platforms/x11/standalone/screens_xrandr.h +++ b/plugins/platforms/x11/standalone/screens_xrandr.h @@ -40,6 +40,7 @@ int number(const QPoint& pos) const override; float refreshRate(int screen) const override; QSize size(int screen) const override; + QSize displaySize() const override; using QObject::event; bool event(xcb_generic_event_t *event) override; diff --git a/plugins/platforms/x11/standalone/screens_xrandr.cpp b/plugins/platforms/x11/standalone/screens_xrandr.cpp --- a/plugins/platforms/x11/standalone/screens_xrandr.cpp +++ b/plugins/platforms/x11/standalone/screens_xrandr.cpp @@ -188,4 +188,13 @@ return false; } +QSize XRandRScreens::displaySize() const +{ + xcb_screen_t *screen = defaultScreen(); + if (!screen) { + return Screens::size(); + } + return QSize(screen->width_in_pixels, screen->height_in_pixels); +} + } // namespace diff --git a/screenedge.cpp b/screenedge.cpp --- a/screenedge.cpp +++ b/screenedge.cpp @@ -418,7 +418,7 @@ const uint interimDesktop = desktop; desktop = vds->toLeft(desktop, vds->isNavigationWrappingAround()); if (desktop != interimDesktop) - pos.setX(displayWidth() - 1 - OFFSET); + pos.setX(screens()->size().width() - 1 - OFFSET); } else if (isRight()) { const uint interimDesktop = desktop; desktop = vds->toRight(desktop, vds->isNavigationWrappingAround()); @@ -429,7 +429,7 @@ const uint interimDesktop = desktop; desktop = vds->above(desktop, vds->isNavigationWrappingAround()); if (desktop != interimDesktop) - pos.setY(displayHeight() - 1 - OFFSET); + pos.setY(screens()->size().height() - 1 - OFFSET); } else if (isBottom()) { const uint interimDesktop = desktop; desktop = vds->below(desktop, vds->isNavigationWrappingAround()); diff --git a/screens.h b/screens.h --- a/screens.h +++ b/screens.h @@ -105,6 +105,18 @@ int intersecting(const QRect &r) const; + /** + * The virtual bounding size of all screens combined. + * The default implementation returns the same as @link{size} and that is the + * method which should be preferred. + * + * This method is only for cases where the platform specific implementation needs + * to support different virtual sizes like on X11 with XRandR panning. + * + * @see size + **/ + virtual QSize displaySize() const; + public Q_SLOTS: void reconfigure(); diff --git a/screens.cpp b/screens.cpp --- a/screens.cpp +++ b/screens.cpp @@ -185,6 +185,11 @@ return cnt; } +QSize Screens::displaySize() const +{ + return size(); +} + BasicScreens::BasicScreens(Platform *backend, QObject *parent) : Screens(parent) , m_backend(backend)