summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--video/out/x11_common.c16
-rw-r--r--video/out/x11_common.h5
2 files changed, 18 insertions, 3 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 24dce5f27c..ab700be5e0 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -925,6 +925,7 @@ int vo_x11_check_events(struct vo *vo)
if (x11->window_hidden)
vo_x11_clearwindow(vo, x11->window);
x11->window_hidden = false;
+ x11->pseudo_mapped = true;
vo_x11_update_geometry(vo);
break;
case DestroyNotify:
@@ -941,6 +942,13 @@ int vo_x11_check_events(struct vo *vo)
case SelectionNotify:
vo_x11_dnd_handle_selection(vo, &Event.xselection);
break;
+ case PropertyNotify:
+ if (Event.xproperty.atom == x11->atom_frame_exts) {
+ if (!x11->pseudo_mapped)
+ MP_VERBOSE(x11, "not waiting for MapNotify\n");
+ x11->pseudo_mapped = true;
+ }
+ break;
default:
if (Event.type == x11->ShmCompletionEvent) {
if (x11->ShmCompletionWaitCount > 0)
@@ -1212,6 +1220,8 @@ static void vo_x11_create_window(struct vo *vo, XVisualInfo *vis,
vo_x11_set_wm_icon(x11);
vo_x11_update_window_title(vo);
vo_x11_dnd_init_window(vo);
+
+ x11->atom_frame_exts = XA(x11, _NET_FRAME_EXTENTS);
}
static void vo_x11_map_window(struct vo *vo, struct mp_rect rc)
@@ -1244,7 +1254,7 @@ static void vo_x11_map_window(struct vo *vo, struct mp_rect rc)
}
// map window
- int events = StructureNotifyMask | ExposureMask;
+ int events = StructureNotifyMask | ExposureMask | PropertyChangeMask;
if (vo->opts->WinID > 0) {
XWindowAttributes attribs;
if (XGetWindowAttributes(x11->display, vo->opts->WinID, &attribs))
@@ -1285,7 +1295,9 @@ static void vo_x11_highlevel_resize(struct vo *vo, struct mp_rect rc)
static void wait_until_mapped(struct vo *vo)
{
struct vo_x11_state *x11 = vo->x11;
- while (x11->window_hidden && x11->window) {
+ if (!x11->pseudo_mapped)
+ x11_send_ewmh_msg(x11, "_NET_REQUEST_FRAME_EXTENTS", (long[5]){0});
+ while (!x11->pseudo_mapped && x11->window) {
XEvent unused;
XPeekEvent(x11->display, &unused);
vo_x11_check_events(vo);
diff --git a/video/out/x11_common.h b/video/out/x11_common.h
index f41654c455..696e73aff3 100644
--- a/video/out/x11_common.h
+++ b/video/out/x11_common.h
@@ -65,7 +65,8 @@ struct vo_x11_state {
Colormap colormap;
int wm_type;
- bool window_hidden;
+ bool window_hidden; // the window was mapped at least once
+ bool pseudo_mapped; // not necessarily mapped, but known window size
int fs; // whether we assume the window is in fullscreen mode
bool mouse_cursor_hidden;
@@ -106,6 +107,8 @@ struct vo_x11_state {
Atom dnd_requested_format;
Window dnd_src_window;
+ Atom atom_frame_exts;
+
/* dragging the window */
bool win_drag_button1_down;
};