forked from AuroraMiddleware/gtk
gtk: Remove GtkClipboard
This commit is contained in:
parent
c8edc6ed58
commit
2d5c82b4ec
@ -20,7 +20,7 @@
|
||||
* @Title: Content Formats
|
||||
* @Short_description: Advertising and negotiating of content
|
||||
* exchange formats
|
||||
@See_also: #GdkDragContext, #GtkClipboard
|
||||
* @See_also: #GdkDragContext, #GdkClipboard
|
||||
*
|
||||
* This section describes the #GdkContentFormats structure that is used to
|
||||
* advertise and negotiate the format of content passed between different
|
||||
|
@ -71,7 +71,6 @@
|
||||
#include <gtk/gtkcenterbox.h>
|
||||
#include <gtk/gtkcheckbutton.h>
|
||||
#include <gtk/gtkcheckmenuitem.h>
|
||||
#include <gtk/gtkclipboard.h>
|
||||
#include <gtk/gtkcolorbutton.h>
|
||||
#include <gtk/gtkcolorchooser.h>
|
||||
#include <gtk/gtkcolorchooserdialog.h>
|
||||
|
@ -29,7 +29,6 @@
|
||||
#endif
|
||||
|
||||
#include "gtkapplicationprivate.h"
|
||||
#include "gtkclipboardprivate.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtkrecentmanager.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
2073
gtk/gtkclipboard.c
2073
gtk/gtkclipboard.c
File diff suppressed because it is too large
Load Diff
@ -1,288 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2000 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Global clipboard abstraction.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_CLIPBOARD_H__
|
||||
#define __GTK_CLIPBOARD_H__
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtkselection.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_CLIPBOARD (gtk_clipboard_get_type ())
|
||||
#define GTK_CLIPBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CLIPBOARD, GtkClipboard))
|
||||
#define GTK_IS_CLIPBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CLIPBOARD))
|
||||
|
||||
/**
|
||||
* GtkClipboardReceivedFunc:
|
||||
* @clipboard: the #GtkClipboard
|
||||
* @selection_data: a #GtkSelectionData containing the data was received.
|
||||
* If retrieving the data failed, then then length field
|
||||
* of @selection_data will be negative.
|
||||
* @data: (closure): the @user_data supplied to
|
||||
* gtk_clipboard_request_contents().
|
||||
*
|
||||
* A function to be called when the results of gtk_clipboard_request_contents()
|
||||
* are received, or when the request fails.
|
||||
*/
|
||||
typedef void (* GtkClipboardReceivedFunc) (GtkClipboard *clipboard,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* GtkClipboardTextReceivedFunc:
|
||||
* @clipboard: the #GtkClipboard
|
||||
* @text: (nullable): the text received, as a UTF-8 encoded string, or
|
||||
* %NULL if retrieving the data failed.
|
||||
* @data: (closure): the @user_data supplied to
|
||||
* gtk_clipboard_request_text().
|
||||
*
|
||||
* A function to be called when the results of gtk_clipboard_request_text()
|
||||
* are received, or when the request fails.
|
||||
*/
|
||||
typedef void (* GtkClipboardTextReceivedFunc) (GtkClipboard *clipboard,
|
||||
const gchar *text,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* GtkClipboardRichTextReceivedFunc:
|
||||
* @clipboard: the #GtkClipboard
|
||||
* @format: The format of the rich text
|
||||
* @text: (nullable) (type utf8): the rich text received, as
|
||||
* a UTF-8 encoded string, or %NULL if retrieving the data failed.
|
||||
* @length: Length of the text.
|
||||
* @data: (closure): the @user_data supplied to
|
||||
* gtk_clipboard_request_rich_text().
|
||||
*
|
||||
* A function to be called when the results of
|
||||
* gtk_clipboard_request_rich_text() are received, or when the request
|
||||
* fails.
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
typedef void (* GtkClipboardRichTextReceivedFunc) (GtkClipboard *clipboard,
|
||||
GdkAtom format,
|
||||
const guint8 *text,
|
||||
gsize length,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* GtkClipboardImageReceivedFunc:
|
||||
* @clipboard: the #GtkClipboard
|
||||
* @pixbuf: the received image
|
||||
* @data: (closure): the @user_data supplied to
|
||||
* gtk_clipboard_request_image().
|
||||
*
|
||||
* A function to be called when the results of gtk_clipboard_request_image()
|
||||
* are received, or when the request fails.
|
||||
*
|
||||
* Since: 2.6
|
||||
*/
|
||||
typedef void (* GtkClipboardImageReceivedFunc) (GtkClipboard *clipboard,
|
||||
GdkPixbuf *pixbuf,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* GtkClipboardURIReceivedFunc:
|
||||
* @clipboard: the #GtkClipboard
|
||||
* @uris: (array zero-terminated=1): the received URIs
|
||||
* @data: (closure): the @user_data supplied to
|
||||
* gtk_clipboard_request_uris().
|
||||
*
|
||||
* A function to be called when the results of
|
||||
* gtk_clipboard_request_uris() are received, or when the request
|
||||
* fails.
|
||||
*
|
||||
* Since: 2.14
|
||||
*/
|
||||
typedef void (* GtkClipboardURIReceivedFunc) (GtkClipboard *clipboard,
|
||||
gchar **uris,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* GtkClipboardTargetsReceivedFunc:
|
||||
* @clipboard: the #GtkClipboard
|
||||
* @atoms: (nullable) (array length=n_atoms): the supported targets,
|
||||
* as array of #GdkAtom, or %NULL if retrieving the data failed.
|
||||
* @n_atoms: the length of the @atoms array.
|
||||
* @data: (closure): the @user_data supplied to
|
||||
* gtk_clipboard_request_targets().
|
||||
*
|
||||
* A function to be called when the results of gtk_clipboard_request_targets()
|
||||
* are received, or when the request fails.
|
||||
*
|
||||
* Since: 2.4
|
||||
*/
|
||||
typedef void (* GtkClipboardTargetsReceivedFunc) (GtkClipboard *clipboard,
|
||||
GdkAtom *atoms,
|
||||
gint n_atoms,
|
||||
gpointer data);
|
||||
|
||||
/* Should these functions have GtkClipboard *clipboard as the first argument?
|
||||
* right now for ClearFunc, you may have trouble determining _which_ clipboard
|
||||
* was cleared, if you reuse your ClearFunc for multiple clipboards.
|
||||
*/
|
||||
/**
|
||||
* GtkClipboardGetFunc:
|
||||
* @clipboard: the #GtkClipboard
|
||||
* @selection_data: a #GtkSelectionData argument in which the requested
|
||||
* data should be stored.
|
||||
* @user_data_or_owner: the @user_data argument passed to
|
||||
* gtk_clipboard_set_with_data(), or the @owner argument passed to
|
||||
* gtk_clipboard_set_with_owner()
|
||||
*
|
||||
* A function that will be called to provide the contents of the selection.
|
||||
* If multiple types of data were advertised, the requested type can
|
||||
* be determined from the @info parameter or by checking the target field
|
||||
* of @selection_data. If the data could successfully be converted into
|
||||
* then it should be stored into the @selection_data object by
|
||||
* calling gtk_selection_data_set() (or related functions such
|
||||
* as gtk_selection_data_set_text()). If no data is set, the requestor
|
||||
* will be informed that the attempt to get the data failed.
|
||||
*/
|
||||
typedef void (* GtkClipboardGetFunc) (GtkClipboard *clipboard,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer user_data_or_owner);
|
||||
|
||||
/**
|
||||
* GtkClipboardClearFunc:
|
||||
* @clipboard: the #GtkClipboard
|
||||
* @user_data_or_owner: the @user_data argument passed to gtk_clipboard_set_with_data(),
|
||||
* or the @owner argument passed to gtk_clipboard_set_with_owner()
|
||||
*
|
||||
* A function that will be called when the contents of the clipboard are changed
|
||||
* or cleared. Once this has called, the @user_data_or_owner argument
|
||||
* will not be used again.
|
||||
*/
|
||||
typedef void (* GtkClipboardClearFunc) (GtkClipboard *clipboard,
|
||||
gpointer user_data_or_owner);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_clipboard_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkClipboard *gtk_clipboard_get_for_display (GdkDisplay *display,
|
||||
GdkAtom selection);
|
||||
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);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_clipboard_set_with_data (GtkClipboard *clipboard,
|
||||
GdkContentFormats *formats,
|
||||
GtkClipboardGetFunc get_func,
|
||||
GtkClipboardClearFunc clear_func,
|
||||
gpointer user_data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_clipboard_set_with_owner (GtkClipboard *clipboard,
|
||||
GdkContentFormats *formats,
|
||||
GtkClipboardGetFunc get_func,
|
||||
GtkClipboardClearFunc clear_func,
|
||||
GObject *owner);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GObject *gtk_clipboard_get_owner (GtkClipboard *clipboard);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_clipboard_clear (GtkClipboard *clipboard);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_clipboard_set_text (GtkClipboard *clipboard,
|
||||
const gchar *text,
|
||||
gint len);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_clipboard_set_image (GtkClipboard *clipboard,
|
||||
GdkPixbuf *pixbuf);
|
||||
GDK_AVAILABLE_IN_3_94
|
||||
void gtk_clipboard_set_surface (GtkClipboard *clipboard,
|
||||
cairo_surface_t *surface);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_clipboard_request_contents (GtkClipboard *clipboard,
|
||||
GdkAtom target,
|
||||
GtkClipboardReceivedFunc callback,
|
||||
gpointer user_data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_clipboard_request_text (GtkClipboard *clipboard,
|
||||
GtkClipboardTextReceivedFunc callback,
|
||||
gpointer user_data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_clipboard_request_image (GtkClipboard *clipboard,
|
||||
GtkClipboardImageReceivedFunc callback,
|
||||
gpointer user_data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_clipboard_request_uris (GtkClipboard *clipboard,
|
||||
GtkClipboardURIReceivedFunc callback,
|
||||
gpointer user_data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_clipboard_request_targets (GtkClipboard *clipboard,
|
||||
GtkClipboardTargetsReceivedFunc callback,
|
||||
gpointer user_data);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkSelectionData *gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,
|
||||
GdkAtom target);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gchar * gtk_clipboard_wait_for_text (GtkClipboard *clipboard);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
guint8 * gtk_clipboard_wait_for_rich_text (GtkClipboard *clipboard,
|
||||
GtkTextBuffer *buffer,
|
||||
GdkAtom *format,
|
||||
gsize *length);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkPixbuf * gtk_clipboard_wait_for_image (GtkClipboard *clipboard);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gchar ** gtk_clipboard_wait_for_uris (GtkClipboard *clipboard);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_clipboard_wait_for_targets (GtkClipboard *clipboard,
|
||||
GdkAtom **formats,
|
||||
gint *n_formats);
|
||||
|
||||
GDK_AVAILABLE_IN_3_94
|
||||
cairo_surface_t * gtk_clipboard_wait_for_surface (GtkClipboard *clipboard);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_clipboard_wait_is_text_available (GtkClipboard *clipboard);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_clipboard_wait_is_image_available (GtkClipboard *clipboard);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_clipboard_wait_is_uris_available (GtkClipboard *clipboard);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_clipboard_wait_is_target_available (GtkClipboard *clipboard,
|
||||
GdkAtom target);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_clipboard_set_can_store (GtkClipboard *clipboard,
|
||||
GdkContentFormats *formats);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_clipboard_store (GtkClipboard *clipboard);
|
||||
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
GdkAtom gtk_clipboard_get_selection (GtkClipboard *clipboard);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CLIPBOARD_H__ */
|
@ -1,91 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2000 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Global clipboard abstraction.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_CLIPBOARD_PRIVATE_H__
|
||||
#define __GTK_CLIPBOARD_PRIVATE_H__
|
||||
|
||||
#include <gtk/gtkclipboard.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_CLIPBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CLIPBOARD, GtkClipboardClass))
|
||||
#define GTK_IS_CLIPBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CLIPBOARD))
|
||||
#define GTK_CLIPBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CLIPBOARD, GtkClipboardClass))
|
||||
|
||||
typedef struct _GtkClipboardClass GtkClipboardClass;
|
||||
|
||||
struct _GtkClipboard
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GdkAtom selection;
|
||||
|
||||
GtkClipboardGetFunc get_func;
|
||||
GtkClipboardClearFunc clear_func;
|
||||
gpointer user_data;
|
||||
gboolean have_owner;
|
||||
|
||||
guint32 timestamp;
|
||||
|
||||
gboolean have_selection;
|
||||
GdkDisplay *display;
|
||||
|
||||
GdkAtom *cached_formats;
|
||||
gint n_cached_formats;
|
||||
|
||||
gulong notify_signal_id;
|
||||
gboolean storing_selection;
|
||||
GMainLoop *store_loop;
|
||||
guint store_timeout;
|
||||
gint n_storable_formats;
|
||||
GdkAtom *storable_formats;
|
||||
};
|
||||
|
||||
struct _GtkClipboardClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* vfuncs */
|
||||
gboolean (* set_contents) (GtkClipboard *clipboard,
|
||||
GdkContentFormats *formats,
|
||||
GtkClipboardGetFunc get_func,
|
||||
GtkClipboardClearFunc clear_func,
|
||||
gpointer user_data,
|
||||
gboolean have_owner);
|
||||
void (* clear) (GtkClipboard *clipboard);
|
||||
void (* request_contents) (GtkClipboard *clipboard,
|
||||
GdkAtom target,
|
||||
GtkClipboardReceivedFunc callback,
|
||||
gpointer user_data);
|
||||
void (* set_can_store) (GtkClipboard *clipboard,
|
||||
GdkContentFormats *formats);
|
||||
void (* store) (GtkClipboard *clipboard);
|
||||
|
||||
/* signals */
|
||||
void (* owner_change) (GtkClipboard *clipboard,
|
||||
GdkEventOwnerChange *event);
|
||||
};
|
||||
void _gtk_clipboard_handle_event (GdkEventOwnerChange *event);
|
||||
|
||||
void _gtk_clipboard_store_all (void);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CLIPBOARD_PRIVATE_H__ */
|
@ -114,7 +114,6 @@
|
||||
|
||||
#include "gtkaccelmapprivate.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkclipboardprivate.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkdebugupdatesprivate.h"
|
||||
#include "gtkdndprivate.h"
|
||||
@ -1071,9 +1070,6 @@ gtk_main_sync (void)
|
||||
g_main_loop_unref (store.store_loop);
|
||||
store.store_loop = NULL;
|
||||
|
||||
/* Try storing all clipboard data we have */
|
||||
_gtk_clipboard_store_all ();
|
||||
|
||||
/* Synchronize the recent manager singleton */
|
||||
_gtk_recent_manager_sync ();
|
||||
}
|
||||
@ -1689,10 +1685,7 @@ gtk_main_do_event (GdkEvent *event)
|
||||
GList *tmp_list;
|
||||
|
||||
if (event->type == GDK_OWNER_CHANGE)
|
||||
{
|
||||
_gtk_clipboard_handle_event (&event->owner_change);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
/* Find the widget which got the event. We store the widget
|
||||
* in the user_data field of GdkWindow's. Ignore the event
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "gtkcontainer.h"
|
||||
#include "gtkaccelmapprivate.h"
|
||||
#include "gtkaccelgroupprivate.h"
|
||||
#include "gtkclipboard.h"
|
||||
#include "gtkcssfiltervalueprivate.h"
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtkcssshadowsvalueprivate.h"
|
||||
@ -12423,36 +12422,6 @@ gtk_widget_get_primary_clipboard (GtkWidget *widget)
|
||||
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
|
||||
* to use. %GDK_SELECTION_CLIPBOARD gives the
|
||||
* default clipboard. Another common value
|
||||
* is %GDK_SELECTION_PRIMARY, which gives
|
||||
* the primary X selection.
|
||||
*
|
||||
* Returns the clipboard object for the given selection to
|
||||
* be used with @widget. @widget must have a #GdkDisplay
|
||||
* associated with it, so must be attached to a toplevel
|
||||
* window.
|
||||
*
|
||||
* Returns: (transfer none): the appropriate clipboard object. If no
|
||||
* clipboard already exists, a new one will
|
||||
* be created. Once a clipboard object has
|
||||
* been created, it is persistent for all time.
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
GtkClipboard *
|
||||
gtk_widget_get_old_clipboard (GtkWidget *widget, GdkAtom selection)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return gtk_clipboard_get_for_display (gtk_widget_get_display (widget),
|
||||
selection);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_list_mnemonic_labels:
|
||||
* @widget: a #GtkWidget
|
||||
|
@ -786,9 +786,6 @@ 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);
|
||||
|
||||
|
||||
/* Expand flags and related support */
|
||||
|
@ -413,7 +413,6 @@ gtk_public_headers = files([
|
||||
'gtkcellview.h',
|
||||
'gtkcheckbutton.h',
|
||||
'gtkcheckmenuitem.h',
|
||||
'gtkclipboard.h',
|
||||
'gtkcolorbutton.h',
|
||||
'gtkcolorchooser.h',
|
||||
'gtkcolorchooserdialog.h',
|
||||
@ -707,12 +706,10 @@ gtk_use_wayland_or_x11_c_sources = files([
|
||||
|
||||
if quartz_enabled
|
||||
dnd_sources = files([
|
||||
'gtkclipboard-quartz.c',
|
||||
'gtkdnd-quartz.c',
|
||||
])
|
||||
else
|
||||
dnd_sources = files([
|
||||
'gtkclipboard.c',
|
||||
'gtkdnd.c',
|
||||
'gtkdragdest.c',
|
||||
])
|
||||
|
@ -88,8 +88,6 @@ gtk/gtkcellview.c
|
||||
gtk/gtkcenterbox.c
|
||||
gtk/gtkcheckbutton.c
|
||||
gtk/gtkcheckmenuitem.c
|
||||
gtk/gtkclipboard.c
|
||||
gtk/gtkclipboard-quartz.c
|
||||
gtk/gtkcolorbutton.c
|
||||
gtk/gtkcolorchooser.c
|
||||
gtk/gtkcolorchooserdialog.c
|
||||
|
@ -88,8 +88,6 @@ gtk/gtkcellview.c
|
||||
gtk/gtkcenterbox.c
|
||||
gtk/gtkcheckbutton.c
|
||||
gtk/gtkcheckmenuitem.c
|
||||
gtk/gtkclipboard.c
|
||||
gtk/gtkclipboard-quartz.c
|
||||
gtk/gtkcolorbutton.c
|
||||
gtk/gtkcolorchooser.c
|
||||
gtk/gtkcolorchooserdialog.c
|
||||
|
@ -25,7 +25,6 @@ gtk_tests = [
|
||||
['testbuttons'],
|
||||
['testcairo'],
|
||||
['testcalendar'],
|
||||
['testclipboard'],
|
||||
['testclipboard2'],
|
||||
['testcolorchooser'],
|
||||
['testcolorchooser2'],
|
||||
|
@ -1,140 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
GtkClipboard *clipboard;
|
||||
GtkWidget *image;
|
||||
GtkWidget *label;
|
||||
|
||||
#define SIZE 256.
|
||||
|
||||
static void
|
||||
image_request_cb (GtkClipboard *clipboard,
|
||||
GdkPixbuf *pixbuf,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPixbuf *copy;
|
||||
int height;
|
||||
int width;
|
||||
gdouble factor;
|
||||
char *str;
|
||||
|
||||
if (pixbuf != NULL)
|
||||
{
|
||||
height = gdk_pixbuf_get_height (pixbuf);
|
||||
width = gdk_pixbuf_get_width (pixbuf);
|
||||
|
||||
factor = MAX ((SIZE / height), (SIZE / width));
|
||||
|
||||
copy = gdk_pixbuf_scale_simple (pixbuf, width * factor, height * factor, GDK_INTERP_BILINEAR);
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (image), copy);
|
||||
g_object_unref (copy);
|
||||
str = g_strdup_printf ("<b>Image</b> %d \342\234\225 %d", width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
str = g_strdup ("<b>No image data</b>");
|
||||
}
|
||||
gtk_label_set_markup (GTK_LABEL (label), str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
static void
|
||||
update_display (void)
|
||||
{
|
||||
gtk_clipboard_request_image (clipboard, image_request_cb, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
on_owner_change (GtkClipboard *clipboard,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
update_display ();
|
||||
}
|
||||
|
||||
static void
|
||||
on_response (GtkDialog *dialog,
|
||||
gint response_id,
|
||||
gpointer user_data)
|
||||
{
|
||||
switch (response_id)
|
||||
{
|
||||
case 0:
|
||||
/* copy large */
|
||||
{
|
||||
GtkIconTheme *theme;
|
||||
GdkPixbuf *pixbuf;
|
||||
theme = gtk_icon_theme_get_default ();
|
||||
pixbuf = gtk_icon_theme_load_icon (theme, "utilities-terminal", 1600, 0, NULL);
|
||||
g_assert_nonnull (pixbuf);
|
||||
gtk_clipboard_set_image (clipboard, pixbuf);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
/* copy small */
|
||||
{
|
||||
GtkIconTheme *theme;
|
||||
GdkPixbuf *pixbuf;
|
||||
theme = gtk_icon_theme_get_default ();
|
||||
pixbuf = gtk_icon_theme_load_icon (theme, "utilities-terminal", 48, 0, NULL);
|
||||
g_assert_nonnull (pixbuf);
|
||||
gtk_clipboard_set_image (clipboard, pixbuf);
|
||||
}
|
||||
break;
|
||||
case GTK_RESPONSE_CLOSE:
|
||||
default:
|
||||
gtk_main_quit ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
gtk_init ();
|
||||
|
||||
window = gtk_dialog_new_with_buttons ("Clipboard",
|
||||
NULL,
|
||||
0,
|
||||
"Copy Large", 0,
|
||||
"Copy Small", 1,
|
||||
"_Close", GTK_RESPONSE_CLOSE,
|
||||
NULL);
|
||||
|
||||
image = gtk_image_new ();
|
||||
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (window))), image);
|
||||
label = gtk_label_new ("No data found");
|
||||
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (window))), label);
|
||||
|
||||
g_signal_connect (window, "response", G_CALLBACK (on_response), NULL);
|
||||
|
||||
clipboard = gtk_clipboard_get_for_display (gtk_widget_get_display (window),
|
||||
GDK_SELECTION_CLIPBOARD);
|
||||
g_signal_connect (clipboard, "owner-change", G_CALLBACK (on_owner_change), NULL);
|
||||
|
||||
update_display ();
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2013 Benjamin Otte <otte@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define SOME_TEXT "Hello World"
|
||||
#define TARGET_TEXT "UTF8_STRING"
|
||||
|
||||
static void
|
||||
test_text (void)
|
||||
{
|
||||
GtkClipboard *clipboard = gtk_clipboard_get_for_display (gdk_display_get_default (), GDK_SELECTION_CLIPBOARD);
|
||||
char *text;
|
||||
|
||||
gtk_clipboard_set_text (clipboard, SOME_TEXT, -1);
|
||||
text = gtk_clipboard_wait_for_text (clipboard);
|
||||
g_assert_cmpstr (text, ==, SOME_TEXT);
|
||||
g_free (text);
|
||||
|
||||
gtk_clipboard_set_text (clipboard, SOME_TEXT SOME_TEXT, strlen (SOME_TEXT));
|
||||
text = gtk_clipboard_wait_for_text (clipboard);
|
||||
g_assert_cmpstr (text, ==, SOME_TEXT);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
test_with_data_get (GtkClipboard *clipboard,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer user_data_or_owner)
|
||||
{
|
||||
gboolean success;
|
||||
|
||||
success = gtk_selection_data_set_text (selection_data, SOME_TEXT, -1);
|
||||
g_assert (success);
|
||||
}
|
||||
|
||||
static void
|
||||
test_with_data_got (GtkClipboard *clipboard,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
guchar *text;
|
||||
|
||||
text = gtk_selection_data_get_text (selection_data);
|
||||
g_assert_cmpstr ((char*)text, ==, SOME_TEXT);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
test_with_data (void)
|
||||
{
|
||||
GtkClipboard *clipboard = gtk_clipboard_get_for_display (gdk_display_get_default (), GDK_SELECTION_CLIPBOARD);
|
||||
const char *entries[] = { TARGET_TEXT };
|
||||
GdkContentFormats *targets;
|
||||
|
||||
targets = gdk_content_formats_new (entries, G_N_ELEMENTS(entries));
|
||||
gtk_clipboard_set_with_data (clipboard, targets, test_with_data_get, NULL, NULL);
|
||||
gdk_content_formats_unref (targets);
|
||||
gtk_clipboard_request_contents (clipboard, gdk_atom_intern (TARGET_TEXT, FALSE), test_with_data_got, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
gtk_test_init (&argc, &argv);
|
||||
|
||||
g_test_add_func ("/clipboard/test_text", test_text);
|
||||
g_test_add_func ("/clipboard/test_with_data", test_with_data);
|
||||
|
||||
return g_test_run();
|
||||
}
|
@ -16,7 +16,6 @@ tests = [
|
||||
['builderparser'],
|
||||
['cellarea'],
|
||||
['check-icon-names'],
|
||||
['clipboard'],
|
||||
['cssprovider'],
|
||||
['entry'],
|
||||
['firefox-stylecontext'],
|
||||
|
Loading…
Reference in New Issue
Block a user