Port usage of XCompositeNameWindowPixmap to xcb

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2018-09-28 18:38:33 +02:00
parent dbb5a6be83
commit 11204e7a44
4 changed files with 11 additions and 9 deletions

View File

@ -9,7 +9,7 @@ MANDIR ?= $(PREFIX)/share/man/man1
APPDIR ?= $(PREFIX)/share/applications APPDIR ?= $(PREFIX)/share/applications
ICODIR ?= $(PREFIX)/share/icons/hicolor/ ICODIR ?= $(PREFIX)/share/icons/hicolor/
PACKAGES = x11 x11-xcb xcb-renderutil xcb-render xcb-damage xcb-randr xcb-image xcomposite xfixes xext PACKAGES = x11 x11-xcb xcb-renderutil xcb-render xcb-damage xcb-randr xcb-composite xcb-image xcomposite xfixes xext
LIBS = -lm -lrt LIBS = -lm -lrt
INCS = INCS =

View File

@ -82,7 +82,7 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/extensions/Xcomposite.h> #include <X11/extensions/Xcomposite.h> /* FIXME remove this once done porting to xcb-composite */
#include <X11/extensions/shape.h> #include <X11/extensions/shape.h>
#include <X11/extensions/Xdbe.h> #include <X11/extensions/Xdbe.h>
#ifdef CONFIG_XSYNC #ifdef CONFIG_XSYNC
@ -93,6 +93,7 @@
#include <X11/extensions/Xinerama.h> #include <X11/extensions/Xinerama.h>
#endif #endif
#include <xcb/composite.h>
#include <xcb/render.h> #include <xcb/render.h>
#include <xcb/damage.h> #include <xcb/damage.h>
#include <xcb/randr.h> #include <xcb/randr.h>
@ -596,7 +597,7 @@ typedef struct _options_t {
Window benchmark_wid; Window benchmark_wid;
/// A list of conditions of windows not to paint. /// A list of conditions of windows not to paint.
c2_lptr_t *paint_blacklist; c2_lptr_t *paint_blacklist;
/// Whether to avoid using XCompositeNameWindowPixmap(), for debugging. /// Whether to avoid using xcb_composite_name_window_pixmap(), for debugging.
bool no_name_pixmap; bool no_name_pixmap;
/// Whether to work under synchronized mode for debugging. /// Whether to work under synchronized mode for debugging.
bool synchronize; bool synchronize;

View File

@ -1446,7 +1446,8 @@ win_paint_win(session_t *ps, win *w, XserverRegion reg_paint,
// Fetch Pixmap // Fetch Pixmap
if (!w->paint.pixmap && ps->has_name_pixmap) { if (!w->paint.pixmap && ps->has_name_pixmap) {
set_ignore_next(ps); set_ignore_next(ps);
w->paint.pixmap = XCompositeNameWindowPixmap(ps->dpy, w->id); w->paint.pixmap = xcb_generate_id(c);
xcb_composite_name_window_pixmap(c, w->id, w->paint.pixmap);
if (w->paint.pixmap) if (w->paint.pixmap)
free_fence(ps, &w->fence); free_fence(ps, &w->fence);
} }

View File

@ -48,16 +48,16 @@ XCreatePixmap_(Display *dpy, Drawable drawable,
#define XCreatePixmap(dpy, drawable, width, height, depth) \ #define XCreatePixmap(dpy, drawable, width, height, depth) \
XCreatePixmap_(dpy, drawable, width, height, depth, M_POS_DATA) XCreatePixmap_(dpy, drawable, width, height, depth, M_POS_DATA)
static inline Pixmap static inline xcb_pixmap_t
XCompositeNameWindowPixmap_(Display *dpy, Window window, M_POS_DATA_PARAMS) { xcb_composite_name_window_pixmap_(xcb_connection_t *c, xcb_window_t window, xcb_pixmap_t pixmap, M_POS_DATA_PARAMS) {
Pixmap ret = XCompositeNameWindowPixmap(dpy, window); xcb_pixmap_t ret = xcb_composite_name_window_pixmap(c, window, pixmap);
if (ret) if (ret)
xrc_add_xid_(ret, "PixmapC", M_POS_DATA_PASSTHROUGH); xrc_add_xid_(ret, "PixmapC", M_POS_DATA_PASSTHROUGH);
return ret; return ret;
} }
#define XCompositeNameWindowPixmap(dpy, window) \ #define xcb_composite_name_window_pixmap(dpy, window, pixmap) \
XCompositeNameWindowPixmap_(dpy, window, M_POS_DATA) xcb_composite_name_window_pixmap_(dpy, window, pixmap, M_POS_DATA)
static inline void static inline void
XFreePixmap_(Display *dpy, Pixmap pixmap, M_POS_DATA_PARAMS) { XFreePixmap_(Display *dpy, Pixmap pixmap, M_POS_DATA_PARAMS) {