From 106c5f99895fefaf5386f7a4a8ddf6e3d646f1fa Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Thu, 3 Feb 2011 21:49:12 +0200 Subject: x11_common: fix for reconfig with pos/xineramascreen set vo_x11_create_vo_window() only called vo_x11_update_geometry() if no window position had been specified by -geometry or -xineramascreen, to avoid overwriting the specified position with values from the existing window. However window size should be initialized to the existing window here, and setting new window title for -use-filename-title is also done in vo_x11_update_geometry() (for whatever reason, it doesn't match what else that function does). Change the code in vo_x11_create_vo_window() to always call vo_x11_update_geometry() for size variable and window title updates, but add a flag that tells it not to update position variables. --- libvo/x11_common.c | 14 +++++++------- libvo/x11_common.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 596645662c..fa65e19870 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -769,7 +769,7 @@ static int check_resize(struct vo *vo) int old_w = vo->dwidth, old_h = vo->dheight; int old_x = vo->dx, old_y = vo->dy; int rc = 0; - vo_x11_update_geometry(vo); + vo_x11_update_geometry(vo, true); if (vo->dwidth != old_w || vo->dheight != old_h) rc |= VO_EVENT_RESIZE; if (vo->dx != old_x || vo->dy != old_y) @@ -1073,7 +1073,7 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y, StructureNotifyMask | KeyPressMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask); - vo_x11_update_geometry(vo); + vo_x11_update_geometry(vo, true); goto final; } if (x11->window == None) { @@ -1115,8 +1115,7 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y, ButtonPressMask | ButtonReleaseMask | ExposureMask); } if (opts->vo_ontop) vo_x11_setlayer(vo, x11->window, opts->vo_ontop); - if (!geometry_xy_changed) - vo_x11_update_geometry(vo); + vo_x11_update_geometry(vo, !geometry_xy_changed); vo_x11_nofs_sizepos(vo, vo->dx, vo->dy, width, height); if (!!vo_fs != !!(flags & VOFLAG_FULLSCREEN)) vo_x11_fullscreen(vo); @@ -1317,7 +1316,7 @@ static int vo_x11_get_fs_type(int supported) * \brief update vo->dx, vo->dy, vo->dwidth and vo->dheight with current values of vo->x11->window * \return returns current color depth of vo->x11->window */ -int vo_x11_update_geometry(struct vo *vo) +int vo_x11_update_geometry(struct vo *vo, bool update_pos) { struct MPOpts *opts = vo->opts; struct vo_x11_state *x11 = vo->x11; @@ -1330,8 +1329,9 @@ int vo_x11_update_geometry(struct vo *vo) vo->dwidth = w; vo->dheight = h; } - XTranslateCoordinates(x11->display, x11->window, x11->rootwin, 0, 0, - &vo->dx, &vo->dy, &dummy_win); + if (update_pos) + XTranslateCoordinates(x11->display, x11->window, x11->rootwin, 0, 0, + &vo->dx, &vo->dy, &dummy_win); if (opts->vo_wintitle) XStoreName(x11->display, x11->window, opts->vo_wintitle); diff --git a/libvo/x11_common.h b/libvo/x11_common.h index 824f55b4c8..32cffbb639 100644 --- a/libvo/x11_common.h +++ b/libvo/x11_common.h @@ -126,7 +126,7 @@ void vo_x11_sizehint(struct vo *vo, int x, int y, int width, int height, int max int vo_x11_check_events(struct vo *vo); void vo_x11_selectinput_witherr(Display *display, Window w, long event_mask); void vo_x11_fullscreen(struct vo *vo); -int vo_x11_update_geometry(struct vo *vo); +int vo_x11_update_geometry(struct vo *vo, bool update_pos); void vo_x11_setlayer(struct vo *vo, Window vo_window, int layer); void vo_x11_uninit(struct vo *vo); Colormap vo_x11_create_colormap(struct vo *vo, XVisualInfo *vinfo); @@ -186,7 +186,7 @@ void xscreensaver_heartbeat(struct vo_x11_state *x11); #ifdef IS_OLD_VO #define vo_x11_create_vo_window(...) vo_x11_create_vo_window(global_vo, __VA_ARGS__) #define vo_x11_fullscreen() vo_x11_fullscreen(global_vo) -#define vo_x11_update_geometry() vo_x11_update_geometry(global_vo) +#define vo_x11_update_geometry() vo_x11_update_geometry(global_vo, 1) #define vo_x11_ontop() vo_x11_ontop(global_vo) #define vo_init() vo_init(global_vo) #define vo_x11_ewmh_fullscreen(action) vo_x11_ewmh_fullscreen(global_vo->x11->display, action) -- cgit v1.2.3