PDA

View Full Version : ClanLib 2.3.3 Examples: GUI_Layered and Linux



dossjh
11-16-2011, 10:16 AM
Hello,

I was reading the readme file for the GUI_Layered example and it says:


Currently linux ClanLib does not use support layered windows

I was wondering what layered windows do? As far as I can tell the example seems to work perfectly.

I see this workaround in app.cpp:



#ifdef WIN32
win_desc.set_fullscreen(true);
win_desc.set_allow_resize(false);
win_desc.set_layered(true);
win_desc.set_decorations(false);
#endif


but since I can't see the result I was wondering what set_layered actually does?

Thanks,

doss

p.s. I love ClanLib so far!

rombust
11-16-2011, 01:03 PM
Windows that are not rectangles. i.e. Windows that have transparent holes

I am hoping that ClanLib 2.3.4 for linux will support it on the next release.

http://esoteric.clanlib.org/~rombust/ReleaseImages/3dgui.png

huntercool
11-17-2011, 10:43 AM
Some old layered window examples:
http://clanlib.org/w/images/5/54/Example_layered1.png
http://clanlib.org/w/images/1/15/Example_layered2.png

dossjh
11-17-2011, 08:30 PM
Wow! That's really cool. Can't imagine what I would ever use it for, but that's really cool.

Is this possible on linux and just hasn't been coded yet, or is there some technical barrier?

doss

rombust
11-23-2011, 11:49 AM
Yeah, it's possible....

Amazing from 20fps on Windows to 1000fps in Linux :ninja:

http://esoteric.clanlib.org/~rombust/ReleaseImages/linux_layered.png

huntercool
11-23-2011, 02:14 PM
You are a true Ninja! :ninja:

Magnus Norddahl
11-23-2011, 08:04 PM
WHAT!? The penguins are faster than Windows??

Naturally such a bold statement could not go unchallenged, so I quickly brought out my DWM ninja tools and generated this:

http://esoteric.clanlib.org/~mbn/temp/dwm-alpha.jpg

Which looked very good except for the fact that I could not click through. So I tried ALL the MS tricks I knew: SetLayeredWindowAttributes, UpdateLayeredWindow, SetWindowRgn, WM_NCHITTEST. None of it worked until I manually generated a clipping region by downloading the alpha bits using glReadPixels:

http://esoteric.clanlib.org/~mbn/temp/dwm-alpha2.jpg

OK, 39 FPS isn't that bad overall for the overkill test, but thats still a far cry from the 1000 fps in Linux.

1-0 to the Penguins.

rombust
11-23-2011, 09:39 PM
Don't be disheartened ...

Linux cheated.

Linux has the same clickthrough problems as windows does.

The trick linux used is to hook onto the mouse click event and read a single pixel at the mouse x,y position.

If the alpha is 0 (or close to zero), we simply move the window backwards.

This works surprisingly well, as the window "underneath" is usally the other window you are working on, so it automatically gets focus.

Ideally, you would require to find the window underneath the mouse position, and raise it and give it focus.

I am not sure if linux/windows security will allow that.

rombust
11-24-2011, 02:21 PM
Well.

The method linux uses is wrong, and not really usable.

The problem is that the user will not be able to click on anything on the desktop, since the application window is always above the desktop.

So, linux method is broken.

Anyway, by optimising the Windows DWM ninja method (By using a worker thread and minor tweaks)....

We now have 360fps on my Windows 7 :)

... very high frame rates...

imho, the penguin lost.

Magnus Norddahl
11-24-2011, 03:11 PM
Does the penguin (x11) support complex clipping regions? If it does, maybe the method used by the windows target also works for linux?

rombust
11-24-2011, 03:39 PM
Yes

http://en.wikipedia.org/wiki/Shape_extension

Magnus Norddahl
11-24-2011, 04:08 PM
Okay so the Linux version could either use: XShapeCombineRectangles with a list of rectangles created the same way as in Windows. Or it could use XShapeCombineMask with a Pixmap containing the alpha values. Perhaps that Pixmap could even be copied from the window area itself, theoretically keeping everything server-side in X11.

If coded correctly in the X11 server, that last option should make the Penguins win. But then again, theoretically pixmaps should be fast but I've never ever seen a single XFree86 derived server deliver on that. (I'm still bitter from all the time I spent on Pixmap code in the ClanLib 0.1.x days, just to see it slower than doing it in software)

rombust
11-28-2011, 10:57 AM
No, XShapeCombineRectangles cannot be used.

The problem is that function also attempts to make the window transparent (on the already transparent areas). Except it does it very very slowly.