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.
This commit is contained in:
Uoti Urpala 2011-02-03 21:49:12 +02:00
parent c24d4e9ec2
commit 106c5f9989
2 changed files with 9 additions and 9 deletions

View File

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

View File

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