aboutsummaryrefslogtreecommitdiff
path: root/src/window
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-01-14 14:24:10 +0100
committerdec05eba <dec05eba@protonmail.com>2023-01-14 14:24:10 +0100
commit8278c7a20dc3845f63abccd13375f2805d9b69e8 (patch)
tree64e930ee5cc98d2f2edae34026983d44628201c4 /src/window
parentc6017539ea7caa1db88040f96b3352f15f7b02b9 (diff)
Improve resize performance by setting back pixel instead of back pixmap
Diffstat (limited to 'src/window')
-rw-r--r--src/window/window.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/window/window.c b/src/window/window.c
index e2a6b9d..d12034f 100644
--- a/src/window/window.c
+++ b/src/window/window.c
@@ -336,7 +336,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_pixmap = None;
+ window_attr.background_pixel = 0;
window_attr.border_pixel = 0;
window_attr.event_mask =
KeyPressMask | KeyReleaseMask |
@@ -347,7 +347,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 | CWBackPixmap, &window_attr)) {
+ if(!XChangeWindowAttributes(context->connection, existing_window, CWColormap | CWEventMask | CWOverrideRedirect | CWBorderPixel | CWBackPixel, &window_attr)) {
fprintf(stderr, "mgl error: XChangeWindowAttributes failed\n");
mgl_window_deinit(self);
return -1;
@@ -360,7 +360,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 | CWBackPixmap, &window_attr);
+ CWColormap | CWEventMask | CWOverrideRedirect | CWBorderPixel | CWBackPixel, &window_attr);
if(!self->window) {
fprintf(stderr, "mgl error: XCreateWindow failed\n");
mgl_window_deinit(self);
@@ -832,7 +832,7 @@ bool mgl_window_poll_event(mgl_window *self, mgl_event *event) {
if(XPending(display)) {
XEvent xev; /* TODO: Move to window struct */
XNextEvent(display, &xev);
- if(xev.xany.window == self->window || event->type == ClientMessage)
+ if(xev.xany.window == self->window || xev.type == ClientMessage)
mgl_window_on_receive_event(self, &xev, event, context);
else
event->type = MGL_EVENT_UNKNOWN;
@@ -862,6 +862,7 @@ void mgl_window_set_view(mgl_window *self, mgl_view *new_view) {
context->gl.glLoadIdentity();
context->gl.glOrtho(0.0, new_view->size.x, new_view->size.y, 0.0, 0.0, 1.0);
context->gl.glMatrixMode(GL_MODELVIEW);
+ context->gl.glLoadIdentity();
}
void mgl_window_get_view(mgl_window *self, mgl_view *view) {