(!1654) Xnest: use xcb for creating / destroying pixmaps
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									da3d670140
								
							
						
					
					
						commit
						3b05bcb799
					
				|  | @ -26,6 +26,7 @@ is" without express or implied warranty. | ||||||
| #include "mipointrst.h" | #include "mipointrst.h" | ||||||
| 
 | 
 | ||||||
| #include "Xnest.h" | #include "Xnest.h" | ||||||
|  | #include "xnest-xcb.h" | ||||||
| 
 | 
 | ||||||
| #include "Display.h" | #include "Display.h" | ||||||
| #include "Screen.h" | #include "Screen.h" | ||||||
|  | @ -40,7 +41,6 @@ Bool | ||||||
| xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) | xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) | ||||||
| { | { | ||||||
|     XImage *ximage; |     XImage *ximage; | ||||||
|     Pixmap source, mask; |  | ||||||
|     XColor fg_color, bg_color; |     XColor fg_color, bg_color; | ||||||
|     unsigned long valuemask; |     unsigned long valuemask; | ||||||
|     XGCValues values; |     XGCValues values; | ||||||
|  | @ -56,13 +56,13 @@ xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) | ||||||
| 
 | 
 | ||||||
|     XChangeGC(xnestDisplay, xnestBitmapGC, valuemask, &values); |     XChangeGC(xnestDisplay, xnestBitmapGC, valuemask, &values); | ||||||
| 
 | 
 | ||||||
|     source = XCreatePixmap(xnestDisplay, |     uint32_t winId = xnestDefaultWindows[pScreen->myNum]; | ||||||
|                            xnestDefaultWindows[pScreen->myNum], |  | ||||||
|                            pCursor->bits->width, pCursor->bits->height, 1); |  | ||||||
| 
 | 
 | ||||||
|     mask = XCreatePixmap(xnestDisplay, |     Pixmap source = xcb_generate_id(xnestUpstreamInfo.conn); | ||||||
|                          xnestDefaultWindows[pScreen->myNum], |     xcb_create_pixmap(xnestUpstreamInfo.conn, 1, source, winId, pCursor->bits->width, pCursor->bits->height); | ||||||
|                          pCursor->bits->width, pCursor->bits->height, 1); | 
 | ||||||
|  |     Pixmap mask = xcb_generate_id(xnestUpstreamInfo.conn); | ||||||
|  |     xcb_create_pixmap(xnestUpstreamInfo.conn, 1, mask, winId, pCursor->bits->width, pCursor->bits->height); | ||||||
| 
 | 
 | ||||||
|     ximage = XCreateImage(xnestDisplay, |     ximage = XCreateImage(xnestDisplay, | ||||||
|                           xnestDefaultVisual(pScreen), |                           xnestDefaultVisual(pScreen), | ||||||
|  | @ -101,8 +101,8 @@ xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) | ||||||
|         XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color, |         XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color, | ||||||
|                             pCursor->bits->xhot, pCursor->bits->yhot); |                             pCursor->bits->xhot, pCursor->bits->yhot); | ||||||
| 
 | 
 | ||||||
|     XFreePixmap(xnestDisplay, source); |     xcb_free_pixmap(xnestUpstreamInfo.conn, source); | ||||||
|     XFreePixmap(xnestDisplay, mask); |     xcb_free_pixmap(xnestUpstreamInfo.conn, mask); | ||||||
| 
 | 
 | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -143,9 +143,13 @@ xnestOpenDisplay(int argc, char *argv[]) | ||||||
|         for (j = 0; j < xnestNumDepths; j++) |         for (j = 0; j < xnestNumDepths; j++) | ||||||
|             if (xnestPixmapFormats[i].depth == 1 || |             if (xnestPixmapFormats[i].depth == 1 || | ||||||
|                 xnestPixmapFormats[i].depth == xnestDepths[j]) { |                 xnestPixmapFormats[i].depth == xnestDepths[j]) { | ||||||
|                 xnestDefaultDrawables[xnestPixmapFormats[i].depth] = |                 uint32_t pixmap = xcb_generate_id(xnestUpstreamInfo.conn); | ||||||
|                     XCreatePixmap(xnestDisplay, xnestUpstreamInfo.screenInfo->root, |                 xcb_create_pixmap(xnestUpstreamInfo.conn, | ||||||
|                                   1, 1, xnestPixmapFormats[i].depth); |                                   xnestPixmapFormats[i].depth, | ||||||
|  |                                   pixmap, | ||||||
|  |                                   xnestUpstreamInfo.screenInfo->root, | ||||||
|  |                                   1, 1); | ||||||
|  |                 xnestDefaultDrawables[xnestPixmapFormats[i].depth] = pixmap; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|     xnestBitmapGC = XCreateGC(xnestDisplay, xnestDefaultDrawables[1], 0L, NULL); |     xnestBitmapGC = XCreateGC(xnestDisplay, xnestDefaultDrawables[1], 0L, NULL); | ||||||
|  |  | ||||||
|  | @ -26,6 +26,7 @@ is" without express or implied warranty. | ||||||
| #include "mi.h" | #include "mi.h" | ||||||
| 
 | 
 | ||||||
| #include "Xnest.h" | #include "Xnest.h" | ||||||
|  | #include "xnest-xcb.h" | ||||||
| 
 | 
 | ||||||
| #include "Display.h" | #include "Display.h" | ||||||
| #include "Screen.h" | #include "Screen.h" | ||||||
|  | @ -56,11 +57,12 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, | ||||||
|     pPixmap->refcnt = 1; |     pPixmap->refcnt = 1; | ||||||
|     pPixmap->devKind = PixmapBytePad(width, depth); |     pPixmap->devKind = PixmapBytePad(width, depth); | ||||||
|     pPixmap->usage_hint = usage_hint; |     pPixmap->usage_hint = usage_hint; | ||||||
|     if (width && height) |     if (width && height) { | ||||||
|         xnestPixmapPriv(pPixmap)->pixmap = |         uint32_t pixmap = xcb_generate_id(xnestUpstreamInfo.conn); | ||||||
|             XCreatePixmap(xnestDisplay, |         xcb_create_pixmap(xnestUpstreamInfo.conn, depth, pixmap, | ||||||
|                           xnestDefaultWindows[pScreen->myNum], |                           xnestDefaultWindows[pScreen->myNum], width, height); | ||||||
|                           width, height, depth); |         xnestPixmapPriv(pPixmap)->pixmap = pixmap; | ||||||
|  |     } | ||||||
|     else |     else | ||||||
|         xnestPixmapPriv(pPixmap)->pixmap = 0; |         xnestPixmapPriv(pPixmap)->pixmap = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -72,7 +74,7 @@ xnestDestroyPixmap(PixmapPtr pPixmap) | ||||||
| { | { | ||||||
|     if (--pPixmap->refcnt) |     if (--pPixmap->refcnt) | ||||||
|         return TRUE; |         return TRUE; | ||||||
|     XFreePixmap(xnestDisplay, xnestPixmap(pPixmap)); |     xcb_free_pixmap(xnestUpstreamInfo.conn, xnestPixmap(pPixmap)); | ||||||
|     FreePixmap(pPixmap); |     FreePixmap(pPixmap); | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
|  | @ -82,10 +84,11 @@ xnestModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, | ||||||
|                         int bitsPerPixel, int devKind, void *pPixData) |                         int bitsPerPixel, int devKind, void *pPixData) | ||||||
| { | { | ||||||
|   if(!xnestPixmapPriv(pPixmap)->pixmap && width > 0 && height > 0) { |   if(!xnestPixmapPriv(pPixmap)->pixmap && width > 0 && height > 0) { | ||||||
|     xnestPixmapPriv(pPixmap)->pixmap = |         uint32_t pixmap = xcb_generate_id(xnestUpstreamInfo.conn); | ||||||
|         XCreatePixmap(xnestDisplay, |         xcb_create_pixmap(xnestUpstreamInfo.conn, depth, pixmap, | ||||||
|                       xnestDefaultWindows[pPixmap->drawable.pScreen->myNum], |                           xnestDefaultWindows[pPixmap->drawable.pScreen->myNum], | ||||||
|                       width, height, depth); |                           width, height); | ||||||
|  |         xnestPixmapPriv(pPixmap)->pixmap = pixmap; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   return miModifyPixmapHeader(pPixmap, width, height, depth, |   return miModifyPixmapHeader(pPixmap, width, height, depth, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue