Re: [g-a-devel] how could one read mouse x,y coordinates?



В Вск, 05/08/2007 в 14:37 +0300, Marius Andreiana пишет:
> Hi,
> 
> With atspi I'd like to generate a mouse click, how I haven't found how
> to read current x,y. I want to pass them to SPI_generateMouseEvent() 
> 
> I don't want to use AccessibleAction_doAction() as click should work
> exactly as one would have pressed mouse button (on a window which
> doesn't have focus, on a gimp canvas etc.)
> I also don't want to listed to all events and update mouse x,y if it's a
> mouse move.
> 
> How to do read mouse x,y coordinates? Is gdk_display_get_pointer() the
> only solution?

Well, as a generic advice on action implementation it's very useful to
look at gok code. For example:

              int x, y, win_x,
win_y;                                         
                Window root_ret,
child_ret;                                     
                unsigned int
mask_ret;                                          
                GtkWidget
*window;                                              
                char
ename[12];                                                 
                snprintf (ename, 12, "b%d%c", button, (state) ? 'p' :
'r');     
                window = gok_main_get_main_window
();                           
                XQueryPointer (GDK_WINDOW_XDISPLAY
(window->window),            
                               GDK_WINDOW_XWINDOW
(window->window),             
                               &root_ret, &child_ret, &x,
&y,                   
                               &win_x, &win_y,
&mask_ret);                      
                SPI_generateMouseEvent (x, y, ename); 

So gdk_display_get_pointer() should be perfectly fine. Other mouse code
gok-mousecontrol.c should be useful too since it would be nice to
implement mouse movement as well.

Btw, Marius, do you think there is sense to create gnome-voice-control
specific mailing list to avoid spreading of discussion over many places.
I can setup one on berlios for example and we'll subscribe David and
others interested.





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