-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transparent background for tooltips, dropdowns etc. #1583
Conversation
you should also ad stubs for any unsupported platform |
This is now ready for review 🚢, only thing I'm annoyed is the amount of commits there, I think we can't squash this as there are contributions from others, and GitHub doesn't allow squashing only some from the older commits? I'm trying to re-base this so that commits from different people are not squashed. |
local squash + force push ;) |
I'm rebasing this, currently a total mess. |
Now I have rebased / squashed this. I think it's now final. 🚢 |
Note for posterity, we removed two spurious |
@cmyr I think this is ready for review. |
This causes failure on Windows 7, STATUS_DLL_NOT_FOUND in particular. I haven't investigated in detail, but it's most likely the dependency on DirectComposition. Since it's not supported on Windows 7, it needs to be loaded as optional functions. That existed for a long while but was removed in #1191, specifically commit 290f6e4. |
Okay we discussed this in Zulip, I'll change the Windows part to make the dependency to composition parts optional. |
It's all green again 🟢. I don't have Windows 7 to test, and looks like the CI doesn't test that either, but when you've got time give it a test on Win 7. If it doesn't work, I may have to get Win 7 running in vbox, I don't want to bother you to test the compilation after my changes. |
It works as expected on 7 - hello works fine, and the "transparency" example isn't transparent but is otherwise functional. You might consider logging a warning in that case. So this is unblocked on me, but still requires someone to review in all the PR's glorious detail. |
Web stub implementation to allow compilation Signed-off-by: Jari Pennanen <ciantic@oksidi.com>
Signed-off-by: Jari Pennanen <ciantic@oksidi.com>
75635ec
to
1ade185
Compare
I added the warning if user is using Win 7 and tries transparent, and rebased, squashed my win 7 fix changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, a few little observations inline but nothing blocking.
I'm curious if this has been tested on multiple monitors, at all; that seems like a possible source of complications. I'm also slightly scared of macOS, and I'll test again on my laptop with a second monitor when I get home later tonight.
Thanks in any case, this should unblock a lot of other work!
I pushed some changes. |
Okay, this looks good to me, thanks again! |
* Windows with transparent background * Mac support for transparency Web stub implementation to allow compilation Signed-off-by: Jari Pennanen <ciantic@oksidi.com> * add transparance on linux!!! Signed-off-by: Jari Pennanen <ciantic@oksidi.com> * Win 7 transparency fix: optionalize DCompositionCreateDevice * Transparency touch-ups Co-authored-by: Robert Wittams <robert@wittams.com> Co-authored-by: jaap aarts <jaap.aarts1@gmail.com>
Goal is to allow create overlay windows, such as tooltips, dropdowns etc. by simply setting the backround of the window to transparent. It also allowes to do windows without decorations (#427) and would be better way for creating overlay widgets (#1577). Additionally #1249.
https://xi.zulipchat.com/#narrow/stream/147926-druid/topic/Semi-transparent.20windows.20without.20titlebars
For instance transparency is required to make tooltip shaped window:
Or dropdown window with custom shadows:
Or if you want to make your UI go full WinAmp style from 90's:
New API for window builder
transparent
:To get fully transparent background, hide also the title bar with
show_titlebar(false)
.Changes include a simple example in
examples/transparency.rs
, currently it renders a test widget like this on a transparent background:Note about Windows 10 code changes: This feature is not supposed to change any behavior of non-transparent windows at all, the opaque windows still should use the same code as before.
The method I chose follows this tutorial: "Windows with C++ : High-Performance Window Layering Using the Windows Composition Engine", it's the most recent, I asked about that in window-rs repo.
Included are Mac support by @rjwittams, and Linux (GTK) support by @JAicewizard. X11 and web support is stubbed.