Parse _MOTIF_HINTS

This commit is contained in:
emersion 2017-10-05 16:49:47 +02:00
parent fc61e82795
commit 454a6a902b
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
2 changed files with 32 additions and 2 deletions

View File

@ -33,6 +33,12 @@ struct wlr_xwayland {
void *data; 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 { struct wlr_xwayland_surface {
xcb_window_t window_id; xcb_window_t window_id;
uint32_t surface_id; uint32_t surface_id;
@ -57,7 +63,8 @@ struct wlr_xwayland_surface {
xcb_atom_t *protocols; xcb_atom_t *protocols;
size_t protocols_len; size_t protocols_len;
uint32_t motif_hints[5]; uint32_t decorations;
#ifdef HAS_XCB_ICCCM #ifdef HAS_XCB_ICCCM
xcb_icccm_wm_hints_t *hints; xcb_icccm_wm_hints_t *hints;
xcb_size_hints_t *size_hints; xcb_size_hints_t *size_hints;

View File

@ -327,6 +327,16 @@ static void read_surface_normal_hints(struct wlr_xwm *xwm,
} }
#endif #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, static void read_surface_motif_hints(struct wlr_xwm *xwm,
struct wlr_xwayland_surface *surface, xcb_get_property_reply_t *reply) { struct wlr_xwayland_surface *surface, xcb_get_property_reply_t *reply) {
if (reply->value_len < 5) { 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); 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); wlr_log(L_DEBUG, "MOTIF_WM_HINTS (%d)", reply->value_len);
} }