Commit 2f50a304 authored by Owen Taylor's avatar Owen Taylor Committed by Tim Janik

commiting changes from owen:

Mon Mar  9 20:38:15 1998  Owen Taylor  <owt1@cornell.edu>

        * gtk/gtkentry.c gtk/gtkeditable.c gtk/gtkspinbutton.c:
          Moved "activate" to editable class. Made the vfuncs in
          gtkeditable just vfuncs not signals.

        * gtkentry.[ch] gtktext.[ch]: Made behavior when pressing
          multiple buttons at once more rational.

        * gtkentry.c gtktext.c: Unified and rationalized key
          bindings. (Now are basically emacs+CUA)

        * gtktext.c:
          - Last position now always shares the property of the preceding
            character
          - Freeze the widget when inserting large amounts of text.
          - Selecting lines now selects the _whole_ line.
          - Fixed bug with displaying the cursor
          - Ctrl-Home/End now move the cursor to the _absolute home/end

        * gtkmenuitem.c: Remove necessary code out of a g_return_if_fail

-timj
parent 990bddfe
Mon Mar 9 20:38:15 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c gtk/gtkeditable.c gtk/gtkspinbutton.c:
Moved "activate" to editable class. Made the vfuncs in
gtkeditable just vfuncs not signals.
* gtkentry.[ch] gtktext.[ch]: Made behavior when pressing
multiple buttons at once more rational.
* gtkentry.c gtktext.c: Unified and rationalized key
bindings. (Now are basically emacs+CUA)
* gtktext.c:
- Last position now always shares the property of the preceding
character
- Freeze the widget when inserting large amounts of text.
- Selecting lines now selects the _whole_ line.
- Fixed bug with displaying the cursor
- Ctrl-Home/End now move the cursor to the _absolute home/end
* gtkmenuitem.c: Remove necessary code out of a g_return_if_fail
1998-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_set_foreground): We now accept the
......
Mon Mar 9 20:38:15 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c gtk/gtkeditable.c gtk/gtkspinbutton.c:
Moved "activate" to editable class. Made the vfuncs in
gtkeditable just vfuncs not signals.
* gtkentry.[ch] gtktext.[ch]: Made behavior when pressing
multiple buttons at once more rational.
* gtkentry.c gtktext.c: Unified and rationalized key
bindings. (Now are basically emacs+CUA)
* gtktext.c:
- Last position now always shares the property of the preceding
character
- Freeze the widget when inserting large amounts of text.
- Selecting lines now selects the _whole_ line.
- Fixed bug with displaying the cursor
- Ctrl-Home/End now move the cursor to the _absolute home/end
* gtkmenuitem.c: Remove necessary code out of a g_return_if_fail
1998-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_set_foreground): We now accept the
......
Mon Mar 9 20:38:15 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c gtk/gtkeditable.c gtk/gtkspinbutton.c:
Moved "activate" to editable class. Made the vfuncs in
gtkeditable just vfuncs not signals.
* gtkentry.[ch] gtktext.[ch]: Made behavior when pressing
multiple buttons at once more rational.
* gtkentry.c gtktext.c: Unified and rationalized key
bindings. (Now are basically emacs+CUA)
* gtktext.c:
- Last position now always shares the property of the preceding
character
- Freeze the widget when inserting large amounts of text.
- Selecting lines now selects the _whole_ line.
- Fixed bug with displaying the cursor
- Ctrl-Home/End now move the cursor to the _absolute home/end
* gtkmenuitem.c: Remove necessary code out of a g_return_if_fail
1998-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_set_foreground): We now accept the
......
Mon Mar 9 20:38:15 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c gtk/gtkeditable.c gtk/gtkspinbutton.c:
Moved "activate" to editable class. Made the vfuncs in
gtkeditable just vfuncs not signals.
* gtkentry.[ch] gtktext.[ch]: Made behavior when pressing
multiple buttons at once more rational.
* gtkentry.c gtktext.c: Unified and rationalized key
bindings. (Now are basically emacs+CUA)
* gtktext.c:
- Last position now always shares the property of the preceding
character
- Freeze the widget when inserting large amounts of text.
- Selecting lines now selects the _whole_ line.
- Fixed bug with displaying the cursor
- Ctrl-Home/End now move the cursor to the _absolute home/end
* gtkmenuitem.c: Remove necessary code out of a g_return_if_fail
1998-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_set_foreground): We now accept the
......
Mon Mar 9 20:38:15 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c gtk/gtkeditable.c gtk/gtkspinbutton.c:
Moved "activate" to editable class. Made the vfuncs in
gtkeditable just vfuncs not signals.
* gtkentry.[ch] gtktext.[ch]: Made behavior when pressing
multiple buttons at once more rational.
* gtkentry.c gtktext.c: Unified and rationalized key
bindings. (Now are basically emacs+CUA)
* gtktext.c:
- Last position now always shares the property of the preceding
character
- Freeze the widget when inserting large amounts of text.
- Selecting lines now selects the _whole_ line.
- Fixed bug with displaying the cursor
- Ctrl-Home/End now move the cursor to the _absolute home/end
* gtkmenuitem.c: Remove necessary code out of a g_return_if_fail
1998-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_set_foreground): We now accept the
......
Mon Mar 9 20:38:15 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c gtk/gtkeditable.c gtk/gtkspinbutton.c:
Moved "activate" to editable class. Made the vfuncs in
gtkeditable just vfuncs not signals.
* gtkentry.[ch] gtktext.[ch]: Made behavior when pressing
multiple buttons at once more rational.
* gtkentry.c gtktext.c: Unified and rationalized key
bindings. (Now are basically emacs+CUA)
* gtktext.c:
- Last position now always shares the property of the preceding
character
- Freeze the widget when inserting large amounts of text.
- Selecting lines now selects the _whole_ line.
- Fixed bug with displaying the cursor
- Ctrl-Home/End now move the cursor to the _absolute home/end
* gtkmenuitem.c: Remove necessary code out of a g_return_if_fail
1998-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_set_foreground): We now accept the
......
Mon Mar 9 20:38:15 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c gtk/gtkeditable.c gtk/gtkspinbutton.c:
Moved "activate" to editable class. Made the vfuncs in
gtkeditable just vfuncs not signals.
* gtkentry.[ch] gtktext.[ch]: Made behavior when pressing
multiple buttons at once more rational.
* gtkentry.c gtktext.c: Unified and rationalized key
bindings. (Now are basically emacs+CUA)
* gtktext.c:
- Last position now always shares the property of the preceding
character
- Freeze the widget when inserting large amounts of text.
- Selecting lines now selects the _whole_ line.
- Fixed bug with displaying the cursor
- Ctrl-Home/End now move the cursor to the _absolute home/end
* gtkmenuitem.c: Remove necessary code out of a g_return_if_fail
1998-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_set_foreground): We now accept the
......
......@@ -159,45 +159,17 @@ TODO AFTER GTK 1.0
Bugs:
- In Entry and Text widget, you can ungrab while still
dragging by pressing button-1, pressing button 3, releaseing 3,
then releasing 1.
- Who knows?
- When selecting on a Text or Entry widget, the selection isn't
claimed until you release the button, and that shows by the
color of the selection. (Which is the real problem - it probably
is OK/better to delay claiming the selection) [fixed]
- Related to the above, when you Shift/arrow to select text, the
selected text doesn't show that you have the selection immediately.
- Selecting an entire line with triple-click doesn't work right -
it should select the wrapped portion too.
- Selecting an entire line should probably select the newline as
well, so when the selection is cut/deleted, the newline goes
along.
- Inserting text in a different property - problems? Shouldn't
split the last position off in any case.
- Do something about the bg pixmap situation. (It will produce
garbage when editing is enabled)
- "Copy" removes selection
Improvements:
- Finish making the key bindings consistent between the Entry
and Text widgets
- Unify the key binding support in some fashion between the
two widgets (???)
- When inserting or deleting large chunks of text, do a freeze/thaw
automatically, to avoid scrolling around for ever on screen.
Entry and Text widget widgets (???)
- Jump scroll on large insertions/deletions
- Figure out a way not to recompute the geometry on insertions/deletions
which are large, but not a significant fraction of the
entire text. (e.g., compute the changes as when the widget
is not frozen, but without the actual scrolling)
- Prune the line start cache. But since it is only 68 bytes
per line, and it is a lot faster when lines are in the cache,
......@@ -254,4 +226,4 @@ TODO AFTER GTK 1.0
* gtk_rc_add_[name/class]_style are broken for bg pixmaps, because
styles are broken for bg pixmaps, and RC styles only hack around
that.
\ No newline at end of file
that.
......@@ -161,6 +161,16 @@ this index. If you see or add a special case in the code for this
end-of-buffer case, make sure to use LAST_INDEX if you can. Very
often, the last index is treated as a newline.
[ One way the last index is special is that, although it is always
part of some property, it will never be part of a property of
length 1 unless there are no other characters in the text. That
is, its properties are always that of the preceding character,
if any.
There is a fair bit of special case code to mantain this condition -
which is needed so that user has control over the properties of
characters inserted at the last position. OWT 2/9/98 ]
Tab stops are variable width. A list of tab stops is contained in the
GtkText structure:
......
......@@ -32,45 +32,11 @@
#define INNER_BORDER 2
enum {
INSERT_TEXT,
DELETE_TEXT,
UPDATE_TEXT,
GET_CHARS,
SET_SELECTION,
ACTIVATE,
CHANGED,
LAST_SIGNAL
};
typedef void (*GtkEditableSignal1) (GtkObject *object,
gpointer arg1,
gint arg2,
gpointer arg3,
gpointer data);
typedef void (*GtkEditableSignal2) (GtkObject *object,
gint arg1,
gint arg2,
gpointer data);
typedef gpointer (*GtkEditableSignal3) (GtkObject *object,
gint arg1,
gint arg2,
gpointer data);
static void gtk_editable_marshal_signal_1 (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
static void gtk_editable_marshal_signal_2 (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
static void gtk_editable_marshal_signal_3 (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
static void gtk_editable_class_init (GtkEditableClass *klass);
static void gtk_editable_init (GtkEditable *editable);
static void gtk_editable_finalize (GtkObject *object);
......@@ -127,47 +93,14 @@ gtk_editable_class_init (GtkEditableClass *class)
parent_class = gtk_type_class (gtk_widget_get_type ());
editable_signals[INSERT_TEXT] =
gtk_signal_new ("insert_text",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkEditableClass, insert_text),
gtk_editable_marshal_signal_1,
GTK_TYPE_NONE, 3,
GTK_TYPE_STRING, GTK_TYPE_INT,
GTK_TYPE_POINTER);
editable_signals[DELETE_TEXT] =
gtk_signal_new ("delete_text",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkEditableClass, delete_text),
gtk_editable_marshal_signal_2,
GTK_TYPE_NONE, 2,
GTK_TYPE_INT, GTK_TYPE_INT);
editable_signals[UPDATE_TEXT] =
gtk_signal_new ("update_text",
editable_signals[ACTIVATE] =
gtk_signal_new ("activate",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkEditableClass, update_text),
gtk_editable_marshal_signal_2,
GTK_TYPE_NONE, 2,
GTK_TYPE_INT, GTK_TYPE_INT);
editable_signals[GET_CHARS] =
gtk_signal_new ("get_chars",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkEditableClass, get_chars),
gtk_editable_marshal_signal_3,
GTK_TYPE_POINTER, 2,
GTK_TYPE_INT, GTK_TYPE_INT);
editable_signals[SET_SELECTION] =
gtk_signal_new ("set_selection",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkEditableClass, set_selection),
gtk_editable_marshal_signal_2,
GTK_TYPE_NONE, 2,
GTK_TYPE_INT, GTK_TYPE_INT);
GTK_SIGNAL_OFFSET (GtkEditableClass, activate),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
editable_signals[CHANGED] =
gtk_signal_new ("changed",
GTK_RUN_LAST,
......@@ -241,53 +174,6 @@ gtk_editable_init (GtkEditable *editable)
NULL);
}
static void
gtk_editable_marshal_signal_1 (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args)
{
GtkEditableSignal1 rfunc;
rfunc = (GtkEditableSignal1) func;
(* rfunc) (object, GTK_VALUE_STRING (args[0]), GTK_VALUE_INT (args[1]),
GTK_VALUE_POINTER (args[2]), func_data);
}
static void
gtk_editable_marshal_signal_2 (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args)
{
GtkEditableSignal2 rfunc;
rfunc = (GtkEditableSignal2) func;
(* rfunc) (object, GTK_VALUE_INT (args[0]), GTK_VALUE_INT (args[1]),
func_data);
}
static void
gtk_editable_marshal_signal_3 (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args)
{
GtkEditableSignal3 rfunc;
gpointer *return_val;
rfunc = (GtkEditableSignal3) func;
return_val = GTK_RETLOC_POINTER (args[2]);
*return_val = (* rfunc) (object,
GTK_VALUE_INT (args[0]),
GTK_VALUE_INT (args[1]),
func_data);
}
static void
gtk_editable_finalize (GtkObject *object)
{
......@@ -315,12 +201,16 @@ gtk_editable_insert_text (GtkEditable *editable,
gint new_text_length,
gint *position)
{
GtkEditableClass *klass;
gchar buf[64];
gchar *text;
g_return_if_fail (editable != NULL);
g_return_if_fail (GTK_IS_EDITABLE (editable));
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
if (new_text_length <= 64)
text = buf;
else
......@@ -328,8 +218,7 @@ gtk_editable_insert_text (GtkEditable *editable,
strncpy (text, new_text, new_text_length);
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[INSERT_TEXT],
text, new_text_length, position);
klass->insert_text (editable, text, new_text_length, position);
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[CHANGED]);
if (new_text_length > 64)
......@@ -341,11 +230,14 @@ gtk_editable_delete_text (GtkEditable *editable,
gint start_pos,
gint end_pos)
{
GtkEditableClass *klass;
g_return_if_fail (editable != NULL);
g_return_if_fail (GTK_IS_EDITABLE (editable));
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[DELETE_TEXT],
start_pos, end_pos);
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
klass->delete_text (editable, start_pos, end_pos);
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[CHANGED]);
}
......@@ -354,11 +246,14 @@ gtk_editable_update_text (GtkEditable *editable,
gint start_pos,
gint end_pos)
{
GtkEditableClass *klass;
g_return_if_fail (editable != NULL);
g_return_if_fail (GTK_IS_EDITABLE (editable));
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[UPDATE_TEXT],
start_pos, end_pos);
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
klass->update_text (editable, start_pos, end_pos);
}
gchar *
......@@ -366,15 +261,14 @@ gtk_editable_get_chars (GtkEditable *editable,
gint start,
gint end)
{
gchar *retval = NULL;
GtkEditableClass *klass;
g_return_val_if_fail (editable != NULL, NULL);
g_return_val_if_fail (GTK_IS_EDITABLE (editable), NULL);
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[GET_CHARS],
start, end, &retval);
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
return retval;
return klass->get_chars (editable, start, end);
}
static void
......@@ -382,11 +276,14 @@ gtk_editable_set_selection (GtkEditable *editable,
gint start_pos,
gint end_pos)
{
GtkEditableClass *klass;
g_return_if_fail (editable != NULL);
g_return_if_fail (GTK_IS_EDITABLE (editable));
gtk_signal_emit (GTK_OBJECT (editable), editable_signals[SET_SELECTION],
start_pos, end_pos);
klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
klass->set_selection (editable, start_pos, end_pos);
}
static gint
......
......@@ -73,6 +73,7 @@ struct _GtkEditableClass
void (* set_selection)(GtkEditable *editable,
gint start_pos,
gint end_pos);
void (* activate) (GtkEditable *editable);
void (* changed) (GtkEditable *editable);
};
......
......@@ -31,11 +31,6 @@
#define DRAW_TIMEOUT 20
#define INNER_BORDER 2
enum {
ACTIVATE,
LAST_SIGNAL
};
static void gtk_entry_class_init (GtkEntryClass *klass);
static void gtk_entry_init (GtkEntry *entry);
static void gtk_entry_finalize (GtkObject *object);
......@@ -111,7 +106,6 @@ static void gtk_entry_set_selection (GtkEditable *editable,
gint end);
static GtkWidgetClass *parent_class = NULL;
static guint entry_signals[LAST_SIGNAL] = { 0 };
static GdkAtom ctext_atom = GDK_NONE;
static GtkTextFunction control_keys[26] =
......@@ -212,16 +206,6 @@ gtk_entry_class_init (GtkEntryClass *class)
parent_class = gtk_type_class (gtk_editable_get_type ());
entry_signals[ACTIVATE] =
gtk_signal_new ("activate",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkEntryClass, activate),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, entry_signals, LAST_SIGNAL);
object_class->finalize = gtk_entry_finalize;
widget_class->realize = gtk_entry_realize;
......@@ -244,7 +228,7 @@ gtk_entry_class_init (GtkEntryClass *class)
editable_class->get_chars = gtk_entry_get_chars;
editable_class->set_selection = gtk_entry_set_selection;
editable_class->changed = (void (*)(GtkEditable *)) gtk_entry_adjust_scroll;
class->activate = NULL;
editable_class->activate = NULL;
}
static void
......@@ -260,6 +244,7 @@ gtk_entry_init (GtkEntry *entry)
entry->text_max_length = 0;
entry->scroll_offset = 0;
entry->timer = 0;
entry->button = 0;
entry->visible = 1;
gtk_entry_grow_text (entry);
......@@ -720,6 +705,18 @@ gtk_entry_button_press (GtkWidget *widget,
entry = GTK_ENTRY (widget);
editable = GTK_EDITABLE (widget);
if (entry->button)
{
GdkEventButton release_event = *event;
release_event.type = GDK_BUTTON_RELEASE;
release_event.button = entry->button;
gtk_entry_button_release (widget, &release_event);
}
entry->button = event->button;
if (!GTK_WIDGET_HAS_FOCUS (widget))
gtk_widget_grab_focus (widget);
......@@ -788,11 +785,16 @@ gtk_entry_button_release (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_ENTRY (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
entry = GTK_ENTRY (widget);
editable = GTK_EDITABLE (widget);
if (entry->button != event->button)
return FALSE;
entry->button = 0;
if (event->button == 1)
{
entry = GTK_ENTRY (widget);
editable = GTK_EDITABLE (widget);
gtk_grab_remove (widget);
editable->has_selection = FALSE;
......@@ -832,6 +834,9 @@ gtk_entry_motion_notify (GtkWidget *widget,
entry = GTK_ENTRY (widget);
if (entry->button == 0)
return FALSE;
x = event->x;
if (event->is_hint || (entry->text_area != event->window))
gdk_window_get_pointer (entry->text_area, &x, NULL, NULL);
......@@ -853,7 +858,8 @@ gtk_entry_key_press (GtkWidget *widget,
gint return_val;
gint key;
gint tmp_pos;
guint initial_pos;
guint tmp_pos;
gint extend_selection;
gint extend_start;
......@@ -868,6 +874,8 @@ gtk_entry_key_press (GtkWidget *widget,
if(editable->editable == FALSE)
return FALSE;
initial_pos = editable->current_pos;
extend_selection = event->state & GDK_SHIFT_MASK;
extend_start = FALSE;
......@@ -886,9 +894,7 @@ gtk_entry_key_press (GtkWidget *widget,
{
case GDK_BackSpace:
return_val = TRUE;
if (editable->selection_start_pos != editable->selection_end_pos)
gtk_editable_delete_selection (editable);
else if (event->state & GDK_CONTROL_MASK)
if (event->state & GDK_CONTROL_MASK)
gtk_delete_backward_word (entry);
else
gtk_delete_backward_character (entry);
......@@ -897,28 +903,31 @@ gtk_entry_key_press (GtkWidget *widget,
return_val = TRUE;
gtk_delete_line (entry);
break;
case GDK_Insert:
return_val = TRUE;
if (event->state & GDK_SHIFT_MASK)
{
extend_selection = FALSE;
gtk_editable_paste_clipboard (editable, event->time);
}
else if (event->state & GDK_CONTROL_MASK)
{
gtk_editable_copy_clipboard (editable, event->time);
}
else
{
/* gtk_toggle_insert(entry) -- IMPLEMENT */
}
break;
case GDK_Insert:
return_val = TRUE;
if (event->state & GDK_SHIFT_MASK)
{
extend_selection = FALSE;
gtk_editable_paste_clipboard (editable, event->time);
}
else if (event->state & GDK_CONTROL_MASK)
{
gtk_editable_copy_clipboard (editable, event->time);
}
else
{
/* gtk_toggle_insert(entry) -- IMPLEMENT */
}
break;
case GDK_Delete:
return_val = TRUE;
if (event->state & GDK_CONTROL_MASK)
gtk_delete_line (entry);
gtk_delete_forward_word (entry);
else if (event->state & GDK_SHIFT_MASK)
gtk_editable_cut_clipboard (editable, event->time);
{
extend_selection = FALSE;
gtk_editable_cut_clipboard (editable, event->time);
}
else
gtk_delete_forward_character (entry);
break;
......@@ -932,15 +941,21 @@ gtk_entry_key_press (GtkWidget *widget,
break;
case GDK_Left:
return_val = TRUE;
gtk_move_backward_character (entry);
if (event->state & GDK_CONTROL_MASK)
gtk_move_backward_word (entry);
else
gtk_move_backward_character (entry);
break;
case GDK_Right:
return_val = TRUE;
gtk_move_forward_character (entry);
if (event->state & GDK_CONTROL_MASK)
gtk_move_forward_word (entry);
else
gtk_move_forward_character (entry);
break;
case GDK_Return:
return_val = TRUE;
gtk_signal_emit (GTK_OBJECT (entry), entry_signals[ACTIVATE]);
gtk_signal_emit_by_name (GTK_OBJECT (entry), "activate");
break;
/* The next two keys should not be inserted literally. Any others ??? */
case GDK_Tab:
......@@ -990,7 +1005,7 @@ gtk_entry_key_press (GtkWidget *widget,
break;
}
if (return_val)
if (return_val && (editable->current_pos != initial_pos))
{
if (extend_selection)
{
......
......@@ -51,13 +51,12 @@ struct _GtkEntry
gint16 scroll_offset;
guint visible : 1;
guint32 timer;
guint button;
};
struct _GtkEntryClass
{
GtkEditableClass parent_class;
void (* activate) (GtkEntry *entry);
};
guint gtk_entry_get_type (void);
......
......@@ -698,7 +698,11 @@ gtk_menu_item_position_menu (GtkMenu *menu,
screen_width = gdk_screen_width ();
screen_height = gdk_screen_height ();
g_return_if_fail (gdk_window_get_origin (GTK_WIDGET (menu_item)->window, &tx, &ty));
if (!gdk_window_get_origin (GTK_WIDGET (menu_item)->window, &tx, &ty))
{
g_warning ("Menu not on screen");
return;
}
switch (menu_item->submenu_placement)
{
......
......@@ -74,7 +74,7 @@ static gint gtk_spin_button_key_press (GtkWidget *widget,
GdkEventKey *event);
static void gtk_spin_button_update (GtkSpinButton *spin_button);
static void gtk_spin_button_changed (GtkEditable *editable);
static void gtk_spin_button_activate (GtkEntry *entry);
static void gtk_spin_button_activate (GtkEditable *editable);