2008-07-01 22:57:50 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
1997-11-24 22:37:52 +00:00
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
* 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
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
|
|
|
|
1999-02-24 07:37:18 +00:00
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
add -DGTK_DISABLE_DEPRECATED. #undef it at the top of gtktypebuiltins.c.
Tue Nov 19 17:05:51 2002 Manish Singh <yosh@gimp.org>
* gtk/Makefile.am: add -DGTK_DISABLE_DEPRECATED. #undef it at the
top of gtktypebuiltins.c.
* gtk/gtkclist.c
* gtk/gtkcombo.c
* gtk/gtkctree.c
* gtk/gtklist.c
* gtk/gtklistitem.c
* gtk/gtkoldeditable.c
* gtk/gtkpixmap.c
* gtk/gtkpreview.c
* gtk/gtksignal.c
* gtk/gtktext.c
* gtk/gtktipsquery.c
* gtk/gtktree.c
* gtk/gtktreeitem.c
* gtk/gtktypeutils.c: #undef GTK_DISABLE_DEPRECATED, deprecated widgets
and compat code.
* gtk/gtkcolorsel.c: move gtk_color_selection_set_color implementation
to set_color_internal, and use that. The deprecated function now
merely wraps it.
* gtk/gtkfontsel.c: same as above, except with
gtk_font_selection_get_font.
* gtk/gtknotebook.c: same as above, except with
gtk_notebook_set_homogeneous, and gtk_notebook_set_tab_{border,
hborder,vborder}.
* gtk/gtkprogressbar.c: same as above, except with
gtk_progress_bar_set_{bar_stype,discrete_blocks,activity_step,
activity_blocks}.
* gtk/gtkstyle.c: same as above, except with gtk_style_get_font.
* gtk/gtkwidget.c: same as above, except with gtk_widget_set_usize.
* gtk/gtkitemfactory.h: declare compatibility functions for deprecated
GtkMenuFactory stuff if GTK_COMPILATION, since they are used
internally by the compat code.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): remove
use of deprecated gtk_check_menu_item_set_show_toggle (it is a noop
now).
* gtk/gtkmain.c: replaced deprecated GTK_TYPE_* with G_TYPE_*.
* gtk/gtkobject.c: replaced various deprecated functions. In set and
get_property, use g_object_{set,get}_data with "user_data" instead
of gtk_object_{set,get}_user_data.
* gtk/gtkprogress.h: API declared if GTK_COMPILATION
* gtk/gtkprogress.c: port get_type to GObject API.
* gtk/gtktypeutils.h: declare GtkArg stuff and gtk_type_init,
if GTK_COMPILATION.
* gtk/gtkwidget.c: define gtk_widget_queue_clear in terms of
gtk_widget_queue_draw instead of the other way around.
* tests/Makefile.am: define -DGTK_DISABLE_DEPRECATED
* tests/testgtk.c
* tests/testselection.c
* tests/testsocket.c: #undef GTK_DISABLE_DEPRECATED, makes use of
deprecated stuff.
2002-11-20 01:07:33 +00:00
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
1998-06-09 10:33:56 +00:00
|
|
|
#include <stdio.h>
|
1998-01-03 05:46:58 +00:00
|
|
|
#include <string.h>
|
2001-04-03 18:48:46 +00:00
|
|
|
#include "gtk/gtk.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
SEL_TYPE_NONE,
|
|
|
|
APPLE_PICT,
|
|
|
|
ATOM,
|
|
|
|
ATOM_PAIR,
|
|
|
|
BITMAP,
|
|
|
|
C_STRING,
|
|
|
|
COLORMAP,
|
|
|
|
COMPOUND_TEXT,
|
|
|
|
DRAWABLE,
|
|
|
|
INTEGER,
|
|
|
|
PIXEL,
|
|
|
|
PIXMAP,
|
|
|
|
SPAN,
|
|
|
|
STRING,
|
|
|
|
TEXT,
|
|
|
|
WINDOW,
|
1998-01-03 05:46:58 +00:00
|
|
|
LAST_SEL_TYPE
|
1997-11-24 22:37:52 +00:00
|
|
|
} SelType;
|
|
|
|
|
|
|
|
GdkAtom seltypes[LAST_SEL_TYPE];
|
|
|
|
|
|
|
|
typedef struct _Target {
|
|
|
|
gchar *target_name;
|
|
|
|
SelType type;
|
|
|
|
GdkAtom target;
|
|
|
|
gint format;
|
|
|
|
} Target;
|
|
|
|
|
|
|
|
/* The following is a list of all the selection targets defined
|
|
|
|
in the ICCCM */
|
|
|
|
|
|
|
|
static Target targets[] = {
|
2004-10-28 15:00:05 +00:00
|
|
|
{ "ADOBE_PORTABLE_DOCUMENT_FORMAT", STRING, NULL, 8 },
|
|
|
|
{ "APPLE_PICT", APPLE_PICT, NULL, 8 },
|
|
|
|
{ "BACKGROUND", PIXEL, NULL, 32 },
|
|
|
|
{ "BITMAP", BITMAP, NULL, 32 },
|
|
|
|
{ "CHARACTER_POSITION", SPAN, NULL, 32 },
|
|
|
|
{ "CLASS", TEXT, NULL, 8 },
|
|
|
|
{ "CLIENT_WINDOW", WINDOW, NULL, 32 },
|
|
|
|
{ "COLORMAP", COLORMAP, NULL, 32 },
|
|
|
|
{ "COLUMN_NUMBER", SPAN, NULL, 32 },
|
|
|
|
{ "COMPOUND_TEXT", COMPOUND_TEXT, NULL, 8 },
|
Added a modular client-message-filter mechanism, that is used for the DND
Sun Oct 18 18:16:39 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdk.c gdkprivate.h: Added a modular client-message-filter
mechanism, that is used for the DND messages.
Removed all the old DND code.
* gdk/gdkcolormap.c gdk/gdkcolormap.h: Add a function to
get the visual of a given colormap.
* gtk/gtkcolorsel.c: Conversion to new DND, drag
a color-swatch.
* gdk/gdk.h gdk/gdkdnd.c: The low-level
X oriented portions of drag and drop protocols.
Sending and receiving client messages, and navigating
window trees.
* gdk/gdkimage.c: added a gdk_flush() when destroying
SHM images to hopefully make it more likely that
X will gracefully handle the segment being destroyed.
* gdk/gdkprivate.h gtk/gtkdebug.h: Add new
DND debugging flags.
* gtk/gtkeditable.[ch]: Updates for the selection handling
changes.
* gtk/gtkselection.[ch]: Added GtkTargetList, a
refcounted data structure for keeping track of lists
of GdkAtom + information. Removed selection_handler_add
in favor of a "drag_data_get" signal.
* gtk/gtkdnd.[ch] gtk/gtk.h: New files - highlevel (event loop
dependent) parts of the DND protocols, display of drag icons,
drag-under highlighting, and the "default handlers".
* gtk/gtkinvisible.[ch]: New widget - InputOnly offscreen
windows that are used for reliable pointer grabs and
selection handling in the DND code.
* gtk/testdnd.c: New test program for new DND. (Old
DND tests in testgtk still need to be converted.)
* gtk/testselection.c: Use the new selection API.
* docs/dnd_internals: Start at describing how
all the new code works inside.
* docs/Changes-1.2.txt: New file describing source-incompatible
changes in GTK+-1.2.
Sat Oct 17 22:50:34 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkwindow.c (gdk_window_remove_filter): Free
the right list node.
* gdk/gdkwindow.c (gdk_window_init): Add gdk_root_parent
to the XID table so we can receive events on it.
Wed Oct 14 12:57:40 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c gdk/gdk.h (gdk_event_get_time): New function
to get the timestamp from a generic event.
Fri Oct 9 13:16:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_add_events): Added function
that safely adds additional events to a widget's event
mask, even if the widget has previously been realized.
(We can do this, but not remove events from the event
mask).
Fri Oct 2 17:35:35 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_property_get): Allow type == 0,
for AnyPropertyType.
Fri Oct 2 10:32:21 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_atom_intern): Add client-local
hashing.
Thu Sep 24 20:33:54 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_send_clientmessage_toall): serial
isn't a timestamp.
Thu Sep 17 14:23:03 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Removed printing
of unknown window lookup warnings. (Made it
a GDK_NOTE) - they happen in many circumstances.
1998-10-18 22:51:24 +00:00
|
|
|
/* { "DELETE", "NULL", 0, ? }, */
|
2004-10-28 15:00:05 +00:00
|
|
|
{ "DRAWABLE", DRAWABLE, NULL, 32 },
|
|
|
|
{ "ENCAPSULATED_POSTSCRIPT", STRING, NULL, 8 },
|
|
|
|
{ "ENCAPSULATED_POSTSCRIPT_INTERCHANGE", STRING, NULL, 8 },
|
|
|
|
{ "FILE_NAME", TEXT, NULL, 8 },
|
|
|
|
{ "FOREGROUND", PIXEL, NULL, 32 },
|
|
|
|
{ "HOST_NAME", TEXT, NULL, 8 },
|
1997-11-24 22:37:52 +00:00
|
|
|
/* { "INSERT_PROPERTY", "NULL", 0, ? NULL }, */
|
|
|
|
/* { "INSERT_SELECTION", "NULL", 0, ? NULL }, */
|
2004-10-28 15:00:05 +00:00
|
|
|
{ "LENGTH", INTEGER, NULL, 32 },
|
|
|
|
{ "LINE_NUMBER", SPAN, NULL, 32 },
|
|
|
|
{ "LIST_LENGTH", INTEGER, NULL, 32 },
|
|
|
|
{ "MODULE", TEXT, NULL, 8 },
|
Added a modular client-message-filter mechanism, that is used for the DND
Sun Oct 18 18:16:39 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdk.c gdkprivate.h: Added a modular client-message-filter
mechanism, that is used for the DND messages.
Removed all the old DND code.
* gdk/gdkcolormap.c gdk/gdkcolormap.h: Add a function to
get the visual of a given colormap.
* gtk/gtkcolorsel.c: Conversion to new DND, drag
a color-swatch.
* gdk/gdk.h gdk/gdkdnd.c: The low-level
X oriented portions of drag and drop protocols.
Sending and receiving client messages, and navigating
window trees.
* gdk/gdkimage.c: added a gdk_flush() when destroying
SHM images to hopefully make it more likely that
X will gracefully handle the segment being destroyed.
* gdk/gdkprivate.h gtk/gtkdebug.h: Add new
DND debugging flags.
* gtk/gtkeditable.[ch]: Updates for the selection handling
changes.
* gtk/gtkselection.[ch]: Added GtkTargetList, a
refcounted data structure for keeping track of lists
of GdkAtom + information. Removed selection_handler_add
in favor of a "drag_data_get" signal.
* gtk/gtkdnd.[ch] gtk/gtk.h: New files - highlevel (event loop
dependent) parts of the DND protocols, display of drag icons,
drag-under highlighting, and the "default handlers".
* gtk/gtkinvisible.[ch]: New widget - InputOnly offscreen
windows that are used for reliable pointer grabs and
selection handling in the DND code.
* gtk/testdnd.c: New test program for new DND. (Old
DND tests in testgtk still need to be converted.)
* gtk/testselection.c: Use the new selection API.
* docs/dnd_internals: Start at describing how
all the new code works inside.
* docs/Changes-1.2.txt: New file describing source-incompatible
changes in GTK+-1.2.
Sat Oct 17 22:50:34 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkwindow.c (gdk_window_remove_filter): Free
the right list node.
* gdk/gdkwindow.c (gdk_window_init): Add gdk_root_parent
to the XID table so we can receive events on it.
Wed Oct 14 12:57:40 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c gdk/gdk.h (gdk_event_get_time): New function
to get the timestamp from a generic event.
Fri Oct 9 13:16:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_add_events): Added function
that safely adds additional events to a widget's event
mask, even if the widget has previously been realized.
(We can do this, but not remove events from the event
mask).
Fri Oct 2 17:35:35 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_property_get): Allow type == 0,
for AnyPropertyType.
Fri Oct 2 10:32:21 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_atom_intern): Add client-local
hashing.
Thu Sep 24 20:33:54 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_send_clientmessage_toall): serial
isn't a timestamp.
Thu Sep 17 14:23:03 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Removed printing
of unknown window lookup warnings. (Made it
a GDK_NOTE) - they happen in many circumstances.
1998-10-18 22:51:24 +00:00
|
|
|
/* { "MULTIPLE", "ATOM_PAIR", 0, 32 }, */
|
2004-10-28 15:00:05 +00:00
|
|
|
{ "NAME", TEXT, NULL, 8 },
|
|
|
|
{ "ODIF", TEXT, NULL, 8 },
|
|
|
|
{ "OWNER_OS", TEXT, NULL, 8 },
|
|
|
|
{ "PIXMAP", PIXMAP, NULL, 32 },
|
|
|
|
{ "POSTSCRIPT", STRING, NULL, 8 },
|
|
|
|
{ "PROCEDURE", TEXT, NULL, 8 },
|
|
|
|
{ "PROCESS", INTEGER, NULL, 32 },
|
|
|
|
{ "STRING", STRING, NULL, 8 },
|
|
|
|
{ "TARGETS", ATOM, NULL, 32 },
|
|
|
|
{ "TASK", INTEGER, NULL, 32 },
|
|
|
|
{ "TEXT", TEXT, NULL, 8 },
|
|
|
|
{ "TIMESTAMP", INTEGER, NULL, 32 },
|
|
|
|
{ "USER", TEXT, NULL, 8 },
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int num_targets = sizeof(targets)/sizeof(Target);
|
|
|
|
|
|
|
|
static int have_selection = FALSE;
|
|
|
|
|
2002-02-25 05:12:14 +00:00
|
|
|
GtkWidget *selection_widget;
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkWidget *selection_text;
|
|
|
|
GtkWidget *selection_button;
|
|
|
|
GString *selection_string = NULL;
|
|
|
|
|
|
|
|
static void
|
1998-05-03 22:41:32 +00:00
|
|
|
init_atoms (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2017-11-15 17:13:31 +00:00
|
|
|
seltypes[SEL_TYPE_NONE] = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
seltypes[APPLE_PICT] = gdk_atom_intern ("APPLE_PICT",FALSE);
|
|
|
|
seltypes[ATOM] = gdk_atom_intern ("ATOM",FALSE);
|
|
|
|
seltypes[ATOM_PAIR] = gdk_atom_intern ("ATOM_PAIR",FALSE);
|
|
|
|
seltypes[BITMAP] = gdk_atom_intern ("BITMAP",FALSE);
|
|
|
|
seltypes[C_STRING] = gdk_atom_intern ("C_STRING",FALSE);
|
|
|
|
seltypes[COLORMAP] = gdk_atom_intern ("COLORMAP",FALSE);
|
|
|
|
seltypes[COMPOUND_TEXT] = gdk_atom_intern ("COMPOUND_TEXT",FALSE);
|
|
|
|
seltypes[DRAWABLE] = gdk_atom_intern ("DRAWABLE",FALSE);
|
|
|
|
seltypes[INTEGER] = gdk_atom_intern ("INTEGER",FALSE);
|
|
|
|
seltypes[PIXEL] = gdk_atom_intern ("PIXEL",FALSE);
|
|
|
|
seltypes[PIXMAP] = gdk_atom_intern ("PIXMAP",FALSE);
|
|
|
|
seltypes[SPAN] = gdk_atom_intern ("SPAN",FALSE);
|
|
|
|
seltypes[STRING] = gdk_atom_intern ("STRING",FALSE);
|
|
|
|
seltypes[TEXT] = gdk_atom_intern ("TEXT",FALSE);
|
|
|
|
seltypes[WINDOW] = gdk_atom_intern ("WINDOW",FALSE);
|
|
|
|
|
|
|
|
for (i=0; i<num_targets; i++)
|
|
|
|
targets[i].target = gdk_atom_intern (targets[i].target_name, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
selection_toggled (GtkWidget *widget)
|
|
|
|
{
|
2010-10-19 16:46:40 +00:00
|
|
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2002-03-04 22:19:47 +00:00
|
|
|
have_selection = gtk_selection_owner_set (selection_widget,
|
1997-11-24 22:37:52 +00:00
|
|
|
GDK_SELECTION_PRIMARY,
|
|
|
|
GDK_CURRENT_TIME);
|
|
|
|
if (!have_selection)
|
1999-01-11 18:49:54 +00:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), FALSE);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (have_selection)
|
|
|
|
{
|
2010-08-15 22:32:44 +00:00
|
|
|
if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == gtk_widget_get_window (widget))
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY,
|
|
|
|
GDK_CURRENT_TIME);
|
|
|
|
have_selection = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Added a modular client-message-filter mechanism, that is used for the DND
Sun Oct 18 18:16:39 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdk.c gdkprivate.h: Added a modular client-message-filter
mechanism, that is used for the DND messages.
Removed all the old DND code.
* gdk/gdkcolormap.c gdk/gdkcolormap.h: Add a function to
get the visual of a given colormap.
* gtk/gtkcolorsel.c: Conversion to new DND, drag
a color-swatch.
* gdk/gdk.h gdk/gdkdnd.c: The low-level
X oriented portions of drag and drop protocols.
Sending and receiving client messages, and navigating
window trees.
* gdk/gdkimage.c: added a gdk_flush() when destroying
SHM images to hopefully make it more likely that
X will gracefully handle the segment being destroyed.
* gdk/gdkprivate.h gtk/gtkdebug.h: Add new
DND debugging flags.
* gtk/gtkeditable.[ch]: Updates for the selection handling
changes.
* gtk/gtkselection.[ch]: Added GtkTargetList, a
refcounted data structure for keeping track of lists
of GdkAtom + information. Removed selection_handler_add
in favor of a "drag_data_get" signal.
* gtk/gtkdnd.[ch] gtk/gtk.h: New files - highlevel (event loop
dependent) parts of the DND protocols, display of drag icons,
drag-under highlighting, and the "default handlers".
* gtk/gtkinvisible.[ch]: New widget - InputOnly offscreen
windows that are used for reliable pointer grabs and
selection handling in the DND code.
* gtk/testdnd.c: New test program for new DND. (Old
DND tests in testgtk still need to be converted.)
* gtk/testselection.c: Use the new selection API.
* docs/dnd_internals: Start at describing how
all the new code works inside.
* docs/Changes-1.2.txt: New file describing source-incompatible
changes in GTK+-1.2.
Sat Oct 17 22:50:34 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkwindow.c (gdk_window_remove_filter): Free
the right list node.
* gdk/gdkwindow.c (gdk_window_init): Add gdk_root_parent
to the XID table so we can receive events on it.
Wed Oct 14 12:57:40 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c gdk/gdk.h (gdk_event_get_time): New function
to get the timestamp from a generic event.
Fri Oct 9 13:16:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_add_events): Added function
that safely adds additional events to a widget's event
mask, even if the widget has previously been realized.
(We can do this, but not remove events from the event
mask).
Fri Oct 2 17:35:35 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_property_get): Allow type == 0,
for AnyPropertyType.
Fri Oct 2 10:32:21 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_atom_intern): Add client-local
hashing.
Thu Sep 24 20:33:54 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_send_clientmessage_toall): serial
isn't a timestamp.
Thu Sep 17 14:23:03 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Removed printing
of unknown window lookup warnings. (Made it
a GDK_NOTE) - they happen in many circumstances.
1998-10-18 22:51:24 +00:00
|
|
|
selection_get (GtkWidget *widget,
|
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
guint time,
|
|
|
|
gpointer data)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
guchar *buffer;
|
|
|
|
gint len;
|
|
|
|
|
|
|
|
if (!selection_string)
|
|
|
|
{
|
|
|
|
buffer = NULL;
|
|
|
|
len = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-03-18 21:11:04 +00:00
|
|
|
buffer = (guchar *)selection_string->str;
|
1997-11-24 22:37:52 +00:00
|
|
|
len = selection_string->len;
|
|
|
|
}
|
Added a modular client-message-filter mechanism, that is used for the DND
Sun Oct 18 18:16:39 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdk.c gdkprivate.h: Added a modular client-message-filter
mechanism, that is used for the DND messages.
Removed all the old DND code.
* gdk/gdkcolormap.c gdk/gdkcolormap.h: Add a function to
get the visual of a given colormap.
* gtk/gtkcolorsel.c: Conversion to new DND, drag
a color-swatch.
* gdk/gdk.h gdk/gdkdnd.c: The low-level
X oriented portions of drag and drop protocols.
Sending and receiving client messages, and navigating
window trees.
* gdk/gdkimage.c: added a gdk_flush() when destroying
SHM images to hopefully make it more likely that
X will gracefully handle the segment being destroyed.
* gdk/gdkprivate.h gtk/gtkdebug.h: Add new
DND debugging flags.
* gtk/gtkeditable.[ch]: Updates for the selection handling
changes.
* gtk/gtkselection.[ch]: Added GtkTargetList, a
refcounted data structure for keeping track of lists
of GdkAtom + information. Removed selection_handler_add
in favor of a "drag_data_get" signal.
* gtk/gtkdnd.[ch] gtk/gtk.h: New files - highlevel (event loop
dependent) parts of the DND protocols, display of drag icons,
drag-under highlighting, and the "default handlers".
* gtk/gtkinvisible.[ch]: New widget - InputOnly offscreen
windows that are used for reliable pointer grabs and
selection handling in the DND code.
* gtk/testdnd.c: New test program for new DND. (Old
DND tests in testgtk still need to be converted.)
* gtk/testselection.c: Use the new selection API.
* docs/dnd_internals: Start at describing how
all the new code works inside.
* docs/Changes-1.2.txt: New file describing source-incompatible
changes in GTK+-1.2.
Sat Oct 17 22:50:34 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkwindow.c (gdk_window_remove_filter): Free
the right list node.
* gdk/gdkwindow.c (gdk_window_init): Add gdk_root_parent
to the XID table so we can receive events on it.
Wed Oct 14 12:57:40 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c gdk/gdk.h (gdk_event_get_time): New function
to get the timestamp from a generic event.
Fri Oct 9 13:16:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_add_events): Added function
that safely adds additional events to a widget's event
mask, even if the widget has previously been realized.
(We can do this, but not remove events from the event
mask).
Fri Oct 2 17:35:35 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_property_get): Allow type == 0,
for AnyPropertyType.
Fri Oct 2 10:32:21 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_atom_intern): Add client-local
hashing.
Thu Sep 24 20:33:54 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_send_clientmessage_toall): serial
isn't a timestamp.
Thu Sep 17 14:23:03 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Removed printing
of unknown window lookup warnings. (Made it
a GDK_NOTE) - they happen in many circumstances.
1998-10-18 22:51:24 +00:00
|
|
|
|
2017-11-16 21:50:37 +00:00
|
|
|
gtk_selection_data_set (selection_data,
|
|
|
|
gtk_selection_data_get_target (selection_data),
|
|
|
|
8, buffer, len);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
selection_clear (GtkWidget *widget, GdkEventSelection *event)
|
|
|
|
{
|
|
|
|
have_selection = FALSE;
|
2002-03-04 22:19:47 +00:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(selection_button), FALSE);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
|
|
|
stringify_atom (guchar *data, gint *position)
|
|
|
|
{
|
|
|
|
gchar *str = gdk_atom_name (*(GdkAtom *)(data+*position));
|
|
|
|
*position += sizeof(GdkAtom);
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
|
|
|
stringify_text (guchar *data, gint *position)
|
|
|
|
{
|
|
|
|
gchar *str = g_strdup ((gchar *)(data+*position));
|
|
|
|
*position += strlen (str) + 1;
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
|
|
|
stringify_xid (guchar *data, gint *position)
|
|
|
|
{
|
|
|
|
gchar buffer[20];
|
|
|
|
gchar *str;
|
|
|
|
|
|
|
|
sprintf(buffer,"0x%x",*(guint32 *)(data+*position));
|
|
|
|
str = g_strdup (buffer);
|
|
|
|
|
|
|
|
*position += sizeof(guint32);
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
|
|
|
stringify_integer (guchar *data, gint *position)
|
|
|
|
{
|
|
|
|
gchar buffer[20];
|
|
|
|
gchar *str;
|
|
|
|
|
|
|
|
sprintf(buffer,"%d",*(int *)(data+*position));
|
|
|
|
str = g_strdup (buffer);
|
|
|
|
|
|
|
|
*position += sizeof(int);
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
|
|
|
stringify_span (guchar *data, gint *position)
|
|
|
|
{
|
|
|
|
gchar buffer[42];
|
|
|
|
gchar *str;
|
|
|
|
|
|
|
|
sprintf(buffer,"%d - %d",((int *)(data+*position))[0],
|
|
|
|
((int *)(data+*position))[1]);
|
|
|
|
str = g_strdup (buffer);
|
|
|
|
|
|
|
|
*position += 2*sizeof(int);
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-12-15 23:47:45 +00:00
|
|
|
selection_received (GtkWidget *widget, GtkSelectionData *selection_data)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
int position;
|
|
|
|
int i;
|
|
|
|
SelType seltype;
|
|
|
|
char *str;
|
2010-12-15 23:47:45 +00:00
|
|
|
guchar *data;
|
2010-03-31 14:16:26 +00:00
|
|
|
GtkTextBuffer *buffer;
|
2010-12-15 23:47:45 +00:00
|
|
|
GdkAtom type;
|
|
|
|
|
|
|
|
if (gtk_selection_data_get_length (selection_data) < 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_print("Error retrieving selection\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-12-15 23:47:45 +00:00
|
|
|
type = gtk_selection_data_get_data_type (selection_data);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
seltype = SEL_TYPE_NONE;
|
|
|
|
for (i=0; i<LAST_SEL_TYPE; i++)
|
|
|
|
{
|
2010-12-15 23:47:45 +00:00
|
|
|
if (seltypes[i] == type)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
seltype = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (seltype == SEL_TYPE_NONE)
|
|
|
|
{
|
2010-12-15 23:47:45 +00:00
|
|
|
char *name = gdk_atom_name (type);
|
Fix problem with g_return_if_fail return value.
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: Move over the
virtual atom code from the gdk-multihead branch, removing the per-display
part. Virtualizing atoms needs to be done now to prevent compat
breakage in direct Xlib accessing code in the future. (#62208)
* gdk/x11/gdkx.h: gdk/gdk/x11/gdkproperty-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
2001-10-22 04:34:42 +00:00
|
|
|
g_print("Don't know how to handle type: %s\n",
|
|
|
|
name?name:"<unknown>");
|
1997-11-24 22:37:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selection_string != NULL)
|
|
|
|
g_string_free (selection_string, TRUE);
|
|
|
|
|
|
|
|
selection_string = g_string_new (NULL);
|
|
|
|
|
2010-03-31 14:16:26 +00:00
|
|
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (selection_text));
|
|
|
|
gtk_text_buffer_set_text (buffer, "", -1);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
position = 0;
|
2010-12-15 23:47:45 +00:00
|
|
|
while (position < gtk_selection_data_get_length (selection_data))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2010-12-15 23:47:45 +00:00
|
|
|
data = (guchar *) gtk_selection_data_get_data (selection_data);
|
1997-11-24 22:37:52 +00:00
|
|
|
switch (seltype)
|
|
|
|
{
|
|
|
|
case ATOM:
|
2010-12-15 23:47:45 +00:00
|
|
|
str = stringify_atom (data, &position);
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
case COMPOUND_TEXT:
|
|
|
|
case STRING:
|
|
|
|
case TEXT:
|
2010-12-15 23:47:45 +00:00
|
|
|
str = stringify_text (data, &position);
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
case BITMAP:
|
|
|
|
case DRAWABLE:
|
|
|
|
case PIXMAP:
|
|
|
|
case WINDOW:
|
|
|
|
case COLORMAP:
|
2010-12-15 23:47:45 +00:00
|
|
|
str = stringify_xid (data, &position);
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
case INTEGER:
|
|
|
|
case PIXEL:
|
2010-12-15 23:47:45 +00:00
|
|
|
str = stringify_integer (data, &position);
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
case SPAN:
|
2010-12-15 23:47:45 +00:00
|
|
|
str = stringify_span (data, &position);
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
2010-12-15 23:47:45 +00:00
|
|
|
char *name = gdk_atom_name (gtk_selection_data_get_data_type (selection_data));
|
Fix problem with g_return_if_fail return value.
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: Move over the
virtual atom code from the gdk-multihead branch, removing the per-display
part. Virtualizing atoms needs to be done now to prevent compat
breakage in direct Xlib accessing code in the future. (#62208)
* gdk/x11/gdkx.h: gdk/gdk/x11/gdkproperty-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
2001-10-22 04:34:42 +00:00
|
|
|
g_print("Can't convert type %s to string\n",
|
|
|
|
name?name:"<unknown>");
|
2010-12-15 23:47:45 +00:00
|
|
|
position = gtk_selection_data_get_length (selection_data);
|
1997-12-18 02:17:14 +00:00
|
|
|
continue;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
2010-03-31 14:16:26 +00:00
|
|
|
gtk_text_buffer_insert_at_cursor (buffer, str, -1);
|
|
|
|
gtk_text_buffer_insert_at_cursor (buffer, "\n", -1);
|
1997-11-24 22:37:52 +00:00
|
|
|
g_string_append (selection_string, str);
|
|
|
|
g_free (str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-04-10 15:06:27 +00:00
|
|
|
paste (GtkWidget *dialog, gint response, GtkWidget *entry)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2001-06-07 22:33:14 +00:00
|
|
|
const char *name;
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkAtom atom;
|
|
|
|
|
2014-04-10 15:06:27 +00:00
|
|
|
if (response != GTK_RESPONSE_APPLY)
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
name = gtk_entry_get_text (GTK_ENTRY(entry));
|
|
|
|
atom = gdk_atom_intern (name, FALSE);
|
|
|
|
|
2017-11-15 17:13:31 +00:00
|
|
|
if (atom == NULL)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_print("Could not create atom: \"%s\"\n",name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-02-25 05:12:14 +00:00
|
|
|
gtk_selection_convert (selection_widget, GDK_SELECTION_PRIMARY, atom,
|
1997-11-24 22:37:52 +00:00
|
|
|
GDK_CURRENT_TIME);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-05-03 22:41:32 +00:00
|
|
|
quit (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2010-03-31 14:16:26 +00:00
|
|
|
gtk_main_quit ();
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
2014-04-10 15:06:27 +00:00
|
|
|
GtkWidget *content_area;
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkWidget *dialog;
|
2011-09-27 03:29:04 +00:00
|
|
|
GtkWidget *vbox;
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *entry;
|
|
|
|
GtkWidget *hbox;
|
2010-03-31 14:16:26 +00:00
|
|
|
GtkWidget *scrolled;
|
Added a modular client-message-filter mechanism, that is used for the DND
Sun Oct 18 18:16:39 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdk.c gdkprivate.h: Added a modular client-message-filter
mechanism, that is used for the DND messages.
Removed all the old DND code.
* gdk/gdkcolormap.c gdk/gdkcolormap.h: Add a function to
get the visual of a given colormap.
* gtk/gtkcolorsel.c: Conversion to new DND, drag
a color-swatch.
* gdk/gdk.h gdk/gdkdnd.c: The low-level
X oriented portions of drag and drop protocols.
Sending and receiving client messages, and navigating
window trees.
* gdk/gdkimage.c: added a gdk_flush() when destroying
SHM images to hopefully make it more likely that
X will gracefully handle the segment being destroyed.
* gdk/gdkprivate.h gtk/gtkdebug.h: Add new
DND debugging flags.
* gtk/gtkeditable.[ch]: Updates for the selection handling
changes.
* gtk/gtkselection.[ch]: Added GtkTargetList, a
refcounted data structure for keeping track of lists
of GdkAtom + information. Removed selection_handler_add
in favor of a "drag_data_get" signal.
* gtk/gtkdnd.[ch] gtk/gtk.h: New files - highlevel (event loop
dependent) parts of the DND protocols, display of drag icons,
drag-under highlighting, and the "default handlers".
* gtk/gtkinvisible.[ch]: New widget - InputOnly offscreen
windows that are used for reliable pointer grabs and
selection handling in the DND code.
* gtk/testdnd.c: New test program for new DND. (Old
DND tests in testgtk still need to be converted.)
* gtk/testselection.c: Use the new selection API.
* docs/dnd_internals: Start at describing how
all the new code works inside.
* docs/Changes-1.2.txt: New file describing source-incompatible
changes in GTK+-1.2.
Sat Oct 17 22:50:34 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkwindow.c (gdk_window_remove_filter): Free
the right list node.
* gdk/gdkwindow.c (gdk_window_init): Add gdk_root_parent
to the XID table so we can receive events on it.
Wed Oct 14 12:57:40 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c gdk/gdk.h (gdk_event_get_time): New function
to get the timestamp from a generic event.
Fri Oct 9 13:16:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_add_events): Added function
that safely adds additional events to a widget's event
mask, even if the widget has previously been realized.
(We can do this, but not remove events from the event
mask).
Fri Oct 2 17:35:35 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_property_get): Allow type == 0,
for AnyPropertyType.
Fri Oct 2 10:32:21 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_atom_intern): Add client-local
hashing.
Thu Sep 24 20:33:54 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_send_clientmessage_toall): serial
isn't a timestamp.
Thu Sep 17 14:23:03 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Removed printing
of unknown window lookup warnings. (Made it
a GDK_NOTE) - they happen in many circumstances.
1998-10-18 22:51:24 +00:00
|
|
|
|
2017-11-16 23:28:53 +00:00
|
|
|
static const char *targetlist[] = {
|
|
|
|
"STRING",
|
|
|
|
"TEXT",
|
|
|
|
"COMPOUND_TEXT"
|
Added a modular client-message-filter mechanism, that is used for the DND
Sun Oct 18 18:16:39 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdk.c gdkprivate.h: Added a modular client-message-filter
mechanism, that is used for the DND messages.
Removed all the old DND code.
* gdk/gdkcolormap.c gdk/gdkcolormap.h: Add a function to
get the visual of a given colormap.
* gtk/gtkcolorsel.c: Conversion to new DND, drag
a color-swatch.
* gdk/gdk.h gdk/gdkdnd.c: The low-level
X oriented portions of drag and drop protocols.
Sending and receiving client messages, and navigating
window trees.
* gdk/gdkimage.c: added a gdk_flush() when destroying
SHM images to hopefully make it more likely that
X will gracefully handle the segment being destroyed.
* gdk/gdkprivate.h gtk/gtkdebug.h: Add new
DND debugging flags.
* gtk/gtkeditable.[ch]: Updates for the selection handling
changes.
* gtk/gtkselection.[ch]: Added GtkTargetList, a
refcounted data structure for keeping track of lists
of GdkAtom + information. Removed selection_handler_add
in favor of a "drag_data_get" signal.
* gtk/gtkdnd.[ch] gtk/gtk.h: New files - highlevel (event loop
dependent) parts of the DND protocols, display of drag icons,
drag-under highlighting, and the "default handlers".
* gtk/gtkinvisible.[ch]: New widget - InputOnly offscreen
windows that are used for reliable pointer grabs and
selection handling in the DND code.
* gtk/testdnd.c: New test program for new DND. (Old
DND tests in testgtk still need to be converted.)
* gtk/testselection.c: Use the new selection API.
* docs/dnd_internals: Start at describing how
all the new code works inside.
* docs/Changes-1.2.txt: New file describing source-incompatible
changes in GTK+-1.2.
Sat Oct 17 22:50:34 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkwindow.c (gdk_window_remove_filter): Free
the right list node.
* gdk/gdkwindow.c (gdk_window_init): Add gdk_root_parent
to the XID table so we can receive events on it.
Wed Oct 14 12:57:40 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c gdk/gdk.h (gdk_event_get_time): New function
to get the timestamp from a generic event.
Fri Oct 9 13:16:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_add_events): Added function
that safely adds additional events to a widget's event
mask, even if the widget has previously been realized.
(We can do this, but not remove events from the event
mask).
Fri Oct 2 17:35:35 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_property_get): Allow type == 0,
for AnyPropertyType.
Fri Oct 2 10:32:21 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_atom_intern): Add client-local
hashing.
Thu Sep 24 20:33:54 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_send_clientmessage_toall): serial
isn't a timestamp.
Thu Sep 17 14:23:03 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Removed printing
of unknown window lookup warnings. (Made it
a GDK_NOTE) - they happen in many circumstances.
1998-10-18 22:51:24 +00:00
|
|
|
};
|
|
|
|
static gint ntargets = sizeof(targetlist) / sizeof(targetlist[0]);
|
2017-11-18 01:19:53 +00:00
|
|
|
GdkContentFormats *list;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2016-12-28 13:53:22 +00:00
|
|
|
gtk_init ();
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
init_atoms();
|
|
|
|
|
2002-02-25 05:12:14 +00:00
|
|
|
selection_widget = gtk_invisible_new ();
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
dialog = gtk_dialog_new ();
|
|
|
|
gtk_widget_set_name (dialog, "Test Input");
|
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_signal_connect (dialog, "destroy",
|
|
|
|
G_CALLBACK (quit), NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-06-03 07:36:39 +00:00
|
|
|
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
|
|
|
|
2011-09-27 03:29:04 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2017-04-21 20:34:36 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (content_area), vbox);
|
2011-09-27 03:29:04 +00:00
|
|
|
gtk_widget_show (vbox);
|
2016-10-02 15:37:22 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
selection_button = gtk_toggle_button_new_with_label ("Claim Selection");
|
2011-09-27 03:29:04 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (vbox), selection_button);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_show (selection_button);
|
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_signal_connect (selection_button, "toggled",
|
|
|
|
G_CALLBACK (selection_toggled), NULL);
|
|
|
|
g_signal_connect (selection_widget, "selection_clear_event",
|
|
|
|
G_CALLBACK (selection_clear), NULL);
|
|
|
|
g_signal_connect (selection_widget, "selection_received",
|
|
|
|
G_CALLBACK (selection_received), NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2017-11-18 01:19:53 +00:00
|
|
|
list = gdk_content_formats_new (targetlist, ntargets);
|
2017-11-14 04:34:15 +00:00
|
|
|
gtk_selection_add_targets (selection_widget, GDK_SELECTION_PRIMARY, list);
|
2017-11-18 01:19:53 +00:00
|
|
|
gdk_content_formats_unref (list);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_signal_connect (selection_widget, "selection_get",
|
|
|
|
G_CALLBACK (selection_get), NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-03-31 14:16:26 +00:00
|
|
|
selection_text = gtk_text_view_new ();
|
|
|
|
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled), selection_text);
|
2011-09-27 03:29:04 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (vbox), scrolled);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_show (selection_text);
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
2011-09-27 03:29:04 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
label = gtk_label_new ("Target:");
|
2017-04-21 20:34:36 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX(hbox), label);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
entry = gtk_entry_new ();
|
2017-04-21 16:59:59 +00:00
|
|
|
gtk_widget_set_hexpand (entry, TRUE);
|
2017-04-21 20:34:36 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX(hbox), entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_show (entry);
|
|
|
|
|
|
|
|
/* .. And create some buttons */
|
2014-04-10 15:06:27 +00:00
|
|
|
gtk_dialog_add_button (GTK_DIALOG (dialog),
|
|
|
|
"Paste",
|
|
|
|
GTK_RESPONSE_APPLY);
|
|
|
|
gtk_dialog_add_button (GTK_DIALOG (dialog),
|
|
|
|
"Quit",
|
|
|
|
GTK_RESPONSE_CLOSE);
|
|
|
|
|
|
|
|
g_signal_connect (dialog, "response",
|
2002-10-13 23:22:33 +00:00
|
|
|
G_CALLBACK (paste), entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
gtk_widget_show (dialog);
|
|
|
|
|
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|