diff options
-rw-r--r-- | gdk/gdkdisplayprivate.h | 5 | ||||
-rw-r--r-- | gdk/gdkselection.c | 36 | ||||
-rw-r--r-- | gdk/x11/gdkdisplay-x11.c | 1 | ||||
-rw-r--r-- | gdk/x11/gdkprivate-x11.h | 5 | ||||
-rw-r--r-- | gdk/x11/gdkselection-x11.c | 38 |
5 files changed, 53 insertions, 32 deletions
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h index 74843f15b4..a2575d8851 100644 --- a/gdk/gdkdisplayprivate.h +++ b/gdk/gdkdisplayprivate.h @@ -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, diff --git a/gdk/gdkselection.c b/gdk/gdkselection.c index 188e64f07e..80131889c3 100644 --- a/gdk/gdkselection.c +++ b/gdk/gdkselection.c @@ -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); +} diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 4595c67f24..26e1b94575 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -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; } diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index 866854ae45..d33b240e08 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -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); diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index 81963dcad3..52d0394fa4 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -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; |