From 3afff3fe9be3b37650cb9d9154de581a56b82939 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 17 May 2014 01:59:08 +0200 Subject: [PATCH] x11: remove vo_hint member Now it's always recreated in vo_x11_sizehint(). Also, the Xlib manual says you must use XAllocSizeHints() (for ABI reasons), so do that. --- video/out/x11_common.c | 46 +++++++++++++++++++++++------------------- video/out/x11_common.h | 1 - 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/video/out/x11_common.c b/video/out/x11_common.c index b5ff806532..f6b83e549a 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -908,37 +908,41 @@ static void vo_x11_sizehint(struct vo *vo, int x, int y, int width, int height, opts->WinID >= 0 || // force to fill parent override_pos; // for fullscreen and such - x11->vo_hint.flags = 0; + XSizeHints *hint = XAllocSizeHints(); + if (!hint) + return; // OOM + if (opts->keepaspect) { - x11->vo_hint.flags |= PAspect; - x11->vo_hint.min_aspect.x = width; - x11->vo_hint.min_aspect.y = height; - x11->vo_hint.max_aspect.x = width; - x11->vo_hint.max_aspect.y = height; + hint->flags |= PAspect; + hint->min_aspect.x = width; + hint->min_aspect.y = height; + hint->max_aspect.x = width; + hint->max_aspect.y = height; } - x11->vo_hint.flags |= PSize | (force_pos ? PPosition : 0); - x11->vo_hint.x = x; - x11->vo_hint.y = y; - x11->vo_hint.width = width; - x11->vo_hint.height = height; - x11->vo_hint.max_width = 0; - x11->vo_hint.max_height = 0; + hint->flags |= PSize | (force_pos ? PPosition : 0); + hint->x = x; + hint->y = y; + hint->width = width; + hint->height = height; + hint->max_width = 0; + hint->max_height = 0; // Set minimum height/width to 4 to avoid off-by-one errors. - x11->vo_hint.flags |= PMinSize; - x11->vo_hint.min_width = x11->vo_hint.min_height = 4; + hint->flags |= PMinSize; + hint->min_width = hint->min_height = 4; // Set the base size. A window manager might display the window // size to the user relative to this. // Setting these to width/height might be nice, but e.g. fluxbox can't handle it. - x11->vo_hint.flags |= PBaseSize; - x11->vo_hint.base_width = 0 /*width*/; - x11->vo_hint.base_height = 0 /*height*/; + hint->flags |= PBaseSize; + hint->base_width = 0 /*width*/; + hint->base_height = 0 /*height*/; - x11->vo_hint.flags |= PWinGravity; - x11->vo_hint.win_gravity = CenterGravity; - XSetWMNormalHints(x11->display, x11->window, &x11->vo_hint); + hint->flags |= PWinGravity; + hint->win_gravity = CenterGravity; + XSetWMNormalHints(x11->display, x11->window, hint); + XFree(hint); } static void vo_x11_move_resize(struct vo *vo, bool move, bool resize, diff --git a/video/out/x11_common.h b/video/out/x11_common.h index d410809c09..a9e685a054 100644 --- a/video/out/x11_common.h +++ b/video/out/x11_common.h @@ -59,7 +59,6 @@ struct vo_x11_state { int fs_layer; int fs; // whether we assume the window is in fullscreen mode - XSizeHints vo_hint; bool mouse_cursor_hidden; int orig_layer;