diff options
| author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-05-03 11:48:46 +0300 |
|---|---|---|
| committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-05-23 15:23:18 +0300 |
| commit | 628c81d2d9a2cf05541a8d95dd99f6349aca851d (patch) | |
| tree | f0063c0a9125e9a6a9562e572429e38efbbb2372 /platform/linuxbsd/x11/display_server_x11.cpp | |
| parent | b947c53ddc08d4314b2ce70ca1bc2adb37b83c37 (diff) | |
| download | redot-engine-628c81d2d9a2cf05541a8d95dd99f6349aca851d.tar.gz | |
[DisplayServer] Add method to check if window transparency is supported and enabled.
Diffstat (limited to 'platform/linuxbsd/x11/display_server_x11.cpp')
| -rw-r--r-- | platform/linuxbsd/x11/display_server_x11.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index fb22cf5983..2491064a58 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -5192,6 +5192,22 @@ void DisplayServerX11::set_context(Context p_context) { } } +bool DisplayServerX11::is_window_transparency_available() const { + CharString net_wm_cm_name = vformat("_NET_WM_CM_S%d", XDefaultScreen(x11_display)).ascii(); + Atom net_wm_cm = XInternAtom(x11_display, net_wm_cm_name.get_data(), False); + if (net_wm_cm == None) { + return false; + } + if (XGetSelectionOwner(x11_display, net_wm_cm) == None) { + return false; + } + + if (rendering_device && !rendering_device->is_composite_alpha_supported()) { + return false; + } + return OS::get_singleton()->is_layered_allowed(); +} + void DisplayServerX11::set_native_icon(const String &p_filename) { WARN_PRINT("Native icon not supported by this display server."); } |
