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 521098 - The mouse events are being passed on even returning true
The mouse events are being passed on even returning true
Status: RESOLVED OBSOLETE
Product: pyatspi2
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: At-spi maintainer(s)
At-spi maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2008-03-07 22:01 UTC by Flavio Percoco Premoli
Modified: 2021-07-05 12:36 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20


Attachments
This is the test script i was using (167 bytes, text/plain)
2008-03-07 22:03 UTC, Flavio Percoco Premoli
  Details
Proposed patch (5.82 KB, patch)
2008-06-03 19:53 UTC, Eitan Isaacson
none Details | Review
Updated test script (309 bytes, text/plain)
2008-06-05 11:47 UTC, Willie Walker
  Details
patch to return GDK_FILTER_REMOVE if we want to consume the event (9.01 KB, patch)
2008-06-19 11:01 UTC, Li Yuan
none Details | Review

Description Flavio Percoco Premoli 2008-03-07 22:01:51 UTC
Please describe the problem:
I'm writing an application and i need to be able to lock the mouse buttons events, so the are not passed on, but even using the consume flag the event is being passed on.

Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Flavio Percoco Premoli 2008-03-07 22:03:21 UTC
Created attachment 106812 [details]
This is the test script i was using

I hope this helps
Comment 2 Li Yuan 2008-03-19 08:34:32 UTC
From the registryd's code, if you want to consume the event, you have to register the listener by registerDeviceEventListener or registerKeystrokeListener. The event will not be consumed if you register the listener by registerGlobalEventListener(registerEventListener in pyatspi). I think we need registerDeviceEventListener to consume the mouse event, but I don't find it in pyatspi. I could be wrong, is it a RFE for pyatspi?
Comment 3 Flavio Percoco Premoli 2008-03-19 09:58:54 UTC
Indeed it isn't there, i did a grep in the pyatspi code and there is no registerDeviceEventListener function:

grep "registerDeviceEventListener" pyatspi/ -R | grep .py

there was no match with the previous command.

I'll look how registerGlobalEventListener was created in registyr.py was created and i'll try to create the registerDeviceEventListener...

What else should we look for??
Comment 4 Li Yuan 2008-03-19 11:09:22 UTC
You can check at-spi/idl/Accessibility_Registry.idl to see what is missed and useful for pyatspi.
Comment 5 Flavio Percoco Premoli 2008-03-24 10:01:31 UTC
i checked what you suggested and i saw the function there. I thought registerDeviceEventListener didn't exist.

I think that we just need to add it to pyatspi...

Comment 6 Flavio Percoco Premoli 2008-04-07 23:54:48 UTC
Just wanted to know if there where some news about this bug?
Comment 7 Eitan Isaacson 2008-06-03 19:53:30 UTC
Created attachment 112077 [details] [review]
Proposed patch

This patch adds the device event register/deregister methods.
I don't think this is going to solve your original problem, since I don't think it is possible to consume device events (besides keyboard events).
registerKeystrokeListener takes an EventListenerMode
registerDeviceEventListener does not.
Comment 8 Willie Walker 2008-06-05 11:47:02 UTC
Created attachment 112205 [details]
Updated test script

This test script uses the new registerDeviceEventListener method.  It gets the events, but doesn't consume them.  I dug through the at-spi registryd code and it seems like it looks for the consumption, but I'm not sure it handles it.

Li, do you have any insight?
Comment 9 Gerd Kohlberger 2008-06-08 07:00:19 UTC
cspi has the same problem. The api docs for AccessibleDeviceListenerCB () state that it's possible to preempt events by returning True in the callback, but the return value has no effect. This would be very useful to implement sticky mouse buttons.
Comment 10 Li Yuan 2008-06-19 09:14:56 UTC
(In reply to comment #7)
> Created an attachment (id=112077) [edit]
> Proposed patch
> 
> This patch adds the device event register/deregister methods.
> I don't think this is going to solve your original problem, since I don't think
> it is possible to consume device events (besides keyboard events).
> registerKeystrokeListener takes an EventListenerMode
> registerDeviceEventListener does not.
> 

If a DeviceEventListener return TRUE, at-spi-registryd should consume the event.
Comment 11 Flavio Percoco Premoli 2008-06-19 10:59:53 UTC
(In reply to comment #10)
> 
> If a DeviceEventListener return TRUE, at-spi-registryd should consume the
> event.
> 

Indeed but the thing is that it doesn't consume the event, I've looked into the code but i can't figure out what's happening

I've tried using the event.consume = True or return True and none of them work.

Hope this helps

cheers

Comment 12 Li Yuan 2008-06-19 11:01:39 UTC
Created attachment 113036 [details] [review]
patch to return GDK_FILTER_REMOVE if we want to consume the event

If ran two copies of Will's script at the same time, the second one can not receive the events, it is "consumed" by the first script. But the GUI can still receive the events. This means at-spi-registryd will not emit the consumed event to other listeners. I guess this is not enough, we need to consume the event in the hole desktop. I made a patch to return GDK_FILTER_REMOVE if the event is consumed to let GDK remove the event, but seems it doesn't work because the GUI application receive the event almost at the same time (at least before the return of the event listener function in at-spi-registryd), so I don't have a good solution to consume the event in the hole desktop. Is there a function in X can do this? (It is not easy because the GUI listeners will be called before the listener in at-spi-registryd returns)
Comment 13 Willie Walker 2008-06-19 13:22:52 UTC
It may be that the functionality requires XEvIE in order to be able to intercept and consume mouse button events.  As such, this problem might be a very difficult one to solve since XEvIE is not reliably deployed on all platforms.

Flavio, can you describe the particular use case some more?  For example, what is the user interaction model you are working to achieve?
Comment 14 Flavio Percoco Premoli 2008-06-21 09:24:40 UTC
(In reply to comment #13)
> It may be that the functionality requires XEvIE in order to be able to
> intercept and consume mouse button events.  As such, this problem might be a
> very difficult one to solve since XEvIE is not reliably deployed on all
> platforms.

Indeed it seems kind of difficult to implement.

> 
> Flavio, can you describe the particular use case some more?  For example, what
> is the user interaction model you are working to achieve?
> 

Well, In that moment I was thinking to create a mouse modifier key and so i needed to consume the mouse button[1-5] (depending on the user settings) to execute the application actions.
Comment 15 André Klapper 2012-02-26 10:44:50 UTC
[Resetting QA Contact to newly introduced "at-spi-maint@gnome.bugs". 
Reason: So far it was impossible to watch changes in at-spi bug reports without following all the specific persons (Li Yuan, Bill Haneman, Jeff Wai, ...) and also their activity outside of at-spi reports.

IMPORTANT: Anyone interested in following all bug activity (including all maintainers) must watch the "at-spi-maint@gnome.bugs" dummy user by adding it to the 'Users to watch' list under Preferences->Email preferences. This is also the default procedure nowadays in GNOME when setting up new products.]
Comment 16 André Klapper 2013-08-14 10:08:15 UTC
[Mass-resetting default assignee, see bug 705890. Please reclaim this bug report by setting the assignee to yourself if you still plan to work on this. Thanks!]
Comment 17 GNOME Infrastructure Team 2021-07-05 12:36:46 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/pyatspi2/-/issues/

Thank you for your understanding and your help.