Problems with X11 focus

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
c_elite
Posts: 3
Joined: Fri Nov 14, 2008 4:35 am

One thing to add about window id and the window in general

Post by c_elite »

I am using OpenGL and kubuntu 8.10 with a G-Force 7200 (i believe) and AMD.
On kubuntu linux when the window is created (noticed full screen the most) the
input from the keyboard does not seem to go through. If ran from a terminal, the
terminal gets the keyboard input, not the OpenGL window. When I looked through
the source in CIrrDeviceLinux.cpp in function setResizeAble when I commented
out the lines that say...
XUnmapWindow(display, window);
and
XMapWindow(display, window);
it worked perfectly fullscreen or windowed mode.
Maybe there is a better way to work around this, but for now I just commented them
out. I'm not much of an X programmer, but if those don't need to be in there, maybe
you could add a flag or something on whether to run them or not. I may be completely
missing something, but I did notice that it did help to comment those lines at least for
the desired effect I was going for (to get keyboard input on startup of program).

Also in windowed mode it seems to work great AFTER you click on the window
to focus it. I messed around with XSetInputFocus but was unsuccessful.

Hope this helps,

~C_elite
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The problem with activation is basically system inherent, because the focus is set by the window manager. In case your window manager doesn't activate the new window there's no focus. Moreover, it's not recommended to try to catch the focus, because the user defines the focus behavior, hence the app shall not override it.
However, the fullscreen mode should usually set the focus to the Irrlicht app automatically. Don't know why this doesn't work.
XMapWindow and XUnmapWindow is only called in setResizeAble, are you sure that you call that method (for a fullscreen app?!)

BTW: Split from original thread, because it was a completely separate question.
c_elite
Posts: 3
Joined: Fri Nov 14, 2008 4:35 am

Post by c_elite »

Okay thank you for splitting it for me, this is only like the second time ever posting on forums so I didn't know where to put it.

I walked through my program, and the library adding std::cin.get() lines everywhere and removing them until the window was not activated. I agree I should probably not call setResizeAble unless it is in windowed mode, so I changed that in my program. But in windowed mode if you do not call setResizeAble or if in setResizeAble you get rid of XMap/XUnmap the window will still be focused by default by the window manager. The only thing that unfocuses the window is when those two functions are run.

What is the reason for those two functions being there? I don't know very much about X programming, so maybe there is something else I can call or do cross platform to make the window be activated by default. Like I said the window manager is doing it job unless those functions are being called.

Also I'm using the Irrlicht 1.4.2 version btw.

Thanks in advance,

~C_elite
Post Reply