Skip to content

Commit

Permalink
Fix #381: Fix crash when panels are set to auto-hide in KDE
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseExposito committed Dec 11, 2020
1 parent 312a6b5 commit 83b4d0d
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/window-system/x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,25 @@ Rectangle X11::getDesktopWorkarea() const {
rootWindow, "_NET_WORKAREA", XA_CARDINAL);

Rectangle workarea;
workarea.x = workareas[0 + (currenDesktop[0] * 4)];
workarea.y = workareas[1 + (currenDesktop[0] * 4)];
workarea.width = workareas[2 + (currenDesktop[0] * 4)];
workarea.height = workareas[3 + (currenDesktop[0] * 4)];

if (workareas.size() >= 4) {
workarea.x = workareas[0 + (currenDesktop[0] * 4)];
workarea.y = workareas[1 + (currenDesktop[0] * 4)];
workarea.width = workareas[2 + (currenDesktop[0] * 4)];
workarea.height = workareas[3 + (currenDesktop[0] * 4)];
} else {
// Some WMs don't set _NET_WORKAREA if there are no visible panels
// https://github.com/JoseExposito/touchegg/issues/381
unsigned int width = 0;
unsigned int height = 0;
Window retRootWindow = None;
unsigned int retBorderWidth = 0;
unsigned int retDepth = 0;
XGetGeometry(display, rootWindow, &retRootWindow, &workarea.x, &workarea.y,
&width, &height, &retBorderWidth, &retDepth);
workarea.width = width;
workarea.height = height;
}

// Mutter uses a non standard property that allow better multiscreen support
if (screenFound) {
Expand Down

0 comments on commit 83b4d0d

Please sign in to comment.