aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-02 06:01:36 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-02 06:01:36 +0200
commitf2da59054cedd1c07779e72537da4d7b14616b48 (patch)
treeb6c8606c1e7494d2fc17439552db30f55b97fd26 /include
parent470dac0e891c1ec59dfe52e77861cf068837976d (diff)
Ensure correct blending function for transparent window
Diffstat (limited to 'include')
-rw-r--r--include/mgl/gl_macro.h1
-rw-r--r--include/mgl/mgl.h3
-rw-r--r--include/mgl/window/window.h5
3 files changed, 8 insertions, 1 deletions
diff --git a/include/mgl/gl_macro.h b/include/mgl/gl_macro.h
index cbecf94..ba2d3f1 100644
--- a/include/mgl/gl_macro.h
+++ b/include/mgl/gl_macro.h
@@ -18,6 +18,7 @@
#define GL_COLOR_BUFFER_BIT 0x00004000
#define GL_BLEND 0x0BE2
+#define GL_ONE 1
#define GL_SRC_ALPHA 0x0302
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
#define GL_TEXTURE_2D 0x0DE1
diff --git a/include/mgl/mgl.h b/include/mgl/mgl.h
index 4e1a181..e314e03 100644
--- a/include/mgl/mgl.h
+++ b/include/mgl/mgl.h
@@ -6,10 +6,13 @@
/* Display* on x11 */
typedef void* mgl_connection;
typedef struct mgl_context mgl_context;
+typedef struct mgl_window mgl_window;
struct mgl_context {
mgl_connection connection;
mgl_gl gl;
+ mgl_window *current_window;
+
unsigned long wm_delete_window_atom;
unsigned long net_wm_ping_atom;
unsigned long net_wm_pid_atom;
diff --git a/include/mgl/window/window.h b/include/mgl/window/window.h
index eb7f587..23b780a 100644
--- a/include/mgl/window/window.h
+++ b/include/mgl/window/window.h
@@ -74,7 +74,7 @@ typedef struct {
mgl_window_handle parent_window; /* 0 = root window */
bool hidden; /* false by default */
bool override_redirect; /* false by default */
- bool support_alpha; /* support alpha for the window, false by default */
+ bool support_alpha; /* support alpha for the window, false by default. If this is set to true then you need to call mgl_window_set_texture_blend_func before rendering textures and call mgl_window_set_render_blend_func afterwards to ensure correct alpha blending */
bool hide_decorations; /* this is a hint, it may be ignored by the window manager, false by default */
mgl_color background_color; /* default: black */
const char *class_name;
@@ -165,6 +165,9 @@ bool mgl_window_get_clipboard(mgl_window *self, mgl_clipboard_callback callback,
bool mgl_window_get_clipboard_string(mgl_window *self, char **str, size_t *size);
void mgl_window_set_key_repeat_enabled(mgl_window *self, bool enabled);
+void mgl_window_set_texture_blend_func(mgl_window *self);
+void mgl_window_set_render_blend_func(mgl_window *self);
+
void mgl_window_flush(mgl_window *self);
#endif /* MGL_WINDOW_H */