diff options
author | emersion <contact@emersion.fr> | 2017-10-05 16:32:05 +0200 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-10-05 19:11:28 +0200 |
commit | fc61e827953479037bd3408a2ff14fa894bcfde1 (patch) | |
tree | 80a0f8790b8c0a35582bb8167458478639aabb0d | |
parent | 267f24753f010e6ac7e49f7bfb27a9c85f40b62d (diff) |
Use pointers for xwayland hints and size_hints
-rw-r--r-- | include/wlr/xwayland.h | 8 | ||||
-rw-r--r-- | xwayland/xwm.c | 22 |
2 files changed, 21 insertions, 9 deletions
diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index 73df1ea9..05453c21 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -59,11 +59,11 @@ struct wlr_xwayland_surface { uint32_t motif_hints[5]; #ifdef HAS_XCB_ICCCM - xcb_icccm_wm_hints_t hints; - xcb_size_hints_t size_hints; + xcb_icccm_wm_hints_t *hints; + xcb_size_hints_t *size_hints; #else - char hints_padding[36]; - char size_hints_padding[72]; + void *hints; + void *size_hints; #endif struct { diff --git a/xwayland/xwm.c b/xwayland/xwm.c index bc930140..2ac24260 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -89,12 +89,14 @@ static void wlr_xwayland_surface_destroy(struct wlr_xwayland_surface *surface) { for (size_t i = 0; i < surface->state->length; i++) { free(surface->state->items[i]); } + free(surface->title); + free(surface->class); + free(surface->instance); list_free(surface->state); free(surface->window_type); free(surface->protocols); - free(surface->class); - free(surface->instance); - free(surface->title); + free(surface->hints); + free(surface->size_hints); free(surface); } @@ -286,7 +288,12 @@ static void read_surface_hints(struct wlr_xwm *xwm, return; } - xcb_icccm_get_wm_hints_from_reply(&surface->hints, reply); + free(surface->hints); + surface->hints = calloc(1, sizeof(xcb_icccm_wm_hints_t)); + if (surface->hints == NULL) { + return; + } + xcb_icccm_get_wm_hints_from_reply(surface->hints, reply); wlr_log(L_DEBUG, "WM_HINTS (%d)", reply->value_len); } @@ -304,7 +311,12 @@ static void read_surface_normal_hints(struct wlr_xwm *xwm, return; } - xcb_icccm_get_wm_size_hints_from_reply(&surface->size_hints, reply); + free(surface->size_hints); + surface->size_hints = calloc(1, sizeof(xcb_size_hints_t)); + if (surface->size_hints == NULL) { + return; + } + xcb_icccm_get_wm_size_hints_from_reply(surface->size_hints, reply); wlr_log(L_DEBUG, "WM_NORMAL_HINTS (%d)", reply->value_len); } |