summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authormaniak1349 <maniak1349@gmail.com>2016-05-22 02:26:36 +0300
committerwm4 <wm4@nowhere>2016-05-22 14:31:37 +0200
commitc4e8c360719f6e716d1f437c08082022a3b6662f (patch)
tree895191a56fbb36b4c57c95c165534e09bcdd7357 /options
parent5a3c299ca1afcaf943576a144aad92716deb5cf9 (diff)
downloadmpv-c4e8c360719f6e716d1f437c08082022a3b6662f.tar.bz2
mpv-c4e8c360719f6e716d1f437c08082022a3b6662f.tar.xz
options: --geometry: center window position after applying size
Center window position after applying W and H parameters of the --geometry option. Passing valid X and Y values will still override the position. Fixes #2397.
Diffstat (limited to 'options')
-rw-r--r--options/m_option.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/options/m_option.c b/options/m_option.c
index 85bdf91cf4..b7b76634f8 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -2089,6 +2089,10 @@ void m_geometry_apply(int *xpos, int *ypos, int *widw, int *widh,
} else if (!(gm->w > 0) && gm->h > 0) {
*widw = *widh * asp;
}
+ // Center window after resize. If valid x:y values are passed to
+ // geometry, then those values will be overriden.
+ *xpos += prew / 2 - *widw / 2;
+ *ypos += preh / 2 - *widh / 2;
}
if (gm->xy_valid) {