Re: How to get information about focus from other then my application?



On Mon, 3 Jan 2005 06:00:55 +0100
"zielone" <zielone0 poczta onet pl> wrote:

Hi all

I need to know which application and which widget in this application
have focus before my application have been activated, how can i do
it?? I want to send text to this widget from my application, I try to
use atk_add_global_event_listener, gdk_window_add_filter and also
at-spi library but without succeed, 

in your gtk app you should request X11 to send your Focus information 
XSelectInput(GDK_DISPLAY(), GDK_ROOT_WINDOW(), FocusChangeMask);

install handler
gdk_window_add_filter(gdk_get_default_root_window (), (GdkFilterFunc)event_filter, data);


static GdkFilterReturn
event_filter(GdkXEvent *xevent, GdkEvent *event, Panel *p)
{
    XEvent *ev = (XEvent *) xevent;
    Window win;
    int type;
    
    if (ev->type == FocusIn || ev->type == FocusOut) {
        XGetInputFocus(GDK_DISPLAY(), &win, &type);
        //do some thing else
    } 
}

I think this code will help you :-)
-- 
Regards, Anatoly



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