summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-07-23 03:30:44 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-07-23 03:38:40 +0300
commit7a669a64073839a0d014f20a691014e332faaf69 (patch)
tree902d9faa1381aaeb992ace2a75b8d4626328212a /libvo
parent8362ad36ac2ee8dc452765a9de559b50927d14be (diff)
downloadmpv-7a669a64073839a0d014f20a691014e332faaf69.tar.bz2
mpv-7a669a64073839a0d014f20a691014e332faaf69.tar.xz
vo: improve fixed-vo behavior when video size changes in x11 VOs
Now the window is only resized when video size (or size specified by -geometry) changes; reconfiguring the window with the same size no longer changes back to default size from possibly user-modified one. Also fix a bug in fullscreen handling that could cause incorrect window size when turning fullscreen off.
Diffstat (limited to 'libvo')
-rw-r--r--libvo/x11_common.c14
-rw-r--r--libvo/x11_common.h12
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;