Use pointers for xwayland hints and size_hints

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

View File

@ -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 {

View File

@ -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);
}