forked from AuroraMiddleware/gtk
Remove explicit pointer grabs, since they are no longer necessary.
Mon Apr 16 14:38:41 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklist.c gtk/gtklistitem.c: Remove explicit pointer grabs, since they are no longer necessary. * gtk/gtkcombo.c (gtk_combo_popup_button_press): Fix #52926 by signal_connect() and call gtk_button_pressed() rather than signal_connect_after(). * tests/testgtk.c: Restore radio menu items to combos since they'll look OK with Raleigh, and it is easier than finishing the process of removing them that was started earlier.
This commit is contained in:
parent
0e432245a4
commit
12aa8608ed
@ -74,7 +74,7 @@ static void gtk_combo_activate (GtkWidget *widget,
|
||||
static gboolean gtk_combo_popup_button_press (GtkWidget *button,
|
||||
GdkEventButton *event,
|
||||
GtkCombo *combo);
|
||||
static void gtk_combo_popup_button_leave (GtkWidget *button,
|
||||
static gboolean gtk_combo_popup_button_leave (GtkWidget *button,
|
||||
GdkEventCrossing *event,
|
||||
GtkCombo *combo);
|
||||
static void gtk_combo_update_entry (GtkList *list,
|
||||
@ -498,28 +498,34 @@ gtk_combo_popup_button_press (GtkWidget *button,
|
||||
{
|
||||
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);
|
||||
|
||||
if (event->button != 1)
|
||||
return;
|
||||
|
||||
combo->current_button = event->button;
|
||||
|
||||
|
||||
gtk_combo_popup_list (combo);
|
||||
gtk_button_pressed (GTK_BUTTON (button));
|
||||
|
||||
gtk_grab_add (combo->popwin);
|
||||
gdk_pointer_grab (combo->popwin->window, TRUE,
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_POINTER_MOTION_MASK,
|
||||
NULL, NULL, GDK_CURRENT_TIME);
|
||||
|
||||
GTK_LIST (combo->list)->drag_selection = TRUE;
|
||||
gdk_pointer_grab (combo->list->window, TRUE,
|
||||
GDK_POINTER_MOTION_HINT_MASK |
|
||||
GDK_BUTTON1_MOTION_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK,
|
||||
NULL, NULL, event->time);
|
||||
gtk_grab_add (combo->list);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gtk_combo_popup_button_leave (GtkWidget *button,
|
||||
GdkEventCrossing *event,
|
||||
GtkCombo *combo)
|
||||
{
|
||||
if (combo->current_button)
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT (button), "leave_notify_event");
|
||||
return combo->current_button != 0;
|
||||
}
|
||||
|
||||
|
||||
@ -590,10 +596,23 @@ gtk_combo_button_press (GtkWidget * widget, GdkEvent * event, GtkCombo * combo)
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_combo_button_release (GtkWidget * widget, GdkEvent * event, GtkCombo * combo)
|
||||
gtk_combo_button_release (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
GtkCombo *combo)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
/* Horrible hack to get connect-after effect without regard to the return value of the default
|
||||
* handler.
|
||||
*/
|
||||
gtk_signal_handler_block_by_func (GTK_OBJECT (widget),
|
||||
GTK_SIGNAL_FUNC (gtk_combo_button_release),
|
||||
combo);
|
||||
gtk_widget_event (widget, event);
|
||||
gtk_signal_handler_unblock_by_func (GTK_OBJECT (widget),
|
||||
GTK_SIGNAL_FUNC (gtk_combo_button_release),
|
||||
combo);
|
||||
|
||||
if ((combo->current_button != 0) && (event->button.button == 1))
|
||||
{
|
||||
/* This was the initial button press */
|
||||
@ -605,7 +624,7 @@ gtk_combo_button_release (GtkWidget * widget, GdkEvent * event, GtkCombo * combo
|
||||
if (widget != combo->button)
|
||||
gtk_widget_event (combo->button, event);
|
||||
|
||||
/* Un-pre-hightlight */
|
||||
/* Un-pre-highlight */
|
||||
|
||||
tmp_event.type = GDK_LEAVE_NOTIFY;
|
||||
tmp_event.window = combo->button->window;
|
||||
@ -747,8 +766,8 @@ gtk_combo_init (GtkCombo * combo)
|
||||
(GtkSignalFunc) gtk_combo_entry_focus_out, combo);
|
||||
combo->activate_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "activate",
|
||||
(GtkSignalFunc) gtk_combo_activate, combo);
|
||||
gtk_signal_connect_after (GTK_OBJECT (combo->button), "button_press_event",
|
||||
(GtkSignalFunc) gtk_combo_popup_button_press, combo);
|
||||
gtk_signal_connect (GTK_OBJECT (combo->button), "button_press_event",
|
||||
(GtkSignalFunc) gtk_combo_popup_button_press, combo);
|
||||
/*gtk_signal_connect_after (GTK_OBJECT (combo->button), "button_release_event",
|
||||
(GtkSignalFunc) gtk_combo_button_release, combo);*/
|
||||
gtk_signal_connect (GTK_OBJECT (combo->button), "leave_notify_event",
|
||||
@ -808,8 +827,8 @@ gtk_combo_init (GtkCombo * combo)
|
||||
gtk_signal_connect (GTK_OBJECT (combo->popwin), "button_press_event",
|
||||
GTK_SIGNAL_FUNC (gtk_combo_button_press), combo);
|
||||
|
||||
gtk_signal_connect_after (GTK_OBJECT (combo->list), "button_release_event",
|
||||
GTK_SIGNAL_FUNC (gtk_combo_button_release), combo);
|
||||
gtk_signal_connect (GTK_OBJECT (combo->list), "button_release_event",
|
||||
GTK_SIGNAL_FUNC (gtk_combo_button_release), 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.
|
||||
|
@ -672,13 +672,6 @@ gtk_list_button_press (GtkWidget *widget,
|
||||
|
||||
if (event->type == GDK_BUTTON_PRESS)
|
||||
{
|
||||
if (gdk_pointer_grab (widget->window, TRUE,
|
||||
GDK_POINTER_MOTION_HINT_MASK |
|
||||
GDK_BUTTON1_MOTION_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK,
|
||||
NULL, NULL, event->time))
|
||||
return FALSE;
|
||||
|
||||
gtk_grab_add (widget);
|
||||
list->drag_selection = TRUE;
|
||||
}
|
||||
@ -1651,11 +1644,8 @@ gtk_list_end_drag_selection (GtkList *list)
|
||||
|
||||
list->drag_selection = FALSE;
|
||||
if (GTK_WIDGET_HAS_GRAB (list))
|
||||
{
|
||||
gtk_grab_remove (GTK_WIDGET (list));
|
||||
if (gdk_pointer_is_grabbed())
|
||||
gdk_pointer_ungrab (GDK_CURRENT_TIME);
|
||||
}
|
||||
gtk_grab_remove (GTK_WIDGET (list));
|
||||
|
||||
if (list->htimer)
|
||||
{
|
||||
gtk_timeout_remove (list->htimer);
|
||||
|
@ -361,6 +361,8 @@ gtk_list_item_realize (GtkWidget *widget)
|
||||
GDK_EXPOSURE_MASK |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_BUTTON1_MOTION_MASK |
|
||||
GDK_POINTER_MOTION_HINT_MASK |
|
||||
GDK_KEY_PRESS_MASK |
|
||||
GDK_KEY_RELEASE_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK |
|
||||
@ -446,17 +448,8 @@ static gint
|
||||
gtk_list_item_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_LIST_ITEM (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
if (event->type == GDK_BUTTON_PRESS)
|
||||
{
|
||||
if (!GTK_WIDGET_HAS_FOCUS (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
if (event->type == GDK_BUTTON_PRESS && !GTK_WIDGET_HAS_FOCUS (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -111,18 +111,23 @@ build_option_menu (OptionMenuItem items[],
|
||||
GtkWidget *omenu;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menu_item;
|
||||
GSList *group;
|
||||
gint i;
|
||||
|
||||
omenu = gtk_option_menu_new ();
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
group = NULL;
|
||||
|
||||
for (i = 0; i < num_items; i++)
|
||||
{
|
||||
menu_item = gtk_menu_item_new_with_label (items[i].name);
|
||||
menu_item = gtk_radio_menu_item_new_with_label (group, items[i].name);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
||||
(GtkSignalFunc) items[i].func, data);
|
||||
group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menu_item));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
|
||||
if (i == history)
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE);
|
||||
gtk_widget_show (menu_item);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user