Commit 95868ef0 authored by Matthias Clasen's avatar Matthias Clasen

Add a vfunc for gdk_selection_property_get

parent 625b8305
......@@ -209,6 +209,11 @@ struct _GdkDisplayClass
GdkAtom target,
GdkAtom property,
guint32 time_);
gint (*get_selection_property) (GdkDisplay *display,
GdkWindow *requestor,
guchar **data,
GdkAtom *type,
gint *format);
/* Signals */
void (*closed) (GdkDisplay *display,
......
......@@ -334,3 +334,39 @@ gdk_selection_send_notify_for_display (GdkDisplay *display,
GDK_DISPLAY_GET_CLASS (display)
->send_selection_notify (display, requestor, selection,target, property, time_);
}
/**
* gdk_selection_property_get:
* @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.
*
* Return value: 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);
}
......@@ -2763,4 +2763,5 @@ _gdk_display_x11_class_init (GdkDisplayX11Class * class)
display_class->get_selection_owner = _gdk_x11_display_get_selection_owner;
display_class->set_selection_owner = _gdk_x11_display_set_selection_owner;
display_class->send_selection_notify = _gdk_x11_display_send_selection_notify;
display_class->get_selection_property = _gdk_x11_display_get_selection_property;
}
......@@ -202,6 +202,11 @@ void _gdk_x11_display_send_selection_notify (GdkDisplay *display,
GdkAtom target,
GdkAtom property,
guint32 time);
gint _gdk_x11_display_get_selection_property (GdkDisplay *display,
GdkWindow *requestor,
guchar **data,
GdkAtom *ret_type,
gint *ret_format);
void _gdk_x11_device_check_extension_events (GdkDevice *device);
......
......@@ -204,45 +204,19 @@ gdk_selection_convert (GdkWindow *requestor,
GDK_WINDOW_XID (requestor), time);
}
/**
* gdk_selection_property_get:
* @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.
*
* Return value: the length of the retrieved data.
**/
gint
gdk_selection_property_get (GdkWindow *requestor,
guchar **data,
GdkAtom *ret_type,
gint *ret_format)
_gdk_x11_display_get_selection_property (GdkDisplay *display,
GdkWindow *requestor,
guchar **data,
GdkAtom *ret_type,
gint *ret_format)
{
gulong nitems;
gulong nbytes;
gulong length = 0; /* Quiet GCC */
gulong length = 0;
Atom prop_type;
gint prop_format;
guchar *t = NULL;
GdkDisplay *display;
g_return_val_if_fail (requestor != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (requestor), 0);
g_return_val_if_fail (GDK_WINDOW_IS_X11 (requestor), 0);
display = GDK_WINDOW_DISPLAY (requestor);
if (GDK_WINDOW_DESTROYED (requestor) || !GDK_WINDOW_IS_X11 (requestor))
goto err;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment