Xnest: replace XSetWMColormapWindows() by xcb_icccm_set_wm_colormap_windows_checked()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-08-05 17:09:49 +02:00
parent 6b14e213a3
commit 43e1cc6856
4 changed files with 44 additions and 30 deletions

View File

@ -34,6 +34,8 @@ is" without express or implied warranty.
#include "XNWindow.h"
#include "Args.h"
#include <xcb/xcb_icccm.h>
DevPrivateKeyRec xnestColormapPrivateKeyRec;
static DevPrivateKeyRec cmapScrPrivateKeyRec;
@ -226,24 +228,10 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
free(xnestOldInstalledColormapWindows);
#ifdef _XSERVER64
{
int i;
Window64 *windows = calloc(numWindows, sizeof(Window64));
if (!windows)
return;
for (i = 0; i < numWindows; ++i)
windows[i] = icws.windows[i];
XSetWMColormapWindows(xnestDisplay,
xnestDefaultWindows[pScreen->myNum], windows,
xnest_wm_colormap_windows(xnestUpstreamInfo.conn,
xnestDefaultWindows[pScreen->myNum],
icws.windows,
numWindows);
free(windows);
}
#else
XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
icws.windows, numWindows);
#endif
xnestOldInstalledColormapWindows = icws.windows;
xnestNumOldInstalledColormapWindows = icws.numWindows;
@ -285,19 +273,10 @@ xnestSetScreenSaverColormapWindow(ScreenPtr pScreen)
{
free(xnestOldInstalledColormapWindows);
#ifdef _XSERVER64
{
Window64 window;
window = xnestScreenSaverWindows[pScreen->myNum];
XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
&window, 1);
xnestScreenSaverWindows[pScreen->myNum] = window;
}
#else
XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
&xnestScreenSaverWindows[pScreen->myNum], 1);
#endif /* _XSERVER64 */
xnest_wm_colormap_windows(xnestUpstreamInfo.conn,
xnestDefaultWindows[pScreen->myNum],
&xnestScreenSaverWindows[pScreen->myNum],
1);
xnestOldInstalledColormapWindows = NULL;
xnestNumOldInstalledColormapWindows = 0;

View File

@ -24,6 +24,7 @@ x11_xcb_dep = dependency('x11-xcb', required: true)
xcb_dep = dependency('xcb', required: true)
xcb_aux_dep = dependency('xcb-aux', required: true)
xcb_shape_dep = dependency('xcb-shape', required: true)
xcb_icccm_dep = dependency('xcb-icccm', required: true)
executable(
'Xnest',
@ -35,6 +36,7 @@ executable(
xcb_dep,
xcb_aux_dep,
xcb_shape_dep,
xcb_icccm_dep,
x11_xcb_dep,
],
link_with: [

View File

@ -5,6 +5,7 @@
#include <dix-config.h>
#include <xcb/xcb.h>
#include <xcb/xcb_icccm.h>
#include <X11/X.h>
#include <X11/Xdefs.h>
@ -42,3 +43,32 @@ uint32_t xnest_upstream_gc(GCPtr pGC) {
return priv->gc;
}
const char WM_COLORMAP_WINDOWS[] = "WM_COLORMAP_WINDOWS";
void xnest_wm_colormap_windows(
xcb_connection_t *conn,
xcb_window_t w,
xcb_window_t *windows,
int count)
{
xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(
conn,
xcb_intern_atom(
conn, 0,
sizeof(WM_COLORMAP_WINDOWS)-1,
WM_COLORMAP_WINDOWS),
NULL);
if (!reply)
return;
xcb_icccm_set_wm_colormap_windows_checked(
conn,
w,
reply->atom,
count,
(xcb_window_t*)windows);
free(reply);
}

View File

@ -22,4 +22,7 @@ void xnest_upstream_setup(void);
/* retrieve upstream GC XID for our xserver GC */
uint32_t xnest_upstream_gc(GCPtr pGC);
void xnest_wm_colormap_windows(xcb_connection_t *conn, xcb_window_t w,
xcb_window_t *windows, int count);
#endif /* __XNEST__XCB_H */