Fixed bug 4085 - X11: Allow configuring _NET_WM_BYPASS_COMPOSITOR through SDL hints
authorSam Lantinga <slouken@libsdl.org>
Fri, 16 Feb 2018 10:23:10 -0800
changeset 11876dfde5d3f9781
parent 11875 91138f56d762
child 11877 2a25e8690229
Fixed bug 4085 - X11: Allow configuring _NET_WM_BYPASS_COMPOSITOR through SDL hints

Callum McGing

This patch allows the user to disable the behaviour that blocks the compositor through a new hint: SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR. This allows tools or other windowed applications to behave properly under KWin.
include/SDL_hints.h
src/video/x11/SDL_x11window.c
     1.1 --- a/include/SDL_hints.h	Sun Oct 29 14:15:00 2017 +0300
     1.2 +++ b/include/SDL_hints.h	Fri Feb 16 10:23:10 2018 -0800
     1.3 @@ -212,6 +212,18 @@
     1.4  #define SDL_HINT_VIDEO_X11_NET_WM_PING      "SDL_VIDEO_X11_NET_WM_PING"
     1.5  
     1.6  /**
     1.7 + * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
     1.8 + * 
     1.9 + * This variable can be set to the following values:
    1.10 + * "0" - Disable _NET_WM_BYPASS_COMPOSITOR
    1.11 + * "1" - Enable _NET_WM_BYPASS_COMPOSITOR
    1.12 + * 
    1.13 + * By default SDL will use _NET_WM_BYPASS_COMPOSITOR
    1.14 + * 
    1.15 + */
    1.16 +#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
    1.17 +
    1.18 +/**
    1.19   *  \brief  A variable controlling whether the window frame and title bar are interactive when the cursor is hidden 
    1.20   *
    1.21   *  This variable can be set to the following values:
     2.1 --- a/src/video/x11/SDL_x11window.c	Sun Oct 29 14:15:00 2017 +0300
     2.2 +++ b/src/video/x11/SDL_x11window.c	Fri Feb 16 10:23:10 2018 -0800
     2.3 @@ -579,11 +579,12 @@
     2.4      wintype = X11_XInternAtom(display, wintype_name, False);
     2.5      X11_XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32,
     2.6                      PropModeReplace, (unsigned char *)&wintype, 1);
     2.7 -
     2.8 -    _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display, "_NET_WM_BYPASS_COMPOSITOR", False);
     2.9 -    X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32,
    2.10 -                    PropModeReplace,
    2.11 -                    (unsigned char *)&compositor, 1);
    2.12 +    if (SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, SDL_TRUE)) {
    2.13 +        _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display, "_NET_WM_BYPASS_COMPOSITOR", False);
    2.14 +        X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32,
    2.15 +                        PropModeReplace,
    2.16 +                        (unsigned char *)&compositor, 1);
    2.17 +    }
    2.18  
    2.19      {
    2.20          Atom protocols[3];