aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Shafer <ashafer@badland.io>2025-08-12 16:19:02 -0400
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2025-08-25 17:39:30 -0500
commit037423da2b2a84f330cb037699ef604ba0d0c94f (patch)
tree0822c0641c44872102a7201af10840cb43f70a1d
parent138acd846be17663aebcb370869deff9f58629c9 (diff)
downloadusermoji-037423da2b2a84f330cb037699ef604ba0d0c94f.tar.xz
vkcube: use _NET_WM_NAME property on X11
This sets the WM_NAME property in X11/Xwayland, usually displayed as the name on the application titlebar. The motivation for this is to help with automated testing environments on Xwayland. Testing frameworks such as wltest may use compositor methods to automate controlling a window to perform tests. When running through Xwayland, clients normally do not have much information exposed about them which can make it difficult for the test framework to find and manipulate the correct window. This change defines the WM_NAME property to allow scripting frameworks (such as Kwin's js API) to be able to find Vkcube on Xwayland.
-rw-r--r--cube/cube.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/cube/cube.c b/cube/cube.c
index c7299e8c..5ccd3025 100644
--- a/cube/cube.c
+++ b/cube/cube.c
@@ -2991,6 +2991,15 @@ static void demo_create_xcb_window(struct demo *demo) {
xcb_create_window(demo->connection, XCB_COPY_FROM_PARENT, demo->xcb_window, demo->screen->root, 0, 0, demo->width, demo->height,
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, demo->screen->root_visual, value_mask, value_list);
+ char *name = "Vkcube X11";
+ xcb_intern_atom_cookie_t net_wm_name_cookie = xcb_intern_atom(demo->connection, 0, strlen("_NET_WM_NAME"), "_NET_WM_NAME");
+ xcb_intern_atom_cookie_t utf8_string_cookie = xcb_intern_atom(demo->connection, 0, strlen("UTF8_STRING"), "UTF8_STRING");
+ xcb_intern_atom_reply_t *net_wm_name_reply = xcb_intern_atom_reply(demo->connection, net_wm_name_cookie, NULL);
+ xcb_intern_atom_reply_t *utf8_string_reply = xcb_intern_atom_reply(demo->connection, utf8_string_cookie, NULL);
+ xcb_change_property(demo->connection, XCB_PROP_MODE_REPLACE,
+ demo->xcb_window, net_wm_name_reply->atom,
+ utf8_string_reply->atom, 8, strlen(name), name);
+
/* Magic code that will send notification when window is destroyed */
xcb_intern_atom_cookie_t cookie = xcb_intern_atom(demo->connection, 1, 12, "WM_PROTOCOLS");
xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(demo->connection, cookie, 0);