Advertisement

Window focusWindow int focusState XGetInputFocus

Started by September 19, 2005 09:32 AM
1 comment, last by Mare 19 years, 1 month ago
Hi! I use the function XGetInputFocus to check if my window has the focus at the moment. Here is the part of code which does the check: Window focusWindow; int focusState; XGetInputFocus(displayHandle, &focusWindow, &focusState); if (focusWindow == myWindow){ } {/code] "myWindow" is another Window variable which contains the id of my own window which was created with XCreateWindow. The problem is that this code does only work with KDE but not with Gnome. I read that the function has problems with GTK based applications, but I could not find any information about an alternative. Is there an alternative function which does also work in Gnome? Or maybe another way to check if my window is on the top? I want to avail too many dependencies, so if it is possible I would like to use only functions from the standard Xlib but not Qt or somethink similar. Thanks.
Sorry for the double-post.
Advertisement
Hi ChristophR,

Do you have an xevents loop running in your code?

If so then you should be able to use the event : FocusIn to see if your window has received focus.

I dont know if this will have a different outcome than using XGetInputFocus() but it is an alternative.

This topic is closed to new replies.

Advertisement