summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-19 00:08:42 +0200
committerwm4 <wm4@nowhere>2014-05-19 01:07:10 +0200
commit821f37db62f9f715e8d68bd87972e0942f76f622 (patch)
treeef8d71d98fef20f1ba9ad13fd9adf16522a4f73c
parent2c012e9eb2fc80d37e0c4dd5dfd427ae154bba13 (diff)
downloadmpv-821f37db62f9f715e8d68bd87972e0942f76f622.tar.bz2
mpv-821f37db62f9f715e8d68bd87972e0942f76f622.tar.xz
x11: request and handle resize events of parent windows with --wid
Before this commit, this was somehow polled (i.e. not the right way). Also, selects the correct window when doing --wid=0 (which is another weird special-case).
-rw-r--r--video/out/x11_common.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 4cf4299972..e9d325c0db 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -785,8 +785,6 @@ int vo_x11_check_events(struct vo *vo)
xscreensaver_heartbeat(vo->x11);
- if (vo->opts->WinID > 0)
- vo_x11_update_geometry(vo);
while (XPending(display)) {
XNextEvent(display, &Event);
switch (Event.type) {
@@ -797,6 +795,11 @@ int vo_x11_check_events(struct vo *vo)
if (x11->window == None)
break;
vo_x11_update_geometry(vo);
+ if (Event.xconfigure.window == vo->opts->WinID) {
+ XMoveResizeWindow(x11->display, x11->window,
+ x11->winrc.x0, x11->winrc.y0,
+ RC_W(x11->winrc), RC_H(x11->winrc));
+ }
break;
case KeyPress: {
char buf[100];
@@ -900,10 +903,6 @@ int vo_x11_check_events(struct vo *vo)
}
update_vo_size(vo);
- if (vo->opts->WinID >= 0 && (x11->pending_vo_events & VO_EVENT_RESIZE)) {
- XMoveResizeWindow(x11->display, x11->window, x11->winrc.x0, x11->winrc.y0,
- RC_W(x11->winrc), RC_H(x11->winrc));
- }
int ret = x11->pending_vo_events;
x11->pending_vo_events = 0;
return ret;
@@ -1265,9 +1264,12 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int flags,
struct mp_rect rc = geo.win;
if (opts->WinID >= 0) {
- if (opts->WinID == 0)
+ if (opts->WinID == 0) {
x11->window = x11->rootwin;
- XSelectInput(x11->display, opts->WinID, StructureNotifyMask);
+ XSelectInput(x11->display, x11->window, StructureNotifyMask);
+ } else {
+ XSelectInput(x11->display, opts->WinID, StructureNotifyMask);
+ }
vo_x11_update_geometry(vo);
rc = x11->winrc;
}