]> Pileus Git - ~andy/gtk/commitdiff
When popping up the list without any selected items, hack the focus on the
authorOwen Taylor <otaylor@redhat.com>
Wed, 23 Oct 2002 00:45:18 +0000 (00:45 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Wed, 23 Oct 2002 00:45:18 +0000 (00:45 +0000)
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.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkcombo.c
tests/testgtk.c

index 3cd7b2036a6caae971ca7d1655c3d165d899e862..f5a63723747bc4fbbce6c1d67d50ff5f6f489ced 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 3cd7b2036a6caae971ca7d1655c3d165d899e862..f5a63723747bc4fbbce6c1d67d50ff5f6f489ced 100644 (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
index 3cd7b2036a6caae971ca7d1655c3d165d899e862..f5a63723747bc4fbbce6c1d67d50ff5f6f489ced 100644 (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
index 3cd7b2036a6caae971ca7d1655c3d165d899e862..f5a63723747bc4fbbce6c1d67d50ff5f6f489ced 100644 (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
index 3cd7b2036a6caae971ca7d1655c3d165d899e862..f5a63723747bc4fbbce6c1d67d50ff5f6f489ced 100644 (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
index 3cd7b2036a6caae971ca7d1655c3d165d899e862..f5a63723747bc4fbbce6c1d67d50ff5f6f489ced 100644 (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
index 06d354b6ca4642ab5605191896219030aed051e6..bb9e222d3a9107ad061eb965ec2369e4e57a4e18 100644 (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);
index 490631c72fea91508d379505aa0314536ad474f5..657adf9b7bdb55811ee513b66f45067dcca0804e 100644 (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