aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-10-05 12:32:12 +0200
committeremersion <contact@emersion.fr>2017-10-05 19:10:23 +0200
commited9796ec683b64655c60b09f0c9969263f4394d6 (patch)
tree7e85d97f2ee833e7ea34752aad0ef2b4e16bdc08
parentef5914bdb61e788cf3b62378c4e7a14d8bf0430f (diff)
xwayland: parse normal hints
-rw-r--r--include/wlr/xwayland.h7
-rw-r--r--meson.build5
-rw-r--r--xwayland/meson.build2
-rw-r--r--xwayland/xwm.c14
4 files changed, 25 insertions, 3 deletions
diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h
index dc9798b2..181259fa 100644
--- a/include/wlr/xwayland.h
+++ b/include/wlr/xwayland.h
@@ -6,6 +6,10 @@
#include <wlr/types/wlr_compositor.h>
#include <xcb/xcb.h>
+#ifdef HAS_XCB_ICCCM
+ #include <xcb/xcb_icccm.h>
+#endif
+
struct wlr_xwm;
struct wlr_xwayland {
@@ -54,6 +58,9 @@ struct wlr_xwayland_surface {
size_t protocols_len;
uint32_t motif_hints[5];
+ #ifdef HAS_XCB_ICCCM
+ xcb_size_hints_t size_hints;
+ #endif
struct {
struct wl_signal destroy;
diff --git a/meson.build b/meson.build
index 520eceb9..57c26b0f 100644
--- a/meson.build
+++ b/meson.build
@@ -45,12 +45,17 @@ udev = dependency('libudev')
pixman = dependency('pixman-1')
xcb = dependency('xcb')
xcb_composite = dependency('xcb-composite')
+xcb_icccm = dependency('xcb-icccm', required: false)
x11_xcb = dependency('x11-xcb')
libcap = dependency('libcap', required: false)
systemd = dependency('libsystemd', required: false)
elogind = dependency('libelogind', required: false)
math = cc.find_library('m', required: false)
+if xcb_icccm.found()
+ add_project_arguments('-DHAS_XCB_ICCCM', language: 'c')
+endif
+
if libcap.found() and get_option('enable_libcap')
add_project_arguments('-DHAS_LIBCAP', language: 'c')
endif
diff --git a/xwayland/meson.build b/xwayland/meson.build
index 9797a1a1..d989f6dd 100644
--- a/xwayland/meson.build
+++ b/xwayland/meson.build
@@ -6,5 +6,5 @@ lib_wlr_xwayland = static_library(
'xwm.c',
),
include_directories: wlr_inc,
- dependencies: [wayland_server, xcb, xcb_composite, pixman],
+ dependencies: [wayland_server, xcb, xcb_composite, xcb_icccm, pixman],
)
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index f97f0a8e..afd4ef29 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -8,6 +8,10 @@
#include "wlr/xwayland.h"
#include "xwm.h"
+#ifdef HAS_XCB_ICCCM
+ #include <xcb/xcb_icccm.h>
+#endif
+
const char *atom_map[ATOM_LAST] = {
"WL_SURFACE_ID",
"WM_DELETE_WINDOW",
@@ -272,17 +276,23 @@ static void read_surface_protocols(struct wlr_xwm *xwm,
wlr_log(L_DEBUG, "WM_PROTOCOLS (%zu)", atoms_len);
}
+#ifdef HAS_XCB_ICCCM
static void read_surface_normal_hints(struct wlr_xwm *xwm,
struct wlr_xwayland_surface *surface, xcb_get_property_reply_t *reply) {
if (reply->type != xwm->atoms[WM_SIZE_HINTS]) {
return;
}
- // TODO: xcb_icccm_get_wm_size_hints_from_reply
- // See https://github.com/i3/i3/blob/55bc6741796e8b179b6111a721a3e9631934bb86/src/handlers.c#L994
+ xcb_icccm_get_wm_size_hints_from_reply(&surface->size_hints, reply);
wlr_log(L_DEBUG, "WM_NORMAL_HINTS (%d)", reply->value_len);
}
+#else
+static void read_surface_normal_hints(struct wlr_xwm *xwm,
+ struct wlr_xwayland_surface *surface, xcb_get_property_reply_t *reply) {
+ // Do nothing
+}
+#endif
static void read_surface_motif_hints(struct wlr_xwm *xwm,
struct wlr_xwayland_surface *surface, xcb_get_property_reply_t *reply) {