coleshan / autokey

Automatically exported from code.google.com/p/autokey
0 stars 0 forks source link

Feature request: mouse event relative to current mouse position #133

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Some times one needs a mouse event relative to current mouse position - not the 
one relative to current window or an absolute position. For example - when one 
chooses a mouse-3 menu item. Here's the way to implement it using 
mouse.absolute:

from Xlib import display
c = display.Display().screen().root.query_pointer()._data
x = c["root_x"]
y = c["root_y"]

'x' and 'y' are current mouse position. One can then use relative position (to 
the current one - not to the top of the current window) using:

mouse.click_absolute(x + offset_x,y + offset_y, button)

Original issue reported on code.google.com by kheyfbo...@gmail.com on 12 Aug 2011 at 6:37

GoogleCodeExporter commented 8 years ago

Original comment by cdekter on 11 Sep 2011 at 7:15

GoogleCodeExporter commented 8 years ago
Implemented for v0.80.0

Original comment by cdekter on 12 Sep 2011 at 4:11