diff options
-rw-r--r-- | include/wlr/xwayland.h | 9 | ||||
-rw-r--r-- | xwayland/xwm.c | 25 |
2 files changed, 32 insertions, 2 deletions
diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index 05453c21..1f2d7acb 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -33,6 +33,12 @@ struct wlr_xwayland { void *data; }; +enum wlr_xwayland_surface_decorations { + WLR_XWAYLAND_SURFACE_DECORATIONS_ALL = 0, + WLR_XWAYLAND_SURFACE_DECORATIONS_NO_BORDER = 1, + WLR_XWAYLAND_SURFACE_DECORATIONS_NO_TITLE = 2, +}; + struct wlr_xwayland_surface { xcb_window_t window_id; uint32_t surface_id; @@ -57,7 +63,8 @@ struct wlr_xwayland_surface { xcb_atom_t *protocols; size_t protocols_len; - uint32_t motif_hints[5]; + uint32_t decorations; + #ifdef HAS_XCB_ICCCM xcb_icccm_wm_hints_t *hints; xcb_size_hints_t *size_hints; diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 2ac24260..120c1ae8 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -327,6 +327,16 @@ static void read_surface_normal_hints(struct wlr_xwm *xwm, } #endif + +#define MWM_HINTS_FLAGS_FIELD 0 +#define MWM_HINTS_DECORATIONS_FIELD 2 + +#define MWM_HINTS_DECORATIONS (1 << 1) + +#define MWM_DECOR_ALL (1 << 0) +#define MWM_DECOR_BORDER (1 << 1) +#define MWM_DECOR_TITLE (1 << 3) + static void read_surface_motif_hints(struct wlr_xwm *xwm, struct wlr_xwayland_surface *surface, xcb_get_property_reply_t *reply) { if (reply->value_len < 5) { @@ -334,7 +344,20 @@ static void read_surface_motif_hints(struct wlr_xwm *xwm, } uint32_t *motif_hints = xcb_get_property_value(reply); - memcpy(surface->motif_hints, motif_hints, sizeof(surface->motif_hints)); + if (motif_hints[MWM_HINTS_FLAGS_FIELD] & MWM_HINTS_DECORATIONS) { + surface->decorations = WLR_XWAYLAND_SURFACE_DECORATIONS_ALL; + uint32_t decorations = motif_hints[MWM_HINTS_DECORATIONS_FIELD]; + if ((decorations & MWM_DECOR_ALL) == 0) { + if ((decorations & MWM_DECOR_BORDER) == 0) { + surface->decorations |= + WLR_XWAYLAND_SURFACE_DECORATIONS_NO_BORDER; + } + if ((decorations & MWM_DECOR_TITLE) == 0) { + surface->decorations |= + WLR_XWAYLAND_SURFACE_DECORATIONS_NO_TITLE; + } + } + } wlr_log(L_DEBUG, "MOTIF_WM_HINTS (%d)", reply->value_len); } |