GNOME Bugzilla – Bug 680174
Add clutter_event_is_pointer_emulated() to distinguish emulated scroll events
Last modified: 2012-07-20 02:00:20 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.
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.
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)
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?
Created attachment 219139 [details] [review] event: Copy the is-pointer-emulated flag Patch clutter_event_copy() to copy the is-pointer-emulated flag.
pushed to master