From bd5cbbb01004969af5112cbfbda240b50dc2126c Mon Sep 17 00:00:00 2001 From: Gergely Risko Date: Mon, 7 Feb 2022 17:43:55 +0100 Subject: [PATCH] Use proper WM_Sx registration for i3 (#4843) i3's WM ownership is registered with the X Atom WM_S_S0 (for screen0), instead of the correct WM_S0. The relevant xcb-util API didn't change, this is simply a bug in i3 that has always been there: https://gitlab.freedesktop.org/xorg/lib/libxcb-util/-/blob/0.4.0/src/atoms.c#L65 --- release-notes/bugfixes/5-fix-wm-registration | 1 + src/main.c | 4 ++-- testcases/t/545-i3-registration.t | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 release-notes/bugfixes/5-fix-wm-registration create mode 100644 testcases/t/545-i3-registration.t diff --git a/release-notes/bugfixes/5-fix-wm-registration b/release-notes/bugfixes/5-fix-wm-registration new file mode 100644 index 00000000..513c96eb --- /dev/null +++ b/release-notes/bugfixes/5-fix-wm-registration @@ -0,0 +1 @@ +changed WM registration selection from WM_S_S to WM_S diff --git a/src/main.c b/src/main.c index 32f93ce2..6d6b9c9c 100644 --- a/src/main.c +++ b/src/main.c @@ -696,11 +696,11 @@ int main(int argc, char *argv[]) { /* Acquire the WM_Sn selection. */ { /* Get the WM_Sn atom */ - char *atom_name = xcb_atom_name_by_screen("WM_S", conn_screen); + char *atom_name = xcb_atom_name_by_screen("WM", conn_screen); wm_sn_selection_owner = xcb_generate_id(conn); if (atom_name == NULL) { - ELOG("xcb_atom_name_by_screen(\"WM_S\", %d) failed, exiting\n", conn_screen); + ELOG("xcb_atom_name_by_screen(\"WM\", %d) failed, exiting\n", conn_screen); return 1; } diff --git a/testcases/t/545-i3-registration.t b/testcases/t/545-i3-registration.t new file mode 100644 index 00000000..6c8d68f4 --- /dev/null +++ b/testcases/t/545-i3-registration.t @@ -0,0 +1,11 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# +# Tests whether our WM registration is done with the correct WM_S0 selection. + +use i3test; + +my $x = X11::XCB::Connection->new; +my $reply = $x->get_selection_owner($x->atom(name => 'WM_S0')->id); +ok($reply, "registration successful"); +done_testing;