diff options
author | Dave Davenport <qball@gmpclient.org> | 2016-02-09 21:25:29 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2016-02-09 21:25:29 +0100 |
commit | 289795b22a2ab0bf3f24e514c50f43df860f2690 (patch) | |
tree | b7cf5179b1e999b2d0e9395cbddf199a99062d1e /source/x11-helper.c | |
parent | 9b12f69fec93756e5e5b5c470d1250d5ffe9eb92 (diff) |
Fix finding active desktop!
Diffstat (limited to 'source/x11-helper.c')
-rw-r--r-- | source/x11-helper.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/x11-helper.c b/source/x11-helper.c index 9c408748..b21e6ff3 100644 --- a/source/x11-helper.c +++ b/source/x11-helper.c @@ -265,6 +265,20 @@ void monitor_active ( Display *display, workarea *mon ) } fprintf ( stderr, "Failed to find selected monitor.\n" ); } + // Get the current desktop. + unsigned long current_desktop = 0; + if ( window_get_cardinal_prop ( display, root, netatoms[_NET_CURRENT_DESKTOP], ¤t_desktop, 1 ) ) { + unsigned long desktops = 0; + if ( window_get_cardinal_prop ( display, root, netatoms[_NET_NUMBER_OF_DESKTOPS], &desktops, 1 ) ) { + unsigned long deskg[desktops * 2]; + if ( window_get_cardinal_prop ( display, root, netatoms[_NET_DESKTOP_VIEWPORT], &deskg[0], desktops * 2 ) ) { + if ( current_desktop < desktops ) { + monitor_dimensions ( display, screen, deskg[current_desktop * 2], deskg[current_desktop * 2 + 1], mon ); + return; + } + } + } + } if ( window_get_prop ( display, root, netatoms[_NET_ACTIVE_WINDOW], &type, &count, &id, sizeof ( Window ) ) && type == XA_WINDOW && count > 0 ) { XWindowAttributes attr; |