From 6b1767cb3cc704b94acbc5b4ebf3ee8c5c2b9102 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 18 Dec 2022 02:36:49 +0100 Subject: Fix issue where images cant be pasted from clipboard if mgl is the first application that uses image/--- atoms --- src/window/window.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/window/window.c b/src/window/window.c index 481d17a..6927992 100644 --- a/src/window/window.c +++ b/src/window/window.c @@ -140,11 +140,11 @@ static int x11_context_init(x11_context *self, bool alpha) { self->clipboard_atom = XInternAtom(context->connection, "CLIPBOARD", False); self->targets_atom = XInternAtom(context->connection, "TARGETS", False); self->text_atom = XInternAtom(context->connection, "TEXT", False); - self->utf8_string_atom = XInternAtom(context->connection, "UTF8_STRING", True); - self->image_png = XInternAtom(context->connection, "image/png", True); - self->image_jpg = XInternAtom(context->connection, "image/jpg", True); - self->image_jpeg = XInternAtom(context->connection, "image/jpeg", True); - self->image_gif = XInternAtom(context->connection, "image/gif", True); + self->utf8_string_atom = XInternAtom(context->connection, "UTF8_STRING", False); + self->image_png = XInternAtom(context->connection, "image/png", False); + self->image_jpg = XInternAtom(context->connection, "image/jpg", False); + self->image_jpeg = XInternAtom(context->connection, "image/jpeg", False); + self->image_gif = XInternAtom(context->connection, "image/gif", False); self->incr_atom = XInternAtom(context->connection, "INCR", False); self->default_cursor = None; self->invisible_cursor = None; @@ -1069,12 +1069,6 @@ bool mgl_window_get_clipboard(mgl_window *self, mgl_clipboard_callback callback, Atom supported_clipboard_types[7]; int supported_clipboard_type_index = 0; - if(clipboard_types & MGL_CLIPBOARD_TYPE_STRING) { - supported_clipboard_types[supported_clipboard_type_index++] = x11_context->utf8_string_atom; - supported_clipboard_types[supported_clipboard_type_index++] = XA_STRING; - supported_clipboard_types[supported_clipboard_type_index++] = x11_context->text_atom; - } - if(clipboard_types & MGL_CLIPBOARD_TYPE_IMAGE_PNG) { supported_clipboard_types[supported_clipboard_type_index++] = x11_context->image_png; } @@ -1087,6 +1081,12 @@ bool mgl_window_get_clipboard(mgl_window *self, mgl_clipboard_callback callback, supported_clipboard_types[supported_clipboard_type_index++] = x11_context->image_gif; } + if(clipboard_types & MGL_CLIPBOARD_TYPE_STRING) { + supported_clipboard_types[supported_clipboard_type_index++] = x11_context->utf8_string_atom; + supported_clipboard_types[supported_clipboard_type_index++] = XA_STRING; + supported_clipboard_types[supported_clipboard_type_index++] = x11_context->text_atom; + } + const unsigned long num_supported_clipboard_types = supported_clipboard_type_index; Atom requested_clipboard_type = None; -- cgit v1.2.3