Re: Send mouse button press event to widget??
- From: David Nečas (Yeti) <yeti physics muni cz>
- To: gtk-app-devel-list gnome org
- Subject: Re: Send mouse button press event to widget??
- Date: Thu, 30 Aug 2007 20:52:09 +0200
On Thu, Aug 30, 2007 at 05:24:21AM -0700, eminemence wrote:
I am creating a virtual cursor on a web page and want to simulate the left
click of the mouse button
when the user presses the enter button.
So I tried even using the gdk_event_put on the global window itself,assuming
the event would find it's
way to the control under the cursor.
The gdk_event_put has not been successful,so what is the way to achieve
this?
I don't recall a working example now (the Gtk+ source code
has some though), but:
- create the event with gdk_event_new()
- fill the fields
- cursor position (in GdkWindow coordinates) can be obtained
with gdk_window_get_pointer()
- window fields have to be g_object_ref()ed IIRC as
something unrefs them later
- send_event should be TRUE
- other information can be obtained from the original
event or other means
- send the event with gtk_widget_event()
- free event
- remember if you send a button presses and no button
releases, widgets can get confused
Yeti
--
http://gwyddion.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]