From b56693d114a9033d5d371b668ac5304a88d6effd Mon Sep 17 00:00:00 2001 From: Lars Hamann Date: Fri, 8 Jan 1999 00:21:36 +0000 Subject: [PATCH] call gtk_spin_button_update before returning a value Fri Jan 8 00:42:00 1999 Lars Hamann * gtk/gtkspinbutton.c (gtk_spin_button_get_value_as_int) (gtk_spin_button_get_value_as_float): call gtk_spin_button_update before returning a value * gtk/gtkclist.c (gtk_clist_motion): don't allow 'drag selections' if clist is a drag source. (gtk_clist_drag_begin): remove pointer grabs, end ongoing selections. * gtk/gtkctree.c (remove_grab): copy of clist function. (gtk_ctree_drag_begin): let clists drag_begin method set the source info struct. --- ChangeLog | 14 ++++++++ ChangeLog.pre-2-0 | 14 ++++++++ ChangeLog.pre-2-10 | 14 ++++++++ ChangeLog.pre-2-2 | 14 ++++++++ ChangeLog.pre-2-4 | 14 ++++++++ ChangeLog.pre-2-6 | 14 ++++++++ ChangeLog.pre-2-8 | 14 ++++++++ gtk/gtkclist.c | 43 +++++++++++------------ gtk/gtkctree.c | 83 ++++++++++++++++++++------------------------- gtk/gtkspinbutton.c | 6 ++++ 10 files changed, 161 insertions(+), 69 deletions(-) diff --git a/ChangeLog b/ChangeLog index ccc1e72160..7edc0e2fbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Fri Jan 8 00:42:00 1999 Lars Hamann + + * gtk/gtkspinbutton.c (gtk_spin_button_get_value_as_int) + (gtk_spin_button_get_value_as_float): call gtk_spin_button_update + before returning a value + + * gtk/gtkclist.c (gtk_clist_motion): don't allow 'drag selections' + if clist is a drag source. + (gtk_clist_drag_begin): remove pointer grabs, end ongoing selections. + + * gtk/gtkctree.c (remove_grab): copy of clist function. + (gtk_ctree_drag_begin): let clists drag_begin method set the + source info struct. + Thu Jan 7 19:10:21 1999 Owen Taylor * gtk/gtkviewport.c (gtk_viewport_style_set): Fixes diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index ccc1e72160..7edc0e2fbe 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,17 @@ +Fri Jan 8 00:42:00 1999 Lars Hamann + + * gtk/gtkspinbutton.c (gtk_spin_button_get_value_as_int) + (gtk_spin_button_get_value_as_float): call gtk_spin_button_update + before returning a value + + * gtk/gtkclist.c (gtk_clist_motion): don't allow 'drag selections' + if clist is a drag source. + (gtk_clist_drag_begin): remove pointer grabs, end ongoing selections. + + * gtk/gtkctree.c (remove_grab): copy of clist function. + (gtk_ctree_drag_begin): let clists drag_begin method set the + source info struct. + Thu Jan 7 19:10:21 1999 Owen Taylor * gtk/gtkviewport.c (gtk_viewport_style_set): Fixes diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ccc1e72160..7edc0e2fbe 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,17 @@ +Fri Jan 8 00:42:00 1999 Lars Hamann + + * gtk/gtkspinbutton.c (gtk_spin_button_get_value_as_int) + (gtk_spin_button_get_value_as_float): call gtk_spin_button_update + before returning a value + + * gtk/gtkclist.c (gtk_clist_motion): don't allow 'drag selections' + if clist is a drag source. + (gtk_clist_drag_begin): remove pointer grabs, end ongoing selections. + + * gtk/gtkctree.c (remove_grab): copy of clist function. + (gtk_ctree_drag_begin): let clists drag_begin method set the + source info struct. + Thu Jan 7 19:10:21 1999 Owen Taylor * gtk/gtkviewport.c (gtk_viewport_style_set): Fixes diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index ccc1e72160..7edc0e2fbe 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,17 @@ +Fri Jan 8 00:42:00 1999 Lars Hamann + + * gtk/gtkspinbutton.c (gtk_spin_button_get_value_as_int) + (gtk_spin_button_get_value_as_float): call gtk_spin_button_update + before returning a value + + * gtk/gtkclist.c (gtk_clist_motion): don't allow 'drag selections' + if clist is a drag source. + (gtk_clist_drag_begin): remove pointer grabs, end ongoing selections. + + * gtk/gtkctree.c (remove_grab): copy of clist function. + (gtk_ctree_drag_begin): let clists drag_begin method set the + source info struct. + Thu Jan 7 19:10:21 1999 Owen Taylor * gtk/gtkviewport.c (gtk_viewport_style_set): Fixes diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index ccc1e72160..7edc0e2fbe 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,17 @@ +Fri Jan 8 00:42:00 1999 Lars Hamann + + * gtk/gtkspinbutton.c (gtk_spin_button_get_value_as_int) + (gtk_spin_button_get_value_as_float): call gtk_spin_button_update + before returning a value + + * gtk/gtkclist.c (gtk_clist_motion): don't allow 'drag selections' + if clist is a drag source. + (gtk_clist_drag_begin): remove pointer grabs, end ongoing selections. + + * gtk/gtkctree.c (remove_grab): copy of clist function. + (gtk_ctree_drag_begin): let clists drag_begin method set the + source info struct. + Thu Jan 7 19:10:21 1999 Owen Taylor * gtk/gtkviewport.c (gtk_viewport_style_set): Fixes diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index ccc1e72160..7edc0e2fbe 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,17 @@ +Fri Jan 8 00:42:00 1999 Lars Hamann + + * gtk/gtkspinbutton.c (gtk_spin_button_get_value_as_int) + (gtk_spin_button_get_value_as_float): call gtk_spin_button_update + before returning a value + + * gtk/gtkclist.c (gtk_clist_motion): don't allow 'drag selections' + if clist is a drag source. + (gtk_clist_drag_begin): remove pointer grabs, end ongoing selections. + + * gtk/gtkctree.c (remove_grab): copy of clist function. + (gtk_ctree_drag_begin): let clists drag_begin method set the + source info struct. + Thu Jan 7 19:10:21 1999 Owen Taylor * gtk/gtkviewport.c (gtk_viewport_style_set): Fixes diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ccc1e72160..7edc0e2fbe 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,17 @@ +Fri Jan 8 00:42:00 1999 Lars Hamann + + * gtk/gtkspinbutton.c (gtk_spin_button_get_value_as_int) + (gtk_spin_button_get_value_as_float): call gtk_spin_button_update + before returning a value + + * gtk/gtkclist.c (gtk_clist_motion): don't allow 'drag selections' + if clist is a drag source. + (gtk_clist_drag_begin): remove pointer grabs, end ongoing selections. + + * gtk/gtkctree.c (remove_grab): copy of clist function. + (gtk_ctree_drag_begin): let clists drag_begin method set the + source info struct. + Thu Jan 7 19:10:21 1999 Owen Taylor * gtk/gtkviewport.c (gtk_viewport_style_set): Fixes diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index d674d2c398..a201f39dc2 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -5202,31 +5202,11 @@ gtk_clist_motion (GtkWidget *widget, x >= (COLUMN_LEFT_XPIXEL(clist, clist->click_cell.column) + clist->column[clist->click_cell.column].area.width))) { - GdkDragContext *context; GtkTargetList *target_list; - gint button; - - button = clist->drag_button; - clist->drag_button = 0; - remove_grab (clist); - - switch (clist->selection_mode) - { - case GTK_SELECTION_EXTENDED: - update_extended_selection (clist, clist->focus_row); - GTK_CLIST_CLASS_FW (clist)->resync_selection - (clist, (GdkEvent *) event); - break; - case GTK_SELECTION_SINGLE: - case GTK_SELECTION_MULTIPLE: - clist->anchor = -1; - case GTK_SELECTION_BROWSE: - break; - } target_list = gtk_target_list_new (&clist_target_table, 1); - context = gtk_drag_begin (widget, target_list, GDK_ACTION_MOVE, - button, (GdkEvent *)event); + gtk_drag_begin (widget, target_list, GDK_ACTION_MOVE, + clist->drag_button, (GdkEvent *)event); } return TRUE; @@ -5283,7 +5263,8 @@ gtk_clist_motion (GtkWidget *widget, row = CLAMP (row, 0, clist->rows - 1); - if (button_actions & GTK_BUTTON_SELECTS) + if (button_actions & GTK_BUTTON_SELECTS & + !gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data")) { if (row == clist->focus_row) return FALSE; @@ -7357,6 +7338,22 @@ gtk_clist_drag_begin (GtkWidget *widget, clist = GTK_CLIST (widget); + clist->drag_button = 0; + remove_grab (clist); + + switch (clist->selection_mode) + { + case GTK_SELECTION_EXTENDED: + update_extended_selection (clist, clist->focus_row); + GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL); + break; + case GTK_SELECTION_SINGLE: + case GTK_SELECTION_MULTIPLE: + clist->anchor = -1; + case GTK_SELECTION_BROWSE: + break; + } + info = g_dataset_get_data (context, "gtk-clist-drag-source"); if (!info) diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c index 642d2b664f..96cf37de34 100644 --- a/gtk/gtkctree.c +++ b/gtk/gtkctree.c @@ -286,6 +286,7 @@ static void gtk_ctree_drag_data_received (GtkWidget *widget, GtkSelectionData *selection_data, guint info, guint32 time); +static void remove_grab (GtkCList *clist); enum @@ -671,7 +672,7 @@ gtk_ctree_realize (GtkWidget *widget) g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_CTREE (widget)); - (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); + GTK_WIDGET_CLASS (parent_class)->realize (widget); ctree = GTK_CTREE (widget); clist = GTK_CLIST (widget); @@ -714,7 +715,7 @@ gtk_ctree_unrealize (GtkWidget *widget) g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_CTREE (widget)); - (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); + GTK_WIDGET_CLASS (parent_class)->unrealize (widget); ctree = GTK_CTREE (widget); clist = GTK_CLIST (widget); @@ -3868,7 +3869,7 @@ real_clear (GtkCList *clist) } GTK_CLIST_UNSET_FLAG (clist, CLIST_AUTO_RESIZE_BLOCKED); - (parent_class->clear) (clist); + parent_class->clear (clist); } @@ -4753,6 +4754,28 @@ gtk_ctree_node_set_shift (GtkCTree *ctree, tree_draw_node (ctree, node); } +static void +remove_grab (GtkCList *clist) +{ + if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist)) + { + gtk_grab_remove (GTK_WIDGET (clist)); + gdk_pointer_ungrab (GDK_CURRENT_TIME); + } + + if (clist->htimer) + { + gtk_timeout_remove (clist->htimer); + clist->htimer = 0; + } + + if (clist->vtimer) + { + gtk_timeout_remove (clist->vtimer); + clist->vtimer = 0; + } +} + void gtk_ctree_node_set_selectable (GtkCTree *ctree, GtkCTreeNode *node, @@ -4776,22 +4799,9 @@ gtk_ctree_node_set_selectable (GtkCTree *ctree, if (clist->anchor >= 0 && clist->selection_mode == GTK_SELECTION_EXTENDED) { - if ((gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_FOCUS (clist))) - { - clist->drag_button = 0; - gtk_grab_remove (GTK_WIDGET (clist)); - gdk_pointer_ungrab (GDK_CURRENT_TIME); - if (clist->htimer) - { - gtk_timeout_remove (clist->htimer); - clist->htimer = 0; - } - if (clist->vtimer) - { - gtk_timeout_remove (clist->vtimer); - clist->vtimer = 0; - } - } + clist->drag_button = 0; + remove_grab (clist); + GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL); } gtk_ctree_unselect (ctree, node); @@ -5784,14 +5794,6 @@ check_drag (GtkCTree *ctree, /************************************/ -static void -drag_source_info_destroy (gpointer data) -{ - GtkCListCellInfo *info = data; - - g_free (info); -} - static void drag_dest_info_destroy (gpointer data) { @@ -5806,7 +5808,7 @@ gtk_ctree_drag_begin (GtkWidget *widget, { GtkCList *clist; GtkCTree *ctree; - GtkCListCellInfo *info; + gboolean use_icons; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_CTREE (widget)); @@ -5815,28 +5817,17 @@ gtk_ctree_drag_begin (GtkWidget *widget, clist = GTK_CLIST (widget); ctree = GTK_CTREE (widget); - info = g_dataset_get_data (context, "gtk-clist-drag-source"); + use_icons = GTK_CLIST_USE_DRAG_ICONS (clist); + GTK_CLIST_UNSET_FLAG (clist, CLIST_USE_DRAG_ICONS); + GTK_WIDGET_CLASS (parent_class)->drag_begin (widget, context); - if (!info) - { - info = g_new (GtkCListCellInfo, 1); - - if (clist->click_cell.row < 0) - clist->click_cell.row = 0; - else if (clist->click_cell.row >= clist->rows) - clist->click_cell.row = clist->rows - 1; - info->row = clist->click_cell.row; - info->column = clist->click_cell.column; - - g_dataset_set_data_full (context, "gtk-clist-drag-source", info, - drag_source_info_destroy); - } - - if (GTK_CLIST_USE_DRAG_ICONS (clist)) + if (use_icons) { GtkCTreeNode *node; - node = GTK_CTREE_NODE (g_list_nth (clist->row_list, info->row)); + GTK_CLIST_SET_FLAG (clist, CLIST_USE_DRAG_ICONS); + node = GTK_CTREE_NODE (g_list_nth (clist->row_list, + clist->click_cell.row)); if (node) { if (GTK_CELL_PIXTEXT diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 54162c5f07..7752b5578e 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -1414,6 +1414,9 @@ gtk_spin_button_get_value_as_float (GtkSpinButton *spin_button) g_return_val_if_fail (spin_button != NULL, 0.0); g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), 0.0); + if (GTK_EDITABLE (spin_button)->editable) + gtk_spin_button_update (spin_button); + return spin_button->adjustment->value; } @@ -1425,6 +1428,9 @@ gtk_spin_button_get_value_as_int (GtkSpinButton *spin_button) g_return_val_if_fail (spin_button != NULL, 0); g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), 0); + if (GTK_EDITABLE (spin_button)->editable) + gtk_spin_button_update (spin_button); + val = spin_button->adjustment->value; if (val - floor (val) < ceil (val) - val) return floor (val);