Commit 1442299b authored by Jonas Danielsson's avatar Jonas Danielsson Committed by Bastien Nocera

clipboard: Add get_default() helper

Add helper for getting the main clipboard. This makes
the API usable for bindings (as GdkAtoms aren't usable through
gobject-introspection), and easier to use in C.

https://bugzilla.gnome.org/show_bug.cgi?id=712752
parent 46b10f1d
......@@ -6476,6 +6476,7 @@ GtkClipboardClearFunc
gtk_clipboard_get
gtk_clipboard_get_for_display
gtk_clipboard_get_display
gtk_clipboard_get_default
gtk_clipboard_set_with_data
gtk_clipboard_set_with_owner
gtk_clipboard_get_owner
......
......@@ -378,6 +378,26 @@ gtk_clipboard_get (GdkAtom selection)
return gtk_clipboard_get_for_display (gdk_display_get_default (), selection);
}
/**
* gtk_clipboard_get_default:
* @display: the #GdkDisplay for which the clipboard is to be retrieved.
*
* Returns the default clipboard object for use with cut/copy/paste menu items
* and keyboard shortcuts.
*
* Return value: (transfer none): the default clipboard object.
*
* Since: 3.16
**/
GtkClipboard *
gtk_clipboard_get_default (GdkDisplay *display)
{
g_return_val_if_fail (display != NULL, NULL);
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return gtk_clipboard_get_for_display (display, GDK_SELECTION_CLIPBOARD);
}
static void
selection_get_cb (GtkWidget *widget,
GtkSelectionData *selection_data,
......
......@@ -189,6 +189,9 @@ GtkClipboard *gtk_clipboard_get_for_display (GdkDisplay *display,
GDK_AVAILABLE_IN_ALL
GtkClipboard *gtk_clipboard_get (GdkAtom selection);
GDK_AVAILABLE_IN_3_16
GtkClipboard *gtk_clipboard_get_default (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
GdkDisplay *gtk_clipboard_get_display (GtkClipboard *clipboard);
......
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