After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 665637 - [patch] should use gdk_copy_event to copy events
[patch] should use gdk_copy_event to copy events
Status: RESOLVED OBSOLETE
Product: goocanvas
Classification: Other
Component: general
svn trunk
Other Linux
: Normal normal
: ---
Assigned To: goocanvas-maint
goocanvas-maint
Depends on:
Blocks:
 
 
Reported: 2011-12-05 23:08 UTC by Timo Kluck
Modified: 2021-05-17 13:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to use gdk_copy_event for copying an event (3.05 KB, patch)
2011-12-05 23:19 UTC, Timo Kluck
committed Details | Review

Description Timo Kluck 2011-12-05 23:08:45 UTC
The events passed for pointer events on items are copied by simply assigning structs instead of using gdk_event_copy. Because of this, a call to gdk_get_source_device(event) fails on these events. There's probably more similar gdk calls that won't work with these pointer events.

The attached patch fixes this.
Comment 1 Timo Kluck 2011-12-05 23:19:03 UTC
Created attachment 202884 [details] [review]
patch to use gdk_copy_event for copying an event
Comment 2 Murray Cumming 2011-12-27 11:11:20 UTC
Damien, may we push this to master?
Comment 3 Damon Chaplin 2012-01-04 10:28:53 UTC
Yes, that patch looks OK.

Do we need to worry about other places we create our own GdkEvent:
  update_pointer_item()/initialize_crossing_event()
  generate_grab_broken()
  goo_canvas_grab_focus()

The last 2 probably don't matter, but I'm not sure about the first one.
Why is gdk_get_source_device(event) needed?
Comment 4 Timo Kluck 2012-01-04 14:22:39 UTC
gdk_get_source_device tells you what device generated the event. I need it to differentiate between input from a wacom tablet and mouse input.

Personally, I would *always* use the dedicated copy function, because it also copies the private data. In fact, all gdk_event_* functions assume that the're actually dealing with a GdkEventPrivate struct, so they will read/write after the GdkEvent struct. This may be a security risk, especially since the new event is on the stack.

So it is very unsafe to not use gdk_event_copy. I would definitely recommend using it everywhere.
Comment 5 Damon Chaplin 2013-11-02 11:04:52 UTC
I've applied the patch.

It might be good to think about how to handle multiple mouse/keyboard devices at some point. I'm not sure how you're supposed to deal with grabs from multiple devices, or enter/leave notifies. It would be difficult to keep track of them all.
Comment 6 GNOME Infrastructure Team 2021-05-17 13:40:30 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/goocanvas/-/issues/29.