mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
gl/window/x11: handle_events() may be called before the window has been created
Fixes an XIO fatal error
This commit is contained in:
parent
cd2669fad1
commit
e2adfb8bf2
1 changed files with 16 additions and 7 deletions
|
@ -61,6 +61,8 @@ struct _GstGLWindowX11Private
|
|||
|
||||
gint preferred_width;
|
||||
gint preferred_height;
|
||||
|
||||
gboolean handle_events;
|
||||
};
|
||||
|
||||
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->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);
|
||||
|
||||
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);
|
||||
|
||||
if (handle_events) {
|
||||
XSelectInput (window_x11->device, window_x11->internal_win_id,
|
||||
StructureNotifyMask | ExposureMask | VisibilityChangeMask |
|
||||
PointerMotionMask | KeyPressMask | KeyReleaseMask);
|
||||
} else {
|
||||
XSelectInput (window_x11->device, window_x11->internal_win_id,
|
||||
StructureNotifyMask | ExposureMask | VisibilityChangeMask);
|
||||
window_x11->priv->handle_events = handle_events;
|
||||
|
||||
if (window_x11->internal_win_id) {
|
||||
if (handle_events) {
|
||||
XSelectInput (window_x11->device, window_x11->internal_win_id,
|
||||
StructureNotifyMask | ExposureMask | VisibilityChangeMask |
|
||||
PointerMotionMask | KeyPressMask | KeyReleaseMask);
|
||||
} else {
|
||||
XSelectInput (window_x11->device, window_x11->internal_win_id,
|
||||
StructureNotifyMask | ExposureMask | VisibilityChangeMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue