1997-11-24 22:37:52 +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.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "gdk/gdkkeysyms.h"
|
1997-12-03 21:43:44 +00:00
|
|
|
#include "gdk/gdki18n.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkentry.h"
|
|
|
|
#include "gtkmain.h"
|
|
|
|
#include "gtkselection.h"
|
|
|
|
#include "gtksignal.h"
|
1998-11-06 22:05:02 +00:00
|
|
|
#include "gtkstyle.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
#define MIN_ENTRY_WIDTH 150
|
|
|
|
#define DRAW_TIMEOUT 20
|
|
|
|
#define INNER_BORDER 2
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
enum {
|
|
|
|
ARG_0,
|
|
|
|
ARG_MAX_LENGTH,
|
1998-08-17 14:48:51 +00:00
|
|
|
ARG_VISIBILITY
|
1998-07-16 20:23:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_entry_class_init (GtkEntryClass *klass);
|
|
|
|
static void gtk_entry_init (GtkEntry *entry);
|
1998-07-16 20:23:12 +00:00
|
|
|
static void gtk_entry_set_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
|
|
|
static void gtk_entry_get_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
1998-01-30 23:47:09 +00:00
|
|
|
static void gtk_entry_finalize (GtkObject *object);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_entry_realize (GtkWidget *widget);
|
|
|
|
static void gtk_entry_unrealize (GtkWidget *widget);
|
|
|
|
static void gtk_entry_draw_focus (GtkWidget *widget);
|
|
|
|
static void gtk_entry_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition);
|
|
|
|
static void gtk_entry_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
1998-01-08 01:58:39 +00:00
|
|
|
static void gtk_entry_make_backing_pixmap (GtkEntry *entry,
|
|
|
|
gint width, gint height);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_entry_draw (GtkWidget *widget,
|
|
|
|
GdkRectangle *area);
|
|
|
|
static gint gtk_entry_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event);
|
|
|
|
static gint gtk_entry_button_press (GtkWidget *widget,
|
|
|
|
GdkEventButton *event);
|
|
|
|
static gint gtk_entry_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *event);
|
|
|
|
static gint gtk_entry_motion_notify (GtkWidget *widget,
|
|
|
|
GdkEventMotion *event);
|
|
|
|
static gint gtk_entry_key_press (GtkWidget *widget,
|
|
|
|
GdkEventKey *event);
|
|
|
|
static gint gtk_entry_focus_in (GtkWidget *widget,
|
|
|
|
GdkEventFocus *event);
|
|
|
|
static gint gtk_entry_focus_out (GtkWidget *widget,
|
|
|
|
GdkEventFocus *event);
|
|
|
|
static void gtk_entry_draw_text (GtkEntry *entry);
|
|
|
|
static void gtk_entry_draw_cursor (GtkEntry *entry);
|
1998-01-08 01:58:39 +00:00
|
|
|
static void gtk_entry_draw_cursor_on_drawable
|
|
|
|
(GtkEntry *entry,
|
|
|
|
GdkDrawable *drawable);
|
1998-03-31 02:36:51 +00:00
|
|
|
static void gtk_entry_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *previous_style);
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
static void gtk_entry_state_changed (GtkWidget *widget,
|
|
|
|
GtkStateType previous_state);
|
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
|
|
|
#ifdef USE_XIM
|
|
|
|
static void gtk_entry_update_ic_attr (GtkWidget *widget);
|
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_entry_queue_draw (GtkEntry *entry);
|
|
|
|
static gint gtk_entry_timer (gpointer data);
|
|
|
|
static gint gtk_entry_position (GtkEntry *entry,
|
|
|
|
gint x);
|
1998-11-28 01:56:09 +00:00
|
|
|
static void entry_adjust_scroll (GtkEntry *entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_entry_grow_text (GtkEntry *entry);
|
1998-03-01 08:47:36 +00:00
|
|
|
static void gtk_entry_insert_text (GtkEditable *editable,
|
1997-11-24 22:37:52 +00:00
|
|
|
const gchar *new_text,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint new_text_length,
|
|
|
|
gint *position);
|
|
|
|
static void gtk_entry_delete_text (GtkEditable *editable,
|
|
|
|
gint start_pos,
|
|
|
|
gint end_pos);
|
1998-03-01 05:11:05 +00:00
|
|
|
static void gtk_entry_update_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
|
|
|
static gchar *gtk_entry_get_chars (GtkEditable *editable,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint start_pos,
|
|
|
|
gint end_pos);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
/* Binding actions */
|
|
|
|
static void gtk_entry_move_cursor (GtkEditable *editable,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
|
|
|
static void gtk_entry_move_word (GtkEditable *editable,
|
|
|
|
gint n);
|
|
|
|
static void gtk_entry_move_to_column (GtkEditable *editable,
|
|
|
|
gint row);
|
|
|
|
static void gtk_entry_kill_char (GtkEditable *editable,
|
|
|
|
gint direction);
|
|
|
|
static void gtk_entry_kill_word (GtkEditable *editable,
|
|
|
|
gint direction);
|
|
|
|
static void gtk_entry_kill_line (GtkEditable *editable,
|
|
|
|
gint direction);
|
|
|
|
|
|
|
|
/* To be removed */
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_move_forward_character (GtkEntry *entry);
|
|
|
|
static void gtk_move_backward_character (GtkEntry *entry);
|
|
|
|
static void gtk_move_forward_word (GtkEntry *entry);
|
|
|
|
static void gtk_move_backward_word (GtkEntry *entry);
|
|
|
|
static void gtk_move_beginning_of_line (GtkEntry *entry);
|
|
|
|
static void gtk_move_end_of_line (GtkEntry *entry);
|
|
|
|
static void gtk_delete_forward_character (GtkEntry *entry);
|
|
|
|
static void gtk_delete_backward_character (GtkEntry *entry);
|
|
|
|
static void gtk_delete_forward_word (GtkEntry *entry);
|
|
|
|
static void gtk_delete_backward_word (GtkEntry *entry);
|
|
|
|
static void gtk_delete_line (GtkEntry *entry);
|
|
|
|
static void gtk_delete_to_line_end (GtkEntry *entry);
|
1998-03-10 22:57:26 +00:00
|
|
|
static void gtk_select_word (GtkEntry *entry,
|
|
|
|
guint32 time);
|
|
|
|
static void gtk_select_line (GtkEntry *entry,
|
|
|
|
guint32 time);
|
1998-03-01 05:11:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void gtk_entry_set_selection (GtkEditable *editable,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint start,
|
|
|
|
gint end);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-22 21:31:10 +00:00
|
|
|
static void gtk_entry_recompute_offsets (GtkEntry *entry);
|
|
|
|
static gint gtk_entry_find_position (GtkEntry *entry,
|
|
|
|
gint position);
|
1998-05-22 07:07:11 +00:00
|
|
|
static void gtk_entry_set_position_from_editable (GtkEditable *editable,
|
|
|
|
gint position);
|
1998-03-22 21:31:10 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static GtkWidgetClass *parent_class = NULL;
|
1997-11-27 04:16:39 +00:00
|
|
|
static GdkAtom ctext_atom = GDK_NONE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTextFunction control_keys[26] =
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1997-12-07 16:25:48 +00:00
|
|
|
(GtkTextFunction)gtk_move_beginning_of_line, /* a */
|
|
|
|
(GtkTextFunction)gtk_move_backward_character, /* b */
|
1998-06-19 01:26:24 +00:00
|
|
|
(GtkTextFunction)gtk_editable_copy_clipboard, /* c */
|
1997-12-07 16:25:48 +00:00
|
|
|
(GtkTextFunction)gtk_delete_forward_character, /* d */
|
|
|
|
(GtkTextFunction)gtk_move_end_of_line, /* e */
|
|
|
|
(GtkTextFunction)gtk_move_forward_character, /* f */
|
|
|
|
NULL, /* g */
|
|
|
|
(GtkTextFunction)gtk_delete_backward_character, /* h */
|
|
|
|
NULL, /* i */
|
|
|
|
NULL, /* j */
|
|
|
|
(GtkTextFunction)gtk_delete_to_line_end, /* k */
|
|
|
|
NULL, /* l */
|
|
|
|
NULL, /* m */
|
|
|
|
NULL, /* n */
|
|
|
|
NULL, /* o */
|
|
|
|
NULL, /* p */
|
|
|
|
NULL, /* q */
|
|
|
|
NULL, /* r */
|
|
|
|
NULL, /* s */
|
|
|
|
NULL, /* t */
|
|
|
|
(GtkTextFunction)gtk_delete_line, /* u */
|
1998-06-19 01:26:24 +00:00
|
|
|
(GtkTextFunction)gtk_editable_paste_clipboard, /* v */
|
1997-12-07 16:25:48 +00:00
|
|
|
(GtkTextFunction)gtk_delete_backward_word, /* w */
|
1998-06-19 01:26:24 +00:00
|
|
|
(GtkTextFunction)gtk_editable_cut_clipboard, /* x */
|
1997-12-07 16:25:48 +00:00
|
|
|
NULL, /* y */
|
|
|
|
NULL, /* z */
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTextFunction alt_keys[26] =
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1997-12-07 16:25:48 +00:00
|
|
|
NULL, /* a */
|
|
|
|
(GtkTextFunction)gtk_move_backward_word, /* b */
|
|
|
|
NULL, /* c */
|
|
|
|
(GtkTextFunction)gtk_delete_forward_word, /* d */
|
|
|
|
NULL, /* e */
|
|
|
|
(GtkTextFunction)gtk_move_forward_word, /* f */
|
|
|
|
NULL, /* g */
|
|
|
|
NULL, /* h */
|
|
|
|
NULL, /* i */
|
|
|
|
NULL, /* j */
|
|
|
|
NULL, /* k */
|
|
|
|
NULL, /* l */
|
|
|
|
NULL, /* m */
|
|
|
|
NULL, /* n */
|
|
|
|
NULL, /* o */
|
|
|
|
NULL, /* p */
|
|
|
|
NULL, /* q */
|
|
|
|
NULL, /* r */
|
|
|
|
NULL, /* s */
|
|
|
|
NULL, /* t */
|
|
|
|
NULL, /* u */
|
|
|
|
NULL, /* v */
|
|
|
|
NULL, /* w */
|
|
|
|
NULL, /* x */
|
|
|
|
NULL, /* y */
|
|
|
|
NULL, /* z */
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
GtkType
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_entry_get_type (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
static GtkType entry_type = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (!entry_type)
|
|
|
|
{
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTypeInfo entry_info =
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
"GtkEntry",
|
|
|
|
sizeof (GtkEntry),
|
|
|
|
sizeof (GtkEntryClass),
|
|
|
|
(GtkClassInitFunc) gtk_entry_class_init,
|
|
|
|
(GtkObjectInitFunc) gtk_entry_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,
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
entry_type = gtk_type_unique (GTK_TYPE_EDITABLE, &entry_info);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return entry_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_class_init (GtkEntryClass *class)
|
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
|
|
|
GtkWidgetClass *widget_class;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditableClass *editable_class;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
object_class = (GtkObjectClass*) class;
|
|
|
|
widget_class = (GtkWidgetClass*) class;
|
1998-03-01 05:11:05 +00:00
|
|
|
editable_class = (GtkEditableClass*) class;
|
1998-07-16 20:23:12 +00:00
|
|
|
parent_class = gtk_type_class (GTK_TYPE_EDITABLE);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
gtk_object_add_arg_type ("GtkEntry::max_length", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_MAX_LENGTH);
|
|
|
|
gtk_object_add_arg_type ("GtkEntry::visibility", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_VISIBILITY);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
object_class->set_arg = gtk_entry_set_arg;
|
|
|
|
object_class->get_arg = gtk_entry_get_arg;
|
1998-01-30 23:47:09 +00:00
|
|
|
object_class->finalize = gtk_entry_finalize;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
widget_class->realize = gtk_entry_realize;
|
|
|
|
widget_class->unrealize = gtk_entry_unrealize;
|
|
|
|
widget_class->draw_focus = gtk_entry_draw_focus;
|
|
|
|
widget_class->size_request = gtk_entry_size_request;
|
|
|
|
widget_class->size_allocate = gtk_entry_size_allocate;
|
|
|
|
widget_class->draw = gtk_entry_draw;
|
|
|
|
widget_class->expose_event = gtk_entry_expose;
|
|
|
|
widget_class->button_press_event = gtk_entry_button_press;
|
|
|
|
widget_class->button_release_event = gtk_entry_button_release;
|
|
|
|
widget_class->motion_notify_event = gtk_entry_motion_notify;
|
|
|
|
widget_class->key_press_event = gtk_entry_key_press;
|
|
|
|
widget_class->focus_in_event = gtk_entry_focus_in;
|
|
|
|
widget_class->focus_out_event = gtk_entry_focus_out;
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
widget_class->style_set = gtk_entry_style_set;
|
|
|
|
widget_class->state_changed = gtk_entry_state_changed;
|
1998-03-01 05:11:05 +00:00
|
|
|
|
|
|
|
editable_class->insert_text = gtk_entry_insert_text;
|
|
|
|
editable_class->delete_text = gtk_entry_delete_text;
|
1998-11-28 01:56:09 +00:00
|
|
|
editable_class->changed = (void (*)(GtkEditable *)) entry_adjust_scroll;
|
1998-06-19 01:26:24 +00:00
|
|
|
|
|
|
|
editable_class->move_cursor = gtk_entry_move_cursor;
|
|
|
|
editable_class->move_word = gtk_entry_move_word;
|
|
|
|
editable_class->move_to_column = gtk_entry_move_to_column;
|
|
|
|
|
|
|
|
editable_class->kill_char = gtk_entry_kill_char;
|
|
|
|
editable_class->kill_word = gtk_entry_kill_word;
|
|
|
|
editable_class->kill_line = gtk_entry_kill_line;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable_class->update_text = gtk_entry_update_text;
|
|
|
|
editable_class->get_chars = gtk_entry_get_chars;
|
|
|
|
editable_class->set_selection = gtk_entry_set_selection;
|
1998-05-22 07:07:11 +00:00
|
|
|
editable_class->set_position = gtk_entry_set_position_from_editable;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
static void
|
|
|
|
gtk_entry_set_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
|
|
|
|
|
|
|
entry = GTK_ENTRY (object);
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case ARG_MAX_LENGTH:
|
|
|
|
gtk_entry_set_max_length (entry, GTK_VALUE_UINT (*arg));
|
|
|
|
break;
|
|
|
|
case ARG_VISIBILITY:
|
|
|
|
gtk_entry_set_visibility (entry, GTK_VALUE_BOOL (*arg));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_get_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
|
|
|
|
|
|
|
entry = GTK_ENTRY (object);
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case ARG_MAX_LENGTH:
|
|
|
|
GTK_VALUE_UINT (*arg) = entry->text_max_length;
|
|
|
|
break;
|
|
|
|
case ARG_VISIBILITY:
|
1999-02-10 00:39:49 +00:00
|
|
|
GTK_VALUE_BOOL (*arg) = GTK_EDITABLE (entry)->visible;
|
1998-07-16 20:23:12 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
arg->type = GTK_TYPE_INVALID;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_entry_init (GtkEntry *entry)
|
|
|
|
{
|
|
|
|
GTK_WIDGET_SET_FLAGS (entry, GTK_CAN_FOCUS);
|
|
|
|
|
|
|
|
entry->text_area = NULL;
|
1998-01-08 01:58:39 +00:00
|
|
|
entry->backing_pixmap = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
entry->text = NULL;
|
|
|
|
entry->text_size = 0;
|
|
|
|
entry->text_length = 0;
|
1998-01-03 08:35:21 +00:00
|
|
|
entry->text_max_length = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
entry->scroll_offset = 0;
|
|
|
|
entry->timer = 0;
|
1998-03-10 03:17:02 +00:00
|
|
|
entry->button = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
entry->visible = 1;
|
1998-02-17 08:32:55 +00:00
|
|
|
|
1998-03-22 21:31:10 +00:00
|
|
|
entry->char_offset = NULL;
|
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
|
|
|
entry->text_mb = NULL;
|
|
|
|
entry->text_mb_dirty = TRUE;
|
|
|
|
entry->use_wchar = FALSE;
|
1998-03-22 21:31:10 +00:00
|
|
|
|
1998-02-17 08:32:55 +00:00
|
|
|
gtk_entry_grow_text (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget*
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_entry_new (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
return GTK_WIDGET (gtk_type_new (GTK_TYPE_ENTRY));
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-01-03 08:35:21 +00:00
|
|
|
GtkWidget*
|
|
|
|
gtk_entry_new_with_max_length (guint16 max)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
1998-07-16 20:23:12 +00:00
|
|
|
|
|
|
|
entry = gtk_type_new (GTK_TYPE_ENTRY);
|
1998-01-03 08:35:21 +00:00
|
|
|
entry->text_max_length = max;
|
1998-07-16 20:23:12 +00:00
|
|
|
|
1998-01-03 08:35:21 +00:00
|
|
|
return GTK_WIDGET (entry);
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
|
|
|
gtk_entry_set_text (GtkEntry *entry,
|
|
|
|
const gchar *text)
|
|
|
|
{
|
|
|
|
gint tmp_pos;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
1998-02-21 17:12:15 +00:00
|
|
|
g_return_if_fail (text != NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (entry);
|
|
|
|
|
|
|
|
gtk_entry_delete_text (GTK_EDITABLE(entry), 0, entry->text_length);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
tmp_pos = 0;
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_editable_insert_text (editable, text, strlen (text), &tmp_pos);
|
|
|
|
editable->current_pos = tmp_pos;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable->selection_start_pos = 0;
|
|
|
|
editable->selection_end_pos = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (GTK_WIDGET_DRAWABLE (entry))
|
|
|
|
gtk_entry_draw_text (entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_entry_append_text (GtkEntry *entry,
|
|
|
|
const gchar *text)
|
|
|
|
{
|
|
|
|
gint tmp_pos;
|
|
|
|
|
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
1998-03-23 14:50:58 +00:00
|
|
|
g_return_if_fail (text != NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
tmp_pos = entry->text_length;
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_editable_insert_text (GTK_EDITABLE(entry), text, strlen (text), &tmp_pos);
|
|
|
|
GTK_EDITABLE(entry)->current_pos = tmp_pos;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_entry_prepend_text (GtkEntry *entry,
|
|
|
|
const gchar *text)
|
|
|
|
{
|
|
|
|
gint tmp_pos;
|
|
|
|
|
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
1998-03-23 14:50:58 +00:00
|
|
|
g_return_if_fail (text != NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
tmp_pos = 0;
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_editable_insert_text (GTK_EDITABLE(entry), text, strlen (text), &tmp_pos);
|
|
|
|
GTK_EDITABLE(entry)->current_pos = tmp_pos;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_entry_set_position (GtkEntry *entry,
|
|
|
|
gint position)
|
|
|
|
{
|
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
|
|
if ((position == -1) || (position > entry->text_length))
|
1998-03-01 05:11:05 +00:00
|
|
|
GTK_EDITABLE(entry)->current_pos = entry->text_length;
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1998-03-01 05:11:05 +00:00
|
|
|
GTK_EDITABLE(entry)->current_pos = position;
|
1998-11-28 01:56:09 +00:00
|
|
|
entry_adjust_scroll (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-05-22 07:07:11 +00:00
|
|
|
static void
|
|
|
|
gtk_entry_set_position_from_editable (GtkEditable *editable,
|
|
|
|
gint position)
|
|
|
|
{
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (editable), position);
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
|
|
|
gtk_entry_set_visibility (GtkEntry *entry,
|
1998-01-07 00:04:19 +00:00
|
|
|
gboolean visible)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
1999-02-10 00:39:49 +00:00
|
|
|
entry->visible = visible ? TRUE : FALSE;
|
|
|
|
GTK_EDITABLE (entry)->visible = visible ? TRUE : FALSE;
|
1998-05-22 07:07:11 +00:00
|
|
|
gtk_entry_recompute_offsets (entry);
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (entry));
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-01-07 00:04:19 +00:00
|
|
|
void
|
|
|
|
gtk_entry_set_editable(GtkEntry *entry,
|
1998-07-16 20:23:12 +00:00
|
|
|
gboolean editable)
|
1998-01-07 00:04:19 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
1998-03-23 14:50:58 +00:00
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
gtk_editable_set_editable (GTK_EDITABLE (entry), editable);
|
1998-01-07 00:04:19 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gchar*
|
|
|
|
gtk_entry_get_text (GtkEntry *entry)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (entry != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
|
|
|
|
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 (!entry->text_mb_dirty)
|
|
|
|
return entry->text_mb;
|
|
|
|
|
|
|
|
if (entry->text_mb)
|
|
|
|
g_free(entry->text_mb);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!entry->text)
|
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
|
|
|
{
|
|
|
|
entry->text_mb = g_new(gchar, 1);
|
|
|
|
entry->text_mb[0] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
entry->text_mb = gtk_entry_get_chars(GTK_EDITABLE(entry), 0, -1);
|
|
|
|
}
|
|
|
|
entry->text_mb_dirty = 0;
|
|
|
|
|
|
|
|
return entry->text_mb;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-01-30 23:47:09 +00:00
|
|
|
gtk_entry_finalize (GtkObject *object)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
|
|
|
|
|
|
|
g_return_if_fail (object != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (object));
|
|
|
|
|
|
|
|
entry = GTK_ENTRY (object);
|
|
|
|
|
|
|
|
if (entry->timer)
|
|
|
|
gtk_timeout_remove (entry->timer);
|
|
|
|
|
1998-02-17 08:32:55 +00:00
|
|
|
entry->text_size = 0;
|
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
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (entry->text)
|
|
|
|
g_free (entry->text);
|
1998-03-22 21:31:10 +00:00
|
|
|
if (entry->char_offset)
|
|
|
|
g_free (entry->char_offset);
|
1997-11-24 22:37:52 +00:00
|
|
|
entry->text = NULL;
|
|
|
|
|
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 (entry->text_mb)
|
|
|
|
g_free (entry->text_mb);
|
|
|
|
entry->text_mb = NULL;
|
|
|
|
|
|
|
|
if (entry->backing_pixmap)
|
1998-01-08 01:58:39 +00:00
|
|
|
if (entry->backing_pixmap)
|
|
|
|
gdk_pixmap_unref (entry->backing_pixmap);
|
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_realize (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkWindowAttr attributes;
|
|
|
|
gint attributes_mask;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (widget));
|
|
|
|
|
|
|
|
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
|
|
|
entry = GTK_ENTRY (widget);
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (widget);
|
1998-04-05 06:58:29 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
attributes.window_type = GDK_WINDOW_CHILD;
|
|
|
|
attributes.x = widget->allocation.x;
|
1998-04-05 06:58:29 +00:00
|
|
|
attributes.y = widget->allocation.y + (widget->allocation.height -
|
|
|
|
widget->requisition.height) / 2;
|
1997-11-24 22:37:52 +00:00
|
|
|
attributes.width = widget->allocation.width;
|
1998-04-05 06:58:29 +00:00
|
|
|
attributes.height = widget->requisition.height;
|
1997-11-24 22:37:52 +00:00
|
|
|
attributes.wclass = GDK_INPUT_OUTPUT;
|
|
|
|
attributes.visual = gtk_widget_get_visual (widget);
|
|
|
|
attributes.colormap = gtk_widget_get_colormap (widget);
|
|
|
|
attributes.event_mask = gtk_widget_get_events (widget);
|
|
|
|
attributes.event_mask |= (GDK_EXPOSURE_MASK |
|
|
|
|
GDK_BUTTON_PRESS_MASK |
|
|
|
|
GDK_BUTTON_RELEASE_MASK |
|
|
|
|
GDK_BUTTON1_MOTION_MASK |
|
|
|
|
GDK_BUTTON3_MOTION_MASK |
|
|
|
|
GDK_POINTER_MOTION_HINT_MASK |
|
|
|
|
GDK_ENTER_NOTIFY_MASK |
|
|
|
|
GDK_LEAVE_NOTIFY_MASK |
|
|
|
|
GDK_KEY_PRESS_MASK);
|
|
|
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
|
|
|
|
1998-01-18 15:09:10 +00:00
|
|
|
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_set_user_data (widget->window, entry);
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
attributes.x = widget->style->klass->xthickness;
|
|
|
|
attributes.y = widget->style->klass->ythickness;
|
1997-11-24 22:37:52 +00:00
|
|
|
attributes.width = widget->allocation.width - attributes.x * 2;
|
1998-04-13 00:20:17 +00:00
|
|
|
attributes.height = widget->requisition.height - attributes.y * 2;
|
1998-01-15 08:45:57 +00:00
|
|
|
attributes.cursor = entry->cursor = gdk_cursor_new (GDK_XTERM);
|
|
|
|
attributes_mask |= GDK_WA_CURSOR;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
entry->text_area = gdk_window_new (widget->window, &attributes, attributes_mask);
|
|
|
|
gdk_window_set_user_data (entry->text_area, entry);
|
|
|
|
|
|
|
|
widget->style = gtk_style_attach (widget->style, widget->window);
|
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
|
|
|
gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1997-11-27 04:16:39 +00:00
|
|
|
#ifdef USE_XIM
|
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 (gdk_im_ready () && (editable->ic_attr = gdk_ic_attr_new ()) != NULL)
|
1997-11-27 04:16:39 +00:00
|
|
|
{
|
|
|
|
gint width, height;
|
|
|
|
GdkEventMask mask;
|
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
|
|
|
GdkColormap *colormap;
|
|
|
|
GdkICAttr *attr = editable->ic_attr;
|
|
|
|
GdkICAttributesType attrmask = GDK_IC_ALL_REQ;
|
1997-11-27 04:16:39 +00:00
|
|
|
GdkIMStyle style;
|
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
|
|
|
GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE |
|
|
|
|
GDK_IM_PREEDIT_NOTHING |
|
|
|
|
GDK_IM_PREEDIT_POSITION |
|
|
|
|
GDK_IM_STATUS_NONE |
|
|
|
|
GDK_IM_STATUS_NOTHING;
|
1997-11-27 04:16:39 +00:00
|
|
|
|
|
|
|
if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
|
1998-08-25 00:06:38 +00:00
|
|
|
supported_style &= ~GDK_IM_PREEDIT_POSITION;
|
1997-11-27 04:16:39 +00:00
|
|
|
|
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
|
|
|
attr->style = style = gdk_im_decide_style (supported_style);
|
|
|
|
attr->client_window = entry->text_area;
|
|
|
|
|
|
|
|
if ((colormap = gtk_widget_get_colormap (widget)) !=
|
|
|
|
gtk_widget_get_default_colormap ())
|
|
|
|
{
|
|
|
|
attrmask |= GDK_IC_PREEDIT_COLORMAP;
|
|
|
|
attr->preedit_colormap = colormap;
|
|
|
|
}
|
|
|
|
attrmask |= GDK_IC_PREEDIT_FOREGROUND;
|
|
|
|
attrmask |= GDK_IC_PREEDIT_BACKGROUND;
|
|
|
|
attr->preedit_foreground = widget->style->fg[GTK_STATE_NORMAL];
|
|
|
|
attr->preedit_background = widget->style->base[GTK_STATE_NORMAL];
|
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
switch (style & GDK_IM_PREEDIT_MASK)
|
1997-11-27 04:16:39 +00:00
|
|
|
{
|
1998-08-25 00:06:38 +00:00
|
|
|
case GDK_IM_PREEDIT_POSITION:
|
1997-11-27 04:16:39 +00:00
|
|
|
if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
|
|
|
|
{
|
|
|
|
g_warning ("over-the-spot style requires fontset");
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
|
1997-11-27 04:16:39 +00:00
|
|
|
gdk_window_get_size (entry->text_area, &width, &height);
|
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
|
|
|
|
|
|
|
attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
|
|
|
|
attr->spot_location.x = 0;
|
|
|
|
attr->spot_location.y = height;
|
|
|
|
attr->preedit_area.x = 0;
|
|
|
|
attr->preedit_area.y = 0;
|
|
|
|
attr->preedit_area.width = width;
|
|
|
|
attr->preedit_area.height = height;
|
|
|
|
attr->preedit_fontset = widget->style->font;
|
|
|
|
|
1997-11-27 04:16:39 +00:00
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
editable->ic = gdk_ic_new (attr, attrmask);
|
1997-11-27 04:16:39 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->ic == NULL)
|
1997-11-27 04:16:39 +00:00
|
|
|
g_warning ("Can't create input context.");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mask = gdk_window_get_events (entry->text_area);
|
1998-03-01 05:11:05 +00:00
|
|
|
mask |= gdk_ic_get_events (editable->ic);
|
1997-11-27 04:16:39 +00:00
|
|
|
gdk_window_set_events (entry->text_area, mask);
|
|
|
|
|
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 (GTK_WIDGET_HAS_FOCUS(widget))
|
|
|
|
gdk_im_begin (editable->ic, entry->text_area);
|
1997-11-27 04:16:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_show (entry->text_area);
|
1998-03-01 05:11:05 +00:00
|
|
|
|
|
|
|
if (editable->selection_start_pos != editable->selection_end_pos)
|
|
|
|
gtk_editable_claim_selection (editable, TRUE, GDK_CURRENT_TIME);
|
1998-03-22 21:31:10 +00:00
|
|
|
|
|
|
|
gtk_entry_recompute_offsets (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_unrealize (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (widget));
|
|
|
|
|
|
|
|
entry = GTK_ENTRY (widget);
|
|
|
|
|
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
|
|
|
#ifdef USE_XIM
|
|
|
|
if (GTK_EDITABLE (widget)->ic)
|
|
|
|
{
|
|
|
|
gdk_ic_destroy (GTK_EDITABLE (widget)->ic);
|
|
|
|
GTK_EDITABLE (widget)->ic = NULL;
|
|
|
|
}
|
|
|
|
if (GTK_EDITABLE (widget)->ic_attr)
|
|
|
|
{
|
|
|
|
gdk_ic_attr_destroy (GTK_EDITABLE (widget)->ic_attr);
|
|
|
|
GTK_EDITABLE (widget)->ic_attr = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (entry->text_area)
|
|
|
|
{
|
|
|
|
gdk_window_set_user_data (entry->text_area, NULL);
|
|
|
|
gdk_window_destroy (entry->text_area);
|
1998-02-02 20:40:03 +00:00
|
|
|
entry->text_area = NULL;
|
1998-01-15 08:45:57 +00:00
|
|
|
gdk_cursor_destroy (entry->cursor);
|
1998-02-02 20:40:03 +00:00
|
|
|
entry->cursor = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-02-12 03:02:14 +00:00
|
|
|
|
|
|
|
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
|
|
|
|
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_draw_focus (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
gint width, height;
|
|
|
|
gint x, y;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (widget));
|
|
|
|
|
|
|
|
if (GTK_WIDGET_DRAWABLE (widget))
|
|
|
|
{
|
|
|
|
x = 0;
|
|
|
|
y = 0;
|
|
|
|
gdk_window_get_size (widget->window, &width, &height);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_HAS_FOCUS (widget))
|
|
|
|
{
|
|
|
|
x += 1;
|
|
|
|
y += 1;
|
|
|
|
width -= 2;
|
|
|
|
height -= 2;
|
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_paint_shadow (widget->style, widget->window,
|
|
|
|
GTK_STATE_NORMAL, GTK_SHADOW_IN,
|
|
|
|
NULL, widget, "entry",
|
|
|
|
x, y, width, height);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (GTK_WIDGET_HAS_FOCUS (widget))
|
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
gdk_window_get_size (widget->window, &width, &height);
|
|
|
|
gtk_paint_focus (widget->style, widget->window,
|
|
|
|
NULL, widget, "entry",
|
|
|
|
0, 0, width - 1, height - 1);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-03-26 20:57:29 +00:00
|
|
|
if (GTK_EDITABLE (widget)->editable)
|
|
|
|
gtk_entry_draw_cursor (GTK_ENTRY (widget));
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition)
|
|
|
|
{
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (widget));
|
|
|
|
g_return_if_fail (requisition != NULL);
|
|
|
|
|
|
|
|
requisition->width = MIN_ENTRY_WIDTH + (widget->style->klass->xthickness + INNER_BORDER) * 2;
|
|
|
|
requisition->height = (widget->style->font->ascent +
|
|
|
|
widget->style->font->descent +
|
|
|
|
(widget->style->klass->ythickness + INNER_BORDER) * 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (widget));
|
|
|
|
g_return_if_fail (allocation != NULL);
|
|
|
|
|
|
|
|
widget->allocation = *allocation;
|
|
|
|
entry = GTK_ENTRY (widget);
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (widget))
|
|
|
|
{
|
|
|
|
gdk_window_move_resize (widget->window,
|
|
|
|
allocation->x,
|
|
|
|
allocation->y + (allocation->height - widget->requisition.height) / 2,
|
|
|
|
allocation->width, widget->requisition.height);
|
|
|
|
gdk_window_move_resize (entry->text_area,
|
1998-11-06 22:05:02 +00:00
|
|
|
widget->style->klass->xthickness,
|
|
|
|
widget->style->klass->ythickness,
|
|
|
|
allocation->width - widget->style->klass->xthickness * 2,
|
|
|
|
widget->requisition.height - widget->style->klass->ythickness * 2);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-04-03 23:17:16 +00:00
|
|
|
/* And make sure the cursor is on screen */
|
1998-11-28 01:56:09 +00:00
|
|
|
entry_adjust_scroll (entry);
|
1998-04-03 23:17:16 +00:00
|
|
|
|
1997-11-27 04:16:39 +00:00
|
|
|
#ifdef USE_XIM
|
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 (editable->ic &&
|
|
|
|
(gdk_ic_get_style (editable->ic) & GDK_IM_PREEDIT_POSITION))
|
1997-11-27 04:16:39 +00:00
|
|
|
{
|
|
|
|
gint width, height;
|
|
|
|
|
|
|
|
gdk_window_get_size (entry->text_area, &width, &height);
|
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
|
|
|
editable->ic_attr->preedit_area.width = width;
|
|
|
|
editable->ic_attr->preedit_area.height = height;
|
|
|
|
gdk_ic_set_attr (editable->ic, editable->ic_attr,
|
|
|
|
GDK_IC_PREEDIT_AREA);
|
1997-11-27 04:16:39 +00:00
|
|
|
}
|
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_draw (GtkWidget *widget,
|
|
|
|
GdkRectangle *area)
|
|
|
|
{
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (widget));
|
|
|
|
g_return_if_fail (area != NULL);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_DRAWABLE (widget))
|
|
|
|
{
|
|
|
|
gtk_widget_draw_focus (widget);
|
|
|
|
gtk_entry_draw_text (GTK_ENTRY (widget));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_entry_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
|
|
|
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
entry = GTK_ENTRY (widget);
|
|
|
|
|
|
|
|
if (widget->window == event->window)
|
|
|
|
gtk_widget_draw_focus (widget);
|
|
|
|
else if (entry->text_area == event->window)
|
|
|
|
gtk_entry_draw_text (GTK_ENTRY (widget));
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_entry_button_press (GtkWidget *widget,
|
|
|
|
GdkEventButton *event)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint tmp_pos;
|
|
|
|
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
1997-11-27 04:16:39 +00:00
|
|
|
if (ctext_atom == GDK_NONE)
|
|
|
|
ctext_atom = gdk_atom_intern ("COMPOUND_TEXT", FALSE);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
entry = GTK_ENTRY (widget);
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (widget);
|
|
|
|
|
1998-03-27 05:17:11 +00:00
|
|
|
if (entry->button && (event->button != entry->button))
|
|
|
|
return FALSE;
|
1998-03-10 03:17:02 +00:00
|
|
|
|
|
|
|
entry->button = event->button;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!GTK_WIDGET_HAS_FOCUS (widget))
|
|
|
|
gtk_widget_grab_focus (widget);
|
|
|
|
|
|
|
|
if (event->button == 1)
|
|
|
|
{
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
gtk_grab_add (widget);
|
|
|
|
|
|
|
|
tmp_pos = gtk_entry_position (entry, event->x + entry->scroll_offset);
|
1998-03-05 06:32:42 +00:00
|
|
|
/* Set it now, so we display things right. We'll unset it
|
|
|
|
* later if things don't work out */
|
|
|
|
editable->has_selection = TRUE;
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_entry_set_selection (editable, tmp_pos, tmp_pos);
|
|
|
|
editable->current_pos = editable->selection_start_pos;
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_2BUTTON_PRESS:
|
1998-03-10 22:57:26 +00:00
|
|
|
gtk_select_word (entry, event->time);
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_3BUTTON_PRESS:
|
1998-03-10 22:57:26 +00:00
|
|
|
gtk_select_line (entry, event->time);
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (event->type == GDK_BUTTON_PRESS)
|
|
|
|
{
|
1998-03-05 06:32:42 +00:00
|
|
|
if ((event->button == 2) && editable->editable)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->selection_start_pos == editable->selection_end_pos ||
|
|
|
|
editable->has_selection)
|
|
|
|
editable->current_pos = gtk_entry_position (entry, event->x + entry->scroll_offset);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_selection_convert (widget, GDK_SELECTION_PRIMARY,
|
1997-11-27 04:16:39 +00:00
|
|
|
ctext_atom, event->time);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_grab_add (widget);
|
|
|
|
|
|
|
|
tmp_pos = gtk_entry_position (entry, event->x + entry->scroll_offset);
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_entry_set_selection (editable, tmp_pos, tmp_pos);
|
|
|
|
editable->has_selection = FALSE;
|
|
|
|
editable->current_pos = editable->selection_start_pos;
|
1998-03-05 06:32:42 +00:00
|
|
|
|
|
|
|
if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == widget->window)
|
|
|
|
gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY, event->time);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_entry_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *event)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
entry = GTK_ENTRY (widget);
|
|
|
|
editable = GTK_EDITABLE (widget);
|
|
|
|
|
|
|
|
if (entry->button != event->button)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
entry->button = 0;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (event->button == 1)
|
|
|
|
{
|
|
|
|
gtk_grab_remove (widget);
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable->has_selection = FALSE;
|
|
|
|
if (editable->selection_start_pos != editable->selection_end_pos)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
if (gtk_selection_owner_set (widget,
|
|
|
|
GDK_SELECTION_PRIMARY,
|
|
|
|
event->time))
|
1998-03-05 06:32:42 +00:00
|
|
|
editable->has_selection = TRUE;
|
|
|
|
else
|
|
|
|
gtk_entry_queue_draw (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == widget->window)
|
|
|
|
gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY, event->time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (event->button == 3)
|
|
|
|
{
|
|
|
|
gtk_grab_remove (widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_entry_motion_notify (GtkWidget *widget,
|
|
|
|
GdkEventMotion *event)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
|
|
|
gint x;
|
|
|
|
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
entry = GTK_ENTRY (widget);
|
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
if (entry->button == 0)
|
|
|
|
return FALSE;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
x = event->x;
|
|
|
|
if (event->is_hint || (entry->text_area != event->window))
|
|
|
|
gdk_window_get_pointer (entry->text_area, &x, NULL, NULL);
|
|
|
|
|
1998-04-06 12:59:06 +00:00
|
|
|
GTK_EDITABLE(entry)->selection_end_pos = gtk_entry_position (entry, x + entry->scroll_offset);
|
1998-03-01 05:11:05 +00:00
|
|
|
GTK_EDITABLE(entry)->current_pos = GTK_EDITABLE(entry)->selection_end_pos;
|
1998-11-28 01:56:09 +00:00
|
|
|
entry_adjust_scroll (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_entry_queue_draw (entry);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_entry_key_press (GtkWidget *widget,
|
|
|
|
GdkEventKey *event)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gint return_val;
|
|
|
|
gint key;
|
1998-03-10 03:17:02 +00:00
|
|
|
guint initial_pos;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint extend_selection;
|
1997-12-07 16:25:48 +00:00
|
|
|
gint extend_start;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
entry = GTK_ENTRY (widget);
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
return_val = FALSE;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if(editable->editable == FALSE)
|
1998-01-07 00:04:19 +00:00
|
|
|
return FALSE;
|
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
initial_pos = editable->current_pos;
|
|
|
|
|
1997-12-07 16:25:48 +00:00
|
|
|
extend_selection = event->state & GDK_SHIFT_MASK;
|
|
|
|
extend_start = FALSE;
|
|
|
|
|
|
|
|
if (extend_selection)
|
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->selection_start_pos == editable->selection_end_pos)
|
1997-12-07 16:25:48 +00:00
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
editable->selection_start_pos = editable->current_pos;
|
|
|
|
editable->selection_end_pos = editable->current_pos;
|
1997-12-07 16:25:48 +00:00
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
extend_start = (editable->current_pos == editable->selection_start_pos);
|
1997-12-07 16:25:48 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
switch (event->keyval)
|
|
|
|
{
|
|
|
|
case GDK_BackSpace:
|
|
|
|
return_val = TRUE;
|
1998-03-10 03:17:02 +00:00
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_delete_backward_word (entry);
|
|
|
|
else
|
|
|
|
gtk_delete_backward_character (entry);
|
|
|
|
break;
|
|
|
|
case GDK_Clear:
|
|
|
|
return_val = TRUE;
|
|
|
|
gtk_delete_line (entry);
|
|
|
|
break;
|
1998-03-10 03:17:02 +00:00
|
|
|
case GDK_Insert:
|
|
|
|
return_val = TRUE;
|
|
|
|
if (event->state & GDK_SHIFT_MASK)
|
|
|
|
{
|
|
|
|
extend_selection = FALSE;
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_editable_paste_clipboard (editable);
|
1998-03-10 03:17:02 +00:00
|
|
|
}
|
|
|
|
else if (event->state & GDK_CONTROL_MASK)
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_editable_copy_clipboard (editable);
|
1998-03-10 03:17:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* gtk_toggle_insert(entry) -- IMPLEMENT */
|
|
|
|
}
|
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
case GDK_Delete:
|
|
|
|
return_val = TRUE;
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
1998-03-10 03:17:02 +00:00
|
|
|
gtk_delete_forward_word (entry);
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
else if (event->state & GDK_SHIFT_MASK)
|
1998-03-10 03:17:02 +00:00
|
|
|
{
|
|
|
|
extend_selection = FALSE;
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_editable_cut_clipboard (editable);
|
1998-03-10 03:17:02 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
gtk_delete_forward_character (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
case GDK_Home:
|
|
|
|
return_val = TRUE;
|
1997-12-07 16:25:48 +00:00
|
|
|
gtk_move_beginning_of_line (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
case GDK_End:
|
1997-12-07 16:25:48 +00:00
|
|
|
return_val = TRUE;
|
|
|
|
gtk_move_end_of_line (entry);
|
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
case GDK_Left:
|
1997-12-07 16:25:48 +00:00
|
|
|
return_val = TRUE;
|
1998-03-10 03:17:02 +00:00
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
gtk_move_backward_word (entry);
|
|
|
|
else
|
|
|
|
gtk_move_backward_character (entry);
|
1997-12-07 16:25:48 +00:00
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
case GDK_Right:
|
|
|
|
return_val = TRUE;
|
1998-03-10 03:17:02 +00:00
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
gtk_move_forward_word (entry);
|
|
|
|
else
|
|
|
|
gtk_move_forward_character (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
case GDK_Return:
|
|
|
|
return_val = TRUE;
|
1998-03-10 03:17:02 +00:00
|
|
|
gtk_signal_emit_by_name (GTK_OBJECT (entry), "activate");
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
1997-11-27 04:16:39 +00:00
|
|
|
/* The next two keys should not be inserted literally. Any others ??? */
|
|
|
|
case GDK_Tab:
|
|
|
|
case GDK_Escape:
|
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
default:
|
|
|
|
if ((event->keyval >= 0x20) && (event->keyval <= 0xFF))
|
|
|
|
{
|
|
|
|
key = event->keyval;
|
|
|
|
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
{
|
|
|
|
if ((key >= 'A') && (key <= 'Z'))
|
|
|
|
key -= 'A' - 'a';
|
|
|
|
|
|
|
|
if ((key >= 'a') && (key <= 'z') && control_keys[key - 'a'])
|
1997-11-27 04:16:39 +00:00
|
|
|
{
|
1998-03-01 10:19:22 +00:00
|
|
|
(* control_keys[key - 'a']) (editable, event->time);
|
1997-11-27 04:16:39 +00:00
|
|
|
return_val = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else if (event->state & GDK_MOD1_MASK)
|
|
|
|
{
|
|
|
|
if ((key >= 'A') && (key <= 'Z'))
|
|
|
|
key -= 'A' - 'a';
|
|
|
|
|
|
|
|
if ((key >= 'a') && (key <= 'z') && alt_keys[key - 'a'])
|
1997-11-27 04:16:39 +00:00
|
|
|
{
|
1998-03-01 10:19:22 +00:00
|
|
|
(* alt_keys[key - 'a']) (editable, event->time);
|
1997-11-27 04:16:39 +00:00
|
|
|
return_val = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1997-11-27 04:16:39 +00:00
|
|
|
}
|
|
|
|
if (event->length > 0)
|
|
|
|
{
|
1998-03-17 19:03:52 +00:00
|
|
|
gint tmp_pos;
|
|
|
|
|
1997-12-07 16:25:48 +00:00
|
|
|
extend_selection = FALSE;
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_editable_delete_selection (editable);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
tmp_pos = editable->current_pos;
|
|
|
|
gtk_editable_insert_text (editable, event->string, event->length, &tmp_pos);
|
|
|
|
editable->current_pos = tmp_pos;
|
1997-11-27 04:16:39 +00:00
|
|
|
|
|
|
|
return_val = TRUE;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1998-07-17 03:56:13 +00:00
|
|
|
/* since we emit signals from within the above code,
|
|
|
|
* the widget might already be destroyed or at least
|
|
|
|
* unrealized.
|
|
|
|
*/
|
|
|
|
if (GTK_WIDGET_REALIZED (editable) &&
|
|
|
|
return_val && (editable->current_pos != initial_pos))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1997-12-07 16:25:48 +00:00
|
|
|
if (extend_selection)
|
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->current_pos < editable->selection_start_pos)
|
|
|
|
editable->selection_start_pos = editable->current_pos;
|
|
|
|
else if (editable->current_pos > editable->selection_end_pos)
|
|
|
|
editable->selection_end_pos = editable->current_pos;
|
1997-12-07 16:25:48 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (extend_start)
|
1998-03-01 05:11:05 +00:00
|
|
|
editable->selection_start_pos = editable->current_pos;
|
1997-12-07 16:25:48 +00:00
|
|
|
else
|
1998-03-01 05:11:05 +00:00
|
|
|
editable->selection_end_pos = editable->current_pos;
|
1997-12-07 16:25:48 +00:00
|
|
|
}
|
|
|
|
}
|
1998-01-06 21:59:00 +00:00
|
|
|
else
|
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
editable->selection_start_pos = 0;
|
|
|
|
editable->selection_end_pos = 0;
|
1998-01-06 21:59:00 +00:00
|
|
|
}
|
1997-12-07 16:25:48 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_editable_claim_selection (editable,
|
|
|
|
editable->selection_start_pos != editable->selection_end_pos,
|
|
|
|
event->time);
|
1997-12-07 16:25:48 +00:00
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
entry_adjust_scroll (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_entry_queue_draw (entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
return return_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_entry_focus_in (GtkWidget *widget,
|
|
|
|
GdkEventFocus *event)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
|
|
|
|
gtk_widget_draw_focus (widget);
|
|
|
|
|
1997-11-27 04:16:39 +00:00
|
|
|
#ifdef USE_XIM
|
1998-03-01 05:11:05 +00:00
|
|
|
if (GTK_EDITABLE(widget)->ic)
|
|
|
|
gdk_im_begin (GTK_EDITABLE(widget)->ic, GTK_ENTRY(widget)->text_area);
|
1997-11-27 04:16:39 +00:00
|
|
|
#endif
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_entry_focus_out (GtkWidget *widget,
|
|
|
|
GdkEventFocus *event)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
|
|
|
|
gtk_widget_draw_focus (widget);
|
|
|
|
|
1997-11-27 04:16:39 +00:00
|
|
|
#ifdef USE_XIM
|
|
|
|
gdk_im_end ();
|
|
|
|
#endif
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1998-01-08 01:58:39 +00:00
|
|
|
static void
|
|
|
|
gtk_entry_make_backing_pixmap (GtkEntry *entry, gint width, gint height)
|
|
|
|
{
|
|
|
|
gint pixmap_width, pixmap_height;
|
|
|
|
|
|
|
|
if (!entry->backing_pixmap)
|
|
|
|
{
|
|
|
|
/* allocate */
|
|
|
|
entry->backing_pixmap = gdk_pixmap_new (entry->text_area,
|
|
|
|
width, height,
|
|
|
|
-1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* reallocate if sizes don't match */
|
|
|
|
gdk_window_get_size (entry->backing_pixmap,
|
|
|
|
&pixmap_width, &pixmap_height);
|
|
|
|
if ((pixmap_width != width) || (pixmap_height != height))
|
|
|
|
{
|
|
|
|
gdk_pixmap_unref (entry->backing_pixmap);
|
|
|
|
entry->backing_pixmap = gdk_pixmap_new (entry->text_area,
|
|
|
|
width, height,
|
|
|
|
-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_entry_draw_text (GtkEntry *entry)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkStateType selected_state;
|
1998-03-22 21:31:10 +00:00
|
|
|
gint start_pos;
|
|
|
|
gint end_pos;
|
|
|
|
gint start_xoffset;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint selection_start_pos;
|
|
|
|
gint selection_end_pos;
|
|
|
|
gint selection_start_xoffset;
|
|
|
|
gint selection_end_xoffset;
|
|
|
|
gint width, height;
|
|
|
|
gint y;
|
1998-01-08 01:58:39 +00:00
|
|
|
GdkDrawable *drawable;
|
|
|
|
gint use_backing_pixmap;
|
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
|
|
|
GdkWChar *stars;
|
|
|
|
GdkWChar *toprint;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
|
|
if (entry->timer)
|
|
|
|
{
|
|
|
|
gtk_timeout_remove (entry->timer);
|
|
|
|
entry->timer = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GTK_WIDGET_DRAWABLE (entry))
|
|
|
|
{
|
|
|
|
widget = GTK_WIDGET (entry);
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-08 01:58:39 +00:00
|
|
|
if (!entry->text)
|
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_paint_flat_box (widget->style, entry->text_area,
|
|
|
|
GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE,
|
|
|
|
NULL, widget, "entry_bg",
|
|
|
|
0, 0, -1, -1);
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->editable)
|
1998-01-08 01:58:39 +00:00
|
|
|
gtk_entry_draw_cursor (entry);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gdk_window_get_size (entry->text_area, &width, &height);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-08 01:58:39 +00:00
|
|
|
/*
|
|
|
|
If the widget has focus, draw on a backing pixmap to avoid flickering
|
|
|
|
and copy it to the text_area.
|
|
|
|
Otherwise draw to text_area directly for better speed.
|
|
|
|
*/
|
|
|
|
use_backing_pixmap = GTK_WIDGET_HAS_FOCUS (widget) && (entry->text != NULL);
|
|
|
|
if (use_backing_pixmap)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_entry_make_backing_pixmap (entry, width, height);
|
|
|
|
drawable = entry->backing_pixmap;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
drawable = entry->text_area;
|
|
|
|
}
|
|
|
|
gtk_paint_flat_box (widget->style, drawable,
|
|
|
|
GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE,
|
|
|
|
NULL, widget, "entry_bg",
|
|
|
|
0, 0, width, height);
|
|
|
|
|
1998-01-08 01:58:39 +00:00
|
|
|
y = (height - (widget->style->font->ascent + widget->style->font->descent)) / 2;
|
|
|
|
y += widget->style->font->ascent;
|
|
|
|
|
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
|
|
|
start_pos = gtk_entry_find_position (entry, entry->scroll_offset);
|
|
|
|
start_xoffset = entry->char_offset[start_pos] - entry->scroll_offset;
|
1998-01-08 01:58:39 +00:00
|
|
|
|
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
|
|
|
end_pos = gtk_entry_find_position (entry, entry->scroll_offset + width);
|
1998-03-22 21:31:10 +00:00
|
|
|
if (end_pos < entry->text_length)
|
|
|
|
end_pos += 1;
|
|
|
|
|
|
|
|
selected_state = GTK_STATE_SELECTED;
|
|
|
|
if (!editable->has_selection)
|
|
|
|
selected_state = GTK_STATE_ACTIVE;
|
1998-05-22 07:07:11 +00:00
|
|
|
|
1998-03-22 21:31:10 +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);
|
|
|
|
|
|
|
|
selection_start_pos = CLAMP (selection_start_pos, start_pos, end_pos);
|
|
|
|
selection_end_pos = CLAMP (selection_end_pos, start_pos, end_pos);
|
|
|
|
|
|
|
|
selection_start_xoffset =
|
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
|
|
|
entry->char_offset[selection_start_pos] - entry->scroll_offset;
|
1998-03-22 21:31:10 +00:00
|
|
|
selection_end_xoffset =
|
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
|
|
|
entry->char_offset[selection_end_pos] -entry->scroll_offset;
|
1998-03-22 21:31:10 +00:00
|
|
|
|
1999-02-10 00:39:49 +00:00
|
|
|
/* if editable->visible, print a bunch of stars. If not, print the standard text. */
|
|
|
|
if (editable->visible)
|
1998-05-22 07:07:11 +00:00
|
|
|
{
|
|
|
|
toprint = entry->text + start_pos;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
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
|
|
|
stars = g_new (GdkWChar, end_pos - start_pos);
|
|
|
|
for (i = 0; i < end_pos - start_pos; i++)
|
1998-05-22 07:07:11 +00:00
|
|
|
stars[i] = '*';
|
|
|
|
toprint = stars;
|
|
|
|
}
|
|
|
|
|
1998-03-22 21:31:10 +00:00
|
|
|
if (selection_start_pos > start_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
|
|
|
gdk_draw_text_wc (drawable, widget->style->font,
|
|
|
|
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
|
|
|
INNER_BORDER + start_xoffset, y,
|
|
|
|
toprint,
|
|
|
|
selection_start_pos - start_pos);
|
1998-03-22 21:31:10 +00:00
|
|
|
|
|
|
|
if ((selection_end_pos >= start_pos) &&
|
|
|
|
(selection_start_pos < end_pos) &&
|
|
|
|
(selection_start_pos != selection_end_pos))
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
gtk_paint_flat_box (widget->style, drawable,
|
|
|
|
selected_state, GTK_SHADOW_NONE,
|
|
|
|
NULL, widget, "text",
|
|
|
|
INNER_BORDER + selection_start_xoffset,
|
|
|
|
INNER_BORDER,
|
|
|
|
selection_end_xoffset - selection_start_xoffset,
|
|
|
|
height - 2*INNER_BORDER);
|
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
|
|
|
gdk_draw_text_wc (drawable, widget->style->font,
|
|
|
|
widget->style->fg_gc[selected_state],
|
|
|
|
INNER_BORDER + selection_start_xoffset, y,
|
|
|
|
toprint + selection_start_pos - start_pos,
|
|
|
|
selection_end_pos - selection_start_pos);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (selection_end_pos < 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
|
|
|
gdk_draw_text_wc (drawable, widget->style->font,
|
|
|
|
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
|
|
|
INNER_BORDER + selection_end_xoffset, y,
|
|
|
|
toprint + selection_end_pos - start_pos,
|
|
|
|
end_pos - selection_end_pos);
|
1998-11-06 22:05:02 +00:00
|
|
|
/* free the space allocated for the stars if it's neccessary. */
|
1999-02-10 00:39:49 +00:00
|
|
|
if (!editable->visible)
|
1998-05-22 07:07:11 +00:00
|
|
|
g_free (toprint);
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->editable)
|
1998-01-08 01:58:39 +00:00
|
|
|
gtk_entry_draw_cursor_on_drawable (entry, drawable);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-08 01:58:39 +00:00
|
|
|
if (use_backing_pixmap)
|
|
|
|
gdk_draw_pixmap(entry->text_area,
|
|
|
|
widget->style->fg_gc[GTK_STATE_NORMAL],
|
|
|
|
entry->backing_pixmap,
|
|
|
|
0, 0, 0, 0, width, height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_draw_cursor (GtkEntry *entry)
|
1998-01-08 01:58:39 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
|
|
gtk_entry_draw_cursor_on_drawable (entry, entry->text_area);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_draw_cursor_on_drawable (GtkEntry *entry, GdkDrawable *drawable)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint xoffset;
|
|
|
|
gint text_area_height;
|
|
|
|
|
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
|
|
if (GTK_WIDGET_DRAWABLE (entry))
|
|
|
|
{
|
|
|
|
widget = GTK_WIDGET (entry);
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
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
|
|
|
xoffset = INNER_BORDER + entry->char_offset[editable->current_pos];
|
1997-11-24 22:37:52 +00:00
|
|
|
xoffset -= entry->scroll_offset;
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
gdk_window_get_size (entry->text_area, NULL, &text_area_height);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_HAS_FOCUS (widget) &&
|
1998-03-01 05:11:05 +00:00
|
|
|
(editable->selection_start_pos == editable->selection_end_pos))
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
gdk_draw_line (drawable, widget->style->fg_gc[GTK_STATE_NORMAL],
|
1998-12-16 20:39:31 +00:00
|
|
|
xoffset, INNER_BORDER,
|
|
|
|
xoffset, text_area_height - INNER_BORDER);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1998-12-16 20:39:31 +00:00
|
|
|
gint yoffset =
|
|
|
|
(text_area_height -
|
|
|
|
(widget->style->font->ascent + widget->style->font->descent)) / 2
|
|
|
|
+ widget->style->font->ascent;
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_paint_flat_box (widget->style, drawable,
|
|
|
|
GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE,
|
|
|
|
NULL, widget, "entry_bg",
|
1998-12-16 20:39:31 +00:00
|
|
|
xoffset, INNER_BORDER,
|
|
|
|
1, text_area_height - INNER_BORDER);
|
1999-01-05 23:46:49 +00:00
|
|
|
|
|
|
|
/* Draw the character under the cursor again
|
|
|
|
*/
|
1999-01-15 16:00:39 +00:00
|
|
|
if ((editable->current_pos < entry->text_length) &&
|
|
|
|
(editable->selection_start_pos == editable->selection_end_pos))
|
1999-01-05 23:46:49 +00:00
|
|
|
gdk_draw_text_wc (drawable, widget->style->font,
|
|
|
|
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
|
|
|
xoffset, yoffset,
|
|
|
|
entry->text + editable->current_pos, 1);
|
1999-01-15 16:00:39 +00:00
|
|
|
}
|
1998-12-16 20:39:31 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1997-11-27 04:16:39 +00:00
|
|
|
#ifdef USE_XIM
|
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 (GTK_WIDGET_HAS_FOCUS(widget) && gdk_im_ready() && editable->ic &&
|
|
|
|
(gdk_ic_get_style (editable->ic) & GDK_IM_PREEDIT_POSITION))
|
1997-11-27 04:16:39 +00:00
|
|
|
{
|
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
|
|
|
editable->ic_attr->spot_location.x = xoffset;
|
|
|
|
editable->ic_attr->spot_location.y =
|
|
|
|
(text_area_height + (widget->style->font->ascent
|
|
|
|
- widget->style->font->descent) + 1) / 2;
|
1997-11-27 04:16:39 +00:00
|
|
|
|
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
|
|
|
gdk_ic_set_attr (editable->ic,
|
|
|
|
editable->ic_attr, GDK_IC_SPOT_LOCATION);
|
1997-11-27 04:16:39 +00:00
|
|
|
}
|
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_queue_draw (GtkEntry *entry)
|
|
|
|
{
|
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
|
|
if (!entry->timer)
|
|
|
|
entry->timer = gtk_timeout_add (DRAW_TIMEOUT, gtk_entry_timer, entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_entry_timer (gpointer data)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
|
|
|
|
1998-12-16 20:09:30 +00:00
|
|
|
GDK_THREADS_ENTER ();
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
entry = GTK_ENTRY (data);
|
|
|
|
entry->timer = 0;
|
|
|
|
gtk_entry_draw_text (entry);
|
|
|
|
|
1998-12-16 20:09:30 +00:00
|
|
|
GDK_THREADS_LEAVE ();
|
1998-12-15 07:32:11 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
1998-03-22 21:31:10 +00:00
|
|
|
gtk_entry_find_position (GtkEntry *entry,
|
|
|
|
gint x)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-22 21:31:10 +00:00
|
|
|
gint start = 0;
|
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
|
|
|
gint end = entry->text_length;
|
1998-03-22 21:31:10 +00:00
|
|
|
gint half;
|
|
|
|
|
1998-06-15 21:27:17 +00:00
|
|
|
if (x <= 0)
|
|
|
|
return 0;
|
1998-03-22 21:31:10 +00:00
|
|
|
if (x >= entry->char_offset[end])
|
|
|
|
return end;
|
|
|
|
|
1998-06-15 21:27:17 +00:00
|
|
|
/* invariant - char_offset[start] <= x < char_offset[end] */
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-22 21:31:10 +00:00
|
|
|
while (start != end)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-22 21:31:10 +00:00
|
|
|
half = (start+end)/2;
|
|
|
|
if (half == start)
|
|
|
|
return half;
|
|
|
|
else if (entry->char_offset[half] <= x)
|
|
|
|
start = half;
|
|
|
|
else
|
|
|
|
end = half;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-03-22 21:31:10 +00:00
|
|
|
return start;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-22 21:31:10 +00:00
|
|
|
static gint
|
|
|
|
gtk_entry_position (GtkEntry *entry,
|
|
|
|
gint x)
|
|
|
|
{
|
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
|
|
|
return gtk_entry_find_position(entry, x);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
static void
|
|
|
|
entry_adjust_scroll (GtkEntry *entry)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-15 21:27:17 +00:00
|
|
|
gint xoffset, max_offset;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint text_area_width;
|
|
|
|
|
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
|
|
if (!entry->text_area)
|
|
|
|
return;
|
|
|
|
|
|
|
|
gdk_window_get_size (entry->text_area, &text_area_width, NULL);
|
|
|
|
|
1998-06-15 21:27:17 +00:00
|
|
|
/* Display as much text as we can */
|
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
|
|
|
max_offset = MAX(0, entry->char_offset[entry->text_length] - text_area_width);
|
1998-06-15 21:27:17 +00:00
|
|
|
|
|
|
|
if (entry->scroll_offset > max_offset)
|
|
|
|
entry->scroll_offset = max_offset;
|
|
|
|
|
|
|
|
/* And make sure cursor is on screen */
|
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
|
|
|
xoffset = entry->char_offset[GTK_EDITABLE(entry)->current_pos];
|
1997-11-24 22:37:52 +00:00
|
|
|
xoffset -= entry->scroll_offset;
|
|
|
|
|
|
|
|
if (xoffset < 0)
|
|
|
|
entry->scroll_offset += xoffset;
|
|
|
|
else if (xoffset > text_area_width)
|
1998-03-22 21:31:10 +00:00
|
|
|
entry->scroll_offset += xoffset - text_area_width + 1;
|
1998-07-16 20:23:12 +00:00
|
|
|
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (entry));
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_grow_text (GtkEntry *entry)
|
|
|
|
{
|
|
|
|
gint previous_size;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
|
|
previous_size = entry->text_size;
|
|
|
|
if (!entry->text_size)
|
|
|
|
entry->text_size = 128;
|
|
|
|
else
|
|
|
|
entry->text_size *= 2;
|
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
|
|
|
entry->text = g_realloc (entry->text, entry->text_size * sizeof(GdkWChar));
|
1998-03-22 21:31:10 +00:00
|
|
|
entry->char_offset = g_realloc (entry->char_offset,
|
|
|
|
entry->text_size * sizeof(guint));
|
|
|
|
|
|
|
|
if (entry->text_length == 0) /* initial allocation */
|
|
|
|
{
|
|
|
|
entry->char_offset[0] = 0;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
for (i = previous_size; i < entry->text_size; i++)
|
|
|
|
entry->text[i] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_entry_insert_text (GtkEditable *editable,
|
1998-03-01 08:47:36 +00:00
|
|
|
const gchar *new_text,
|
|
|
|
gint new_text_length,
|
|
|
|
gint *position)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
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
|
|
|
GdkWChar *text;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint start_pos;
|
|
|
|
gint end_pos;
|
|
|
|
gint last_pos;
|
1998-03-22 21:31:10 +00:00
|
|
|
gint max_length;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint i;
|
|
|
|
|
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
|
|
|
guchar *new_text_nt;
|
|
|
|
gint insertion_length;
|
|
|
|
GdkWChar *insertion_text;
|
1998-03-22 21:31:10 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEntry *entry;
|
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
|
|
|
GtkWidget *widget;
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-03-02 17:27:17 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
1998-03-01 05:11:05 +00:00
|
|
|
g_return_if_fail (GTK_IS_ENTRY (editable));
|
|
|
|
|
|
|
|
entry = GTK_ENTRY (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
|
|
|
widget = GTK_WIDGET (editable);
|
|
|
|
|
|
|
|
if ((entry->text_length == 0) && (entry->use_wchar == FALSE))
|
|
|
|
{
|
|
|
|
if (!GTK_WIDGET_REALIZED (widget))
|
|
|
|
gtk_widget_ensure_style (widget);
|
|
|
|
if ((widget->style) && (widget->style->font->type == GDK_FONT_FONTSET))
|
|
|
|
entry->use_wchar = TRUE;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-18 15:41:03 +00:00
|
|
|
if (new_text_length < 0)
|
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
|
|
|
{
|
|
|
|
new_text_nt = (gchar *)new_text;
|
|
|
|
new_text_length = strlen (new_text);
|
|
|
|
if (new_text_length <= 0) return;
|
|
|
|
}
|
|
|
|
else if (new_text_length == 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* make a null-terminated copy of new_text */
|
|
|
|
new_text_nt = g_new (gchar, new_text_length + 1);
|
|
|
|
memcpy (new_text_nt, new_text, new_text_length);
|
|
|
|
new_text_nt[new_text_length] = 0;
|
|
|
|
}
|
1998-03-22 21:31:10 +00:00
|
|
|
|
|
|
|
/* The algorithms here will work as long as, the text size (a
|
|
|
|
* multiple of 2), fits into a guint16 but we specify a shorter
|
|
|
|
* maximum length so that if the user pastes a very long text, there
|
|
|
|
* is not a long hang from the slow X_LOCALE functions. */
|
|
|
|
|
|
|
|
if (entry->text_max_length == 0)
|
|
|
|
max_length = 2047;
|
|
|
|
else
|
|
|
|
max_length = MIN (2047, entry->text_max_length);
|
1998-03-18 15:41:03 +00:00
|
|
|
|
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
|
|
|
/* Convert to wide characters */
|
|
|
|
insertion_text = g_new (GdkWChar, new_text_length);
|
|
|
|
if (entry->use_wchar)
|
|
|
|
insertion_length = gdk_mbstowcs (insertion_text, new_text_nt,
|
|
|
|
new_text_length);
|
|
|
|
else
|
|
|
|
for (insertion_length=0; new_text_nt[insertion_length]; insertion_length++)
|
|
|
|
insertion_text[insertion_length] = new_text_nt[insertion_length];
|
|
|
|
if (new_text_nt != (guchar *)new_text)
|
|
|
|
g_free (new_text_nt);
|
|
|
|
|
1998-01-03 08:35:21 +00:00
|
|
|
/* Make sure we do not exceed the maximum size of the entry. */
|
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 (insertion_length + entry->text_length > max_length)
|
|
|
|
insertion_length = max_length - entry->text_length;
|
1998-01-03 08:35:21 +00:00
|
|
|
|
|
|
|
/* Don't insert anything, if there was nothing to insert. */
|
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 (insertion_length <= 0)
|
1998-03-22 21:31:10 +00:00
|
|
|
{
|
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
|
|
|
g_free(insertion_text);
|
|
|
|
return;
|
1998-03-22 21:31:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure we are inserting at integral character position */
|
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
|
|
|
start_pos = *position;
|
|
|
|
if (start_pos < 0)
|
|
|
|
start_pos = 0;
|
|
|
|
else if (start_pos > entry->text_length)
|
|
|
|
start_pos = entry->text_length;
|
1998-03-22 21:31:10 +00:00
|
|
|
|
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
|
|
|
end_pos = start_pos + insertion_length;
|
|
|
|
last_pos = insertion_length + entry->text_length;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->selection_start_pos >= *position)
|
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
|
|
|
editable->selection_start_pos += insertion_length;
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->selection_end_pos >= *position)
|
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
|
|
|
editable->selection_end_pos += insertion_length;
|
1997-11-27 04:16:39 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (last_pos >= entry->text_size)
|
|
|
|
gtk_entry_grow_text (entry);
|
|
|
|
|
|
|
|
text = entry->text;
|
|
|
|
for (i = last_pos - 1; i >= end_pos; i--)
|
|
|
|
text[i] = text[i- (end_pos - start_pos)];
|
|
|
|
for (i = start_pos; i < end_pos; i++)
|
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
|
|
|
text[i] = insertion_text[i - start_pos];
|
|
|
|
g_free (insertion_text);
|
1998-03-22 21:31:10 +00:00
|
|
|
|
|
|
|
/* Fix up the the character offsets */
|
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (entry))
|
|
|
|
{
|
|
|
|
gint offset = 0;
|
|
|
|
|
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
|
|
|
for (i = last_pos; i >= end_pos; i--)
|
1998-03-22 21:31:10 +00:00
|
|
|
entry->char_offset[i]
|
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
|
|
|
= entry->char_offset[i - insertion_length];
|
1998-03-22 21:31:10 +00:00
|
|
|
|
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
|
|
|
for (i=start_pos; i<end_pos; i++)
|
1998-03-22 21:31:10 +00:00
|
|
|
{
|
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
|
|
|
entry->char_offset[i] = entry->char_offset[start_pos] + offset;
|
1999-02-10 00:39:49 +00:00
|
|
|
if (editable->visible)
|
1998-05-22 07:07:11 +00:00
|
|
|
{
|
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
|
|
|
offset += gdk_char_width_wc (GTK_WIDGET (entry)->style->font,
|
|
|
|
entry->text[i]);
|
1998-05-22 07:07:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
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
|
|
|
offset += gdk_char_width (GTK_WIDGET (entry)->style->font, '*');
|
1998-05-22 07:07:11 +00:00
|
|
|
}
|
1998-03-22 21:31:10 +00:00
|
|
|
}
|
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
|
|
|
for (i = end_pos; i <= last_pos; i++)
|
1998-03-22 21:31:10 +00:00
|
|
|
entry->char_offset[i] += offset;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
entry->text_length += insertion_length;
|
1997-11-24 22:37:52 +00:00
|
|
|
*position = end_pos;
|
1998-03-01 05:11:05 +00:00
|
|
|
|
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
|
|
|
entry->text_mb_dirty = 1;
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_entry_queue_draw (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-03-22 21:31:10 +00:00
|
|
|
/* Recompute the x offsets of all characters in the buffer */
|
|
|
|
static void
|
|
|
|
gtk_entry_recompute_offsets (GtkEntry *entry)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint offset = 0;
|
|
|
|
|
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
|
|
|
for (i=0; i<entry->text_length; i++)
|
1998-03-22 21:31:10 +00:00
|
|
|
{
|
|
|
|
entry->char_offset[i] = offset;
|
1999-02-10 00:39:49 +00:00
|
|
|
if (GTK_EDITABLE (entry)->visible)
|
1998-05-22 07:07:11 +00:00
|
|
|
{
|
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
|
|
|
offset += gdk_char_width_wc (GTK_WIDGET (entry)->style->font,
|
|
|
|
entry->text[i]);
|
1998-05-22 07:07:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
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
|
|
|
offset += gdk_char_width (GTK_WIDGET (entry)->style->font, '*');
|
1998-05-22 07:07:11 +00:00
|
|
|
}
|
1998-03-22 21:31:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
entry->char_offset[i] = offset;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_entry_delete_text (GtkEditable *editable,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint start_pos,
|
|
|
|
gint end_pos)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
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
|
|
|
GdkWChar *text;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint deletion_length;
|
|
|
|
gint i;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEntry *entry;
|
|
|
|
|
1998-03-02 17:27:17 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
1998-03-01 05:11:05 +00:00
|
|
|
g_return_if_fail (GTK_IS_ENTRY (editable));
|
|
|
|
|
|
|
|
entry = GTK_ENTRY (editable);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-22 21:31:10 +00:00
|
|
|
if (end_pos < 0)
|
|
|
|
end_pos = entry->text_length;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->selection_start_pos > start_pos)
|
|
|
|
editable->selection_start_pos -= MIN(end_pos, editable->selection_start_pos) - start_pos;
|
|
|
|
if (editable->selection_end_pos > start_pos)
|
|
|
|
editable->selection_end_pos -= MIN(end_pos, editable->selection_end_pos) - start_pos;
|
1998-03-22 21:31:10 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if ((start_pos < end_pos) &&
|
|
|
|
(start_pos >= 0) &&
|
|
|
|
(end_pos <= entry->text_length))
|
|
|
|
{
|
|
|
|
text = entry->text;
|
|
|
|
deletion_length = end_pos - start_pos;
|
|
|
|
|
1998-03-22 21:31:10 +00:00
|
|
|
/* Fix up the character offsets */
|
|
|
|
if (GTK_WIDGET_REALIZED (entry))
|
|
|
|
{
|
|
|
|
gint deletion_width =
|
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
|
|
|
entry->char_offset[end_pos] - entry->char_offset[start_pos];
|
1998-03-22 21:31:10 +00:00
|
|
|
|
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
|
|
|
for (i = 0 ; i <= entry->text_length - end_pos; i++)
|
|
|
|
entry->char_offset[start_pos+i] = entry->char_offset[end_pos+i] - deletion_width;
|
1998-03-22 21:31:10 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (i = end_pos; i < entry->text_length; i++)
|
|
|
|
text[i - deletion_length] = text[i];
|
|
|
|
|
|
|
|
for (i = entry->text_length - deletion_length; i < entry->text_length; i++)
|
|
|
|
text[i] = '\0';
|
|
|
|
|
|
|
|
entry->text_length -= deletion_length;
|
1998-03-01 05:11:05 +00:00
|
|
|
editable->current_pos = start_pos;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-03-01 05:11:05 +00:00
|
|
|
|
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
|
|
|
entry->text_mb_dirty = 1;
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_entry_queue_draw (entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static void
|
|
|
|
gtk_entry_update_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
|
|
|
{
|
|
|
|
gtk_entry_queue_draw (GTK_ENTRY(editable));
|
|
|
|
}
|
|
|
|
|
1998-03-17 19:03:52 +00:00
|
|
|
static gchar *
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_entry_get_chars (GtkEditable *editable,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint start_pos,
|
|
|
|
gint end_pos)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
|
|
|
|
1998-03-02 17:27:17 +00:00
|
|
|
g_return_val_if_fail (editable != NULL, NULL);
|
1998-03-01 05:11:05 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (editable), NULL);
|
|
|
|
|
|
|
|
entry = GTK_ENTRY (editable);
|
|
|
|
|
1998-03-01 08:47:36 +00:00
|
|
|
if (end_pos < 0)
|
|
|
|
end_pos = entry->text_length;
|
|
|
|
|
|
|
|
start_pos = MIN(entry->text_length, start_pos);
|
|
|
|
end_pos = MIN(entry->text_length, end_pos);
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-03-10 22:57:26 +00:00
|
|
|
if (start_pos <= 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
|
|
|
guchar *mbstr;
|
|
|
|
if (entry->use_wchar)
|
|
|
|
{
|
|
|
|
GdkWChar ch;
|
|
|
|
if (end_pos >= entry->text_size)
|
|
|
|
gtk_entry_grow_text(entry);
|
|
|
|
ch = entry->text[end_pos];
|
|
|
|
entry->text[end_pos] = 0;
|
|
|
|
mbstr = gdk_wcstombs (entry->text + start_pos);
|
|
|
|
entry->text[end_pos] = ch;
|
|
|
|
return (gchar *)mbstr;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
mbstr = g_new (gchar, end_pos - start_pos + 1);
|
|
|
|
for (i=0; i<end_pos-start_pos; i++)
|
|
|
|
mbstr[i] = entry->text[start_pos + i];
|
|
|
|
mbstr[i] = 0;
|
|
|
|
return (gchar *)mbstr;
|
|
|
|
}
|
1998-03-10 22:57:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return NULL;
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_entry_move_cursor (GtkEditable *editable,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
GtkEntry *entry;
|
|
|
|
entry = GTK_ENTRY (editable);
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
/* Horizontal motion */
|
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 ((gint)editable->current_pos < -x)
|
|
|
|
editable->current_pos = 0;
|
|
|
|
else if (editable->current_pos + x > entry->text_length)
|
|
|
|
editable->current_pos = entry->text_length;
|
|
|
|
else
|
|
|
|
editable->current_pos += x;
|
1998-06-19 01:26:24 +00:00
|
|
|
|
|
|
|
/* Ignore vertical motion */
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_move_forward_character (GtkEntry *entry)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_entry_move_cursor (GTK_EDITABLE (entry), 1, 0);
|
|
|
|
}
|
1998-03-23 14:50:58 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_move_backward_character (GtkEntry *entry)
|
|
|
|
{
|
|
|
|
gtk_entry_move_cursor (GTK_EDITABLE (entry), -1, 0);
|
|
|
|
}
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_entry_move_word (GtkEditable *editable,
|
|
|
|
gint n)
|
|
|
|
{
|
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
|
|
|
while (n-- > 0)
|
|
|
|
gtk_move_forward_word (GTK_ENTRY (editable));
|
|
|
|
while (n++ < 0)
|
|
|
|
gtk_move_backward_word (GTK_ENTRY (editable));
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_move_forward_word (GtkEntry *entry)
|
|
|
|
{
|
1998-03-23 14:50:58 +00:00
|
|
|
GtkEditable *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
|
|
|
GdkWChar *text;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint i;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (entry);
|
|
|
|
|
1998-03-05 06:32:42 +00:00
|
|
|
if (entry->text && (editable->current_pos < entry->text_length))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
text = entry->text;
|
1998-03-01 05:11:05 +00:00
|
|
|
i = editable->current_pos;
|
1998-03-17 19:03:52 +00:00
|
|
|
|
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 ((entry->use_wchar) ? (!gdk_iswalnum (text[i])) : (!isalnum (text[i])))
|
|
|
|
for (; i < entry->text_length; i++)
|
|
|
|
{
|
|
|
|
if ((entry->use_wchar) ? gdk_iswalnum (text[i]) : isalnum (text[i]))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (; i < entry->text_length; i++)
|
1997-11-27 04:16:39 +00:00
|
|
|
{
|
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 ((entry->use_wchar) ? (!gdk_iswalnum (text[i])) : (!isalnum (text[i])))
|
|
|
|
break;
|
1997-11-27 04:16:39 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
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
|
|
|
editable->current_pos = i;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_move_backward_word (GtkEntry *entry)
|
|
|
|
{
|
1998-03-23 14:50:58 +00:00
|
|
|
GtkEditable *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
|
|
|
GdkWChar *text;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint i;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (entry);
|
|
|
|
|
1998-03-17 19:03:52 +00:00
|
|
|
if (entry->text && editable->current_pos > 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
text = entry->text;
|
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
|
|
|
i = editable->current_pos - 1;
|
|
|
|
if ((entry->use_wchar) ? (!gdk_iswalnum (text[i])) : (!isalnum (text[i])))
|
|
|
|
for (; i >= 0; i--)
|
|
|
|
{
|
|
|
|
if ((entry->use_wchar) ? gdk_iswalnum (text[i]) : isalnum (text[i]))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
for (; i >= 0; i--)
|
1997-11-27 04:16:39 +00:00
|
|
|
{
|
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 ((entry->use_wchar) ? (!gdk_iswalnum (text[i])) : (!isalnum (text[i])))
|
1997-11-27 04:16:39 +00:00
|
|
|
{
|
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
|
|
|
i++;
|
|
|
|
break;
|
1997-11-27 04:16:39 +00:00
|
|
|
}
|
|
|
|
}
|
1998-03-22 21:31:10 +00:00
|
|
|
|
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 (i < 0)
|
|
|
|
i = 0;
|
1998-03-22 21:31:10 +00:00
|
|
|
|
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
|
|
|
editable->current_pos = i;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_entry_move_to_column (GtkEditable *editable, gint column)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
|
|
|
|
|
|
|
entry = GTK_ENTRY (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
|
|
|
if (column < 0 || column > entry->text_length)
|
1998-06-19 01:26:24 +00:00
|
|
|
editable->current_pos = entry->text_length;
|
|
|
|
else
|
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
|
|
|
editable->current_pos = column;
|
1998-06-19 01:26:24 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_move_beginning_of_line (GtkEntry *entry)
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_entry_move_to_column (GTK_EDITABLE (entry), 0);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_move_end_of_line (GtkEntry *entry)
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_entry_move_to_column (GTK_EDITABLE (entry), -1);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_entry_kill_char (GtkEditable *editable,
|
|
|
|
gint direction)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->selection_start_pos != editable->selection_end_pos)
|
|
|
|
gtk_editable_delete_selection (editable);
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
else
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gint old_pos = editable->current_pos;
|
|
|
|
if (direction >= 0)
|
|
|
|
{
|
|
|
|
gtk_entry_move_cursor (editable, 1, 0);
|
|
|
|
gtk_editable_delete_text (editable, old_pos, editable->current_pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_entry_move_cursor (editable, -1, 0);
|
|
|
|
gtk_editable_delete_text (editable, editable->current_pos, old_pos);
|
|
|
|
}
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_delete_forward_character (GtkEntry *entry)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_entry_kill_char (GTK_EDITABLE (entry), 1);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_delete_backward_character (GtkEntry *entry)
|
|
|
|
{
|
|
|
|
gtk_entry_kill_char (GTK_EDITABLE (entry), -1);
|
|
|
|
}
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_entry_kill_word (GtkEditable *editable,
|
|
|
|
gint direction)
|
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->selection_start_pos != editable->selection_end_pos)
|
|
|
|
gtk_editable_delete_selection (editable);
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
else
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gint old_pos = editable->current_pos;
|
|
|
|
if (direction >= 0)
|
|
|
|
{
|
|
|
|
gtk_entry_move_word (editable, 1);
|
|
|
|
gtk_editable_delete_text (editable, old_pos, editable->current_pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_entry_move_word (editable, -1);
|
|
|
|
gtk_editable_delete_text (editable, editable->current_pos, old_pos);
|
|
|
|
}
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_delete_forward_word (GtkEntry *entry)
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_entry_kill_word (GTK_EDITABLE (entry), 1);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_delete_backward_word (GtkEntry *entry)
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_entry_kill_word (GTK_EDITABLE (entry), -1);
|
|
|
|
}
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_entry_kill_line (GtkEditable *editable,
|
|
|
|
gint direction)
|
|
|
|
{
|
|
|
|
gint old_pos = editable->current_pos;
|
|
|
|
if (direction >= 0)
|
|
|
|
{
|
|
|
|
gtk_entry_move_to_column (editable, -1);
|
|
|
|
gtk_editable_delete_text (editable, old_pos, editable->current_pos);
|
|
|
|
}
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
else
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_entry_move_to_column (editable, 0);
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_editable_delete_text (editable, editable->current_pos, old_pos);
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_delete_line (GtkEntry *entry)
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_entry_move_to_column (GTK_EDITABLE (entry), 0);
|
|
|
|
gtk_entry_kill_line (GTK_EDITABLE (entry), 1);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_delete_to_line_end (GtkEntry *entry)
|
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_editable_delete_text (GTK_EDITABLE(entry), GTK_EDITABLE(entry)->current_pos, entry->text_length);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-03-23 14:50:58 +00:00
|
|
|
gtk_select_word (GtkEntry *entry,
|
|
|
|
guint32 time)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-23 14:50:58 +00:00
|
|
|
GtkEditable *editable;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint start_pos;
|
|
|
|
gint end_pos;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (entry);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_move_backward_word (entry);
|
1998-03-01 05:11:05 +00:00
|
|
|
start_pos = editable->current_pos;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
gtk_move_forward_word (entry);
|
1998-03-01 05:11:05 +00:00
|
|
|
end_pos = editable->current_pos;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-10 22:57:26 +00:00
|
|
|
editable->has_selection = TRUE;
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_entry_set_selection (editable, start_pos, end_pos);
|
1998-03-10 22:57:26 +00:00
|
|
|
gtk_editable_claim_selection (editable, start_pos != end_pos, time);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-03-23 14:50:58 +00:00
|
|
|
gtk_select_line (GtkEntry *entry,
|
|
|
|
guint32 time)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
1998-03-23 14:50:58 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (entry);
|
1997-12-07 16:25:48 +00:00
|
|
|
|
1998-03-10 22:57:26 +00:00
|
|
|
editable->has_selection = TRUE;
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_entry_set_selection (editable, 0, entry->text_length);
|
1998-03-10 22:57:26 +00:00
|
|
|
gtk_editable_claim_selection (editable, entry->text_length != 0, time);
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable->current_pos = editable->selection_end_pos;
|
1997-12-07 16:25:48 +00:00
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static void
|
1998-03-23 14:50:58 +00:00
|
|
|
gtk_entry_set_selection (GtkEditable *editable,
|
|
|
|
gint start,
|
|
|
|
gint end)
|
1997-12-07 16:25:48 +00:00
|
|
|
{
|
1998-03-23 14:50:58 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
1998-03-01 05:11:05 +00:00
|
|
|
g_return_if_fail (GTK_IS_ENTRY (editable));
|
1997-12-07 16:25:48 +00:00
|
|
|
|
1998-03-01 08:47:36 +00:00
|
|
|
if (end < 0)
|
|
|
|
end = GTK_ENTRY (editable)->text_length;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable->selection_start_pos = start;
|
|
|
|
editable->selection_end_pos = end;
|
1997-12-07 16:25:48 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_entry_queue_draw (GTK_ENTRY (editable));
|
1997-12-07 16:25:48 +00:00
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
void
|
|
|
|
gtk_entry_select_region (GtkEntry *entry,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint start,
|
|
|
|
gint end)
|
1997-12-07 16:25:48 +00:00
|
|
|
{
|
1998-03-23 14:50:58 +00:00
|
|
|
gtk_editable_select_region (GTK_EDITABLE (entry), start, end);
|
1997-12-07 16:25:48 +00:00
|
|
|
}
|
1998-03-18 15:41:03 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
gtk_entry_set_max_length (GtkEntry *entry,
|
|
|
|
guint16 max)
|
|
|
|
{
|
1998-03-23 14:50:58 +00:00
|
|
|
g_return_if_fail (entry != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
1998-03-18 15:41:03 +00:00
|
|
|
|
|
|
|
if (max && entry->text_length > max)
|
|
|
|
gtk_editable_delete_text(GTK_EDITABLE(entry), max, -1);
|
|
|
|
entry->text_max_length = max;
|
|
|
|
}
|
1998-03-31 02:36:51 +00:00
|
|
|
|
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
|
|
|
#ifdef USE_XIM
|
|
|
|
static void
|
|
|
|
gtk_entry_update_ic_attr (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkEditable *editable = (GtkEditable *) widget;
|
|
|
|
GdkICAttributesType mask = 0;
|
|
|
|
|
1999-01-28 03:38:58 +00:00
|
|
|
if (editable->ic == NULL)
|
|
|
|
return;
|
|
|
|
|
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
|
|
|
gdk_ic_get_attr (editable->ic, editable->ic_attr,
|
|
|
|
GDK_IC_PREEDIT_FOREGROUND |
|
|
|
|
GDK_IC_PREEDIT_BACKGROUND |
|
|
|
|
GDK_IC_PREEDIT_FONTSET);
|
|
|
|
|
|
|
|
if (editable->ic_attr->preedit_foreground.pixel !=
|
|
|
|
widget->style->fg[GTK_STATE_NORMAL].pixel)
|
|
|
|
{
|
|
|
|
mask |= GDK_IC_PREEDIT_FOREGROUND;
|
|
|
|
editable->ic_attr->preedit_foreground
|
|
|
|
= widget->style->fg[GTK_STATE_NORMAL];
|
|
|
|
}
|
|
|
|
if (editable->ic_attr->preedit_background.pixel !=
|
|
|
|
widget->style->base[GTK_STATE_NORMAL].pixel)
|
|
|
|
{
|
|
|
|
mask |= GDK_IC_PREEDIT_BACKGROUND;
|
|
|
|
editable->ic_attr->preedit_background
|
|
|
|
= widget->style->base[GTK_STATE_NORMAL];
|
|
|
|
}
|
|
|
|
if ((gdk_ic_get_style (editable->ic) & GDK_IM_PREEDIT_POSITION) &&
|
1999-01-28 03:38:58 +00:00
|
|
|
widget->style->font != NULL &&
|
|
|
|
widget->style->font->type == GDK_FONT_FONTSET &&
|
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
|
|
|
!gdk_font_equal (editable->ic_attr->preedit_fontset,
|
|
|
|
widget->style->font))
|
|
|
|
{
|
|
|
|
mask |= GDK_IC_PREEDIT_FONTSET;
|
|
|
|
editable->ic_attr->preedit_fontset = widget->style->font;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mask)
|
|
|
|
gdk_ic_set_attr (editable->ic, editable->ic_attr, mask);
|
|
|
|
}
|
|
|
|
#endif /* USE_XIM */
|
|
|
|
|
1998-03-31 02:36:51 +00:00
|
|
|
static void
|
|
|
|
gtk_entry_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *previous_style)
|
|
|
|
{
|
|
|
|
GtkEntry *entry;
|
|
|
|
gint scroll_char;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (widget));
|
|
|
|
|
|
|
|
if (previous_style && GTK_WIDGET_REALIZED (widget))
|
|
|
|
{
|
|
|
|
entry = GTK_ENTRY (widget);
|
|
|
|
|
|
|
|
scroll_char = gtk_entry_find_position (entry, entry->scroll_offset);
|
|
|
|
gtk_entry_recompute_offsets (GTK_ENTRY (widget));
|
|
|
|
entry->scroll_offset = entry->char_offset[scroll_char];
|
1998-11-28 01:56:09 +00:00
|
|
|
entry_adjust_scroll (entry);
|
1998-05-10 02:46:20 +00:00
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
|
|
|
gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
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
|
|
|
|
|
|
|
#ifdef USE_XIM
|
|
|
|
gtk_entry_update_ic_attr (widget);
|
|
|
|
#endif
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (GTK_WIDGET_DRAWABLE (widget))
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_widget_queue_clear(widget);
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_entry_state_changed (GtkWidget *widget,
|
|
|
|
GtkStateType previous_state)
|
|
|
|
{
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (widget));
|
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (widget))
|
|
|
|
{
|
|
|
|
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
|
|
|
gdk_window_set_background (GTK_ENTRY (widget)->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
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
|
|
|
|
|
|
|
#ifdef USE_XIM
|
|
|
|
gtk_entry_update_ic_attr (widget);
|
|
|
|
#endif
|
1998-03-31 02:36:51 +00:00
|
|
|
}
|
1998-05-10 02:46:20 +00:00
|
|
|
|
|
|
|
if (GTK_WIDGET_DRAWABLE (widget))
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_widget_queue_clear(widget);
|
1998-03-31 02:36:51 +00:00
|
|
|
}
|