aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-01-14 14:41:21 +0100
committerdec05eba <dec05eba@protonmail.com>2023-01-14 14:41:21 +0100
commitbb770991b2d688b247106e116c1ee222c6dbbe11 (patch)
tree0311b5ba2dc9cd412a745d11e0894858ebdfe602
parent1ad975ac730a28b3c1a4fb4c2d0abc387e18d3f6 (diff)
Eliminate resize flicker by setting window gravity to NorthWest
-rw-r--r--src/window/window.c5
1 files changed, 3 insertions, 2 deletions
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);