From bb770991b2d688b247106e116c1ee222c6dbbe11 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 14 Jan 2023 14:41:21 +0100 Subject: Eliminate resize flicker by setting window gravity to NorthWest --- src/window/window.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/window') diff --git a/src/window/window.c b/src/window/window.c index 660ae9d..958adab 100644 --- a/src/window/window.c +++ b/src/window/window.c @@ -338,6 +338,7 @@ static int mgl_window_init(mgl_window *self, const char *title, const mgl_window window_attr.colormap = x11_context->color_map; window_attr.background_pixel = 0; window_attr.border_pixel = 0; + window_attr.bit_gravity = NorthWestGravity; window_attr.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | @@ -347,7 +348,7 @@ static int mgl_window_init(mgl_window *self, const char *title, const mgl_window const bool hide_window = params ? params->hidden : false; if(existing_window) { - if(!XChangeWindowAttributes(context->connection, existing_window, CWColormap | CWEventMask | CWOverrideRedirect | CWBorderPixel | CWBackPixel, &window_attr)) { + if(!XChangeWindowAttributes(context->connection, existing_window, CWColormap | CWEventMask | CWOverrideRedirect | CWBorderPixel | CWBackPixel | CWBitGravity, &window_attr)) { fprintf(stderr, "mgl error: XChangeWindowAttributes failed\n"); mgl_window_deinit(self); return -1; @@ -360,7 +361,7 @@ static int mgl_window_init(mgl_window *self, const char *title, const mgl_window self->window = XCreateWindow(context->connection, parent_window, params->position.x, params->position.y, window_size.x, window_size.y, 0, x11_context->visual_info->depth, InputOutput, x11_context->visual_info->visual, - CWColormap | CWEventMask | CWOverrideRedirect | CWBorderPixel | CWBackPixel, &window_attr); + CWColormap | CWEventMask | CWOverrideRedirect | CWBorderPixel | CWBackPixel | CWBitGravity, &window_attr); if(!self->window) { fprintf(stderr, "mgl error: XCreateWindow failed\n"); mgl_window_deinit(self); -- cgit v1.2.3