When popping up the list without any selected items, hack the focus on the

Tue Oct 22 20:02:22 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkcombo.c: When popping up the list without
        any selected items, hack the focus on the list to
        avoid triggering a bug in GtkList when clicking
        on focused-but-not-selected items (#86700,
        Zimler Attila, Matthias Clasen) and to keep
        GtkWindow from selecting the first item.

        * tests/testgtk.c (create_list): Make the initial
        setting of the selection mode correspond to the option
        menu.
This commit is contained in:
Owen Taylor 2002-10-23 00:45:18 +00:00 committed by Owen Taylor
parent ecb42dc789
commit 3d4c27d06a
8 changed files with 100 additions and 1 deletions

View File

@ -1,3 +1,16 @@
Tue Oct 22 20:02:22 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: When popping up the list without
any selected items, hack the focus on the list to
avoid triggering a bug in GtkList when clicking
on focused-but-not-selected items (#86700,
Zimler Attila, Matthias Clasen) and to keep
GtkWindow from selecting the first item.
* tests/testgtk.c (create_list): Make the initial
setting of the selection mode correspond to the option
menu.
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties

View File

@ -1,3 +1,16 @@
Tue Oct 22 20:02:22 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: When popping up the list without
any selected items, hack the focus on the list to
avoid triggering a bug in GtkList when clicking
on focused-but-not-selected items (#86700,
Zimler Attila, Matthias Clasen) and to keep
GtkWindow from selecting the first item.
* tests/testgtk.c (create_list): Make the initial
setting of the selection mode correspond to the option
menu.
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties

View File

@ -1,3 +1,16 @@
Tue Oct 22 20:02:22 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: When popping up the list without
any selected items, hack the focus on the list to
avoid triggering a bug in GtkList when clicking
on focused-but-not-selected items (#86700,
Zimler Attila, Matthias Clasen) and to keep
GtkWindow from selecting the first item.
* tests/testgtk.c (create_list): Make the initial
setting of the selection mode correspond to the option
menu.
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties

View File

@ -1,3 +1,16 @@
Tue Oct 22 20:02:22 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: When popping up the list without
any selected items, hack the focus on the list to
avoid triggering a bug in GtkList when clicking
on focused-but-not-selected items (#86700,
Zimler Attila, Matthias Clasen) and to keep
GtkWindow from selecting the first item.
* tests/testgtk.c (create_list): Make the initial
setting of the selection mode correspond to the option
menu.
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties

View File

@ -1,3 +1,16 @@
Tue Oct 22 20:02:22 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: When popping up the list without
any selected items, hack the focus on the list to
avoid triggering a bug in GtkList when clicking
on focused-but-not-selected items (#86700,
Zimler Attila, Matthias Clasen) and to keep
GtkWindow from selecting the first item.
* tests/testgtk.c (create_list): Make the initial
setting of the selection mode correspond to the option
menu.
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties

View File

@ -1,3 +1,16 @@
Tue Oct 22 20:02:22 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: When popping up the list without
any selected items, hack the focus on the list to
avoid triggering a bug in GtkList when clicking
on focused-but-not-selected items (#86700,
Zimler Attila, Matthias Clasen) and to keep
GtkWindow from selecting the first item.
* tests/testgtk.c (create_list): Make the initial
setting of the selection mode correspond to the option
menu.
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties

View File

@ -503,6 +503,7 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w
static void
gtk_combo_popup_list (GtkCombo * combo)
{
GtkList *list;
gint height, width, x, y;
gint old_width, old_height;
@ -518,6 +519,26 @@ gtk_combo_popup_list (GtkCombo * combo)
gtk_widget_hide (GTK_SCROLLED_WINDOW (combo->popup)->vscrollbar);
}
gtk_combo_update_list (GTK_ENTRY (combo->entry), combo);
/* We need to make sure some child of combo->popwin
* is focused to disable GtkWindow's automatic
* "focus-the-first-item" code. If there is no selected
* child, we focus the list itself with some hackery.
*/
list = GTK_LIST (combo->list);
if (list->selection)
{
gtk_widget_grab_focus (list->selection->data);
}
else
{
GTK_WIDGET_SET_FLAGS (list, GTK_CAN_FOCUS);
gtk_widget_grab_focus (list);
GTK_WIDGET_UNSET_FLAGS (list, GTK_CAN_FOCUS);
}
gtk_window_move (GTK_WINDOW (combo->popwin), x, y);
gtk_widget_set_size_request (combo->popwin, width, height);
gtk_widget_show (combo->popwin);

View File

@ -5179,7 +5179,7 @@ create_list (GtkWidget *widget)
GTK_POLICY_AUTOMATIC);
list = gtk_list_new ();
gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_EXTENDED);
gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
gtk_scrolled_window_add_with_viewport
(GTK_SCROLLED_WINDOW (scrolled_win), list);
gtk_container_set_focus_vadjustment