-/* GTK - The GTK+ Toolkit
+/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
MULTIPLE,
TARGETS,
TIMESTAMP,
+ SAVE_TARGETS,
LAST_ATOM
};
In emergency, you could use #GDK_CURRENT_TIME
*
* Requests the contents of a selection. When received,
- * a "selection_received" signal will be generated.
+ * a "selection-received" signal will be generated.
*
* Return value: %TRUE if requested succeeded. %FALSE if we could not process
* request. (e.g., there was already a request in process for
if (owner_window != NULL)
{
GtkWidget *owner_widget;
+ gpointer owner_widget_ptr;
GtkSelectionData selection_data;
selection_data.selection = selection;
selection_data.length = -1;
selection_data.display = display;
- gdk_window_get_user_data (owner_window, (gpointer *)&owner_widget);
+ gdk_window_get_user_data (owner_window, &owner_widget_ptr);
+ owner_widget = owner_widget_ptr;
if (owner_widget != NULL)
{
return TRUE;
}
+/**
+ * gtk_selection_data_get_selection:
+ * @selection_data: a pointer to a #GtkSelectionData structure.
+ *
+ * Retrieves the selection #GdkAtom of the selection data.
+ *
+ * Returns: the selection #GdkAtom of the selection data.
+ *
+ * Since: 2.16
+ **/
+GdkAtom
+gtk_selection_data_get_selection (GtkSelectionData *selection_data)
+{
+ g_return_val_if_fail (selection_data != NULL, 0);
+
+ return selection_data->selection;
+}
+
/**
* gtk_selection_data_get_target:
* @selection_data: a pointer to a #GtkSelectionData structure.
*
* Retrieves the target of the selection.
*
+ * Returns: the target of the selection.
+ *
* Since: 2.14
**/
GdkAtom
*
* Retrieves the data type of the selection.
*
+ * Returns: the data type of the selection.
+ *
* Since: 2.14
**/
GdkAtom
*
* Retrieves the format of the selection.
*
+ * Returns: the format of the selection.
+ *
* Since: 2.14
**/
gint
/**
* gtk_selection_data_get_data:
* @selection_data: a pointer to a #GtkSelectionData structure.
- * @length: an integer to be filled in, or %NULL
*
* Retrieves the raw data of the selection.
*
- * If @length is not %NULL it is filled with the length of data.
+ * Returns: the raw data of the selection.
*
* Since: 2.14
**/
const guchar*
-gtk_selection_data_get_data (GtkSelectionData *selection_data,
- guint *length)
+gtk_selection_data_get_data (GtkSelectionData *selection_data)
{
g_return_val_if_fail (selection_data != NULL, NULL);
- if (length)
- *length = selection_data->length;
-
return selection_data->data;
}
+/**
+ * gtk_selection_data_get_length:
+ * @selection_data: a pointer to a #GtkSelectionData structure.
+ *
+ * Retrieves the length of the raw data of the selection.
+ *
+ * Returns: the length of the data of the selection.
+ *
+ * Since: 2.14
+ */
+gint
+gtk_selection_data_get_length (GtkSelectionData *selection_data)
+{
+ g_return_val_if_fail (selection_data != NULL, -1);
+
+ return selection_data->length;
+}
+
/**
* gtk_selection_data_get_display:
* @selection_data: a pointer to a #GtkSelectionData structure.
*
* Retrieves the display of the selection.
*
+ * Returns: the display of the selection.
+ *
* Since: 2.14
**/
GdkDisplay *
/**
* gtk_selection_data_set_uris:
* @selection_data: a #GtkSelectionData
- * @uris: a %NULL-terminated array of strings hilding URIs
+ * @uris: a %NULL-terminated array of strings holding URIs
*
* Sets the contents of the selection from a list of URIs.
* The string is converted to the form determined by
{
g_return_val_if_fail (selection_data != NULL, FALSE);
+ /* As usual, java gets it wrong and sets the type to TARGETS, not ATOM
+ */
if (selection_data->length >= 0 &&
selection_data->format == 32 &&
- selection_data->type == GDK_SELECTION_TYPE_ATOM)
+ (selection_data->type == GDK_SELECTION_TYPE_ATOM ||
+ selection_data->type == gtk_selection_atoms[TARGETS]))
{
if (targets)
*targets = g_memdup (selection_data->data, selection_data->length);
gtk_selection_atoms[MULTIPLE] = gdk_atom_intern_static_string ("MULTIPLE");
gtk_selection_atoms[TIMESTAMP] = gdk_atom_intern_static_string ("TIMESTAMP");
gtk_selection_atoms[TARGETS] = gdk_atom_intern_static_string ("TARGETS");
+ gtk_selection_atoms[SAVE_TARGETS] = gdk_atom_intern_static_string ("SAVE_TARGETS");
initialize = FALSE;
}
* @widget: a #GtkWidget
* @event: the event
*
- * The default handler for the GtkWidget::selection_clear_event
+ * The default handler for the #GtkWidget::selection-clear-event
* signal.
*
* Return value: %TRUE if the event was handled, otherwise false
* Since: 2.2
*
* Deprecated: 2.4: Instead of calling this function, chain up from
- * your selection_clear_event handler. Calling this function
+ * your selection-clear-event handler. Calling this function
* from any other context is illegal.
**/
gboolean
#endif
gtk_selection_invoke_handler (widget, &data, event->time);
-
if (data.length < 0)
{
info->conversions[i].property = GDK_NONE;
/*************************************************************
* _gtk_selection_notify:
- * Handler for "selection_notify_event" signals on windows
+ * Handler for "selection-notify-event" signals on windows
* where a retrieval is currently in process. The selection
* owner has responded to our conversion request.
* arguments:
/*************************************************************
* _gtk_selection_property_notify:
- * Handler for "property_notify_event" signals on windows
+ * Handler for "property-notify-event" signals on windows
* where a retrieval is currently in process. The selection
* owner has added more data.
* arguments:
/*************************************************************
* gtk_selection_retrieval_report:
- * Emits a "selection_received" signal.
+ * Emits a "selection-received" signal.
* arguments:
* info: information about the retrieval that completed
* buffer: buffer containing data (NULL => errror)
data.display = gtk_widget_get_display (info->widget);
g_signal_emit_by_name (info->widget,
- "selection_received",
+ "selection-received",
&data, time);
}
g_return_if_fail (widget != NULL);
target_list = gtk_selection_target_list_get (widget, data->selection);
- if (target_list &&
+ if (data->target != gtk_selection_atoms[SAVE_TARGETS] &&
+ target_list &&
gtk_target_list_find (target_list, data->target, &info))
{
g_signal_emit_by_name (widget,
- "selection_get",
+ "selection-get",
data,
info, time);
}
tmp_list = tmp_list->next;
}
}
+ else if (data->target == gtk_selection_atoms[SAVE_TARGETS])
+ {
+ gtk_selection_data_set (data,
+ gdk_atom_intern_static_string ("NULL"),
+ 32, "", 0);
+ }
else
{
data->length = -1;