gl/window/x11: handle_events() may be called before the window has been created

Fixes an XIO fatal error
This commit is contained in:
Matthew Waters 2015-06-12 00:30:58 +10:00 committed by Tim-Philipp Müller
parent dffa2857d7
commit e37cf3c55f

View file

@ -61,6 +61,8 @@ struct _GstGLWindowX11Private
gint preferred_width; gint preferred_width;
gint preferred_height; gint preferred_height;
gboolean handle_events;
}; };
guintptr gst_gl_window_x11_get_display (GstGLWindow * window); guintptr gst_gl_window_x11_get_display (GstGLWindow * window);
@ -236,6 +238,9 @@ gst_gl_window_x11_create_window (GstGLWindowX11 * window_x11)
window_x11->visual_info->depth, InputOutput, window_x11->visual_info->depth, InputOutput,
window_x11->visual_info->visual, mask, &win_attr); window_x11->visual_info->visual, mask, &win_attr);
gst_gl_window_x11_handle_events (GST_GL_WINDOW (window_x11),
window_x11->priv->handle_events);
XSync (window_x11->device, FALSE); XSync (window_x11->device, FALSE);
XSetWindowBackgroundPixmap (window_x11->device, XSetWindowBackgroundPixmap (window_x11->device,
@ -490,13 +495,17 @@ gst_gl_window_x11_handle_events (GstGLWindow * window, gboolean handle_events)
window_x11 = GST_GL_WINDOW_X11 (window); window_x11 = GST_GL_WINDOW_X11 (window);
if (handle_events) { window_x11->priv->handle_events = handle_events;
XSelectInput (window_x11->device, window_x11->internal_win_id,
StructureNotifyMask | ExposureMask | VisibilityChangeMask | if (window_x11->internal_win_id) {
PointerMotionMask | KeyPressMask | KeyReleaseMask); if (handle_events) {
} else { XSelectInput (window_x11->device, window_x11->internal_win_id,
XSelectInput (window_x11->device, window_x11->internal_win_id, StructureNotifyMask | ExposureMask | VisibilityChangeMask |
StructureNotifyMask | ExposureMask | VisibilityChangeMask); PointerMotionMask | KeyPressMask | KeyReleaseMask);
} else {
XSelectInput (window_x11->device, window_x11->internal_win_id,
StructureNotifyMask | ExposureMask | VisibilityChangeMask);
}
} }
} }