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 142943 - Tablet (extended input) event propagation limitations on win32 (tablet pointer becomes core pointer)
Tablet (extended input) event propagation limitations on win32 (tablet pointe...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.4.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2004-05-21 22:03 UTC by Robert Ögren
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for extended input event propagation and grabbing in win32 port of GTK+ (10.51 KB, patch)
2004-05-21 22:19 UTC, Robert Ögren
none Details | Review

Description Robert Ögren 2004-05-21 22:03:30 UTC
The code for propagating events from extended input devices (tablets) in the
Win32 port of GTK+ 2.4 contains several deficiencies. This can be observed in
The GIMP 2.0.1 when moving the tablet pointer over the buttons in the main
window, which causes it to switch to the core pointer instead.  This is also
mentioned in bug #115774, but since that bug is for the X11 port of GTK+ and
the problems described here are in win32-specific code I felt it was best to
open a new bug report.  The problems and solutions I describe here apply to
GTK+ 2.4, more specifically the gtk-2-4 branch updated today from anoncvs,
after my patch from bug #138341 has been applied and with the --use-wintab
option set when running. The problems occur using a Wacom Graphire 3 USB tablet,
though this should apply to all extended input devices that use the wintab
interface.

The problems in the GIMP is caused by the following limitations in GTK+:

- There is a bug in gdk/win32/gdkinput-win32.c in the tablet event propagation
  loop in _gdk_input_other_event(), where it does not update the "impl" variable
  after changing to the parent window object. This prevents tablet events from
  being propagated to the parent window when the button doesn't want it.

- The event propagation code in gdk/win32/gdkevents-win32.c should check if an
  extended input device is active (_gdk_input_ignore_core) and if a window
  wants extended events, normal mouse events should not be sent. This is done,
  but only for the original window that got the message. The propagation code in
  the "propagate" function does not check if the parent or grabber wants
  extended events. This causes mouse (core pointer) move events to be sent to
  the main GIMP window which then switches to the core pointer device even
  though that window wants input from extended devices.

If the two problems above are fixed, GIMP no longer switches to the core
pointer when the tablet cursor is over the buttons. However, if the tablet
pointer is moved over the main menu items (without clicking), GIMP frequently
switches between core pointer and tablet cursor as the tablet pointer is moved.
This is because the tablet event propagation code in gdkinput-win32.c doesn't
check if a window wants ordinary events before propagating events to parents.
This means that the menu item will get the ordinary mouse event, and the tablet
events will be sent to its parents until they reach the window. This should
probably be fixed so that tablet events are not propagated past a window that
wants ordinary events.

Finally, the gdkinput-win32.c code does not handle grabbing of the extended
devices, which makes it hard to use the tablet to for example draw near the
edges of a window. This might be considered a separate bug, but it is
closely related to the event propagation code and therefore I initially
report it here, as my prosed fix also tries to address that problem.

I have made an attempt to fix all the things mentioned above. A first version
of a patch will be attached shortly. It is not perfect though, and comments
and suggestions on how this should work are welcome. If I've totally 
misunderstood how the event propagation is supposed to work, feel free to hit me
with the cluestick :)
Comment 1 Robert Ögren 2004-05-21 22:19:14 UTC
Created attachment 27916 [details] [review]
Patch for extended input event propagation and grabbing in win32 port of GTK+

Here's a patch that I wrote to try to adress these problems. It is not perfect,
in particular the grabbing code does not handle all parameters that can be
passed to *grab_input, but it solves the problems I observed. I have only
tested it on my system with The GIMP 2.0.1. As I said earlier, comments and
suggestions are highly appreciated.
Comment 2 Tor Lillqvist 2004-05-22 05:08:50 UTC
Again, wow and thanks! Will apply as soon as possible.
Comment 3 Tor Lillqvist 2004-05-24 22:37:31 UTC
Patch applied. (Slight modification: I dropped the parallel "impl" pointer in 
_gdk_input_other_event(), and just use a cast on obj->impl. Please check I got 
it OK.)
Comment 4 Robert Ögren 2004-05-25 18:59:36 UTC
It works fine for me. Thanks for cleaning it up.