Re: Simulating mouse input with gdk_event_put()?



On Sun, Jun 28, 2009 at 8:20 AM, Dan Kegel <dank kegel com> wrote:
I have figured out how to inject synthetic, or fake, keyboard events
using gdk_event_put(), but I'm having trouble generating mock
mouse events.  The function I'm trying to implement should take
the X and Y coordinates of the click relative to the app's window,
and generate a click sufficient to activate a button.

Somebody who faced the same problem replied:
"The main stumbling block was trying to find the GdkWindow at arbitrary
screen coordinate (x,y). We ended up punting and moving the pointer
with gdk_display_warp_pointer(), then finding the proper GdkWindow
with gdk_window_at_pointer(). Here is the code:

http://www.google.com/codesearch/p?hl=en&sa=N&cd=1&ct=rc#h0RrPvyPu-c/chrome/browser/automation/ui_controls_linux.cc

Disclaimer: there are probably inefficiencies in that code, but it
seems to be good enough for our purposes (automated testing)."

- Dan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]