call gtk_spin_button_update before returning a value

Fri Jan  8 00:42:00 1999  Lars Hamann  <lars@gtk.org>

	* 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.
This commit is contained in:
Lars Hamann 1999-01-08 00:21:36 +00:00 committed by Lars Hamann
parent 41604dd844
commit b56693d114
10 changed files with 161 additions and 69 deletions

View File

@ -1,3 +1,17 @@
Fri Jan 8 00:42:00 1999 Lars Hamann <lars@gtk.org>
* 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 <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes

View File

@ -1,3 +1,17 @@
Fri Jan 8 00:42:00 1999 Lars Hamann <lars@gtk.org>
* 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 <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes

View File

@ -1,3 +1,17 @@
Fri Jan 8 00:42:00 1999 Lars Hamann <lars@gtk.org>
* 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 <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes

View File

@ -1,3 +1,17 @@
Fri Jan 8 00:42:00 1999 Lars Hamann <lars@gtk.org>
* 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 <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes

View File

@ -1,3 +1,17 @@
Fri Jan 8 00:42:00 1999 Lars Hamann <lars@gtk.org>
* 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 <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes

View File

@ -1,3 +1,17 @@
Fri Jan 8 00:42:00 1999 Lars Hamann <lars@gtk.org>
* 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 <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes

View File

@ -1,3 +1,17 @@
Fri Jan 8 00:42:00 1999 Lars Hamann <lars@gtk.org>
* 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 <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes

View File

@ -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)

View File

@ -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

View File

@ -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);