summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-17 14:26:49 +0200
committerwm4 <wm4@nowhere>2014-05-17 14:26:49 +0200
commit5a1bf2552371ec030f6c219905da5e14f4e2e6dc (patch)
tree3edb84618e6eca7482ac22e7d0450bc00f49b030
parent0e579f84394169e82bb88aa9b608f8d5b2fb21d2 (diff)
downloadmpv-5a1bf2552371ec030f6c219905da5e14f4e2e6dc.tar.bz2
mpv-5a1bf2552371ec030f6c219905da5e14f4e2e6dc.tar.xz
x11: comment about gravity
The window "gravity" influences how placement interacts with WM added borders (i.e. from decorations). This is probably what the code removed in commit c14721c8 was about. In theory, we'd probably want to set the gravity depending on the relative placement requested by the user (so that it's possible to line up the top/left video pixel with the monitor corner, as well as the bottom/right pixel - but that would be too complicated, and who cares after all?). I'm also not sure whether CenterGravity really uses the top/left corner as reference point (instead of making coordinates relative to the window center), but empirically it's correct.
-rw-r--r--video/out/x11_common.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index b747724b45..bf5113f2de 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -933,8 +933,12 @@ static void vo_x11_sizehint(struct vo *vo, struct mp_rect rc, bool override_pos)
hint->flags |= PMinSize;
hint->min_width = hint->min_height = 4;
+ // This will use the top/left corner of the window for positioning, instead
+ // of the top/left corner of the client. _NET_MOVERESIZE_WINDOW could be
+ // used to get a different reference point, while keeping gravity.
hint->flags |= PWinGravity;
hint->win_gravity = CenterGravity;
+
XSetWMNormalHints(x11->display, x11->window, hint);
XFree(hint);
}