[gtk+/gdk-backend: 83/91] Add a vfunc for gdk_selection_property_get
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gdk-backend: 83/91] Add a vfunc for gdk_selection_property_get
- Date: Sat, 18 Dec 2010 01:12:48 +0000 (UTC)
commit 19a7ebb75389fef3b91559b16faf0ee7a193313b
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 16 20:10:11 2010 -0500
Add a vfunc for gdk_selection_property_get
gdk/gdkdisplayprivate.h | 5 +++++
gdk/gdkselection.c | 36 ++++++++++++++++++++++++++++++++++++
gdk/x11/gdkdisplay-x11.c | 1 +
gdk/x11/gdkprivate-x11.h | 5 +++++
gdk/x11/gdkselection-x11.c | 38 ++++++--------------------------------
5 files changed, 53 insertions(+), 32 deletions(-)
---
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index 74843f1..a2575d8 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 188e64f..8013188 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 4595c67..26e1b94 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 866854a..d33b240 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 81963dc..52d0394 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]