Raising window and setting keyboard focus
Chris Kurecka
ckurecka at gmail.com
Wed Dec 1 13:34:17 PST 2004
Hi,
I'm trying to write a program using Xlib that will move another window
to the foreground and give it keyboard focus. I tried using the
following calls:
Window raise;
/* assign raise to appropriate window */
XRaiseWindow(dpy, raise);
XSetInputFocus(dpy, raise, RevertToNone, CurrentTime);
This raises the window to the foreground but does not give it input
focus, which still goes to the terminal that launched my program.
I also tried:
int did_it_work = XGrabKeyboard(dpy, raise, false, GrabModeAsync,
GrabModeAsync, CurrentTime);
No errors are returned. Is this not working because I didn't create
the window I'm trying to change the focus to, or is it something else?
I've tried it in both KDE and GNOME, so I don't think it's window
manager dependent. Is there any way to do what I'm seeking, without
using Qt/GTK calls?
Thanks a lot!
Chris Kurecka
More information about the xorg
mailing list