Handle the EWMH atom _NET_WM_DESKTOP.
We already claim _NET_WM_DESKTOP support in _NET_SUPPORTED since around 2009, but haven't actually done anything with it. However, especially pagers like gnome-panel rely on this property to be updated and many tools, like GTK, want to use the corresponding client messages to make a window sticky, move it around etc. This patch implements full support according to the EWMH spec. This means: * We set the property on all windows when managing it. * We keep the property updated on all windows at all times. * We read and respect the property upon managing a window if it was set before mapping the window. * We react to client messages for it. * We remove the property on withdrawn windows. Note that the special value 0xFFFFFFFF, according to the spec, means that the window shall be shown on all workspaces. We do this by making it sticky and float it. This shows it on all workspaces at least on the output it is on. Furthermore, the spec gives us the freedom to ignore _NET_WM_DESKTOP when managing a window if we have good reason to. In our case, we give window swallowing a higher priority since the user would likely expect that and we want to keep placeholder windows only around for as long as we have to. However, we do prioritize this property over, for example, startup notifications. fixes #2153 fixes #1507 fixes #938
This commit is contained in:
@ -398,6 +398,9 @@ struct Window {
|
||||
/** The _NET_WM_WINDOW_TYPE for this window. */
|
||||
xcb_atom_t window_type;
|
||||
|
||||
/** The _NET_WM_DESKTOP for this window. */
|
||||
uint32_t wm_desktop;
|
||||
|
||||
/** Whether the window says it is a dock window */
|
||||
enum { W_NODOCK = 0,
|
||||
W_DOCK_TOP = 1,
|
||||
|
@ -36,6 +36,13 @@ void ewmh_update_desktop_names(void);
|
||||
*/
|
||||
void ewmh_update_desktop_viewport(void);
|
||||
|
||||
/**
|
||||
* Updates _NET_WM_DESKTOP for all windows.
|
||||
* A request will only be made if the cached value differs from the calculated value.
|
||||
*
|
||||
*/
|
||||
void ewmh_update_wm_desktop(void);
|
||||
|
||||
/**
|
||||
* Updates _NET_ACTIVE_WINDOW with the currently focused window.
|
||||
*
|
||||
@ -96,3 +103,21 @@ void ewmh_setup_hints(void);
|
||||
*
|
||||
*/
|
||||
void ewmh_update_workarea(void);
|
||||
|
||||
/**
|
||||
* Returns the workspace container as enumerated by the EWMH desktop model.
|
||||
* Returns NULL if no workspace could be found for the index.
|
||||
*
|
||||
* This is the reverse of ewmh_get_workspace_index.
|
||||
*
|
||||
*/
|
||||
Con *ewmh_get_workspace_by_index(uint32_t idx);
|
||||
|
||||
/**
|
||||
* Returns the EWMH desktop index for the workspace the given container is on.
|
||||
* Returns NET_WM_DESKTOP_NONE if the desktop index cannot be determined.
|
||||
*
|
||||
* This is the reverse of ewmh_get_workspace_by_index.
|
||||
*
|
||||
*/
|
||||
uint32_t ewmh_get_workspace_index(Con *con);
|
||||
|
@ -14,6 +14,14 @@
|
||||
#include "tree.h"
|
||||
#include "randr.h"
|
||||
|
||||
/* We use NET_WM_DESKTOP_NONE for cases where we cannot determine the EWMH
|
||||
* desktop index for a window. We cannot use a negative value like -1 since we
|
||||
* need to use uint32_t as we actually need the full range of it. This is
|
||||
* technically dangerous, but it's safe to assume that we will never have more
|
||||
* than 4294967279 workspaces open at a time. */
|
||||
#define NET_WM_DESKTOP_NONE 0xFFFFFFF0
|
||||
#define NET_WM_DESKTOP_ALL 0xFFFFFFFF
|
||||
|
||||
/**
|
||||
* Returns a pointer to the workspace with the given number (starting at 0),
|
||||
* creating the workspace if necessary (by allocating the necessary amount of
|
||||
|
Reference in New Issue
Block a user