summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2017-12-03 02:10:40 +0900
committerTim-Philipp Müller <tim@centricular.com>2017-12-08 00:48:16 +0000
commit6e770e0ebbc9b36fa06a9a3a7b485ee1e8ea97e5 (patch)
tree3b7b6b720175fa155e02b6a25d5c64b2ac09a9b7 /sys
parent32eae2b166064f134ef0ac6bcda65e5cd41b4efb (diff)
downloadgst-plugins-base-6e770e0ebbc9b36fa06a9a3a7b485ee1e8ea97e5.tar.gz
gst-plugins-base-6e770e0ebbc9b36fa06a9a3a7b485ee1e8ea97e5.tar.xz
ximagesink, xvimagesink: fix incorrect type conversion of pointer position
I'm currently playing with modified ximagesink that does XGrabPointer() in order to receive the mouse events occurred outside of the window and send them to the navigation interface. The pointer positions usually have positive coordinates, but it could be negative with that change. When the ximagesink handles XEvent that contains a negative pointer coordinate, it incorrectly generates the GstEvent that contains an extremely large positive pointer coordinate. This is because the negative pointer position in XEvent is incorrectly converted from signed to unsigned and passed as an argument to gst_navigation_send_mouse_event() which causes implicit conversion from integer to double. So the pointer position in the received XEvent and generated GstEvent are completely different. This potential problem does not seem to be a real problem with unmodified ximagesink but there is no reason to leave it as is. This also fixes xvimagesink that has the same potential problem. https://bugzilla.gnome.org/show_bug.cgi?id=791140
Diffstat (limited to 'sys')
-rw-r--r--sys/ximage/ximagesink.c2
-rw-r--r--sys/xvimage/xvimagesink.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c
index 9176ca69d..e9615a294 100644
--- a/sys/ximage/ximagesink.c
+++ b/sys/ximage/ximagesink.c
@@ -558,7 +558,7 @@ static void
gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
{
XEvent e;
- guint pointer_x = 0, pointer_y = 0;
+ gint pointer_x = 0, pointer_y = 0;
gboolean pointer_moved = FALSE;
gboolean exposed = FALSE, configured = FALSE;
diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c
index 4ca0c1135..72ff5745e 100644
--- a/sys/xvimage/xvimagesink.c
+++ b/sys/xvimage/xvimagesink.c
@@ -407,7 +407,7 @@ static void
gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
{
XEvent e;
- guint pointer_x = 0, pointer_y = 0;
+ gint pointer_x = 0, pointer_y = 0;
gboolean pointer_moved = FALSE;
gboolean exposed = FALSE, configured = FALSE;