Fix warning.

Wed Nov 13 15:52:53 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkcombo.c (gtk_combo_activate): Fix warning.

        * gtk/gtkcombo.c: Fix code that was meant to delay
        grabbing events on the list until we had an enter-notify.
        (#54353, reported by Mike Fulbright, others)
This commit is contained in:
Owen Taylor 2002-11-13 21:47:11 +00:00 committed by Owen Taylor
parent 050c933b34
commit 712644fefb
7 changed files with 89 additions and 10 deletions

View File

@ -1,3 +1,11 @@
Wed Nov 13 15:52:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_activate): Fix warning.
* gtk/gtkcombo.c: Fix code that was meant to delay
grabbing events on the list until we had an enter-notify.
(#54353, reported by Mike Fulbright, others)
2002-11-13 Matthias Clasen <maclas@gmx.de>
* gtk/theme-bits/decompose-bits.c (do_part): Add a const here.

View File

@ -1,3 +1,11 @@
Wed Nov 13 15:52:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_activate): Fix warning.
* gtk/gtkcombo.c: Fix code that was meant to delay
grabbing events on the list until we had an enter-notify.
(#54353, reported by Mike Fulbright, others)
2002-11-13 Matthias Clasen <maclas@gmx.de>
* gtk/theme-bits/decompose-bits.c (do_part): Add a const here.

View File

@ -1,3 +1,11 @@
Wed Nov 13 15:52:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_activate): Fix warning.
* gtk/gtkcombo.c: Fix code that was meant to delay
grabbing events on the list until we had an enter-notify.
(#54353, reported by Mike Fulbright, others)
2002-11-13 Matthias Clasen <maclas@gmx.de>
* gtk/theme-bits/decompose-bits.c (do_part): Add a const here.

View File

@ -1,3 +1,11 @@
Wed Nov 13 15:52:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_activate): Fix warning.
* gtk/gtkcombo.c: Fix code that was meant to delay
grabbing events on the list until we had an enter-notify.
(#54353, reported by Mike Fulbright, others)
2002-11-13 Matthias Clasen <maclas@gmx.de>
* gtk/theme-bits/decompose-bits.c (do_part): Add a const here.

View File

@ -1,3 +1,11 @@
Wed Nov 13 15:52:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_activate): Fix warning.
* gtk/gtkcombo.c: Fix code that was meant to delay
grabbing events on the list until we had an enter-notify.
(#54353, reported by Mike Fulbright, others)
2002-11-13 Matthias Clasen <maclas@gmx.de>
* gtk/theme-bits/decompose-bits.c (do_part): Add a const here.

View File

@ -1,3 +1,11 @@
Wed Nov 13 15:52:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_activate): Fix warning.
* gtk/gtkcombo.c: Fix code that was meant to delay
grabbing events on the list until we had an enter-notify.
(#54353, reported by Mike Fulbright, others)
2002-11-13 Matthias Clasen <maclas@gmx.de>
* gtk/theme-bits/decompose-bits.c (do_part): Add a const here.

View File

@ -601,7 +601,7 @@ gtk_combo_activate (GtkWidget *widget,
if (!combo->button->window ||
!popup_grab_on_window (combo->button->window,
gtk_get_current_event_time ()))
return FALSE;
return;
gtk_combo_popup_list (combo);
@ -641,8 +641,6 @@ gtk_combo_popup_button_press (GtkWidget *button,
gtk_button_pressed (GTK_BUTTON (button));
gtk_grab_add (combo->popwin);
GTK_LIST (combo->list)->drag_selection = TRUE;
gtk_grab_add (combo->list);
return TRUE;
}
@ -759,6 +757,29 @@ gtk_combo_button_event_after (GtkWidget *widget,
gtk_combo_popdown_list (combo);
}
static void
find_child_foreach (GtkWidget *widget,
gpointer data)
{
GdkEventButton *event = data;
if (!event->window)
{
if (event->x >= widget->allocation.x &&
event->x < widget->allocation.x + widget->allocation.width &&
event->y >= widget->allocation.y &&
event->y < widget->allocation.y + widget->allocation.height)
event->window = g_object_ref (widget->window);
}
}
static void
find_child_window (GtkContainer *container,
GdkEventButton *event)
{
gtk_container_foreach (container, find_child_foreach, event);
}
static gint
gtk_combo_list_enter (GtkWidget *widget,
GdkEventCrossing *event,
@ -783,7 +804,6 @@ gtk_combo_list_enter (GtkWidget *widget,
*/
gdk_window_get_pointer (combo->list->window, &x, &y, &mask);
tmp_event->button.window = g_object_ref (combo->list->window);
tmp_event->button.send_event = TRUE;
tmp_event->button.time = GDK_CURRENT_TIME; /* bad */
tmp_event->button.x = x;
@ -794,6 +814,19 @@ gtk_combo_list_enter (GtkWidget *widget,
tmp_event->button.button = combo->current_button;
tmp_event->button.state = mask;
find_child_window (GTK_CONTAINER (combo->list), &tmp_event->button);
if (!tmp_event->button.window)
{
GtkWidget *child;
if (GTK_LIST (combo->list)->children)
child = GTK_LIST (combo->list)->children->data;
else
child = combo->list;
tmp_event->button.window = g_object_ref (child->window);
}
gtk_widget_event (combo->list, tmp_event);
gdk_event_free (tmp_event);
}
@ -915,14 +948,12 @@ gtk_combo_init (GtkCombo * combo)
g_signal_connect (combo->popwin, "button_press_event",
G_CALLBACK (gtk_combo_button_press), combo);
g_signal_connect (combo->popwin, "event_after",
G_CALLBACK (gtk_combo_button_event_after), combo);
g_signal_connect (combo->list, "event_after",
G_CALLBACK (gtk_combo_button_event_after), combo);
/* We connect here on the button, because we'll have a grab on it
* when the event occurs. But we are actually interested in enters
* for the combo->list.
*/
g_signal_connect (combo->button, "enter_notify_event",
g_signal_connect (combo->list, "enter_notify_event",
G_CALLBACK (gtk_combo_list_enter), combo);
}