diff options
author | Lars Hamann <lars@gtk.org> | 1998-07-31 20:48:06 +0000 |
---|---|---|
committer | Lars Hamann <lars@src.gnome.org> | 1998-07-31 20:48:06 +0000 |
commit | 8ad52d10249a4ee97fb6b84a8c798f03fa45c7bd (patch) | |
tree | 6f1edea6def97d695832410cd5179cf947cebef8 /gtk/gtkcombo.c | |
parent | cf7b958af57a768e075bb3961771eb11248453d2 (diff) | |
download | gtk+-8ad52d10249a4ee97fb6b84a8c798f03fa45c7bd.tar.gz |
Few fixes for column resize. Store resize column in clist->drag_pos.
Fri Jul 31 20:45:07 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_button_press) (gtk_clist_motion)
(gtk_clist_button_release) (new_column_width): Few fixes for
column resize. Store resize column in clist->drag_pos.
Thu Jul 31 15:18:36 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.h
* gtk/gtkctree.c
* gtk/testgtk.c : New typedef GtkCTreeNode, changed all GList *node
to GtkCTreeNode *node.
* gtk/gtklist.h : added extended selection mode and auto scrolling.
(struct _GtkList): removed unneeded variables timer, button,
selection_start_pos, selection_end_pos, scroll_direction, have_grab.
Added new variables undo_selection, undo_unselection, last_focus_child,
undo_focus_child, htimer, vtimer, anchor, drag_pos, anchor_state,
drag_selection, add_mode.
New functions :
(gtk_list_extend_selection), (gtk_list_start_selection),
(gtk_list_end_selection), (gtk_list_select_all),
(gtk_list_unselect_all), (gtk_list_scroll_horizontal),
(gtk_list_scroll_vertical), (gtk_list_toggle_add_mode),
(gtk_list_toggle_focus_row), (gtk_list_toggle_row),
(gtk_list_undo_selection), (gtk_list_end_drag_selection)
* gtk/gtklist.c :
(gtk_list_enter_notify): removed, because auto scrolling now works
with gtk_list_motion_notify
New functions, needed for auto scrolling :
(gtk_list_motion_notify) (gtk_list_move_focus_child)
New functions for extended selection support :
(gtk_list_set_anchor), (gtk_list_fake_unselect_all),
(gtk_list_fake_toggle_row), (gtk_list_update_extended_selection),
(gtk_list_focus_lost)
(gtk_list_set_focus_child): modified gtk_container_set_focus_child
function to support auto scrolling, and avoid out-of-sync errors in
case auf GTK_SELECTION_BROWSE
(gtk_list_focus): modified gtk_container_focus function to avoid out
off sync errors in case auf GTK_SELECTION_EXTENDED
* gtk/gtklistitem.h
* gtk/gtklistitem.c :
New signal functions for key binding support :
(toggle_focus_row), (select_all), (list_item), (unselect_all)
(list_item), (undo_selection), (start_selection), (end_selection)
(extend_selection), (scroll_horizontal), (scroll_vertical),
(toggle_add_mode)
(gtk_list_item_realize): added GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK
(gtk_list_item_draw_focus): modify gc if parent has add_mode set.
* gtk/gtkcombo.c :
(gtk_combo_popup_button_press): grab pointer for combo->list
(gtk_combo_button_release): ungrab only if combo->popwin HAS_GRAB
(gtk_combo_list_key_press): take care of which child HAS_GRAB
(gtk_comb_init): don't connect combo->button with button_release_event
Diffstat (limited to 'gtk/gtkcombo.c')
-rw-r--r-- | gtk/gtkcombo.c | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c index 165bed40f1..03b24e1ecc 100644 --- a/gtk/gtkcombo.c +++ b/gtk/gtkcombo.c @@ -383,6 +383,7 @@ gtk_combo_activate (GtkWidget *widget, 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 | @@ -402,6 +403,14 @@ gtk_combo_popup_button_press (GtkWidget *button, gtk_combo_popup_list (combo); combo->current_button = event->button; + + 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); } static void @@ -527,8 +536,11 @@ gtk_combo_button_release (GtkWidget * widget, GdkEvent * event, GtkCombo * combo { /* The user has clicked inside the popwin and released */ - gtk_grab_remove (combo->popwin); - gdk_pointer_ungrab (event->button.time); + if (GTK_WIDGET_HAS_GRAB (combo->popwin)) + { + gtk_grab_remove (combo->popwin); + gdk_pointer_ungrab (event->button.time); + } } gtk_widget_hide (combo->popwin); @@ -583,9 +595,21 @@ gtk_combo_list_key_press (GtkWidget * widget, GdkEventKey * event, GtkCombo * co { if (event->keyval == GDK_Escape) { + if (GTK_WIDGET_HAS_GRAB (combo->popwin)) + { + gtk_grab_remove (combo->popwin); + gdk_pointer_ungrab (GDK_CURRENT_TIME); + } + else if (GTK_WIDGET_HAS_GRAB (combo->list)) + gtk_list_end_drag_selection (GTK_LIST (combo->list)); gtk_widget_hide (combo->popwin); - gtk_grab_remove (combo->popwin); - gdk_pointer_ungrab (GDK_CURRENT_TIME); + if (GTK_WIDGET_HAS_GRAB (combo->button)) + { + combo->current_button = 0; + GTK_BUTTON (combo->button)->in_button = FALSE; + gtk_button_released (combo->button); + gtk_grab_remove (combo->button); + } return TRUE; } return FALSE; @@ -625,8 +649,8 @@ gtk_combo_init (GtkCombo * combo) (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_after (GTK_OBJECT (combo->button), "button_release_event", - (GtkSignalFunc) gtk_combo_button_release, 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", (GtkSignalFunc) gtk_combo_popup_button_leave, combo); /*gtk_signal_connect(GTK_OBJECT(combo->button), "clicked", @@ -670,6 +694,8 @@ gtk_combo_init (GtkCombo * combo) gtk_container_add (GTK_CONTAINER (combo->popup), combo->list); gtk_container_set_focus_vadjustment (GTK_CONTAINER (combo->list), gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (combo->popup))); + gtk_container_set_focus_hadjustment (GTK_CONTAINER (combo->list), + gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (combo->popup))); gtk_widget_show (combo->list); combo->list_change_id = gtk_signal_connect (GTK_OBJECT (combo->list), "selection_changed", @@ -679,8 +705,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 (GTK_OBJECT (combo->list), "button_release_event", - GTK_SIGNAL_FUNC (gtk_combo_button_release), combo); + gtk_signal_connect_after (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. |