Browse Source

set _NET_WM_BYPASS_COMPOSITOR hint to avoid flickering (#256)

For compositors which support it (picom >v7.5, formerly known as compton), this
should result in the i3lock window no longer being composited, hence fixing
issue #204.

related to #204
pull/257/head
Michael Stapelberg 3 years ago
committed by GitHub
parent
commit
1b9b2bd7f8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 31
      xcb.c

31
xcb.c

@ -29,6 +29,26 @@ extern auth_state_t auth_state;
xcb_connection_t *conn;
xcb_screen_t *screen;
static xcb_atom_t _NET_WM_BYPASS_COMPOSITOR = XCB_NONE;
void _init_net_wm_bypass_compositor(xcb_connection_t *conn) {
if (_NET_WM_BYPASS_COMPOSITOR != XCB_NONE) {
/* already initialized */
return;
}
xcb_generic_error_t *err;
xcb_intern_atom_reply_t *atom_reply = xcb_intern_atom_reply(
conn,
xcb_intern_atom(conn, 0, strlen("_NET_WM_BYPASS_COMPOSITOR"), "_NET_WM_BYPASS_COMPOSITOR"),
&err);
if (atom_reply == NULL) {
fprintf(stderr, "X11 Error %d\n", err->error_code);
free(err);
return;
}
_NET_WM_BYPASS_COMPOSITOR = atom_reply->atom;
free(atom_reply);
}
#define curs_invisible_width 8
#define curs_invisible_height 8
@ -158,6 +178,17 @@ xcb_window_t open_fullscreen_window(xcb_connection_t *conn, xcb_screen_t *scr, c
2 * (strlen("i3lock") + 1),
"i3lock\0i3lock\0");
const uint32_t bypass_compositor = 1; /* disable compositing */
_init_net_wm_bypass_compositor(conn);
xcb_change_property(conn,
XCB_PROP_MODE_REPLACE,
win,
_NET_WM_BYPASS_COMPOSITOR,
XCB_ATOM_CARDINAL,
32,
1,
&bypass_compositor);
/* Map the window (= make it visible) */
xcb_map_window(conn, win);

Loading…
Cancel
Save