x(v)imagesink: Don't create invalid GstNavigationModifierType by simply passing throu...
authorSebastian Dröge <sebastian@centricular.com>
Tue, 23 Aug 2022 16:12:17 +0000 (19:12 +0300)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 25 Aug 2022 14:57:22 +0000 (14:57 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2931>

subprojects/gst-plugins-base/sys/ximage/ximagesink.c
subprojects/gst-plugins-base/sys/xvimage/xvimagesink.c

index e885b724b2ed4cc5bd4a3388b732061d86409774..6b1b4879237ebbf4f95cbfd42ac2a263c835becf 100644 (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)",
index 7f98f0a36a0ac84663fead9f7ab2698b64269c3e..e9fcb6cfc7a655fe28b515a656a9f58d4c6e704f 100644 (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)",