We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2128 - Add Windows-like composite layered windows to ShapedWindow API
Summary: Add Windows-like composite layered windows to ShapedWindow API
Status: RESOLVED ABANDONED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.1
Hardware: All All
: P2 enhancement
Assignee: Albert Huang
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-01 22:48 UTC by Albert Huang
Modified: 2018-08-06 21:20 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Huang 2013-10-01 22:48:46 UTC
(Apologies if I sound like an idiot and/or use totally invalid terms - not much experience in this area yet!)

I was playing around with SDL 2.0's new ShapedWindow API, but was surprised to see that it did not support per-pixel alpha for shaped windows, or as Microsoft calls it, "Layered Windows". I believe that all of the desktop platforms supported by SDL can handle this kind of window:

* Windows (who sorta invented it) via LayeredWindows API
* Mac Carbon - via Quartz
* Mac Cocoa - via subclassing a few classes and modifying behavior
* Linux - X11 ARGB visuals (Wayland should have this too)

As for implementation, I think it should be possible to leverage the existing API, but now have another WindowShapeMode called ShapeModeAlpha, which would leverage the surface's alpha channel to do the per-pixel window alpha.

(Another interesting idea - maybe using this to do transparent OpenGL windows? Just a random thought.)

I'd be happy to try to hack in some patches for the team to review (though again, very little experience, so my hacks might be ugly!).
Comment 1 Sam Lantinga 2013-10-03 08:04:51 UTC
Actually I would much prefer an alpha-channel based API over the existing one, if it could be supported on all major platforms.

If you provide a new implementation I'll be glad to accept it and add it to the API.

Cheers!
Comment 2 Albert Huang 2013-10-03 14:30:56 UTC
(In reply to Sam Lantinga from comment #1)
> Actually I would much prefer an alpha-channel based API over the existing
> one, if it could be supported on all major platforms.

By new API do you mean an entirely new API, or what I mentioned before (adding a new WindowShapeMode)? (Just a bit confused with your wording!)

> If you provide a new implementation I'll be glad to accept it and add it to
> the API.

As for the implementation, I've been looking at some platform documentation (Windows, Mac, X11), and then noticed that Qt implements this feature. I did a quick test implementation in PyQt and found their implementation works perfectly. Their code is also easy to find and look at. However... Qt uses the LGPL license, while SDL uses the zlib license. While Qt has been more "free" in recent years, the LGPL license is much more restrictive than the zlib license. (LGPL requires attribution and source code, whereas zlib does not... the latter license is more flexible for game developers, which may be why the license was changed.)

That said, from a sort of legal perspective, am I allowed to "look" at the code and use it as a reference to write the API, or must I write it from scratch?
Comment 3 Sam Lantinga 2013-10-06 02:07:31 UTC
Either a new API or a new mode would be fine.  Once you add one, migrating it to the other if we want would be trivial.

Looking at LGPL code to know what API calls to make is fine.  You obviously can't copy the code, but learning from it is okay.
Comment 4 Ryan C. Gordon 2018-08-06 21:20:20 UTC
Hello, and sorry if you're getting dozens of copies of this message by email.

We are closing out bugs that appear to be abandoned in some form. This can happen for lots of reasons: we couldn't reproduce it, conversation faded out, the bug was noted as fixed in a comment but we forgot to mark it resolved, the report is good but the fix is impractical, we fixed it a long time ago without realizing there was an associated report, etc.

Individually, any of these bugs might have a better resolution (such as WONTFIX or WORKSFORME or INVALID) but we've added a new resolution of ABANDONED to make this easily searchable and make it clear that it's not necessarily unreasonable to revive a given bug report.

So if this bug is still a going concern and you feel it should still be open: please feel free to reopen it! But unless you respond, we'd like to consider these bugs closed, as many of them are several years old and overwhelming our ability to prioritize recent issues.

(please note that hundred of bug reports were sorted through here, so we apologize for any human error. Just reopen the bug in that case!)

Thanks,
--ryan.