(!1654) 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:
		
							parent
							
								
									df20e9e2b4
								
							
						
					
					
						commit
						73c8b74b99
					
				|  | @ -35,6 +35,8 @@ is" without express or implied warranty. | |||
| #include "XNWindow.h" | ||||
| #include "Args.h" | ||||
| 
 | ||||
| #include <xcb/xcb_icccm.h> | ||||
| 
 | ||||
| DevPrivateKeyRec xnestColormapPrivateKeyRec; | ||||
| 
 | ||||
| static DevPrivateKeyRec cmapScrPrivateKeyRec; | ||||
|  | @ -220,22 +222,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; | ||||
|  | @ -277,19 +267,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; | ||||
|  |  | |||
|  | @ -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: [ | ||||
|  |  | |||
|  | @ -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); | ||||
| } | ||||
|  |  | |||
|  | @ -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 */ | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue