Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

[Gtk] Add Popover transparency without alpha support #587

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sevoku
Copy link
Member

@sevoku sevoku commented Mar 14, 2016

Simulates alpha color support by rendering the Gdk window content behind a popover on its background, if the Gdk screen does not support alpha colors or window opacity.

This is especially relevant on Windows where Gtk has no opacity/alpha color support (and may be triggered on Linux or Mac in rare cases, where i.e. the graphic adapter support is broken or an old Gtk version is being used):

Without Fake Transparency:
xwt popover broken alpha

With this Patch:
xwt popover fake alpha

And the fixed Xamarin Android Designer on Windows:
xwt popover android designer

sevoku added 5 commits March 14, 2016 18:35
Simulates alpha color support by rendering the Gdk window
content behind a popover on its background, if the Gdk
screen does not support alpha colors or window opacity.
* Use gdk_cairo_set_source_window() if possible (Gtk+ 2.24+)
* Optimize window to pixbuf rendering with Gtk+ < 2.24
On Windows and Mac gdk_cairo_set_source_window()
does not work properly.
If the platform has no alpha support and alpha
can not be faked, just fill the whole popover
with the desired background color and stroke
around the whole window.
@sevoku
Copy link
Member Author

sevoku commented Mar 21, 2016

I have tested this on all platforms with all resolutions now. On Mac and Windows we can't use gdk_cairo_set_source_window() at all and with HiDPI the alternative Pixbuf rendering does not work.

For any non-working case, I've added a fallback which simply fills the whole window:
Popover rendering fallback
(this is just a demo, on Mac we have full alpha support with all resolutions)
But actually the fallback triggers on HiDPI Windows only.

@slluis: I hope this is robust enough now, since I catch all cases that are known to break.

Base automatically changed from master to main March 9, 2021 14:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant