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 680174 - Add clutter_event_is_pointer_emulated() to distinguish emulated scroll events
Add clutter_event_is_pointer_emulated() to distinguish emulated scroll events
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: x11
git master
Other Linux
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2012-07-18 14:22 UTC by Emanuele Aina
Modified: 2012-07-20 02:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
event: Expose is-pointer-emulated flag (2.58 KB, patch)
2012-07-18 14:54 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review
Testcase for clutter_event_is_pointer_emulated() (1.52 KB, text/plain)
2012-07-18 15:41 UTC, Emanuele Aina
  Details
event: Copy the is-pointer-emulated flag (832 bytes, patch)
2012-07-18 16:43 UTC, Emanuele Aina
committed Details | Review

Description Emanuele Aina 2012-07-18 14:22:23 UTC
I'd like to react to scroll events in my actor:

* if xinput is enabled I handle CLUTTER_SCROLL_SMOOTH events and discard the other CLUTTER_SCROLL_* 
  events that the xserver generates for compatibility, otherwise I would scroll too much

* if xinput is not enabled I should handle the non-SMOOTH events, as the SMOOTH one would not be sent

Given that xinput may or may be not enabled by the caller and it's outside of my control, I'd like to distinguish events with the pointer-emulated flag that Clutter already stores but does not expose.
Comment 1 Emmanuele Bassi (:ebassi) 2012-07-18 14:54:39 UTC
Created attachment 219130 [details] [review]
event: Expose is-pointer-emulated flag

Clutter on X11 already stores this flag to distinguish between events
that have been synthesized by the X server and real events.
Comment 2 Emanuele Aina 2012-07-18 15:41:02 UTC
Created attachment 219131 [details]
Testcase for clutter_event_is_pointer_emulated() 

If I run the attached testcase with `./scroll --enable-xinput' the emulated flag is always unset:

SCROLL (direction:smooth t:131807897 emulated:no dx:0,00 dy:0,00)
SCROLL (direction:down t:131807897 emulated:no)
SCROLL (direction:smooth t:131808410 emulated:no dx:0,00 dy:-1,00)
SCROLL (direction:up t:131808410 emulated:no)
SCROLL (direction:smooth t:131808866 emulated:no dx:0,00 dy:1,00)
SCROLL (direction:down t:131808866 emulated:no)
SCROLL (direction:smooth t:131809354 emulated:no dx:0,00 dy:-1,00)
Comment 3 Emanuele Aina 2012-07-18 16:21:30 UTC
It turns out that clutter_event_copy() does not copy the `is_pointer_emulated' field.

Adding the following line at clutter-event.c:1144 seems to fix the issue:
new_real_event->is_pointer_emulated = real_event->is_pointer_emulated;

The `platform_data' field is also missing from clutter_event_copy(). Should it be added too?
Comment 4 Emanuele Aina 2012-07-18 16:43:59 UTC
Created attachment 219139 [details] [review]
event: Copy the is-pointer-emulated flag

Patch clutter_event_copy() to copy the is-pointer-emulated flag.
Comment 5 Emmanuele Bassi (:ebassi) 2012-07-20 02:00:15 UTC
pushed to master