summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorArthur Williams <taaparthur@gmail.com>2020-05-22 21:25:52 -0700
committerwm4 <1387750+wm4@users.noreply.github.com>2020-05-24 13:35:57 +0200
commit4d5688dc9a44a9f8bb1a3a4b650b45733dd1c509 (patch)
tree0ee7f01ea8fc45d193af7bb33784b5414d93a649 /video
parent685bd6a5f51572f983c446ba951fce45ab7bfb06 (diff)
downloadmpv-4d5688dc9a44a9f8bb1a3a4b650b45733dd1c509.tar.bz2
mpv-4d5688dc9a44a9f8bb1a3a4b650b45733dd1c509.tar.xz
x11_common: added ICCCM WM_HINTS
When the window is mapped, some ICCCM WM_HINTS are set. The input field is set to true and state is set to NormalState. To quote the spec, "The input field is used to communicate to the window manager the input focus model used by the client" and "[c]lients with the Passive and Locally Active models should set the input flag to True". mpv falls under the Passive Input model, since it expects keyboard input, but only listens for key events on its single, top-level window instead of subordinate windows (Locally Active) or the root window (Globally Active). From the end users prospective, all EWMH/ICCCM compliant WMs (especially the minimalistic ones) will allow the user to focus mpv, which will allow mpv to receive key events. If the input field is not set, WMs are allowed to assume that mpv doesn't require focus.
Diffstat (limited to 'video')
-rw-r--r--video/out/x11_common.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 898efd2ad5..c209472657 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -756,6 +756,16 @@ static void vo_x11_decoration(struct vo *vo, bool d)
PropModeReplace, (unsigned char *) &mhints, 5);
}
+static void vo_x11_wm_hints(struct vo *vo, Window window)
+{
+ struct vo_x11_state *x11 = vo->x11;
+ XWMHints hints = {0};
+ hints.flags = InputHint | StateHint;
+ hints.input = 1;
+ hints.initial_state = NormalState;
+ XSetWMHints(x11->display, window, &hints);
+}
+
static void vo_x11_classhint(struct vo *vo, Window window, const char *name)
{
struct vo_x11_state *x11 = vo->x11;
@@ -1615,6 +1625,7 @@ bool vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis,
if (x11->window == None) {
vo_x11_create_window(vo, vis, (struct mp_rect){.x1 = 320, .y1 = 200 });
vo_x11_classhint(vo, x11->window, classname);
+ vo_x11_wm_hints(vo, x11->window);
x11->window_hidden = true;
}