do not just return if the combo-list is empty since that will cause the

Fri May  1 20:25:29 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkcombo.c (gtk_combo_popup_list): do not just return if
                the combo-list is empty since that will cause the combo to operate
                        on a non existing GtkList window.
                                (gtk_combo_get_pos): provide the combo list with a usfull default
                                        height if empty.
                                                (gtk_combo_popup_button_press): grab the focus.
                                                        (gtk_combo_activate): grab the focus.
This commit is contained in:
Tim Janik 1998-05-02 04:20:55 +00:00 committed by Tim Janik
parent 67c79cda67
commit 998ac31096
8 changed files with 101 additions and 29 deletions

View File

@ -4,6 +4,16 @@ Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
is popped up so that it will be compatible with
auto-scrolling in the future.
Fri May 1 20:25:29 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcombo.c (gtk_combo_popup_list): do not just return if
the combo-list is empty since that will cause the combo to operate
on a non existing GtkList window.
(gtk_combo_get_pos): provide the combo list with a usfull default
height if empty.
(gtk_combo_popup_button_press): grab the focus.
(gtk_combo_activate): grab the focus.
Fri May 1 12:06:43 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.[ch] (gtk_widget_reset_rc_styles): New

View File

@ -4,6 +4,16 @@ Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
is popped up so that it will be compatible with
auto-scrolling in the future.
Fri May 1 20:25:29 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcombo.c (gtk_combo_popup_list): do not just return if
the combo-list is empty since that will cause the combo to operate
on a non existing GtkList window.
(gtk_combo_get_pos): provide the combo list with a usfull default
height if empty.
(gtk_combo_popup_button_press): grab the focus.
(gtk_combo_activate): grab the focus.
Fri May 1 12:06:43 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.[ch] (gtk_widget_reset_rc_styles): New

View File

@ -4,6 +4,16 @@ Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
is popped up so that it will be compatible with
auto-scrolling in the future.
Fri May 1 20:25:29 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcombo.c (gtk_combo_popup_list): do not just return if
the combo-list is empty since that will cause the combo to operate
on a non existing GtkList window.
(gtk_combo_get_pos): provide the combo list with a usfull default
height if empty.
(gtk_combo_popup_button_press): grab the focus.
(gtk_combo_activate): grab the focus.
Fri May 1 12:06:43 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.[ch] (gtk_widget_reset_rc_styles): New

View File

@ -4,6 +4,16 @@ Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
is popped up so that it will be compatible with
auto-scrolling in the future.
Fri May 1 20:25:29 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcombo.c (gtk_combo_popup_list): do not just return if
the combo-list is empty since that will cause the combo to operate
on a non existing GtkList window.
(gtk_combo_get_pos): provide the combo list with a usfull default
height if empty.
(gtk_combo_popup_button_press): grab the focus.
(gtk_combo_activate): grab the focus.
Fri May 1 12:06:43 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.[ch] (gtk_widget_reset_rc_styles): New

View File

@ -4,6 +4,16 @@ Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
is popped up so that it will be compatible with
auto-scrolling in the future.
Fri May 1 20:25:29 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcombo.c (gtk_combo_popup_list): do not just return if
the combo-list is empty since that will cause the combo to operate
on a non existing GtkList window.
(gtk_combo_get_pos): provide the combo list with a usfull default
height if empty.
(gtk_combo_popup_button_press): grab the focus.
(gtk_combo_activate): grab the focus.
Fri May 1 12:06:43 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.[ch] (gtk_widget_reset_rc_styles): New

View File

@ -4,6 +4,16 @@ Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
is popped up so that it will be compatible with
auto-scrolling in the future.
Fri May 1 20:25:29 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcombo.c (gtk_combo_popup_list): do not just return if
the combo-list is empty since that will cause the combo to operate
on a non existing GtkList window.
(gtk_combo_get_pos): provide the combo list with a usfull default
height if empty.
(gtk_combo_popup_button_press): grab the focus.
(gtk_combo_activate): grab the focus.
Fri May 1 12:06:43 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.[ch] (gtk_widget_reset_rc_styles): New

View File

@ -4,6 +4,16 @@ Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
is popped up so that it will be compatible with
auto-scrolling in the future.
Fri May 1 20:25:29 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcombo.c (gtk_combo_popup_list): do not just return if
the combo-list is empty since that will cause the combo to operate
on a non existing GtkList window.
(gtk_combo_get_pos): provide the combo list with a usfull default
height if empty.
(gtk_combo_popup_button_press): grab the focus.
(gtk_combo_activate): grab the focus.
Fri May 1 12:06:43 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.[ch] (gtk_widget_reset_rc_styles): New

View File

@ -36,7 +36,8 @@
const gchar *gtk_combo_string_key = "gtk-combo-string-value";
#define COMBO_LIST_MAX_HEIGHT 400
#define COMBO_LIST_MAX_HEIGHT (400)
#define EMPTY_LIST_HEIGHT (15)
static void gtk_combo_class_init (GtkComboClass *klass);
static void gtk_combo_init (GtkCombo *combo);
@ -272,21 +273,21 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w
gtk_widget_size_request (combo->list, &list_requisition);
min_height = MIN (list_requisition.height,
popup->vscrollbar->requisition.height);
if (!GTK_LIST (combo->list)->children)
list_requisition.height += EMPTY_LIST_HEIGHT;
alloc_width = widget->allocation.width -
alloc_width = (widget->allocation.width -
2 * popwin->child->style->klass->xthickness -
2 * GTK_CONTAINER (popwin->child)->border_width -
2 * GTK_CONTAINER (combo->popup)->border_width -
2 * GTK_CONTAINER (popup->viewport)->border_width -
2 * popup->viewport->style->klass->xthickness;
2 * popup->viewport->style->klass->xthickness);
work_height =
2 * popwin->child->style->klass->ythickness +
work_height = (2 * popwin->child->style->klass->ythickness +
2 * GTK_CONTAINER (popwin->child)->border_width +
2 * GTK_CONTAINER (combo->popup)->border_width +
2 * GTK_CONTAINER (popup->viewport)->border_width +
2 * popup->viewport->style->klass->xthickness;
2 * popup->viewport->style->klass->xthickness);
do
{
@ -334,9 +335,6 @@ gtk_combo_popup_list (GtkCombo * combo)
gint height, width, x, y;
gint old_width, old_height;
if (!GTK_LIST (combo->list)->children)
return;
old_width = combo->popwin->allocation.width;
old_height = combo->popwin->allocation.height;
@ -364,6 +362,8 @@ gtk_combo_activate (GtkWidget *widget,
{
gtk_combo_popup_list (combo);
if (!GTK_WIDGET_HAS_FOCUS (combo->entry))
gtk_widget_grab_focus (combo->entry);
gtk_grab_add (combo->popwin);
gdk_pointer_grab (combo->popwin->window, TRUE,
GDK_BUTTON_PRESS_MASK |
@ -377,6 +377,8 @@ gtk_combo_popup_button_press (GtkWidget *button,
GdkEventButton *event,
GtkCombo *combo)
{
if (!GTK_WIDGET_HAS_FOCUS (combo->entry))
gtk_widget_grab_focus (combo->entry);
if (!combo->current_button && (event->button == 1))
gtk_combo_popup_list (combo);