[gtk+] widget: Add gtk_widget_get_clipboard()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] widget: Add gtk_widget_get_clipboard()
- Date: Sun, 3 Dec 2017 04:53:30 +0000 (UTC)
commit 54c8a4b3b71fa42abee49d8615b2e0d5a9ab3045
Author: Benjamin Otte <otte redhat com>
Date: Sat Nov 25 23:55:34 2017 +0100
widget: Add gtk_widget_get_clipboard()
... and gtk_widget_get_primary_clipboard().
They both give out the new GdkClipboard.
docs/reference/gtk/gtk4-sections.txt | 2 +
gtk/gtkwidget.c | 44 ++++++++++++++++++++++++++++++++++
gtk/gtkwidget.h | 4 +++
3 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index ebd4a4c..220bb62 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -4530,6 +4530,8 @@ gtk_widget_freeze_child_notify
gtk_widget_get_child_visible
gtk_widget_get_parent
gtk_widget_get_settings
+gtk_widget_get_clipboard
+gtk_widget_get_primary_clipboard
gtk_widget_get_old_clipboard
gtk_widget_get_display
gtk_widget_get_size_request
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 4d250c9..51b0864 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -12380,6 +12380,50 @@ gtk_widget_set_margin_bottom (GtkWidget *widget,
}
/**
+ * gtk_widget_get_clipboard:
+ * @widget: a #GtkWidget
+ *
+ * This is a utility function to get the clipboard object for the
+ * #GdkDisplay that @widget is using.
+ *
+ * Note that this function always works, even when @widget is not
+ * realized yet.
+ *
+ * Returns: (transfer none): the appropriate clipboard object.
+ *
+ * Since: 3.94
+ **/
+GdkClipboard *
+gtk_widget_get_clipboard (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+
+ return gdk_display_get_clipboard (gtk_widget_get_display (widget));
+}
+
+/**
+ * gtk_widget_get_primary_clipboard:
+ * @widget: a #GtkWidget
+ *
+ * This is a utility function to get the primary clipboard object
+ * for the #GdkDisplay that @widget is using.
+ *
+ * Note that this function always works, even when @widget is not
+ * realized yet.
+ *
+ * Returns: (transfer none): the appropriate clipboard object.
+ *
+ * Since: 3.94
+ **/
+GdkClipboard *
+gtk_widget_get_primary_clipboard (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+
+ return gdk_display_get_primary_clipboard (gtk_widget_get_display (widget));
+}
+
+/**
* gtk_widget_get_old_clipboard:
* @widget: a #GtkWidget
* @selection: a #GdkAtom which identifies the clipboard
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 5631299..edb7fea 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -782,6 +782,10 @@ GDK_AVAILABLE_IN_ALL
GdkDisplay * gtk_widget_get_display (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
GtkSettings* gtk_widget_get_settings (GtkWidget *widget);
+GDK_AVAILABLE_IN_3_94
+GdkClipboard *gtk_widget_get_clipboard (GtkWidget *widget);
+GDK_AVAILABLE_IN_3_94
+GdkClipboard *gtk_widget_get_primary_clipboard (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
GtkClipboard *gtk_widget_get_old_clipboard (GtkWidget *widget,
GdkAtom selection);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]