1998-03-01 05:11:05 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* 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
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1998-03-01 05:11:05 +00:00
|
|
|
*/
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <string.h>
|
|
|
|
#ifdef USE_XIM
|
|
|
|
#include "gdk/gdkx.h"
|
|
|
|
#endif
|
|
|
|
#include "gdk/gdkkeysyms.h"
|
|
|
|
#include "gdk/gdki18n.h"
|
|
|
|
#include "gtkeditable.h"
|
|
|
|
#include "gtkmain.h"
|
|
|
|
#include "gtkselection.h"
|
|
|
|
#include "gtksignal.h"
|
|
|
|
|
|
|
|
#define MIN_EDITABLE_WIDTH 150
|
|
|
|
#define DRAW_TIMEOUT 20
|
|
|
|
#define INNER_BORDER 2
|
|
|
|
|
|
|
|
enum {
|
|
|
|
CHANGED,
|
1998-05-22 07:07:11 +00:00
|
|
|
INSERT_TEXT,
|
|
|
|
DELETE_TEXT,
|
1998-06-19 01:26:24 +00:00
|
|
|
/* Binding actions */
|
|
|
|
ACTIVATE,
|
1998-07-16 20:23:12 +00:00
|
|
|
SET_EDITABLE,
|
1998-06-19 01:26:24 +00:00
|
|
|
MOVE_CURSOR,
|
|
|
|
MOVE_WORD,
|
|
|
|
MOVE_PAGE,
|
|
|
|
MOVE_TO_ROW,
|
|
|
|
MOVE_TO_COLUMN,
|
|
|
|
KILL_CHAR,
|
|
|
|
KILL_WORD,
|
|
|
|
KILL_LINE,
|
|
|
|
CUT_CLIPBOARD,
|
|
|
|
COPY_CLIPBOARD,
|
|
|
|
PASTE_CLIPBOARD,
|
1998-03-01 05:11:05 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
enum {
|
|
|
|
ARG_0,
|
|
|
|
ARG_TEXT_POSITION,
|
|
|
|
ARG_EDITABLE
|
|
|
|
};
|
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
|
|
|
|
|
|
|
/* values for selection info */
|
|
|
|
|
|
|
|
enum {
|
|
|
|
TARGET_STRING,
|
|
|
|
TARGET_TEXT,
|
1999-01-01 23:36:32 +00:00
|
|
|
TARGET_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
|
|
|
};
|
1998-07-16 20:23:12 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void gtk_editable_class_init (GtkEditableClass *klass);
|
|
|
|
static void gtk_editable_init (GtkEditable *editable);
|
1998-07-16 20:23:12 +00:00
|
|
|
static void gtk_editable_set_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
|
|
|
static void gtk_editable_get_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
1998-06-19 01:26:24 +00:00
|
|
|
static gint gtk_editable_selection_clear (GtkWidget *widget,
|
|
|
|
GdkEventSelection *event);
|
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 void gtk_editable_selection_get (GtkWidget *widget,
|
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
guint info,
|
|
|
|
guint time);
|
1998-06-19 01:26:24 +00:00
|
|
|
static void gtk_editable_selection_received (GtkWidget *widget,
|
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
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
guint time);
|
1998-06-19 01:26:24 +00:00
|
|
|
|
|
|
|
static void gtk_editable_set_selection (GtkEditable *editable,
|
|
|
|
gint start,
|
|
|
|
gint end);
|
|
|
|
static guint32 gtk_editable_get_event_time (GtkEditable *editable);
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
static void gtk_editable_real_cut_clipboard (GtkEditable *editable);
|
|
|
|
static void gtk_editable_real_copy_clipboard (GtkEditable *editable);
|
|
|
|
static void gtk_editable_real_paste_clipboard (GtkEditable *editable);
|
|
|
|
static void gtk_editable_real_set_editable (GtkEditable *editable,
|
|
|
|
gboolean is_editable);
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static GtkWidgetClass *parent_class = NULL;
|
1998-03-09 15:16:28 +00:00
|
|
|
static guint editable_signals[LAST_SIGNAL] = { 0 };
|
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
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static GdkAtom clipboard_atom = GDK_NONE;
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
GtkType
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_editable_get_type (void)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
static GtkType editable_type = 0;
|
1998-03-01 05:11:05 +00:00
|
|
|
|
|
|
|
if (!editable_type)
|
|
|
|
{
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTypeInfo editable_info =
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
"GtkEditable",
|
|
|
|
sizeof (GtkEditable),
|
|
|
|
sizeof (GtkEditableClass),
|
|
|
|
(GtkClassInitFunc) gtk_editable_class_init,
|
|
|
|
(GtkObjectInitFunc) gtk_editable_init,
|
1998-07-04 15:31:30 +00:00
|
|
|
/* reserved_1 */ NULL,
|
|
|
|
/* reserved_2 */ NULL,
|
1998-06-28 07:46:10 +00:00
|
|
|
(GtkClassInitFunc) NULL,
|
1998-03-01 05:11:05 +00:00
|
|
|
};
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
editable_type = gtk_type_unique (GTK_TYPE_WIDGET, &editable_info);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return editable_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_editable_class_init (GtkEditableClass *class)
|
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
|
|
|
GtkWidgetClass *widget_class;
|
|
|
|
|
|
|
|
object_class = (GtkObjectClass*) class;
|
|
|
|
widget_class = (GtkWidgetClass*) class;
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
parent_class = gtk_type_class (GTK_TYPE_WIDGET);
|
1998-03-01 05:11:05 +00:00
|
|
|
|
|
|
|
editable_signals[CHANGED] =
|
|
|
|
gtk_signal_new ("changed",
|
|
|
|
GTK_RUN_LAST,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, changed),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__NONE,
|
1998-03-01 05:11:05 +00:00
|
|
|
GTK_TYPE_NONE, 0);
|
|
|
|
|
1998-05-22 07:07:11 +00:00
|
|
|
editable_signals[INSERT_TEXT] =
|
|
|
|
gtk_signal_new ("insert_text",
|
|
|
|
GTK_RUN_LAST,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, insert_text),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__POINTER_INT_POINTER,
|
1998-05-22 07:07:11 +00:00
|
|
|
GTK_TYPE_NONE,
|
|
|
|
3,
|
|
|
|
GTK_TYPE_STRING,
|
|
|
|
GTK_TYPE_INT,
|
|
|
|
GTK_TYPE_POINTER);
|
|
|
|
|
|
|
|
editable_signals[DELETE_TEXT] =
|
|
|
|
gtk_signal_new ("delete_text",
|
|
|
|
GTK_RUN_LAST,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, delete_text),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__INT_INT,
|
1998-05-22 07:07:11 +00:00
|
|
|
GTK_TYPE_NONE,
|
|
|
|
2,
|
|
|
|
GTK_TYPE_INT,
|
1998-05-25 02:41:36 +00:00
|
|
|
GTK_TYPE_INT);
|
1998-05-22 07:07:11 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
editable_signals[ACTIVATE] =
|
|
|
|
gtk_signal_new ("activate",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, activate),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__NONE,
|
1998-06-19 01:26:24 +00:00
|
|
|
GTK_TYPE_NONE, 0);
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
editable_signals[SET_EDITABLE] =
|
|
|
|
gtk_signal_new ("set-editable",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, set_editable),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__BOOL,
|
1998-07-16 20:23:12 +00:00
|
|
|
GTK_TYPE_NONE, 1,
|
|
|
|
GTK_TYPE_BOOL);
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
editable_signals[MOVE_CURSOR] =
|
|
|
|
gtk_signal_new ("move_cursor",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, move_cursor),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__INT_INT,
|
1998-06-19 01:26:24 +00:00
|
|
|
GTK_TYPE_NONE, 2,
|
|
|
|
GTK_TYPE_INT,
|
|
|
|
GTK_TYPE_INT);
|
|
|
|
|
|
|
|
editable_signals[MOVE_WORD] =
|
|
|
|
gtk_signal_new ("move_word",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, move_word),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__INT,
|
1998-06-19 01:26:24 +00:00
|
|
|
GTK_TYPE_NONE, 1,
|
|
|
|
GTK_TYPE_INT);
|
|
|
|
|
|
|
|
editable_signals[MOVE_PAGE] =
|
|
|
|
gtk_signal_new ("move_page",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, move_page),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__INT_INT,
|
1998-06-19 01:26:24 +00:00
|
|
|
GTK_TYPE_NONE, 2,
|
|
|
|
GTK_TYPE_INT,
|
|
|
|
GTK_TYPE_INT);
|
|
|
|
|
|
|
|
editable_signals[MOVE_TO_ROW] =
|
|
|
|
gtk_signal_new ("move_to_row",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, move_to_row),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__INT,
|
1998-06-19 01:26:24 +00:00
|
|
|
GTK_TYPE_NONE, 1,
|
|
|
|
GTK_TYPE_INT);
|
|
|
|
|
|
|
|
editable_signals[MOVE_TO_COLUMN] =
|
|
|
|
gtk_signal_new ("move_to_column",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, move_to_column),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__INT,
|
1998-06-19 01:26:24 +00:00
|
|
|
GTK_TYPE_NONE, 1,
|
|
|
|
GTK_TYPE_INT);
|
|
|
|
|
|
|
|
editable_signals[KILL_CHAR] =
|
|
|
|
gtk_signal_new ("kill_char",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, kill_char),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__INT,
|
1998-06-19 01:26:24 +00:00
|
|
|
GTK_TYPE_NONE, 1,
|
|
|
|
GTK_TYPE_INT);
|
|
|
|
|
|
|
|
editable_signals[KILL_WORD] =
|
|
|
|
gtk_signal_new ("kill_word",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, kill_word),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__INT,
|
1998-06-19 01:26:24 +00:00
|
|
|
GTK_TYPE_NONE, 1,
|
|
|
|
GTK_TYPE_INT);
|
|
|
|
|
|
|
|
editable_signals[KILL_LINE] =
|
|
|
|
gtk_signal_new ("kill_line",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, kill_line),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__INT,
|
1998-06-19 01:26:24 +00:00
|
|
|
GTK_TYPE_NONE, 1,
|
|
|
|
GTK_TYPE_INT);
|
|
|
|
|
|
|
|
editable_signals[CUT_CLIPBOARD] =
|
|
|
|
gtk_signal_new ("cut_clipboard",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, cut_clipboard),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__NONE,
|
1998-06-19 01:26:24 +00:00
|
|
|
GTK_TYPE_NONE, 0);
|
|
|
|
|
|
|
|
editable_signals[COPY_CLIPBOARD] =
|
|
|
|
gtk_signal_new ("copy_clipboard",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, copy_clipboard),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__NONE,
|
1998-06-19 01:26:24 +00:00
|
|
|
GTK_TYPE_NONE, 0);
|
|
|
|
|
|
|
|
editable_signals[PASTE_CLIPBOARD] =
|
|
|
|
gtk_signal_new ("paste_clipboard",
|
|
|
|
GTK_RUN_LAST | GTK_RUN_ACTION,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkEditableClass, paste_clipboard),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__NONE,
|
1998-06-19 01:26:24 +00:00
|
|
|
GTK_TYPE_NONE, 0);
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_object_class_add_signals (object_class, editable_signals, LAST_SIGNAL);
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
gtk_object_add_arg_type ("GtkEditable::text_position", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_TEXT_POSITION);
|
|
|
|
gtk_object_add_arg_type ("GtkEditable::editable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE);
|
|
|
|
|
|
|
|
object_class->set_arg = gtk_editable_set_arg;
|
|
|
|
object_class->get_arg = gtk_editable_get_arg;
|
1998-03-01 05:11:05 +00:00
|
|
|
|
|
|
|
widget_class->selection_clear_event = gtk_editable_selection_clear;
|
|
|
|
widget_class->selection_received = gtk_editable_selection_received;
|
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
|
|
|
widget_class->selection_get = gtk_editable_selection_get;
|
1998-03-01 05:11:05 +00:00
|
|
|
|
|
|
|
class->insert_text = NULL;
|
|
|
|
class->delete_text = NULL;
|
1998-06-19 01:26:24 +00:00
|
|
|
|
|
|
|
class->activate = NULL;
|
1998-07-16 20:23:12 +00:00
|
|
|
class->set_editable = gtk_editable_real_set_editable;
|
1998-06-19 01:26:24 +00:00
|
|
|
|
|
|
|
class->move_cursor = NULL;
|
|
|
|
class->move_word = NULL;
|
|
|
|
class->move_page = NULL;
|
|
|
|
class->move_to_row = NULL;
|
|
|
|
class->move_to_column = NULL;
|
|
|
|
|
|
|
|
class->kill_char = NULL;
|
|
|
|
class->kill_word = NULL;
|
|
|
|
class->kill_line = NULL;
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
class->cut_clipboard = gtk_editable_real_cut_clipboard;
|
|
|
|
class->copy_clipboard = gtk_editable_real_copy_clipboard;
|
|
|
|
class->paste_clipboard = gtk_editable_real_paste_clipboard;
|
1998-06-19 01:26:24 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
class->update_text = NULL;
|
|
|
|
class->get_chars = NULL;
|
|
|
|
class->set_selection = NULL;
|
1998-06-19 01:26:24 +00:00
|
|
|
class->set_position = NULL;
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
static void
|
|
|
|
gtk_editable_set_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
|
|
|
{
|
|
|
|
GtkEditable *editable;
|
|
|
|
|
|
|
|
editable = GTK_EDITABLE (object);
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case ARG_TEXT_POSITION:
|
|
|
|
gtk_editable_set_position (editable, GTK_VALUE_INT (*arg));
|
|
|
|
break;
|
|
|
|
case ARG_EDITABLE:
|
|
|
|
gtk_editable_set_editable (editable, GTK_VALUE_BOOL (*arg));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_editable_get_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
|
|
|
{
|
|
|
|
GtkEditable *editable;
|
|
|
|
|
|
|
|
editable = GTK_EDITABLE (object);
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case ARG_TEXT_POSITION:
|
|
|
|
GTK_VALUE_INT (*arg) = editable->current_pos;
|
|
|
|
break;
|
|
|
|
case ARG_EDITABLE:
|
|
|
|
GTK_VALUE_BOOL (*arg) = editable->editable;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
arg->type = GTK_TYPE_INVALID;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static void
|
|
|
|
gtk_editable_init (GtkEditable *editable)
|
|
|
|
{
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTargetEntry targets[] = {
|
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
|
|
|
{ "STRING", TARGET_STRING },
|
|
|
|
{ "TEXT", TARGET_TEXT },
|
|
|
|
{ "COMPOUND_TEXT", TARGET_COMPOUND_TEXT }
|
|
|
|
};
|
1998-11-30 19:07:15 +00:00
|
|
|
static const gint n_targets = sizeof(targets) / sizeof(targets[0]);
|
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
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
GTK_WIDGET_SET_FLAGS (editable, GTK_CAN_FOCUS);
|
|
|
|
|
|
|
|
editable->selection_start_pos = 0;
|
|
|
|
editable->selection_end_pos = 0;
|
|
|
|
editable->has_selection = FALSE;
|
|
|
|
editable->editable = 1;
|
|
|
|
editable->clipboard_text = NULL;
|
|
|
|
|
|
|
|
#ifdef USE_XIM
|
|
|
|
editable->ic = NULL;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!clipboard_atom)
|
|
|
|
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
|
|
|
|
|
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
|
|
|
gtk_selection_add_targets (GTK_WIDGET (editable), GDK_SELECTION_PRIMARY,
|
|
|
|
targets, n_targets);
|
|
|
|
gtk_selection_add_targets (GTK_WIDGET (editable), clipboard_atom,
|
|
|
|
targets, n_targets);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_editable_insert_text (GtkEditable *editable,
|
|
|
|
const gchar *new_text,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint new_text_length,
|
|
|
|
gint *position)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
GtkEditableClass *klass;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gchar buf[64];
|
|
|
|
gchar *text;
|
|
|
|
|
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (new_text_length <= 64)
|
|
|
|
text = buf;
|
|
|
|
else
|
|
|
|
text = g_new (gchar, new_text_length);
|
|
|
|
|
|
|
|
strncpy (text, new_text, new_text_length);
|
|
|
|
|
1998-05-22 07:07:11 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[INSERT_TEXT], text, new_text_length, position);
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[CHANGED]);
|
|
|
|
|
|
|
|
if (new_text_length > 64)
|
|
|
|
g_free (text);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_editable_delete_text (GtkEditable *editable,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint start_pos,
|
|
|
|
gint end_pos)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
GtkEditableClass *klass;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
|
|
|
|
|
1998-05-22 07:07:11 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[DELETE_TEXT], start_pos, end_pos);
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[CHANGED]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_editable_update_text (GtkEditable *editable,
|
|
|
|
gint start_pos,
|
|
|
|
gint end_pos)
|
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
GtkEditableClass *klass;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
|
|
|
|
|
1998-05-25 02:41:36 +00:00
|
|
|
klass->update_text (editable, start_pos, end_pos);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
|
|
|
gtk_editable_get_chars (GtkEditable *editable,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint start,
|
|
|
|
gint end)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
GtkEditableClass *klass;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
g_return_val_if_fail (editable != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GTK_IS_EDITABLE (editable), NULL);
|
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-05-25 02:41:36 +00:00
|
|
|
return klass->get_chars (editable, start, end);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_editable_set_selection (GtkEditable *editable,
|
|
|
|
gint start_pos,
|
|
|
|
gint end_pos)
|
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
GtkEditableClass *klass;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
|
|
|
|
|
1998-05-25 02:41:36 +00:00
|
|
|
klass->set_selection (editable, start_pos, end_pos);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
1998-05-22 07:07:11 +00:00
|
|
|
void
|
1998-08-17 14:48:51 +00:00
|
|
|
gtk_editable_set_position (GtkEditable *editable,
|
|
|
|
gint position)
|
1998-05-22 07:07:11 +00:00
|
|
|
{
|
|
|
|
GtkEditableClass *klass;
|
|
|
|
|
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
|
|
|
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
|
|
|
|
|
1998-08-17 14:48:51 +00:00
|
|
|
klass->set_position (editable, position);
|
1998-05-22 07:07:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
gtk_editable_get_position (GtkEditable *editable)
|
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_val_if_fail (editable != NULL, -1);
|
|
|
|
g_return_val_if_fail (GTK_IS_EDITABLE (editable), -1);
|
|
|
|
|
1998-05-22 07:07:11 +00:00
|
|
|
return editable->current_pos;
|
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static gint
|
|
|
|
gtk_editable_selection_clear (GtkWidget *widget,
|
1998-03-09 15:16:28 +00:00
|
|
|
GdkEventSelection *event)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
GtkEditable *editable;
|
1998-03-09 15:16:28 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_EDITABLE (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
1998-03-09 15:16:28 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
/* Let the selection handling code know that the selection
|
|
|
|
* has been changed, since we've overriden the default handler */
|
1998-03-10 22:57:26 +00:00
|
|
|
if (!gtk_selection_clear (widget, event))
|
|
|
|
return FALSE;
|
1998-03-09 15:16:28 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (widget);
|
1998-03-09 15:16:28 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (event->selection == GDK_SELECTION_PRIMARY)
|
|
|
|
{
|
|
|
|
if (editable->has_selection)
|
|
|
|
{
|
|
|
|
editable->has_selection = FALSE;
|
|
|
|
gtk_editable_update_text (editable, editable->selection_start_pos,
|
|
|
|
editable->selection_end_pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (event->selection == clipboard_atom)
|
|
|
|
{
|
|
|
|
g_free (editable->clipboard_text);
|
|
|
|
editable->clipboard_text = NULL;
|
|
|
|
}
|
1998-03-09 15:16:28 +00:00
|
|
|
|
1998-03-10 22:57:26 +00:00
|
|
|
return TRUE;
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static 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
|
|
|
gtk_editable_selection_get (GtkWidget *widget,
|
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
guint info,
|
|
|
|
guint time)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
GtkEditable *editable;
|
|
|
|
gint selection_start_pos;
|
|
|
|
gint selection_end_pos;
|
|
|
|
|
|
|
|
gchar *str;
|
|
|
|
gint length;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (widget));
|
|
|
|
|
|
|
|
editable = GTK_EDITABLE (widget);
|
|
|
|
|
|
|
|
if (selection_data->selection == GDK_SELECTION_PRIMARY)
|
|
|
|
{
|
|
|
|
selection_start_pos = MIN (editable->selection_start_pos, editable->selection_end_pos);
|
|
|
|
selection_end_pos = MAX (editable->selection_start_pos, editable->selection_end_pos);
|
1998-03-01 08:47:36 +00:00
|
|
|
str = gtk_editable_get_chars(editable,
|
|
|
|
selection_start_pos,
|
1998-03-01 05:11:05 +00:00
|
|
|
selection_end_pos);
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (!str)
|
|
|
|
return; /* Refuse */
|
|
|
|
length = strlen (str);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
else /* CLIPBOARD */
|
|
|
|
{
|
|
|
|
if (!editable->clipboard_text)
|
|
|
|
return; /* Refuse */
|
|
|
|
|
|
|
|
str = editable->clipboard_text;
|
|
|
|
length = strlen (editable->clipboard_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
|
|
|
if (info == TARGET_STRING)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
gtk_selection_data_set (selection_data,
|
|
|
|
GDK_SELECTION_TYPE_STRING,
|
1998-03-17 19:03:52 +00:00
|
|
|
8*sizeof(gchar), (guchar *)str, length);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
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
|
|
|
else if ((info == TARGET_TEXT) || (info == TARGET_COMPOUND_TEXT))
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
guchar *text;
|
|
|
|
gchar c;
|
|
|
|
GdkAtom encoding;
|
|
|
|
gint format;
|
|
|
|
gint new_length;
|
|
|
|
|
|
|
|
c = str[length];
|
|
|
|
str[length] = '\0';
|
|
|
|
gdk_string_to_compound_text (str, &encoding, &format, &text, &new_length);
|
|
|
|
gtk_selection_data_set (selection_data, encoding, format, text, new_length);
|
|
|
|
gdk_free_compound_text (text);
|
|
|
|
str[length] = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (str != editable->clipboard_text)
|
|
|
|
g_free (str);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_editable_selection_received (GtkWidget *widget,
|
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
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
guint time)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
GtkEditable *editable;
|
|
|
|
gint reselect;
|
|
|
|
gint old_pos;
|
|
|
|
gint tmp_pos;
|
|
|
|
enum {INVALID, STRING, CTEXT} type;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (widget));
|
|
|
|
|
|
|
|
editable = GTK_EDITABLE (widget);
|
|
|
|
|
|
|
|
if (selection_data->type == GDK_TARGET_STRING)
|
|
|
|
type = STRING;
|
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
|
|
|
else if ((selection_data->type == gdk_atom_intern ("COMPOUND_TEXT", FALSE)) ||
|
|
|
|
(selection_data->type == gdk_atom_intern ("TEXT", FALSE)))
|
1998-03-01 05:11:05 +00:00
|
|
|
type = CTEXT;
|
|
|
|
else
|
|
|
|
type = INVALID;
|
|
|
|
|
|
|
|
if (type == INVALID || selection_data->length < 0)
|
|
|
|
{
|
|
|
|
/* avoid infinite loop */
|
|
|
|
if (selection_data->target != GDK_TARGET_STRING)
|
|
|
|
gtk_selection_convert (widget, selection_data->selection,
|
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
|
|
|
GDK_TARGET_STRING, time);
|
1998-03-01 05:11:05 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
reselect = FALSE;
|
|
|
|
|
|
|
|
if ((editable->selection_start_pos != editable->selection_end_pos) &&
|
|
|
|
(!editable->has_selection ||
|
|
|
|
(selection_data->selection == clipboard_atom)))
|
|
|
|
{
|
|
|
|
reselect = TRUE;
|
|
|
|
|
|
|
|
/* Don't want to call gtk_editable_delete_selection here if we are going
|
|
|
|
* to reclaim the selection to avoid extra server traffic */
|
|
|
|
if (editable->has_selection)
|
|
|
|
{
|
|
|
|
gtk_editable_delete_text (editable,
|
|
|
|
MIN (editable->selection_start_pos, editable->selection_end_pos),
|
|
|
|
MAX (editable->selection_start_pos, editable->selection_end_pos));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
gtk_editable_delete_selection (editable);
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp_pos = old_pos = editable->current_pos;
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case STRING:
|
|
|
|
selection_data->data[selection_data->length] = 0;
|
1998-04-10 00:44:35 +00:00
|
|
|
gtk_editable_insert_text (editable, (gchar *)selection_data->data,
|
1998-03-17 19:03:52 +00:00
|
|
|
strlen ((gchar *)selection_data->data),
|
|
|
|
&tmp_pos);
|
1998-03-01 05:11:05 +00:00
|
|
|
editable->current_pos = tmp_pos;
|
|
|
|
break;
|
|
|
|
case CTEXT:
|
|
|
|
{
|
|
|
|
gchar **list;
|
|
|
|
gint count;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
count = gdk_text_property_to_text_list (selection_data->type,
|
|
|
|
selection_data->format,
|
|
|
|
selection_data->data,
|
|
|
|
selection_data->length,
|
|
|
|
&list);
|
|
|
|
for (i=0; i<count; i++)
|
|
|
|
{
|
|
|
|
gtk_editable_insert_text (editable, list[i], strlen (list[i]), &tmp_pos);
|
|
|
|
editable->current_pos = tmp_pos;
|
|
|
|
}
|
|
|
|
if (count > 0)
|
|
|
|
gdk_free_text_list (list);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case INVALID: /* quiet compiler */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reselect)
|
|
|
|
gtk_editable_set_selection (editable, old_pos, editable->current_pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_editable_delete_selection (GtkEditable *editable)
|
|
|
|
{
|
1998-03-07 03:05:36 +00:00
|
|
|
guint start;
|
|
|
|
guint end;
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
if (!editable->editable)
|
|
|
|
return;
|
|
|
|
|
|
|
|
start = editable->selection_start_pos;
|
|
|
|
end = editable->selection_end_pos;
|
1998-03-01 05:11:05 +00:00
|
|
|
|
|
|
|
editable->selection_start_pos = 0;
|
|
|
|
editable->selection_end_pos = 0;
|
|
|
|
|
1998-03-01 08:47:36 +00:00
|
|
|
if (start != end)
|
|
|
|
gtk_editable_delete_text (editable, MIN (start, end), MAX (start,end));
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->has_selection)
|
|
|
|
{
|
|
|
|
editable->has_selection = FALSE;
|
|
|
|
if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == GTK_WIDGET (editable)->window)
|
|
|
|
gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_editable_claim_selection (GtkEditable *editable,
|
|
|
|
gboolean claim,
|
|
|
|
guint32 time)
|
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
1998-03-01 05:11:05 +00:00
|
|
|
g_return_if_fail (GTK_WIDGET_REALIZED (editable));
|
1998-03-08 21:53:56 +00:00
|
|
|
|
|
|
|
editable->has_selection = FALSE;
|
1998-03-01 05:11:05 +00:00
|
|
|
|
|
|
|
if (claim)
|
|
|
|
{
|
|
|
|
if (gtk_selection_owner_set (GTK_WIDGET(editable), GDK_SELECTION_PRIMARY, time))
|
|
|
|
editable->has_selection = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) ==
|
|
|
|
GTK_WIDGET(editable)->window)
|
|
|
|
gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY, time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_editable_select_region (GtkEditable *editable,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint start,
|
|
|
|
gint end)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (editable))
|
|
|
|
gtk_editable_claim_selection (editable, start != end, GDK_CURRENT_TIME);
|
1998-08-17 14:48:51 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_editable_set_selection (editable, start, end);
|
|
|
|
}
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
/* Get the timestamp of the current event. Actually, the only thing
|
|
|
|
* we really care about below is the key event
|
|
|
|
*/
|
|
|
|
static guint32
|
|
|
|
gtk_editable_get_event_time (GtkEditable *editable)
|
|
|
|
{
|
|
|
|
GdkEvent *event;
|
1998-08-17 14:48:51 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
event = gtk_get_current_event();
|
1998-08-17 14:48:51 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
if (event)
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
return event->motion.time;
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
return event->button.time;
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
return event->key.time;
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
return event->crossing.time;
|
|
|
|
case GDK_PROPERTY_NOTIFY:
|
|
|
|
return event->property.time;
|
|
|
|
case GDK_SELECTION_CLEAR:
|
|
|
|
case GDK_SELECTION_REQUEST:
|
|
|
|
case GDK_SELECTION_NOTIFY:
|
|
|
|
return event->selection.time;
|
|
|
|
case GDK_PROXIMITY_IN:
|
|
|
|
case GDK_PROXIMITY_OUT:
|
|
|
|
return event->proximity.time;
|
|
|
|
default: /* use current time */
|
1998-08-17 14:48:51 +00:00
|
|
|
break;
|
1998-06-19 01:26:24 +00:00
|
|
|
}
|
1998-08-17 14:48:51 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
return GDK_CURRENT_TIME;
|
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
void
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_editable_cut_clipboard (GtkEditable *editable)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[CUT_CLIPBOARD]);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_editable_copy_clipboard (GtkEditable *editable)
|
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[COPY_CLIPBOARD]);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_editable_paste_clipboard (GtkEditable *editable)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[PASTE_CLIPBOARD]);
|
|
|
|
}
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
void
|
|
|
|
gtk_editable_set_editable (GtkEditable *editable,
|
|
|
|
gboolean is_editable)
|
|
|
|
{
|
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
|
|
|
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[SET_EDITABLE], is_editable != FALSE);
|
|
|
|
}
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
1998-07-16 20:23:12 +00:00
|
|
|
gtk_editable_real_set_editable (GtkEditable *editable,
|
|
|
|
gboolean is_editable)
|
1998-06-19 01:26:24 +00:00
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
|
|
|
editable->editable = is_editable != FALSE;
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (editable));
|
1998-06-19 01:26:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-07-16 20:23:12 +00:00
|
|
|
gtk_editable_real_cut_clipboard (GtkEditable *editable)
|
1998-06-19 01:26:24 +00:00
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
|
|
|
gtk_editable_real_copy_clipboard (editable);
|
|
|
|
gtk_editable_delete_selection (editable);
|
|
|
|
}
|
1998-06-19 01:26:24 +00:00
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
static void
|
|
|
|
gtk_editable_real_copy_clipboard (GtkEditable *editable)
|
|
|
|
{
|
|
|
|
guint32 time;
|
1998-03-01 05:11:05 +00:00
|
|
|
gint selection_start_pos;
|
|
|
|
gint selection_end_pos;
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
|
|
|
time = gtk_editable_get_event_time (editable);
|
1998-03-01 05:11:05 +00:00
|
|
|
selection_start_pos = MIN (editable->selection_start_pos, editable->selection_end_pos);
|
|
|
|
selection_end_pos = MAX (editable->selection_start_pos, editable->selection_end_pos);
|
|
|
|
|
|
|
|
if (selection_start_pos != selection_end_pos)
|
|
|
|
{
|
|
|
|
if (gtk_selection_owner_set (GTK_WIDGET (editable),
|
|
|
|
clipboard_atom,
|
1998-03-01 10:19:22 +00:00
|
|
|
time))
|
1998-03-01 05:11:05 +00:00
|
|
|
editable->clipboard_text = gtk_editable_get_chars (editable,
|
1998-03-01 08:47:36 +00:00
|
|
|
selection_start_pos,
|
|
|
|
selection_end_pos);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
1998-07-16 20:23:12 +00:00
|
|
|
gtk_editable_real_paste_clipboard (GtkEditable *editable)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
guint32 time;
|
1998-06-19 01:26:24 +00:00
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
|
|
|
time = gtk_editable_get_event_time (editable);
|
1998-03-07 03:05:36 +00:00
|
|
|
if (editable->editable)
|
|
|
|
gtk_selection_convert (GTK_WIDGET(editable),
|
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
|
|
|
clipboard_atom,
|
|
|
|
gdk_atom_intern ("COMPOUND_TEXT", FALSE), time);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_editable_changed (GtkEditable *editable)
|
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_EDITABLE (editable));
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[CHANGED]);
|
|
|
|
}
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
static void
|
|
|
|
gtk_editable_parent_set (GtkWidget *widget,
|
|
|
|
GtkWidget *old_parent,
|
|
|
|
GtkWidget *editable)
|
|
|
|
{
|
|
|
|
GtkWidget *parent;
|
|
|
|
|
|
|
|
parent = old_parent;
|
|
|
|
while (parent)
|
|
|
|
{
|
|
|
|
gtk_signal_disconnect_by_func (GTK_OBJECT (parent),
|
|
|
|
GTK_SIGNAL_FUNC (gtk_editable_parent_set),
|
|
|
|
editable);
|
|
|
|
parent = parent->parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
parent = widget->parent;
|
|
|
|
while (parent)
|
|
|
|
{
|
|
|
|
gtk_signal_connect (GTK_OBJECT (parent), "parent_set",
|
|
|
|
GTK_SIGNAL_FUNC (gtk_editable_parent_set),
|
|
|
|
editable);
|
|
|
|
|
|
|
|
parent = parent->parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|