x(v)imagesink: Don't create invalid GstNavigationModifierType by simply passing through X11 event states

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2931>
This commit is contained in:
Sebastian Dröge 2022-08-23 19:12:17 +03:00 committed by GStreamer Marge Bot
parent 0d72a6209c
commit 65b15f72b5
2 changed files with 18 additions and 10 deletions

View file

@ -730,7 +730,7 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
pointer_x, pointer_y);
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
gst_navigation_event_new_mouse_move (pointer_x, pointer_y,
e.xmotion.state));
e.xmotion.state & GST_NAVIGATION_MODIFIER_MASK));
g_mutex_lock (&ximagesink->flow_lock);
g_mutex_lock (&ximagesink->x_lock);
@ -756,14 +756,16 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
e.xbutton.button, e.xbutton.x, e.xbutton.x);
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
gst_navigation_event_new_mouse_button_press (e.xbutton.button,
e.xbutton.x, e.xbutton.y, e.xbutton.state));
e.xbutton.x, e.xbutton.y,
e.xbutton.state & GST_NAVIGATION_MODIFIER_MASK));
break;
case ButtonRelease:
GST_DEBUG ("ximagesink button %d release over window at %d,%d",
e.xbutton.button, e.xbutton.x, e.xbutton.x);
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
gst_navigation_event_new_mouse_button_release (e.xbutton.button,
e.xbutton.x, e.xbutton.y, e.xbutton.state));
e.xbutton.x, e.xbutton.y,
e.xbutton.state & GST_NAVIGATION_MODIFIER_MASK));
break;
case KeyPress:
case KeyRelease:
@ -788,8 +790,10 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
e.xkey.keycode, e.xkey.x, e.xkey.y, key_str);
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
(e.type == KeyPress) ?
gst_navigation_event_new_key_press (key_str, e.xkey.state) :
gst_navigation_event_new_key_release (key_str, e.xkey.state));
gst_navigation_event_new_key_press (key_str,
e.xkey.state & GST_NAVIGATION_MODIFIER_MASK) :
gst_navigation_event_new_key_release (key_str,
e.xkey.state & GST_NAVIGATION_MODIFIER_MASK));
break;
default:
GST_DEBUG_OBJECT (ximagesink, "ximagesink unhandled X event (%d)",

View file

@ -464,7 +464,7 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
pointer_x, pointer_y);
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
gst_navigation_event_new_mouse_move (e.xbutton.x, e.xbutton.y,
e.xbutton.state));
e.xbutton.state & GST_NAVIGATION_MODIFIER_MASK));
g_mutex_lock (&xvimagesink->flow_lock);
g_mutex_lock (&xvimagesink->context->lock);
@ -490,7 +490,8 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
e.xbutton.button, e.xbutton.x, e.xbutton.y);
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
gst_navigation_event_new_mouse_button_press (e.xbutton.button,
e.xbutton.x, e.xbutton.y, e.xbutton.state));
e.xbutton.x, e.xbutton.y,
e.xbutton.state & GST_NAVIGATION_MODIFIER_MASK));
break;
case ButtonRelease:
/* Mouse button released over our window. We send upstream
@ -499,7 +500,8 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
e.xbutton.button, e.xbutton.x, e.xbutton.y);
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
gst_navigation_event_new_mouse_button_release (e.xbutton.button,
e.xbutton.x, e.xbutton.y, e.xbutton.state));
e.xbutton.x, e.xbutton.y,
e.xbutton.state & GST_NAVIGATION_MODIFIER_MASK));
break;
case KeyPress:
case KeyRelease:
@ -524,8 +526,10 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
e.xkey.keycode, e.xkey.x, e.xkey.y, key_str);
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
(e.type == KeyPress) ?
gst_navigation_event_new_key_press (key_str, e.xkey.state) :
gst_navigation_event_new_key_release (key_str, e.xkey.state));
gst_navigation_event_new_key_press (key_str,
e.xkey.state & GST_NAVIGATION_MODIFIER_MASK) :
gst_navigation_event_new_key_release (key_str,
e.xkey.state & GST_NAVIGATION_MODIFIER_MASK));
break;
default:
GST_DEBUG_OBJECT (xvimagesink, "xvimagesink unhandled X event (%d)",