Commit d1be9aea authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Don't to focus insensitive widgets. (#68203)

Tue Feb 26 18:01:10 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkwidget.c (gtk_widget_grab_focus): Don't
        to focus insensitive widgets. (#68203)

        * gtk/gtkentry.c (gtk_entry_state_changed): Clear any
        current selection if we become insensitive. (#68203)

        * gtk/gtkentry.c (gtk_entry_grab_focus): Don't
        select the text if the entry isn't editable. (#67203)

        * gtk/gtkentry.c: Activate keybindings when not editable,
        but supress keybindings that change the text. (#65848, #68203)

        * gtk/gtkentry.c (gtk_entry_set_property): Reset the
        IM context for the entry when it is made not editable.
parent e7171e19
Tue Feb 26 18:01:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_grab_focus): Don't
to focus insensitive widgets. (#68203)
* gtk/gtkentry.c (gtk_entry_state_changed): Clear any
current selection if we become insensitive. (#68203)
* gtk/gtkentry.c (gtk_entry_grab_focus): Don't
select the text if the entry isn't editable. (#67203)
* gtk/gtkentry.c: Activate keybindings when not editable,
but supress keybindings that change the text. (#65848, #68203)
* gtk/gtkentry.c (gtk_entry_set_property): Reset the
IM context for the entry when it is made not editable.
Tue Feb 26 17:04:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c (update_color): Emit ::color_changed
......
Tue Feb 26 18:01:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_grab_focus): Don't
to focus insensitive widgets. (#68203)
* gtk/gtkentry.c (gtk_entry_state_changed): Clear any
current selection if we become insensitive. (#68203)
* gtk/gtkentry.c (gtk_entry_grab_focus): Don't
select the text if the entry isn't editable. (#67203)
* gtk/gtkentry.c: Activate keybindings when not editable,
but supress keybindings that change the text. (#65848, #68203)
* gtk/gtkentry.c (gtk_entry_set_property): Reset the
IM context for the entry when it is made not editable.
Tue Feb 26 17:04:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c (update_color): Emit ::color_changed
......
Tue Feb 26 18:01:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_grab_focus): Don't
to focus insensitive widgets. (#68203)
* gtk/gtkentry.c (gtk_entry_state_changed): Clear any
current selection if we become insensitive. (#68203)
* gtk/gtkentry.c (gtk_entry_grab_focus): Don't
select the text if the entry isn't editable. (#67203)
* gtk/gtkentry.c: Activate keybindings when not editable,
but supress keybindings that change the text. (#65848, #68203)
* gtk/gtkentry.c (gtk_entry_set_property): Reset the
IM context for the entry when it is made not editable.
Tue Feb 26 17:04:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c (update_color): Emit ::color_changed
......
Tue Feb 26 18:01:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_grab_focus): Don't
to focus insensitive widgets. (#68203)
* gtk/gtkentry.c (gtk_entry_state_changed): Clear any
current selection if we become insensitive. (#68203)
* gtk/gtkentry.c (gtk_entry_grab_focus): Don't
select the text if the entry isn't editable. (#67203)
* gtk/gtkentry.c: Activate keybindings when not editable,
but supress keybindings that change the text. (#65848, #68203)
* gtk/gtkentry.c (gtk_entry_set_property): Reset the
IM context for the entry when it is made not editable.
Tue Feb 26 17:04:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c (update_color): Emit ::color_changed
......
Tue Feb 26 18:01:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_grab_focus): Don't
to focus insensitive widgets. (#68203)
* gtk/gtkentry.c (gtk_entry_state_changed): Clear any
current selection if we become insensitive. (#68203)
* gtk/gtkentry.c (gtk_entry_grab_focus): Don't
select the text if the entry isn't editable. (#67203)
* gtk/gtkentry.c: Activate keybindings when not editable,
but supress keybindings that change the text. (#65848, #68203)
* gtk/gtkentry.c (gtk_entry_set_property): Reset the
IM context for the entry when it is made not editable.
Tue Feb 26 17:04:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c (update_color): Emit ::color_changed
......
Tue Feb 26 18:01:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_grab_focus): Don't
to focus insensitive widgets. (#68203)
* gtk/gtkentry.c (gtk_entry_state_changed): Clear any
current selection if we become insensitive. (#68203)
* gtk/gtkentry.c (gtk_entry_grab_focus): Don't
select the text if the entry isn't editable. (#67203)
* gtk/gtkentry.c: Activate keybindings when not editable,
but supress keybindings that change the text. (#65848, #68203)
* gtk/gtkentry.c (gtk_entry_set_property): Reset the
IM context for the entry when it is made not editable.
Tue Feb 26 17:04:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c (update_color): Emit ::color_changed
......
Tue Feb 26 18:01:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_grab_focus): Don't
to focus insensitive widgets. (#68203)
* gtk/gtkentry.c (gtk_entry_state_changed): Clear any
current selection if we become insensitive. (#68203)
* gtk/gtkentry.c (gtk_entry_grab_focus): Don't
select the text if the entry isn't editable. (#67203)
* gtk/gtkentry.c: Activate keybindings when not editable,
but supress keybindings that change the text. (#65848, #68203)
* gtk/gtkentry.c (gtk_entry_set_property): Reset the
IM context for the entry when it is made not editable.
Tue Feb 26 17:04:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c (update_color): Emit ::color_changed
......
......@@ -292,6 +292,8 @@ static void gtk_entry_do_popup (GtkEntry *entry,
GdkEventButton *event);
static gboolean gtk_entry_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
static void gtk_entry_state_changed (GtkWidget *widget,
GtkStateType previous_state);
static void gtk_entry_check_cursor_blink (GtkEntry *entry);
static void gtk_entry_pend_cursor_blink (GtkEntry *entry);
static void get_text_area_size (GtkEntry *entry,
......@@ -767,6 +769,9 @@ gtk_entry_set_property (GObject *object,
{
entry->editable = new_value;
gtk_entry_queue_draw (entry);
if (!entry->editable)
gtk_entry_reset_im_context (entry);
}
}
break;
......@@ -1524,18 +1529,19 @@ gtk_entry_key_press (GtkWidget *widget,
{
GtkEntry *entry = GTK_ENTRY (widget);
if (!entry->editable)
return FALSE;
gtk_entry_pend_cursor_blink (entry);
if (gtk_im_context_filter_keypress (entry->im_context, event))
if (entry->editable)
{
gtk_entry_obscure_mouse_cursor (entry);
entry->need_im_reset = TRUE;
return TRUE;
if (gtk_im_context_filter_keypress (entry->im_context, event))
{
gtk_entry_obscure_mouse_cursor (entry);
entry->need_im_reset = TRUE;
return TRUE;
}
}
else if (GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event))
if (GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event))
/* Activate key bindings
*/
return TRUE;
......@@ -1550,15 +1556,15 @@ gtk_entry_key_release (GtkWidget *widget,
GtkEntry *entry = GTK_ENTRY (widget);
if (!entry->editable)
return FALSE;
if (gtk_im_context_filter_keypress (entry->im_context, event))
{
entry->need_im_reset = TRUE;
return TRUE;
if (gtk_im_context_filter_keypress (entry->im_context, event))
{
entry->need_im_reset = TRUE;
return TRUE;
}
}
else
return GTK_WIDGET_CLASS (parent_class)->key_release_event (widget, event);
return GTK_WIDGET_CLASS (parent_class)->key_release_event (widget, event);
}
static gint
......@@ -1604,6 +1610,7 @@ gtk_entry_focus_out (GtkWidget *widget,
static void
gtk_entry_grab_focus (GtkWidget *widget)
{
GtkEntry *entry = GTK_ENTRY (widget);
gboolean select_on_focus;
GTK_WIDGET_CLASS (parent_class)->grab_focus (widget);
......@@ -1613,7 +1620,7 @@ gtk_entry_grab_focus (GtkWidget *widget)
&select_on_focus,
NULL);
if (select_on_focus && !GTK_ENTRY (widget)->in_click)
if (select_on_focus && entry->editable && !entry->in_click)
gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
}
......@@ -1632,12 +1639,20 @@ static void
gtk_entry_state_changed (GtkWidget *widget,
GtkStateType previous_state)
{
GtkEntry *entry = GTK_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)]);
gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
}
if (!GTK_WIDGET_IS_SENSITIVE (widget))
{
/* Clear any selection */
gtk_editable_select_region (GTK_EDITABLE (entry), entry->current_pos, entry->current_pos);
}
gtk_widget_queue_clear (widget);
}
......@@ -2064,10 +2079,13 @@ gtk_entry_insert_at_cursor (GtkEntry *entry,
GtkEditable *editable = GTK_EDITABLE (entry);
gint pos = entry->current_pos;
gtk_entry_reset_im_context (entry);
if (entry->editable)
{
gtk_entry_reset_im_context (entry);
gtk_editable_insert_text (editable, str, -1, &pos);
gtk_editable_set_position (editable, pos);
gtk_editable_insert_text (editable, str, -1, &pos);
gtk_editable_set_position (editable, pos);
}
}
static void
......@@ -2164,14 +2182,19 @@ gtk_entry_cut_clipboard (GtkEntry *entry)
gint start, end;
gtk_entry_copy_clipboard (entry);
if (gtk_editable_get_selection_bounds (editable, &start, &end))
gtk_editable_delete_text (editable, start, end);
if (entry->editable)
{
if (gtk_editable_get_selection_bounds (editable, &start, &end))
gtk_editable_delete_text (editable, start, end);
}
}
static void
gtk_entry_paste_clipboard (GtkEntry *entry)
{
gtk_entry_paste (entry, GDK_NONE);
if (entry->editable)
gtk_entry_paste (entry, GDK_NONE);
}
static void
......@@ -3767,7 +3790,8 @@ unichar_chosen_func (const char *text,
{
GtkEntry *entry = GTK_ENTRY (data);
gtk_entry_enter_text (entry, text);
if (entry->editable)
gtk_entry_enter_text (entry, text);
}
typedef struct
......
......@@ -3308,6 +3308,9 @@ gtk_widget_grab_focus (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
if (!GTK_WIDGET_IS_SENSITIVE (widget))
return;
g_object_ref (G_OBJECT (widget));
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[GRAB_FOCUS]);
g_object_notify (G_OBJECT (widget), "has_focus");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment