(!1654) Xnest: replace XCreateWindow() by use xcb_create_window()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									e4b6534a16
								
							
						
					
					
						commit
						0b299452a4
					
				|  | @ -13,6 +13,9 @@ is" without express or implied warranty. | |||
| */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include <xcb/xcb.h> | ||||
| #include <xcb/xcb_aux.h> | ||||
| 
 | ||||
| #include <X11/X.h> | ||||
| #include <X11/Xdefs.h> | ||||
| #include <X11/Xproto.h> | ||||
|  | @ -137,7 +140,6 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) | |||
|     int numVisuals, numDepths; | ||||
|     int i, j, depthIndex; | ||||
|     unsigned long valuemask; | ||||
|     XSetWindowAttributes attributes; | ||||
|     XWindowAttributes gattributes; | ||||
|     XSizeHints sizeHints; | ||||
|     VisualID defaultVisual; | ||||
|  | @ -360,29 +362,35 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) | |||
| 
 | ||||
|     if (xnestDoFullGeneration) { | ||||
| 
 | ||||
|         xcb_params_cw_t attributes = { | ||||
|             .back_pixel = xnestUpstreamInfo.screenInfo->white_pixel, | ||||
|             .event_mask = xnestEventMask, | ||||
|             .colormap = xnestDefaultVisualColormap(xnestDefaultVisual(pScreen)), | ||||
|         }; | ||||
| 
 | ||||
|         valuemask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK | XCB_CW_COLORMAP; | ||||
|         attributes.background_pixel = xnestUpstreamInfo.screenInfo->white_pixel; | ||||
|         attributes.event_mask = xnestEventMask; | ||||
|         attributes.colormap = | ||||
|             xnestDefaultVisualColormap(xnestDefaultVisual(pScreen)); | ||||
| 
 | ||||
|         if (xnestParentWindow != 0) { | ||||
|             xnestDefaultWindows[pScreen->myNum] = xnestParentWindow; | ||||
|             XSelectInput(xnestDisplay, xnestDefaultWindows[pScreen->myNum], | ||||
|                          xnestEventMask); | ||||
|         } | ||||
|         else | ||||
|             xnestDefaultWindows[pScreen->myNum] = | ||||
|                 XCreateWindow(xnestDisplay, | ||||
|         else { | ||||
|             xnestDefaultWindows[pScreen->myNum] = xcb_generate_id(xnestUpstreamInfo.conn); | ||||
|             xcb_aux_create_window(xnestUpstreamInfo.conn, | ||||
|                                   pScreen->rootDepth, | ||||
|                                   xnestDefaultWindows[pScreen->myNum], | ||||
|                                   xnestUpstreamInfo.screenInfo->root, | ||||
|                                   xnestX + POSITION_OFFSET, | ||||
|                                   xnestY + POSITION_OFFSET, | ||||
|                               xnestWidth, xnestHeight, | ||||
|                                   xnestWidth, | ||||
|                                   xnestHeight, | ||||
|                                   xnestBorderWidth, | ||||
|                               pScreen->rootDepth, | ||||
|                               InputOutput, | ||||
|                               xnestDefaultVisual(pScreen), | ||||
|                               valuemask, &attributes); | ||||
|                                   XCB_WINDOW_CLASS_INPUT_OUTPUT, | ||||
|                                   xnestDefaultVisual(pScreen)->visualid, | ||||
|                                   valuemask, | ||||
|                                   &attributes); | ||||
|         } | ||||
| 
 | ||||
|         if (!xnestWindowName) | ||||
|             xnestWindowName = argv[0]; | ||||
|  | @ -405,15 +413,21 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) | |||
|         XMapWindow(xnestDisplay, xnestDefaultWindows[pScreen->myNum]); | ||||
| 
 | ||||
|         valuemask = XCB_CW_BACK_PIXMAP | XCB_CW_COLORMAP; | ||||
|         attributes.background_pixmap = xnestScreenSaverPixmap; | ||||
|         attributes.back_pixmap = xnestScreenSaverPixmap; | ||||
|         attributes.colormap = xnestUpstreamInfo.screenInfo->default_colormap; | ||||
|         xnestScreenSaverWindows[pScreen->myNum] = | ||||
|             XCreateWindow(xnestDisplay, | ||||
|                           xnestDefaultWindows[pScreen->myNum], | ||||
|                           0, 0, xnestWidth, xnestHeight, 0, | ||||
| 
 | ||||
|         xnestScreenSaverWindows[pScreen->myNum] = xcb_generate_id(xnestUpstreamInfo.conn); | ||||
|         xcb_aux_create_window(xnestUpstreamInfo.conn, | ||||
|                               xnestUpstreamInfo.screenInfo->root_depth, | ||||
|                           InputOutput, DefaultVisual(xnestDisplay, | ||||
|                                                      xnestUpstreamInfo.screenId), | ||||
|                               xnestScreenSaverWindows[pScreen->myNum], | ||||
|                               xnestDefaultWindows[pScreen->myNum], | ||||
|                               0, | ||||
|                               0, | ||||
|                               xnestWidth, | ||||
|                               xnestHeight, | ||||
|                               0, | ||||
|                               XCB_WINDOW_CLASS_INPUT_OUTPUT, | ||||
|                               xnestUpstreamInfo.screenInfo->root_visual, | ||||
|                               valuemask, | ||||
|                               &attributes); | ||||
|     } | ||||
|  |  | |||
|  | @ -13,6 +13,9 @@ is" without express or implied warranty. | |||
| */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include <xcb/xcb.h> | ||||
| #include <xcb/xcb_aux.h> | ||||
| 
 | ||||
| #include <X11/X.h> | ||||
| #include <X11/Xdefs.h> | ||||
| #include <X11/Xproto.h> | ||||
|  | @ -27,6 +30,7 @@ is" without express or implied warranty. | |||
| #include "region.h" | ||||
| 
 | ||||
| #include "Xnest.h" | ||||
| #include "xnest-xcb.h" | ||||
| 
 | ||||
| #include "Display.h" | ||||
| #include "Screen.h" | ||||
|  | @ -74,7 +78,7 @@ Bool | |||
| xnestCreateWindow(WindowPtr pWin) | ||||
| { | ||||
|     unsigned long mask; | ||||
|     XSetWindowAttributes attributes; | ||||
|     xcb_params_cw_t attributes = { 0 }; | ||||
|     Visual *visual; | ||||
|     ColormapPtr pCmap; | ||||
| 
 | ||||
|  | @ -114,18 +118,21 @@ xnestCreateWindow(WindowPtr pWin) | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     xnestWindowPriv(pWin)->window = XCreateWindow(xnestDisplay, | ||||
|     xnestWindowPriv(pWin)->window = xcb_generate_id(xnestUpstreamInfo.conn); | ||||
|     xcb_aux_create_window(xnestUpstreamInfo.conn, | ||||
|                           pWin->drawable.depth, | ||||
|                           xnestWindowPriv(pWin)->window, | ||||
|                           xnestWindowParent(pWin), | ||||
|                                                   pWin->origin.x - | ||||
|                                                   wBorderWidth(pWin), | ||||
|                                                   pWin->origin.y - | ||||
|                                                   wBorderWidth(pWin), | ||||
|                           pWin->origin.x - wBorderWidth(pWin), | ||||
|                           pWin->origin.y - wBorderWidth(pWin), | ||||
|                           pWin->drawable.width, | ||||
|                           pWin->drawable.height, | ||||
|                           pWin->borderWidth, | ||||
|                                                   pWin->drawable.depth, | ||||
|                           pWin->drawable.class, | ||||
|                                                   visual, mask, &attributes); | ||||
|                           (visual ? visual->visualid : 0), | ||||
|                           mask, | ||||
|                           &attributes); | ||||
| 
 | ||||
|     xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin); | ||||
|     xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin); | ||||
|     xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin); | ||||
|  |  | |||
|  | @ -22,6 +22,7 @@ srcs = [ | |||
| 
 | ||||
| x11_xcb_dep = dependency('x11-xcb', required: true) | ||||
| xcb_dep = dependency('xcb', required: true) | ||||
| xcb_aux_dep = dependency('xcb-aux', required: true) | ||||
| 
 | ||||
| executable( | ||||
|     'Xnest', | ||||
|  | @ -31,6 +32,7 @@ executable( | |||
|         common_dep, | ||||
|         xnest_dep, | ||||
|         xcb_dep, | ||||
|         xcb_aux_dep, | ||||
|         x11_xcb_dep, | ||||
|     ], | ||||
|     link_with: [ | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue