How to set focus to another application?

shaheed srhaque at iee.org
Sun Sep 28 11:43:10 BST 2003


Hi,

I tried moving the relevant logic out of the KMainWindow constructor, but I 
still cannot get this to work. The logic looks like this:

    int status = XWarpPointer(
        display,
        None,
        targetWindow,
        0,
        0,
        0,
        0,
        10, 10);
    NETRootInfo(display, 0).setActiveWindow(targetWindow);
    // give X a chance.
    XSync(display, 0);

and I *know* that the value of targetWindow is correct, because the pointer 
does in fact move to the title-bar of the application I select. However, the 
application does not light up its title-bar, nor does it accept key presses.

I did also try inserting a call like this just before the setActiveWindow(), 
but it made no difference:

    status = XSetInputFocus(display, targetWindow, RevertToNone, CurrentTime);
    kdDebug(s_area) << "Focussed pointer to window " << status << endl;

Any more ideas?

Thanks, Shaheed





More information about the kde-core-devel mailing list