aboutsummaryrefslogtreecommitdiff
path: root/src/window/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window/window.c')
-rw-r--r--src/window/window.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/window/window.c b/src/window/window.c
index 958adab..101fb42 100644
--- a/src/window/window.c
+++ b/src/window/window.c
@@ -282,6 +282,12 @@ static void mgl_window_on_resize(mgl_window *self, int width, int height) {
mgl_window_set_scissor(self, &(mgl_scissor){ .position = { 0, 0 }, .size = self->size });
}
+static unsigned long mgl_color_to_x11_pixel(mgl_color color) {
+ if(color.a == 0)
+ return 0;
+ return (color.r << 16) | (color.g << 8) | color.b;
+}
+
static int mgl_window_init(mgl_window *self, const char *title, const mgl_window_create_params *params, Window existing_window) {
self->window = 0;
self->context = NULL;
@@ -336,7 +342,7 @@ static int mgl_window_init(mgl_window *self, const char *title, const mgl_window
XSetWindowAttributes window_attr;
window_attr.override_redirect = params ? params->override_redirect : false;
window_attr.colormap = x11_context->color_map;
- window_attr.background_pixel = 0;
+ window_attr.background_pixel = mgl_color_to_x11_pixel(params ? params->background_color : (mgl_color){ .r = 0, .g = 0, .b = 0, .a = 0 });
window_attr.border_pixel = 0;
window_attr.bit_gravity = NorthWestGravity;
window_attr.event_mask =