summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2023-03-31 15:07:35 +0200
committerMarge Bot <marge-bot@gnome.org>2023-04-04 18:35:11 +0000
commit2e82702084be7c80bdf6cb393ae8efb0c6d4454b (patch)
tree12575314f25a745d85f43ebd965b64a4146749e8
parent20e2adc4fc0549a394a18cf207ad32b42b142d4f (diff)
downloadmutter-2e82702084be7c80bdf6cb393ae8efb0c6d4454b.tar.gz
x11: Pass Atom directly
We convert an atom to string just to convert it to an atom. We can avoid the roundtrip. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2945>
-rw-r--r--src/x11/meta-selection-source-x11.c6
-rw-r--r--src/x11/meta-x11-selection-input-stream-private.h2
-rw-r--r--src/x11/meta-x11-selection-input-stream.c4
3 files changed, 5 insertions, 7 deletions
diff --git a/src/x11/meta-selection-source-x11.c b/src/x11/meta-selection-source-x11.c
index 7715dbf6f..4fcb81d42 100644
--- a/src/x11/meta-selection-source-x11.c
+++ b/src/x11/meta-selection-source-x11.c
@@ -75,7 +75,6 @@ meta_selection_source_x11_read_async (MetaSelectionSource *source,
gpointer user_data)
{
MetaSelectionSourceX11 *source_x11 = META_SELECTION_SOURCE_X11 (source);
- Display *xdisplay = meta_x11_display_get_xdisplay (source_x11->x11_display);
GTask *task;
task = g_task_new (source, cancellable, callback, user_data);
@@ -91,7 +90,7 @@ meta_selection_source_x11_read_async (MetaSelectionSource *source,
mimetype = "UTF8_STRING";
meta_x11_selection_input_stream_new_async (source_x11->x11_display,
- XGetAtomName (xdisplay, source_x11->xselection),
+ source_x11->xselection,
mimetype,
source_x11->timestamp,
G_PRIORITY_DEFAULT,
@@ -236,7 +235,6 @@ meta_selection_source_x11_new_async (MetaX11Display *x11_display,
GAsyncReadyCallback callback,
gpointer user_data)
{
- Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
MetaSelectionSourceX11 *source;
GTask *task;
@@ -251,7 +249,7 @@ meta_selection_source_x11_new_async (MetaX11Display *x11_display,
g_task_set_task_data (task, source, g_object_unref);
meta_x11_selection_input_stream_new_async (x11_display,
- XGetAtomName (xdisplay, xselection),
+ xselection,
"TARGETS",
timestamp,
G_PRIORITY_DEFAULT,
diff --git a/src/x11/meta-x11-selection-input-stream-private.h b/src/x11/meta-x11-selection-input-stream-private.h
index a2b74ea99..e2d8864bb 100644
--- a/src/x11/meta-x11-selection-input-stream-private.h
+++ b/src/x11/meta-x11-selection-input-stream-private.h
@@ -33,7 +33,7 @@ G_DECLARE_FINAL_TYPE (MetaX11SelectionInputStream,
GInputStream)
void meta_x11_selection_input_stream_new_async (MetaX11Display *x11_display,
- const char *selection,
+ Atom xselection,
const char *target,
guint32 timestamp,
int io_priority,
diff --git a/src/x11/meta-x11-selection-input-stream.c b/src/x11/meta-x11-selection-input-stream.c
index 491adbedd..fae46af24 100644
--- a/src/x11/meta-x11-selection-input-stream.c
+++ b/src/x11/meta-x11-selection-input-stream.c
@@ -524,7 +524,7 @@ meta_x11_selection_input_stream_xevent (MetaX11SelectionInputStream *stream,
void
meta_x11_selection_input_stream_new_async (MetaX11Display *x11_display,
- const char *selection,
+ Atom xselection,
const char *target,
guint32 timestamp,
int io_priority,
@@ -548,7 +548,7 @@ meta_x11_selection_input_stream_new_async (MetaX11Display *x11_display,
x11_display->selection.input_streams =
g_list_prepend (x11_display->selection.input_streams, stream);
- priv->xselection = XInternAtom (x11_display->xdisplay, selection, False);
+ priv->xselection = xselection;
priv->xtarget = XInternAtom (x11_display->xdisplay, target, False);
priv->xproperty = XInternAtom (x11_display->xdisplay, "META_SELECTION", False);
priv->window = XCreateWindow (x11_display->xdisplay,