From ed9796ec683b64655c60b09f0c9969263f4394d6 Mon Sep 17 00:00:00 2001
From: emersion <contact@emersion.fr>
Date: Thu, 5 Oct 2017 12:32:12 +0200
Subject: xwayland: parse normal hints

---
 xwayland/meson.build |  2 +-
 xwayland/xwm.c       | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

(limited to 'xwayland')

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) {
-- 
cgit v1.2.3