diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-08-02 06:01:50 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-08-02 06:01:50 +0200 |
commit | a0971b0a124f7c1ff040cc226aaa0ce7e58b8a40 (patch) | |
tree | 2072303c1e0db1b7f4cb136e6f9f6608791f7ec8 | |
parent | be41f208c6660a879818321e2904795c7d45fe3e (diff) |
Ensure correct blending function for transparent window
m--------- | depends/mgl | 0 | ||||
-rw-r--r-- | include/mglpp/window/Window.hpp | 5 | ||||
-rw-r--r-- | src/window/Window.cpp | 8 |
3 files changed, 12 insertions, 1 deletions
diff --git a/depends/mgl b/depends/mgl -Subproject 470dac0e891c1ec59dfe52e77861cf068837976 +Subproject f2da59054cedd1c07779e72537da4d7b14616b4 diff --git a/include/mglpp/window/Window.hpp b/include/mglpp/window/Window.hpp index 7d3f90b..6e4e485 100644 --- a/include/mglpp/window/Window.hpp +++ b/include/mglpp/window/Window.hpp @@ -44,7 +44,7 @@ namespace mgl { WindowHandle parent_window = 0; /* 0 = root window */ bool hidden = false; bool override_redirect = false; - bool support_alpha = false; /* support alpha for the window */ + bool support_alpha = false; /* support alpha for the window. If this is set to true then you need to call window.set_texture_blend_func before rendering textures and call window.set_render_blend_func afterwards to ensure correct alpha blending */ bool hide_decorations = false; /* this is a hint, it may be ignored by the window manager */ Color background_color = {0, 0, 0, 0}; const char *class_name = nullptr; @@ -107,6 +107,9 @@ namespace mgl { bool get_clipboard(ClipboardCallback callback); std::string get_clipboard_string(); + void set_texture_blend_func(); + void set_render_blend_func(); + WindowHandle get_system_handle() const; mgl_window* internal_window(); diff --git a/src/window/Window.cpp b/src/window/Window.cpp index 339df71..0e80456 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -182,6 +182,14 @@ namespace mgl { return result; } + void Window::set_texture_blend_func() { + mgl_window_set_texture_blend_func(&window); + } + + void Window::set_render_blend_func() { + mgl_window_set_render_blend_func(&window); + } + WindowHandle Window::get_system_handle() const { return window.window; } |