Commit 54f9aef0 authored by Benjamin Otte's avatar Benjamin Otte

gdk: Remove gdk_selection_convert()

It's not used anymore.
parent ca5f859d
......@@ -425,10 +425,6 @@ GDK_SELECTION_TYPE_INTEGER
GDK_SELECTION_TYPE_PIXMAP
GDK_SELECTION_TYPE_WINDOW
GDK_SELECTION_TYPE_STRING
gdk_selection_convert
gdk_selection_property_get
gdk_selection_send_notify
gdk_selection_send_notify_for_display
</SECTION>
<SECTION>
......@@ -763,7 +759,6 @@ GdkEventCrossing
GdkEventFocus
GdkEventConfigure
GdkEventProperty
GdkEventSelection
GdkEventDND
GdkEventProximity
GdkEventWindowState
......
......@@ -5185,7 +5185,6 @@ gtk_css_section_get_type
<FILE>gtkselection</FILE>
<TITLE>Selections</TITLE>
GtkSelectionData
gtk_selection_convert
gtk_selection_data_set
gtk_selection_data_set_text
gtk_selection_data_get_text
......@@ -5212,12 +5211,10 @@ gtk_selection_data_get_target
gtk_targets_include_image
gtk_targets_include_text
gtk_targets_include_uri
gtk_selection_remove_all
gtk_selection_data_copy
gtk_selection_data_free
<SUBSECTION Standard>
GTK_TYPE_SELECTION_DATA
GTK_TYPE_TARGET_LIST
<SUBSECTION Private>
gtk_selection_data_get_type
</SECTION>
......
......@@ -573,9 +573,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete;
display_class->create_window_impl = _gdk_broadway_display_create_window_impl;
display_class->get_keymap = _gdk_broadway_display_get_keymap;
display_class->send_selection_notify = _gdk_broadway_display_send_selection_notify;
display_class->get_selection_property = _gdk_broadway_display_get_selection_property;
display_class->convert_selection = _gdk_broadway_display_convert_selection;
display_class->text_property_to_utf8_list = _gdk_broadway_display_text_property_to_utf8_list;
display_class->utf8_to_string_target = _gdk_broadway_display_utf8_to_string_target;
......
......@@ -123,22 +123,6 @@ void _gdk_broadway_display_create_window_impl (GdkDisplay *display,
GdkWindow *real_parent,
GdkEventMask event_mask,
GdkWindowAttr *attributes);
gint _gdk_broadway_display_get_selection_property (GdkDisplay *display,
GdkWindow *requestor,
guchar **data,
GdkAtom *ret_type,
gint *ret_format);
void _gdk_broadway_display_send_selection_notify (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time);
void _gdk_broadway_display_convert_selection (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
guint32 time);
gint _gdk_broadway_display_text_property_to_utf8_list (GdkDisplay *display,
GdkAtom encoding,
gint format,
......
......@@ -33,49 +33,6 @@
#include <string.h>
void
_gdk_broadway_display_convert_selection (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
guint32 time)
{
g_warning ("convert_selection not implemented");
}
gint
_gdk_broadway_display_get_selection_property (GdkDisplay *display,
GdkWindow *requestor,
guchar **data,
GdkAtom *ret_type,
gint *ret_format)
{
if (ret_type)
*ret_type = NULL;
if (ret_format)
*ret_format = 0;
if (data)
*data = NULL;
g_warning ("get_selection_property not implemented");
return 0;
}
void
_gdk_broadway_display_send_selection_notify (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time)
{
g_return_if_fail (GDK_IS_DISPLAY (display));
g_warning ("send_selection_notify not implemented");
}
static gint
make_list (const gchar *text,
gint length,
......
......@@ -167,23 +167,6 @@ struct _GdkDisplayClass
GdkKeymap * (*get_keymap) (GdkDisplay *display);
void (*send_selection_notify) (GdkDisplay *dispay,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time);
gint (*get_selection_property) (GdkDisplay *display,
GdkWindow *requestor,
guchar **data,
GdkAtom *type,
gint *format);
void (*convert_selection) (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
guint32 time);
gint (*text_property_to_utf8_list) (GdkDisplay *display,
GdkAtom encoding,
gint format,
......
......@@ -1032,7 +1032,6 @@ gboolean
gdk_drag_context_handle_dest_event (GdkEvent *event)
{
GdkDragContext *context = NULL;
GList *l;
switch ((guint) event->type)
{
......@@ -1040,19 +1039,6 @@ gdk_drag_context_handle_dest_event (GdkEvent *event)
case GDK_DROP_START:
context = event->dnd.context;
break;
case GDK_SELECTION_NOTIFY:
for (l = contexts; l; l = l->next)
{
GdkDragContext *c = l->data;
if (!c->is_source &&
event->selection.selection == gdk_drag_get_selection (c))
{
context = c;
break;
}
}
break;
default:
return FALSE;
}
......
......@@ -587,12 +587,6 @@ gdk_event_copy (const GdkEvent *event)
sizeof (gdouble) * gdk_device_get_n_axes (event->motion.device));
break;
case GDK_SELECTION_NOTIFY:
new_event->selection.requestor = event->selection.requestor;
if (new_event->selection.requestor)
g_object_ref (new_event->selection.requestor);
break;
default:
break;
}
......@@ -673,11 +667,6 @@ gdk_event_free (GdkEvent *event)
g_free (event->motion.axes);
break;
case GDK_SELECTION_NOTIFY:
if (event->selection.requestor)
g_object_unref (event->selection.requestor);
break;
default:
break;
}
......@@ -750,8 +739,6 @@ gdk_event_get_time (const GdkEvent *event)
return event->crossing.time;
case GDK_PROPERTY_NOTIFY:
return event->property.time;
case GDK_SELECTION_NOTIFY:
return event->selection.time;
case GDK_PROXIMITY_IN:
case GDK_PROXIMITY_OUT:
return event->proximity.time;
......@@ -846,7 +833,6 @@ gdk_event_get_state (const GdkEvent *event,
case GDK_CLIENT_EVENT:
case GDK_CONFIGURE:
case GDK_FOCUS_CHANGE:
case GDK_SELECTION_NOTIFY:
case GDK_PROXIMITY_IN:
case GDK_PROXIMITY_OUT:
case GDK_DAMAGE:
......@@ -2698,72 +2684,6 @@ gdk_event_get_property (const GdkEvent *event,
return FALSE;
}
/**
* gdk_event_get_selection:
* @event: a #GdkEvent
* @selection: (out):
*
* Returns: %TRUE on success, otherwise %FALSE
**/
gboolean
gdk_event_get_selection (const GdkEvent *event,
GdkAtom *selection)
{
if (!event)
return FALSE;
if (event->type == GDK_SELECTION_NOTIFY)
{
*selection = event->selection.selection;
return TRUE;
}
return FALSE;
}
/**
* gdk_event_get_selection_property:
* @event: a #GdkEvent
* @property: (out) (optional):
* @target: (out) (optional):
* @requestor: (out) (optional) (transfer none):
*
* Returns: %TRUE on success, otherwise %FALSE
**/
gboolean
gdk_event_get_selection_property (const GdkEvent *event,
GdkAtom *property,
GdkAtom *target,
GdkWindow **requestor)
{
if (!event)
return FALSE;
if (event->type == GDK_SELECTION_NOTIFY)
{
if (property)
*property = event->selection.property;
if (target)
*target = event->selection.target;
if (requestor)
*requestor = event->selection.requestor;
return TRUE;
}
return FALSE;
}
void
gdk_event_set_selection (GdkEvent *event,
GdkWindow *window,
GdkAtom selection,
guint32 time)
{
event->selection.window = g_object_ref (window);
event->selection.selection = selection;
event->selection.time = time;
}
/**
* gdk_event_get_axes:
* @event: a #GdkEvent
......
......@@ -132,7 +132,6 @@ typedef struct _GdkEventFocus GdkEventFocus;
typedef struct _GdkEventCrossing GdkEventCrossing;
typedef struct _GdkEventConfigure GdkEventConfigure;
typedef struct _GdkEventProperty GdkEventProperty;
typedef struct _GdkEventSelection GdkEventSelection;
typedef struct _GdkEventOwnerChange GdkEventOwnerChange;
typedef struct _GdkEventProximity GdkEventProximity;
typedef struct _GdkEventDND GdkEventDND;
......@@ -233,9 +232,6 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
* @GDK_MAP: the window has been mapped.
* @GDK_UNMAP: the window has been unmapped.
* @GDK_PROPERTY_NOTIFY: a property on the window has been changed or deleted.
* @GDK_SELECTION_CLEAR: the application has lost ownership of a selection.
* @GDK_SELECTION_REQUEST: another application has requested a selection.
* @GDK_SELECTION_NOTIFY: a selection has been received.
* @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing
* surface (e.g. a touchscreen or graphics tablet).
* @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing
......@@ -304,7 +300,6 @@ typedef enum
GDK_MAP = 14,
GDK_UNMAP = 15,
GDK_PROPERTY_NOTIFY = 16,
GDK_SELECTION_NOTIFY = 19,
GDK_PROXIMITY_IN = 20,
GDK_PROXIMITY_OUT = 21,
GDK_DRAG_ENTER = 22,
......@@ -715,19 +710,6 @@ gboolean gdk_event_get_property (const GdkEvent *event,
GdkAtom *property,
GdkPropertyState *state);
GDK_AVAILABLE_IN_3_92
gboolean gdk_event_get_selection (const GdkEvent *event,
GdkAtom *selection);
GDK_AVAILABLE_IN_3_92
gboolean gdk_event_get_selection_property (const GdkEvent *event,
GdkAtom *property,
GdkAtom *target,
GdkWindow **requestor);
GDK_AVAILABLE_IN_3_92
void gdk_event_set_selection (GdkEvent *event,
GdkWindow *window,
GdkAtom selection,
guint32 time);
GDK_AVAILABLE_IN_3_92
gboolean gdk_event_get_axes (GdkEvent *event,
gdouble **axes,
guint *n_axes);
......
......@@ -404,32 +404,6 @@ struct _GdkEventProperty
guint state;
};
/**
* GdkEventSelection:
* @type: the type of the event (%GDK_SELECTION_NOTIFY).
* @window: the window which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @selection: the selection.
* @target: the target to which the selection should be converted.
* @property: the property in which to place the result of the conversion.
* @time: the time of the event in milliseconds.
* @requestor: the window on which to place @property or %NULL if none.
*
* Generated when a selection is requested or ownership of a selection
* is taken over by another client application.
*/
struct _GdkEventSelection
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
GdkAtom selection;
GdkAtom target;
GdkAtom property;
guint32 time;
GdkWindow *requestor;
};
/**
* GdkEventProximity:
* @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
......@@ -708,7 +682,6 @@ struct _GdkEventPadGroupMode {
* @focus_change: a #GdkEventFocus
* @configure: a #GdkEventConfigure
* @property: a #GdkEventProperty
* @selection: a #GdkEventSelection
* @proximity: a #GdkEventProximity
* @dnd: a #GdkEventDND
* @window_state: a #GdkEventWindowState
......@@ -764,7 +737,6 @@ union _GdkEvent
GdkEventFocus focus_change;
GdkEventConfigure configure;
GdkEventProperty property;
GdkEventSelection selection;
GdkEventProximity proximity;
GdkEventDND dnd;
GdkEventWindowState window_state;
......
......@@ -60,110 +60,6 @@
* X Inter-client Communication Conventions Manual (ICCCM).
*/
/**
* gdk_selection_send_notify:
* @requestor: window to which to deliver response.
* @selection: selection that was requested.
* @target: target that was selected.
* @property: property in which the selection owner stored the
* data, or %NULL to indicate that the request
* was rejected.
* @time_: timestamp.
*
* Sends a response to SelectionRequest event.
*/
void
gdk_selection_send_notify (GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time)
{
gdk_selection_send_notify_for_display (gdk_window_get_display (requestor),
requestor, selection,
target, property, time);
}
/**
* gdk_selection_send_notify_for_display:
* @display: the #GdkDisplay where @requestor is realized
* @requestor: window to which to deliver response
* @selection: selection that was requested
* @target: target that was selected
* @property: property in which the selection owner stored the data,
* or %NULL to indicate that the request was rejected
* @time_: timestamp
*
* Send a response to SelectionRequest event.
*
* Since: 2.2
*/
void
gdk_selection_send_notify_for_display (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time_)
{
g_return_if_fail (GDK_IS_DISPLAY (display));
GDK_DISPLAY_GET_CLASS (display)
->send_selection_notify (display, requestor, selection,target, property, time_);
}
/**
* gdk_selection_property_get: (skip)
* @requestor: the window on which the data is stored
* @data: location to store a pointer to the retrieved data.
If the retrieval failed, %NULL we be stored here, otherwise, it
will be non-%NULL and the returned data should be freed with g_free()
when you are finished using it. The length of the
allocated memory is one more than the length
of the returned data, and the final byte will always
be zero, to ensure nul-termination of strings
* @prop_type: location to store the type of the property
* @prop_format: location to store the format of the property
*
* Retrieves selection data that was stored by the selection
* data in response to a call to gdk_selection_convert(). This function
* will not be used by applications, who should use the #GtkClipboard
* API instead.
*
* Returns: the length of the retrieved data.
*/
gint
gdk_selection_property_get (GdkWindow *requestor,
guchar **data,
GdkAtom *ret_type,
gint *ret_format)
{
GdkDisplay *display;
g_return_val_if_fail (GDK_IS_WINDOW (requestor), 0);
display = gdk_window_get_display (requestor);
return GDK_DISPLAY_GET_CLASS (display)
->get_selection_property (display, requestor, data, ret_type, ret_format);
}
void
gdk_selection_convert (GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
guint32 time)
{
GdkDisplay *display;
g_return_if_fail (selection != NULL);
display = gdk_window_get_display (requestor);
GDK_DISPLAY_GET_CLASS (display)
->convert_selection (display, requestor, selection, target, time);
}
/**
* gdk_text_property_to_utf8_list_for_display:
* @display: a #GdkDisplay
......
......@@ -152,46 +152,6 @@ G_BEGIN_DECLS
/* Selections
*/
/**
* gdk_selection_convert:
* @requestor: a #GdkWindow.
* @selection: an atom identifying the selection to get the
* contents of.
* @target: the form in which to retrieve the selection.
* @time_: the timestamp to use when retrieving the
* selection. The selection owner may refuse the
* request if it did not own the selection at
* the time indicated by the timestamp.
*
* Retrieves the contents of a selection in a given
* form.
*/
GDK_AVAILABLE_IN_ALL
void gdk_selection_convert (GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
guint32 time_);
GDK_AVAILABLE_IN_ALL
gint gdk_selection_property_get (GdkWindow *requestor,
guchar **data,
GdkAtom *prop_type,
gint *prop_format);
GDK_AVAILABLE_IN_ALL
void gdk_selection_send_notify (GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time_);
GDK_AVAILABLE_IN_ALL
void gdk_selection_send_notify_for_display (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time_);
G_END_DECLS
#endif /* __GDK_SELECTION_H__ */
......@@ -5468,10 +5468,6 @@ _gdk_make_event (GdkWindow *window,
event->property.state = the_state;
break;
case GDK_SELECTION_NOTIFY:
event->selection.time = the_time;
break;
case GDK_PROXIMITY_IN:
case GDK_PROXIMITY_OUT:
event->proximity.time = the_time;
......
......@@ -496,327 +496,6 @@ gdk_mir_display_pop_error_trap (GdkDisplay *display,
return 0;
}
static void
gdk_mir_display_send_selection_notify (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time)
{
}
static gint
gdk_mir_display_get_selection_property (GdkDisplay *display,
GdkWindow *requestor,
guchar **data,
GdkAtom *ret_type,
gint *ret_format)
{
gint length;
gdk_property_get (requestor,
gdk_atom_intern_static_string ("GDK_SELECTION"),
NULL,
0,
G_MAXULONG,
FALSE,
ret_type,
ret_format,
&length,
data);
return length;
}
static gint
get_format_score (const gchar *format,
GdkAtom target,
GdkAtom *out_type,
gint *out_size)
{
const gchar *target_string;
GdkAtom dummy_type;
gint dummy_size;
target_string = _gdk_atom_name_const (target);
if (!out_type)
out_type = &dummy_type;
if (!out_size)
out_size = &dummy_size;
if (!g_ascii_strcasecmp (format, target_string))
{
*out_type = GDK_SELECTION_TYPE_STRING;
*out_size = sizeof (guchar);
return G_MAXINT;
}
if (target == gdk_atom_intern_static_string ("UTF8_STRING"))
return get_format_score (format, gdk_atom_intern_static_string ("text/plain;charset=utf-8"), out_type, out_size);
/* TODO: use best media type for COMPOUND_TEXT target */
if (target == gdk_atom_intern_static_string ("COMPOUND_TEXT"))
return get_format_score (format, gdk_atom_intern_static_string ("text/plain;charset=utf-8"), out_type, out_size);
if (target == GDK_TARGET_STRING)
return get_format_score (format, gdk_atom_intern_static_string ("text/plain;charset=iso-8859-1"), out_type, out_size);
if (target == gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"))
return get_format_score (format, gdk_atom_intern_static_string ("text/plain;charset=utf-8"), out_type, out_size);
if (g_content_type_is_a (format, target_string))
{
*out_type = GDK_SELECTION_TYPE_STRING;
*out_size = sizeof (guchar);
return 2;
}
if (g_content_type_is_a (target_string, format))
{
*out_type = GDK_SELECTION_TYPE_STRING;
*out_size = sizeof (guchar);
return 1;
}
return 0;
}
static gint
get_best_format_index (const gchar * const *formats,
guint n_formats,
GdkAtom target,
GdkAtom *out_type,
gint *out_size)
{
gint best_i = -1;
gint best_score = 0;
GdkAtom best_type;
gint best_size;
gint score;
GdkAtom type;
gint size;
gint i;
if (!out_type)
out_type = &best_type;
if (!out_size)
out_size = &best_size;
*out_type = NULL;
*out_size = 0;
for (i = 0; i < n_formats; i++)
{
score = get_format_score (formats[i], target, &type, &size);
if (score > best_score)
{
best_i = i;
best_score = score;
*out_type = type;
*out_size = size;
}
}
return best_i;
}
static void
gdk_mir_display_real_convert_selection (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
guint32 time)
{
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
const gchar *paste_data;
gsize paste_size;
const gint *paste_header;
GPtrArray *paste_formats;
GArray *paste_targets;
GdkAtom paste_target;
GdkEvent *event;
gint best_i;
GdkAtom best_type;
gint best_size;
gint i;
g_return_if_fail (mir_display->paste_data);
paste_data = g_variant_get_fixed_array (mir_display->paste_data, &paste_size, sizeof (guchar));
paste_header = (const gint *) paste_data;
if (paste_data)
{
paste_formats = g_ptr_array_new_full (paste_header[0], g_free);
for (i = 0; i < paste_header[0]; i++)
g_ptr_array_add (paste_formats, g_strndup (paste_data + paste_header[1 + 4 * i], paste_header[2 + 4 * i]));
}
else
paste_formats = g_ptr_array_new_with_free_func (g_free);
if (target == gdk_atom_intern_static_string ("TARGETS"))
{
paste_targets = g_array_sized_new (TRUE, FALSE, sizeof (GdkAtom), paste_formats->len);
for (i = 0; i < paste_formats->len; i++)
{
paste_target = gdk_atom_intern (g_ptr_array_index (paste_formats, i), FALSE);
g_array_append_val (paste_targets, paste_target);
}
gdk_property_change (requestor,
gdk_atom_intern_static_string ("GDK_SELECTION"),
GDK_SELECTION_TYPE_ATOM,
8 * sizeof (GdkAtom),