From 24ed62138869e8d510f374445c0f9bc644594142 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 26 Jan 2011 14:02:31 -0500 Subject: [PATCH] Set WM_CLASS for X11 compositor window Don't want to be 'Unknown' in GNOME Shell. --- compositor/compositor-x11.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/compositor/compositor-x11.c b/compositor/compositor-x11.c index 7e7c8ca..5cacb3f 100644 --- a/compositor/compositor-x11.c +++ b/compositor/compositor-x11.c @@ -59,7 +59,9 @@ struct x11_compositor { xcb_atom_t wm_normal_hints; xcb_atom_t wm_size_hints; xcb_atom_t wm_delete_window; + xcb_atom_t wm_class; xcb_atom_t net_wm_name; + xcb_atom_t string; xcb_atom_t utf8_string; } atom; }; @@ -332,6 +334,7 @@ static int x11_compositor_create_output(struct x11_compositor *c, int width, int height) { static const char name[] = "Wayland Compositor"; + static const char class[] = "wayland-1\0Wayland Compositor"; struct x11_output *output; xcb_dri2_dri2_buffer_t *buffers; xcb_dri2_get_buffers_reply_t *reply; @@ -398,12 +401,15 @@ x11_compositor_create_output(struct x11_compositor *c, int width, int height) sizeof normal_hints / 4, (uint8_t *) &normal_hints); - xcb_map_window(c->conn, output->window); - /* Set window name. Don't bother with non-EWMH WMs. */ xcb_change_property(c->conn, XCB_PROP_MODE_REPLACE, output->window, c->atom.net_wm_name, c->atom.utf8_string, 8, strlen(name), name); + xcb_change_property(c->conn, XCB_PROP_MODE_REPLACE, output->window, + c->atom.wm_class, c->atom.string, 8, + sizeof class, class); + + xcb_map_window(c->conn, output->window); rectangle.x = 0; rectangle.y = 0; @@ -603,7 +609,9 @@ x11_compositor_get_resources(struct x11_compositor *c) { "WM_NORMAL_HINTS", F(atom.wm_normal_hints) }, { "WM_SIZE_HINTS", F(atom.wm_size_hints) }, { "WM_DELETE_WINDOW", F(atom.wm_delete_window) }, + { "WM_CLASS", F(atom.wm_class) }, { "_NET_WM_NAME", F(atom.net_wm_name) }, + { "STRING", F(atom.string) }, { "UTF8_STRING", F(atom.utf8_string) }, }; -- 2.7.4