Results 1 to 13 of 13

Thread: ClanLib 2.3.3 Examples: GUI_Layered and Linux

  1. #1
    Peasant
    Join Date
    Nov 2011
    Location
    Little Rock, AR, USA
    Posts
    6

    Default ClanLib 2.3.3 Examples: GUI_Layered and Linux

    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:

    Code:
            #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!

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    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.


  3. #3
    Lesser Knight
    Join Date
    Mar 2009
    Posts
    54

    Default

    Some old layered window examples:


  4. #4
    Peasant
    Join Date
    Nov 2011
    Location
    Little Rock, AR, USA
    Posts
    6

    Default

    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

  5. #5
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Yeah, it's possible....

    Amazing from 20fps on Windows to 1000fps in Linux

    Last edited by rombust; 11-23-2011 at 02:58 PM. Reason: clickthough now works

  6. #6
    Lesser Knight
    Join Date
    Mar 2009
    Posts
    54

    Default

    You are a true Ninja!

  7. #7
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    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:



    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:



    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.

  8. #8
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    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.

  9. #9
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    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.

  10. #10
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Wink

    Does the penguin (x11) support complex clipping regions? If it does, maybe the method used by the windows target also works for linux?

  11. #11

  12. #12
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    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)

  13. #13
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    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.

Similar Threads

  1. ClanLib 2.2 SVN Examples
    By rombust in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 03-30-2010, 02:51 PM
  2. Problems running ClanLib examples
    By trigger-happy in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 02-10-2010, 03:19 PM
  3. Problem compiling Examples on GNU/Linux
    By SpartanJ in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 02-25-2009, 05:17 PM
  4. Using GTK for ClanLib 0.9 Linux
    By rombust in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 09-23-2008, 04:03 PM
  5. Installing ClanLib 0.8 and ClanLib 0.9 on linux
    By rombust in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 07-15-2008, 09:51 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •