Linux: Problem with Mouse Focus

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
zoschfrosch
Posts: 11
Joined: Sat Nov 22, 2003 11:03 pm

Linux: Problem with Mouse Focus

Post by zoschfrosch »

Hello,

I read the article in C't, which teased me very much. So I tested the examples with Linux and KDevelop.
When I start the examples, they have the complete control of the mouse movements, even if another program has the focus. This is extremely obstructive when I try to debug the examples, because I cannot use the mouse to control the debugger. What can I do?

And still another question:
I spent some time with the quake examples until I found out that the problem with the textures is a known bug. Can I find a list of all known bugs anywhere on this website? I didn't find it in the Bug Tracker.

Thanks in advance
Thomas
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

The problem with the mouse focus can be eliminated by simple adding a
device->isWindowActive() in the run loop. For example

Code: Select all

while(device->run())
if (device->isWindowActive())
{
   //draw
}
Unfortunately, CIrrDeviceLinux::isWindowActive() is not implemented yet, it always returns true. That's because I am not very experienced in linux, and my first target is Windows. But if you know a simple way to determine if the renderingwindow is active, just post it. :)

And you are right, a list of known bugs (+ known temporarily solution for this) would be a very good idea. I'll add this to the homepage.
Guest

Post by Guest »

Hi Niko,

thank you for the rapid reply. Unfortunately, I am also not very experienced in programming under Linux, I'm still at the beginning.
But I'll try to find a solution, an if it works, I'll post it to you.

With best Regards
Thomas
zoschfrosch
Posts: 11
Joined: Sat Nov 22, 2003 11:03 pm

Post by zoschfrosch »

Hi Niko,

here is a possible solution:

Code: Select all

//! returns if window is active. if not, nothing need to be drawn
bool CIrrDeviceLinux::isWindowActive()
{
	Window focus_return;
	int revert_to_return;
	XGetInputFocus(display, &focus_return, &revert_to_return);
	return (focus_return==window);
}
If I use this function in the run()-Loop and the irrlicht-Window looses focus, this has two effects:
I can use the mouse in the focus-window (that's what I wanted) and
the irrlicht-Window stops refreshing which leeds to strange color effects when you move another window over it (does'nt matter).

Still one question: Is it possible to get fixes from other linux users before you release the next version of irrlicht? I am especially interestet in the fix for the linux problem with quake textures :lol:

Regards
Thomas
Post Reply