diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c index 517452047..76012ddbf 100644 --- a/hw/xnest/Color.c +++ b/hw/xnest/Color.c @@ -38,6 +38,8 @@ is" without express or implied warranty. #include "XNWindow.h" #include "Args.h" +#include + DevPrivateKeyRec xnestColormapPrivateKeyRec; static DevPrivateKeyRec cmapScrPrivateKeyRec; @@ -223,22 +225,10 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen) if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) { free(xnestOldInstalledColormapWindows); -#ifdef _XSERVER64 - { - int i; - Window64 *windows = xallocarray(numWindows, sizeof(Window64)); - - 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; @@ -280,19 +270,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; diff --git a/hw/xnest/meson.build b/hw/xnest/meson.build index ccff44867..e2a978b83 100644 --- a/hw/xnest/meson.build +++ b/hw/xnest/meson.build @@ -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: [ diff --git a/hw/xnest/xcb.c b/hw/xnest/xcb.c index 83284361d..41f6dbfb8 100644 --- a/hw/xnest/xcb.c +++ b/hw/xnest/xcb.c @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -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); +} diff --git a/hw/xnest/xnest-xcb.h b/hw/xnest/xnest-xcb.h index 3c35e04dc..a924e2575 100644 --- a/hw/xnest/xnest-xcb.h +++ b/hw/xnest/xnest-xcb.h @@ -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 */