(!1654) Xnest: replace XCreatePixmapFromBitmapData() by xcb_put_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									c74a77f619
								
							
						
					
					
						commit
						a1377e4b3c
					
				| 
						 | 
					@ -184,7 +184,8 @@ xnestOpenDisplay(int argc, char *argv[])
 | 
				
			||||||
                                      (char *) icon_bits, icon_width, icon_height);
 | 
					                                      (char *) icon_bits, icon_width, icon_height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xnestScreenSaverPixmap =
 | 
					    xnestScreenSaverPixmap =
 | 
				
			||||||
        XCreatePixmapFromBitmapData(xnestDisplay,
 | 
					        xnest_create_pixmap_from_bitmap_data(
 | 
				
			||||||
 | 
					                                    xnestUpstreamInfo.conn,
 | 
				
			||||||
                                    xnestUpstreamInfo.screenInfo->root,
 | 
					                                    xnestUpstreamInfo.screenInfo->root,
 | 
				
			||||||
                                    (char *) screensaver_bits,
 | 
					                                    (char *) screensaver_bits,
 | 
				
			||||||
                                    screensaver_width,
 | 
					                                    screensaver_width,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,7 @@
 | 
				
			||||||
#include <dix-config.h>
 | 
					#include <dix-config.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <xcb/xcb.h>
 | 
					#include <xcb/xcb.h>
 | 
				
			||||||
 | 
					#include <xcb/xcb_aux.h>
 | 
				
			||||||
#include <xcb/xcb_icccm.h>
 | 
					#include <xcb/xcb_icccm.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <X11/X.h>
 | 
					#include <X11/X.h>
 | 
				
			||||||
| 
						 | 
					@ -105,3 +106,44 @@ uint32_t xnest_create_bitmap_from_data(
 | 
				
			||||||
    xcb_free_gc(conn, gc);
 | 
					    xcb_free_gc(conn, gc);
 | 
				
			||||||
    return pix;
 | 
					    return pix;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					uint32_t xnest_create_pixmap_from_bitmap_data(
 | 
				
			||||||
 | 
					    xcb_connection_t *conn,
 | 
				
			||||||
 | 
					    uint32_t drawable,
 | 
				
			||||||
 | 
					    const char *data,
 | 
				
			||||||
 | 
					    uint32_t width,
 | 
				
			||||||
 | 
					    uint32_t height,
 | 
				
			||||||
 | 
					    uint32_t fg,
 | 
				
			||||||
 | 
					    uint32_t bg,
 | 
				
			||||||
 | 
					    uint16_t depth)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    uint32_t pix = xcb_generate_id(xnestUpstreamInfo.conn);
 | 
				
			||||||
 | 
					    xcb_create_pixmap(conn, depth, pix, drawable, width, height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    uint32_t gc = xcb_generate_id(xnestUpstreamInfo.conn);
 | 
				
			||||||
 | 
					    xcb_create_gc(conn, gc, pix, 0, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    xcb_params_gc_t gcv = {
 | 
				
			||||||
 | 
					        .foreground = fg,
 | 
				
			||||||
 | 
					        .background = bg
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    xcb_aux_change_gc(conn, gc, XCB_GC_FOREGROUND | XCB_GC_BACKGROUND, &gcv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const int leftPad = 0;
 | 
				
			||||||
 | 
					    xcb_put_image(conn,
 | 
				
			||||||
 | 
					                  XYBitmap,
 | 
				
			||||||
 | 
					                  pix,
 | 
				
			||||||
 | 
					                  gc,
 | 
				
			||||||
 | 
					                  width,
 | 
				
			||||||
 | 
					                  height,
 | 
				
			||||||
 | 
					                  0 /* dst_x */,
 | 
				
			||||||
 | 
					                  0 /* dst_y */,
 | 
				
			||||||
 | 
					                  leftPad,
 | 
				
			||||||
 | 
					                  1 /* depth */,
 | 
				
			||||||
 | 
					                  BitmapBytePad(width + leftPad) * height,
 | 
				
			||||||
 | 
					                  (uint8_t*)data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    xcb_free_gc(conn, gc);
 | 
				
			||||||
 | 
					    return pix;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,4 +28,8 @@ void xnest_wm_colormap_windows(xcb_connection_t *conn, xcb_window_t w,
 | 
				
			||||||
uint32_t xnest_create_bitmap_from_data(xcb_connection_t *conn, uint32_t drawable,
 | 
					uint32_t xnest_create_bitmap_from_data(xcb_connection_t *conn, uint32_t drawable,
 | 
				
			||||||
                                       const char *data, uint32_t width, uint32_t height);
 | 
					                                       const char *data, uint32_t width, uint32_t height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					uint32_t xnest_create_pixmap_from_bitmap_data(xcb_connection_t *conn, uint32_t drawable,
 | 
				
			||||||
 | 
					                                         const char *data, uint32_t width, uint32_t height,
 | 
				
			||||||
 | 
					                                         uint32_t fg, uint32_t bg, uint16_t depth);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* __XNEST__XCB_H */
 | 
					#endif /* __XNEST__XCB_H */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue