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.
This commit is contained in:
wm4 2014-05-17 01:59:08 +02:00
parent 4807f8bdd2
commit 3afff3fe9b
2 changed files with 25 additions and 22 deletions

View File

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

View File

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