diff options
-rw-r--r-- | libvo/x11_common.c | 14 | ||||
-rw-r--r-- | libvo/x11_common.h | 12 |
2 files changed, 26 insertions, 0 deletions
diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 5f433f478e..9fcd4f3f05 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -757,6 +757,9 @@ void vo_x11_uninit(struct vo *vo) } vo_fs = 0; x11->vo_old_width = x11->vo_old_height = 0; + x11->last_video_width = 0; + x11->last_video_height = 0; + x11->size_changed_during_fs = false; } } @@ -882,6 +885,13 @@ static void vo_x11_nofs_sizepos(struct vo *vo, int x, int y, int width, int height) { struct vo_x11_state *x11 = vo->x11; + if (width == x11->last_video_width && height == x11->last_video_height) { + if (!vo->opts->force_window_position && !x11->size_changed_during_fs) + return; + } else if (vo_fs) + x11->size_changed_during_fs = true; + x11->last_video_height = height; + x11->last_video_width = width; vo_x11_sizehint(vo, x, y, width, height, 0); if (vo_fs) { x11->vo_old_x = x; @@ -1321,6 +1331,10 @@ void vo_x11_fullscreen(struct vo *vo) { vo_x11_ewmh_fullscreen(x11, _NET_WM_STATE_REMOVE); // removes fullscreen state if wm supports EWMH vo_fs = VO_FALSE; + if (x11->size_changed_during_fs && (x11->fs_type & vo_wm_FULLSCREEN)) + vo_x11_nofs_sizepos(vo, vo->dx, vo->dy, x11->last_video_width, + x11->last_video_height); + x11->size_changed_during_fs = false; } else { // win->fs diff --git a/libvo/x11_common.h b/libvo/x11_common.h index 6ae51f87c2..459bd07e20 100644 --- a/libvo/x11_common.h +++ b/libvo/x11_common.h @@ -20,6 +20,7 @@ #define MPLAYER_X11_COMMON_H #include <stdint.h> +#include <stdbool.h> #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -61,6 +62,17 @@ struct vo_x11_state { int vo_old_width; int vo_old_height; + /* Keep track of original video width/height to determine when to + * resize window when reconfiguring. Resize window when video size + * changes, but don't force window size changes as long as video size + * stays the same (even if that size is different from the current + * window size after the user modified the latter). */ + int last_video_width; + int last_video_height; + /* Video size changed during fullscreen when we couldn't tell the new + * size to the window manager. Must set window size when turning + * fullscreen off. */ + bool size_changed_during_fs; unsigned int olddecor; unsigned int oldfuncs; |