Krolyxon
Commit ba0d87f

Branches

Refs →

nsxivba0d87f

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". sxiv 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 sxiv, which will
allow sxiv to receive key events. If the input field is not set, WMs are
allowed to assume that sxiv doesn't require focus.
Author
Arthur Williams
Date
2020-06-22 22:52 -0700
Committer
Berke Kocaoğlu · 2021-09-16 22:55 +0300
Parent
88f77bc
Commit
ba0d87fadf4bb292d7baadf9f01843da354c4a43

+6 −0

1 file changed

  1. M window.c +6 −0
M window.c View
@@ -154,6 +154,7 @@ void win_open(win_t *win)
154154 Pixmap none;
155155 int gmask;
156156 XSizeHints sizehints;
157+ XWMHints hints;
157158
158159 e = &win->env;
159160 parent = options->embed != 0 ? options->embed : RootWindow(e->dpy, e->scr);
@@ -252,6 +253,11 @@ void win_open(win_t *win)
252253 sizehints.y = win->y;
253254 XSetWMNormalHints(win->env.dpy, win->xwin, &sizehints);
254255
256+ hints.flags = InputHint | StateHint;
257+ hints.input = 1;
258+ hints.initial_state = NormalState;
259+ XSetWMHints(win->env.dpy, win->xwin, &hints);
260+
255261 win->h -= win->bar.h;
256262
257263 win->buf.w = e->scrw;