From fb25adae36bd07fd3e159ae77c9827abf8742dfc Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sun, 15 Oct 2017 14:50:21 -0400 Subject: [PATCH] xwayland: use xfixes extension --- meson.build | 1 + xwayland/meson.build | 9 ++++++++- xwayland/xwm.c | 22 ++++++++++++++++++++++ xwayland/xwm.h | 2 ++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 3e4cab38..e4b5a39f 100644 --- a/meson.build +++ b/meson.build @@ -51,6 +51,7 @@ udev = dependency('libudev') pixman = dependency('pixman-1') xcb = dependency('xcb') xcb_composite = dependency('xcb-composite') +xcb_xfixes = dependency('xcb-xfixes') xcb_icccm = dependency('xcb-icccm', required: false) x11_xcb = dependency('x11-xcb') libcap = dependency('libcap', required: false) diff --git a/xwayland/meson.build b/xwayland/meson.build index d989f6dd..a05ae584 100644 --- a/xwayland/meson.build +++ b/xwayland/meson.build @@ -6,5 +6,12 @@ lib_wlr_xwayland = static_library( 'xwm.c', ), include_directories: wlr_inc, - dependencies: [wayland_server, xcb, xcb_composite, xcb_icccm, pixman], + dependencies: [ + wayland_server, + xcb, + xcb_composite, + xcb_xfixes, + xcb_icccm, + pixman, + ], ) diff --git a/xwayland/xwm.c b/xwayland/xwm.c index bc1bb4de..fd70fe4c 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -3,6 +3,7 @@ #endif #include #include +#include #include "wlr/util/log.h" #include "wlr/types/wlr_surface.h" #include "wlr/xwayland.h" @@ -825,9 +826,30 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) { // TODO more xcb init // xcb_prefetch_extension_data(xwm->xcb_conn, &xcb_composite_id); + xcb_prefetch_extension_data(xwm->xcb_conn, &xcb_xfixes_id); + xcb_get_resources(xwm); xcb_init_wm(xwm); + xwm->xfixes = xcb_get_extension_data(xwm->xcb_conn, &xcb_xfixes_id); + + if (!xwm->xfixes || !xwm->xfixes->present) { + wlr_log(L_DEBUG, "xfixes not available"); + } + + xcb_xfixes_query_version_cookie_t xfixes_cookie; + xcb_xfixes_query_version_reply_t *xfixes_reply; + xfixes_cookie = + xcb_xfixes_query_version(xwm->xcb_conn, XCB_XFIXES_MAJOR_VERSION, + XCB_XFIXES_MINOR_VERSION); + xfixes_reply = + xcb_xfixes_query_version_reply(xwm->xcb_conn, xfixes_cookie, NULL); + + wlr_log(L_DEBUG, "xfixes version: %d.%d", + xfixes_reply->major_version, xfixes_reply->minor_version); + + free(xfixes_reply); + xwm->surface_create_listener.notify = create_surface_handler; wl_signal_add(&wlr_xwayland->compositor->events.create_surface, &xwm->surface_create_listener); diff --git a/xwayland/xwm.h b/xwayland/xwm.h index be710a1b..a04b1065 100644 --- a/xwayland/xwm.h +++ b/xwayland/xwm.h @@ -85,6 +85,8 @@ struct wlr_xwm { struct wl_list new_surfaces; struct wl_list unpaired_surfaces; + + const xcb_query_extension_reply_t *xfixes; }; void xwm_destroy(struct wlr_xwm *xwm);