summaryrefslogtreecommitdiffstats
path: root/video/out/x11_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/x11_common.c')
-rw-r--r--video/out/x11_common.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index e9389c5f38..9da95ab200 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -1242,11 +1242,16 @@ static void vo_x11_map_window(struct vo *vo, struct mp_rect rc)
}
// map window
- vo_x11_selectinput_witherr(vo, x11->display, x11->window,
- StructureNotifyMask | ExposureMask |
- KeyPressMask | KeyReleaseMask |
- ButtonPressMask | ButtonReleaseMask |
- PointerMotionMask | LeaveWindowMask);
+ int events = StructureNotifyMask | ExposureMask;
+ if (vo->opts->WinID > 0) {
+ XWindowAttributes attribs;
+ if (XGetWindowAttributes(x11->display, vo->opts->WinID, &attribs))
+ events |= attribs.your_event_mask;
+ } else {
+ events |= KeyPressMask | KeyReleaseMask | ButtonPressMask |
+ ButtonReleaseMask | PointerMotionMask | LeaveWindowMask;
+ }
+ vo_x11_selectinput_witherr(vo, x11->display, x11->window, events);
XMapWindow(x11->display, x11->window);
}