Copy xcb_icccm structs into wlroots

This commit is contained in:
emersion 2017-10-05 22:23:37 +02:00
parent 454a6a902b
commit 12b9b1a4bd
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
2 changed files with 40 additions and 12 deletions

View File

@ -39,6 +39,30 @@ enum wlr_xwayland_surface_decorations {
WLR_XWAYLAND_SURFACE_DECORATIONS_NO_TITLE = 2, WLR_XWAYLAND_SURFACE_DECORATIONS_NO_TITLE = 2,
}; };
struct wlr_xwayland_surface_hints {
uint32_t flags;
uint32_t input;
int32_t initial_state;
xcb_pixmap_t icon_pixmap;
xcb_window_t icon_window;
int32_t icon_x, icon_y;
xcb_pixmap_t icon_mask;
xcb_window_t window_group;
};
struct wlr_xwayland_surface_size_hints {
uint32_t flags;
int32_t x, y;
int32_t width, height;
int32_t min_width, min_height;
int32_t max_width, max_height;
int32_t width_inc, height_inc;
int32_t base_width, base_height;
int32_t min_aspect_num, min_aspect_den;
int32_t max_aspect_num, max_aspect_den;
uint32_t win_gravity;
};
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;
@ -64,14 +88,9 @@ struct wlr_xwayland_surface {
size_t protocols_len; size_t protocols_len;
uint32_t decorations; uint32_t decorations;
struct wlr_xwayland_surface_hints *hints;
#ifdef HAS_XCB_ICCCM uint32_t hints_urgency;
xcb_icccm_wm_hints_t *hints; struct wlr_xwayland_surface_size_hints *size_hints;
xcb_size_hints_t *size_hints;
#else
void *hints;
void *size_hints;
#endif
struct { struct {
struct wl_signal destroy; struct wl_signal destroy;

View File

@ -288,12 +288,16 @@ static void read_surface_hints(struct wlr_xwm *xwm,
return; return;
} }
xcb_icccm_wm_hints_t hints;
xcb_icccm_get_wm_hints_from_reply(&hints, reply);
free(surface->hints); free(surface->hints);
surface->hints = calloc(1, sizeof(xcb_icccm_wm_hints_t)); surface->hints = calloc(1, sizeof(struct wlr_xwayland_surface_hints));
if (surface->hints == NULL) { if (surface->hints == NULL) {
return; return;
} }
xcb_icccm_get_wm_hints_from_reply(surface->hints, reply); memcpy(surface->hints, &hints, sizeof(struct wlr_xwayland_surface_hints));
surface->hints_urgency = xcb_icccm_wm_hints_get_urgency(&hints);
wlr_log(L_DEBUG, "WM_HINTS (%d)", reply->value_len); wlr_log(L_DEBUG, "WM_HINTS (%d)", reply->value_len);
} }
@ -311,12 +315,17 @@ static void read_surface_normal_hints(struct wlr_xwm *xwm,
return; return;
} }
xcb_size_hints_t size_hints;
xcb_icccm_get_wm_size_hints_from_reply(&size_hints, reply);
free(surface->size_hints); free(surface->size_hints);
surface->size_hints = calloc(1, sizeof(xcb_size_hints_t)); surface->size_hints =
calloc(1, sizeof(struct wlr_xwayland_surface_size_hints));
if (surface->size_hints == NULL) { if (surface->size_hints == NULL) {
return; return;
} }
xcb_icccm_get_wm_size_hints_from_reply(surface->size_hints, reply); memcpy(surface->size_hints, &size_hints,
sizeof(struct wlr_xwayland_surface_size_hints));
wlr_log(L_DEBUG, "WM_NORMAL_HINTS (%d)", reply->value_len); wlr_log(L_DEBUG, "WM_NORMAL_HINTS (%d)", reply->value_len);
} }