Donnerstag, Juli 29, 2004


Solving X11 fullscreen problems?

MPlayer is a nice project, but there is one part of the Code, which was patched again and again and still does not work under every available WM:

The X11 fullscreen code.

Now I've taken up the challenge to try another approach to this fullscreen problem.

My code had other problems, so its yet unclear if I will succeed, but it was an interesting learning experience anyway.

The problem with X11 fullscreen is, that you have to deal with a WindowManager, which has decorated your window and shows for example the KDE kicker on top of your window.

So you have to talk to the WM and say: Undecorate that window and layer it on top.

Unfortunately there is no standard way to do so.

There are certain pseudo-standards, but if you try to follow those, you always find one or another broken WindowManager and then you have to code around those shortcomings. This can lead even to window managers, which say that they do support a certain extension, but in fact they don't.

Light on the horizon brings the EWMH standard, which seems to be quite mature, but not alll WMs support this standard, yet and it must be a perfect world, where all WMs would be EWMH compliant.

So a new approach was seeked: If its only to make fullscreen work, we don't need the Window Manager. Ok, so we create a SimpleWindow and before we display it, we set the override_redirect flag to true:

unsigned long valuemask = CWOverrideRedirect; // Just set that Attribute

XSetWindowAttributes attributes;

// Create a sample window
Window window= XCreateSimpleWindow(display, XDefaultRootWindow(display), 0, 0, (DisplayWidth(display, screen)), (DisplayHeight(display, screen)), 0, 0, 0);

attributes.override_redirect = True;
// Change the window attributes
XChangeWindowAttributes(display, window, valuemask, &attributes);

Now we have a nice fullscreen window on top of the window stack, which works with every window manager.

Fine, problem solved?

Unfortunately not as there are those things called "virtual desktops" and application switching also should work.

"Well, but I thought you wanted to watch a video?"

"Yes, but I want to read my mail, when the movie is boring."

Hm, ok.

Well, we still have that old movie window, so as soon as one of the windows looses focus, we hide that fullscreen window and just show it again, when the video window gets focus again.

This is easy in theory, but not so easy in practical use. Also you have to fiddle witzh virutal desktops, where you do not get a focus out event in all cases, but Unmap and Map Notifies.

Well, and as soon as that works, you find out that it does not yet work on all WMs, so you are in WM hell again, which you wanted to avoid in the first place.

The idea of the above method was, that if a WM would grab your window, it would violate the X Protocol, so that you have a standards compliant way to do things.

The next thing I want to try is a WM managed window, which has the TRANSIENT_FOR hint set, which according to iccwm protocol all WMs must (should ?) support.

This probably won't get rid of the application switching and virtual desktop problem, but at least your fullscreen window never gets the focus, which is a huge advantage in designing the event handling.

Well, lets see if there is a "perfect" X11 fullscreen solution.

But before I can work on that again, I have to care for my pending Knoppix projects.

So stay tuned.

Comments: Kommentar veröffentlichen

<< Home

This page is powered by Blogger. Isn't yours?