1
0
Fork 0

x11: Remove unused member variables from MetaX11SelectionInputStream

The private format and type member variables were not being used by any
of the callers, so they can simply be removed. This also fixes a leak of
type which was introduced when switching from gdk_x11_get_xatom_name()
to XGetAtomName().

Fixes: e66f4396e ("x11: Avoid GDK API in X11 selections")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2957>
This commit is contained in:
Sebastian Keller 2023-04-13 00:53:28 +02:00 committed by Marge Bot
parent 5a4b67dd9e
commit 01ae1d32ee
3 changed files with 5 additions and 24 deletions

View file

@ -48,7 +48,7 @@ stream_new_cb (GObject *source,
GInputStream *stream;
GError *error = NULL;
stream = meta_x11_selection_input_stream_new_finish (res, NULL, NULL, &error);
stream = meta_x11_selection_input_stream_new_finish (res, &error);
if (stream)
g_task_return_pointer (task, stream, g_object_unref);
@ -217,7 +217,7 @@ get_mimetypes_cb (GObject *source,
GInputStream *stream;
GError *error = NULL;
stream = meta_x11_selection_input_stream_new_finish (res, NULL, NULL, &error);
stream = meta_x11_selection_input_stream_new_finish (res, &error);
if (error)
{
g_task_return_error (task, error);

View file

@ -41,8 +41,6 @@ void meta_x11_selection_input_stream_new_async (MetaX11Display
GAsyncReadyCallback callback,
gpointer user_data);
GInputStream * meta_x11_selection_input_stream_new_finish (GAsyncResult *result,
const char **type,
int *format,
GError **error);
gboolean meta_x11_selection_input_stream_xevent (MetaX11SelectionInputStream *stream,

View file

@ -41,9 +41,7 @@ struct MetaX11SelectionInputStreamPrivate
Atom xselection;
Atom xtarget;
Atom xproperty;
const char *type;
Atom xtype;
int format;
GTask *pending_task;
uint8_t *pending_data;
@ -342,8 +340,7 @@ static GBytes *
get_selection_property (MetaX11Display *x11_display,
Window owner,
Atom property,
Atom *ret_type,
gint *ret_format)
Atom *ret_type)
{
gulong nitems;
gulong nbytes;
@ -386,7 +383,6 @@ get_selection_property (MetaX11Display *x11_display,
}
*ret_type = prop_type;
*ret_format = prop_format;
return g_bytes_new_with_free_func (data,
length,
@ -399,7 +395,6 @@ err:
XFree (data);
*ret_type = None;
*ret_format = 0;
return NULL;
}
@ -414,7 +409,6 @@ meta_x11_selection_input_stream_xevent (MetaX11SelectionInputStream *stream,
Window xwindow;
GBytes *bytes;
Atom type;
gint format;
char *target;
xdisplay = priv->x11_display->xdisplay;
@ -434,7 +428,7 @@ meta_x11_selection_input_stream_xevent (MetaX11SelectionInputStream *stream,
bytes = get_selection_property (priv->x11_display, xwindow,
xevent->xproperty.atom,
&type, &format);
&type);
if (bytes == NULL)
{
@ -486,8 +480,7 @@ meta_x11_selection_input_stream_xevent (MetaX11SelectionInputStream *stream,
{
bytes = get_selection_property (priv->x11_display, xwindow,
xevent->xselection.property,
&priv->xtype, &priv->format);
priv->type = XGetAtomName (xdisplay, priv->xtype);
&priv->xtype);
g_task_return_pointer (task, g_object_ref (stream), g_object_unref);
@ -575,12 +568,9 @@ meta_x11_selection_input_stream_new_async (MetaX11Display *x11_display,
GInputStream *
meta_x11_selection_input_stream_new_finish (GAsyncResult *result,
const char **type,
int *format,
GError **error)
{
MetaX11SelectionInputStream *stream;
MetaX11SelectionInputStreamPrivate *priv;
GTask *task;
g_return_val_if_fail (g_task_is_valid (result, NULL), NULL);
@ -592,12 +582,5 @@ meta_x11_selection_input_stream_new_finish (GAsyncResult *result,
if (!stream)
return NULL;
priv = meta_x11_selection_input_stream_get_instance_private (stream);
if (type)
*type = priv->type;
if (format)
*format = priv->format;
return G_INPUT_STREAM (stream);
}