Skip to content

Commit

Permalink
ximagesink, xvimagesink: fix incorrect type conversion of pointer pos…
Browse files Browse the repository at this point in the history
…ition

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
  • Loading branch information
mita authored and tp-m committed Dec 8, 2017
1 parent 32eae2b commit 6e770e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sys/ximage/ximagesink.c
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion sys/xvimage/xvimagesink.c
Expand Up @@ -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;

Expand Down

0 comments on commit 6e770e0

Please sign in to comment.