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>
This commit is contained in:
Carlos Garnacho 2023-03-31 15:07:35 +02:00 committed by Marge Bot
parent 20e2adc4fc
commit 2e82702084
3 changed files with 5 additions and 7 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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,