From 6c56e275115fdb5a2fb93d4f6f7459ccb8460151 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 8 Nov 2021 07:05:17 -0800 Subject: [PATCH] Set both _NET_WM_NAME and WM_NAME so SDL windows can be shared in the browser. Fixes https://github.com/libsdl-org/SDL/issues/4924 --- src/video/x11/SDL_x11video.c | 1 + src/video/x11/SDL_x11video.h | 1 + src/video/x11/SDL_x11window.c | 3 +++ 3 files changed, 5 insertions(+) diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index a67bce887..476daea38 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -405,6 +405,7 @@ X11_VideoInit(_THIS) GET_ATOM(WM_PROTOCOLS); GET_ATOM(WM_DELETE_WINDOW); GET_ATOM(WM_TAKE_FOCUS); + GET_ATOM(WM_NAME); GET_ATOM(_NET_WM_STATE); GET_ATOM(_NET_WM_STATE_HIDDEN); GET_ATOM(_NET_WM_STATE_FOCUSED); diff --git a/src/video/x11/SDL_x11video.h b/src/video/x11/SDL_x11video.h index 7281e1130..18d5f4a27 100644 --- a/src/video/x11/SDL_x11video.h +++ b/src/video/x11/SDL_x11video.h @@ -93,6 +93,7 @@ typedef struct SDL_VideoData Atom WM_PROTOCOLS; Atom WM_DELETE_WINDOW; Atom WM_TAKE_FOCUS; + Atom WM_NAME; Atom _NET_WM_STATE; Atom _NET_WM_STATE_HIDDEN; Atom _NET_WM_STATE_FOCUSED; diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 8d81cb055..bdadbc702 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -734,6 +734,9 @@ X11_SetWindowTitle(_THIS, SDL_Window * window) Atom UTF8_STRING = data->videodata->UTF8_STRING; Atom _NET_WM_NAME = data->videodata->_NET_WM_NAME; + Atom WM_NAME = data->videodata->WM_NAME; + + X11_XChangeProperty(display, data->xwindow, WM_NAME, UTF8_STRING, 8, 0, (const unsigned char *) title, strlen(title)); status = X11_XChangeProperty(display, data->xwindow, _NET_WM_NAME, UTF8_STRING, 8, 0, (const unsigned char *) title, strlen(title));