Commit feefa270 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Fixes for bug #56248:

2003-03-29  Matthias Clasen  <maclas@gmx.de>

        Fixes for bug #56248:

	* gtk/gtknotebook.c (stop_scrolling): New function to remove the
	timer and queue a redraw.
	(gtk_notebook_grab_notify):
	(gtk_notebook_state_changed): New functions to call stop_scrolling()
	if necessary.
	(gtk_notebook_button_release): Use stop_scrolling().
	(gtk_notebook_draw_arrow): Fix drawing of insensitive arrows.

	* gtk/gtkrange.c (stop_scrolling): New function to remove the
	grab, remove the timer and queue a redraw.
	(gtk_range_grab_notify):
	(gtk_range_state_changed): New functions to call stop_scrolling()
	if necessary.
	(gtk_range_button_release): Use stop_scrolling().

	* gtk/gtkspinbutton.c (gtk_spin_button_grab_notify):
	(gtk_spin_button_state_changed): Redraw after stop_spinning.
	(gtk_spin_button_stop_spinning): Reset click_child to correct the
	drawing of the arrows.
	(gtk_spin_button_button_release): Use a local copy of click_child,
	since stop_spinning() resets it.
parent 357833d9
2003-03-29 Matthias Clasen <maclas@gmx.de>
Fixes for bug #56248:
* gtk/gtknotebook.c (stop_scrolling): New function to remove the
timer and queue a redraw.
(gtk_notebook_grab_notify):
(gtk_notebook_state_changed): New functions to call stop_scrolling()
if necessary.
(gtk_notebook_button_release): Use stop_scrolling().
(gtk_notebook_draw_arrow): Fix drawing of insensitive arrows.
* gtk/gtkrange.c (stop_scrolling): New function to remove the
grab, remove the timer and queue a redraw.
(gtk_range_grab_notify):
(gtk_range_state_changed): New functions to call stop_scrolling()
if necessary.
(gtk_range_button_release): Use stop_scrolling().
* gtk/gtkspinbutton.c (gtk_spin_button_grab_notify):
(gtk_spin_button_state_changed): Redraw after stop_spinning.
(gtk_spin_button_stop_spinning): Reset click_child to correct the
drawing of the arrows.
(gtk_spin_button_button_release): Use a local copy of click_child,
since stop_spinning() resets it.
* gtk/gtknotebook.c (gtk_notebook_class_init): Add C-A-PgUp and
C-A-PgDown as alternatives to the A-less variants. (This slipped
in accidentally some time ago). (#97860)
......
2003-03-29 Matthias Clasen <maclas@gmx.de>
Fixes for bug #56248:
* gtk/gtknotebook.c (stop_scrolling): New function to remove the
timer and queue a redraw.
(gtk_notebook_grab_notify):
(gtk_notebook_state_changed): New functions to call stop_scrolling()
if necessary.
(gtk_notebook_button_release): Use stop_scrolling().
(gtk_notebook_draw_arrow): Fix drawing of insensitive arrows.
* gtk/gtkrange.c (stop_scrolling): New function to remove the
grab, remove the timer and queue a redraw.
(gtk_range_grab_notify):
(gtk_range_state_changed): New functions to call stop_scrolling()
if necessary.
(gtk_range_button_release): Use stop_scrolling().
* gtk/gtkspinbutton.c (gtk_spin_button_grab_notify):
(gtk_spin_button_state_changed): Redraw after stop_spinning.
(gtk_spin_button_stop_spinning): Reset click_child to correct the
drawing of the arrows.
(gtk_spin_button_button_release): Use a local copy of click_child,
since stop_spinning() resets it.
* gtk/gtknotebook.c (gtk_notebook_class_init): Add C-A-PgUp and
C-A-PgDown as alternatives to the A-less variants. (This slipped
in accidentally some time ago). (#97860)
......
2003-03-29 Matthias Clasen <maclas@gmx.de>
Fixes for bug #56248:
* gtk/gtknotebook.c (stop_scrolling): New function to remove the
timer and queue a redraw.
(gtk_notebook_grab_notify):
(gtk_notebook_state_changed): New functions to call stop_scrolling()
if necessary.
(gtk_notebook_button_release): Use stop_scrolling().
(gtk_notebook_draw_arrow): Fix drawing of insensitive arrows.
* gtk/gtkrange.c (stop_scrolling): New function to remove the
grab, remove the timer and queue a redraw.
(gtk_range_grab_notify):
(gtk_range_state_changed): New functions to call stop_scrolling()
if necessary.
(gtk_range_button_release): Use stop_scrolling().
* gtk/gtkspinbutton.c (gtk_spin_button_grab_notify):
(gtk_spin_button_state_changed): Redraw after stop_spinning.
(gtk_spin_button_stop_spinning): Reset click_child to correct the
drawing of the arrows.
(gtk_spin_button_button_release): Use a local copy of click_child,
since stop_spinning() resets it.
* gtk/gtknotebook.c (gtk_notebook_class_init): Add C-A-PgUp and
C-A-PgDown as alternatives to the A-less variants. (This slipped
in accidentally some time ago). (#97860)
......
2003-03-29 Matthias Clasen <maclas@gmx.de>
Fixes for bug #56248:
* gtk/gtknotebook.c (stop_scrolling): New function to remove the
timer and queue a redraw.
(gtk_notebook_grab_notify):
(gtk_notebook_state_changed): New functions to call stop_scrolling()
if necessary.
(gtk_notebook_button_release): Use stop_scrolling().
(gtk_notebook_draw_arrow): Fix drawing of insensitive arrows.
* gtk/gtkrange.c (stop_scrolling): New function to remove the
grab, remove the timer and queue a redraw.
(gtk_range_grab_notify):
(gtk_range_state_changed): New functions to call stop_scrolling()
if necessary.
(gtk_range_button_release): Use stop_scrolling().
* gtk/gtkspinbutton.c (gtk_spin_button_grab_notify):
(gtk_spin_button_state_changed): Redraw after stop_spinning.
(gtk_spin_button_stop_spinning): Reset click_child to correct the
drawing of the arrows.
(gtk_spin_button_button_release): Use a local copy of click_child,
since stop_spinning() resets it.
* gtk/gtknotebook.c (gtk_notebook_class_init): Add C-A-PgUp and
C-A-PgDown as alternatives to the A-less variants. (This slipped
in accidentally some time ago). (#97860)
......
2003-03-29 Matthias Clasen <maclas@gmx.de>
Fixes for bug #56248:
* gtk/gtknotebook.c (stop_scrolling): New function to remove the
timer and queue a redraw.
(gtk_notebook_grab_notify):
(gtk_notebook_state_changed): New functions to call stop_scrolling()
if necessary.
(gtk_notebook_button_release): Use stop_scrolling().
(gtk_notebook_draw_arrow): Fix drawing of insensitive arrows.
* gtk/gtkrange.c (stop_scrolling): New function to remove the
grab, remove the timer and queue a redraw.
(gtk_range_grab_notify):
(gtk_range_state_changed): New functions to call stop_scrolling()
if necessary.
(gtk_range_button_release): Use stop_scrolling().
* gtk/gtkspinbutton.c (gtk_spin_button_grab_notify):
(gtk_spin_button_state_changed): Redraw after stop_spinning.
(gtk_spin_button_stop_spinning): Reset click_child to correct the
drawing of the arrows.
(gtk_spin_button_button_release): Use a local copy of click_child,
since stop_spinning() resets it.
* gtk/gtknotebook.c (gtk_notebook_class_init): Add C-A-PgUp and
C-A-PgDown as alternatives to the A-less variants. (This slipped
in accidentally some time ago). (#97860)
......
......@@ -158,6 +158,10 @@ static gint gtk_notebook_motion_notify (GtkWidget *widget,
GdkEventMotion *event);
static gint gtk_notebook_focus_in (GtkWidget *widget,
GdkEventFocus *event);
static void gtk_notebook_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static void gtk_notebook_state_changed (GtkWidget *widget,
GtkStateType previous_state);
static void gtk_notebook_draw_focus (GtkWidget *widget);
static gint gtk_notebook_focus (GtkWidget *widget,
GtkDirectionType direction);
......@@ -348,6 +352,8 @@ gtk_notebook_class_init (GtkNotebookClass *class)
widget_class->enter_notify_event = gtk_notebook_enter_notify;
widget_class->leave_notify_event = gtk_notebook_leave_notify;
widget_class->motion_notify_event = gtk_notebook_motion_notify;
widget_class->grab_notify = gtk_notebook_grab_notify;
widget_class->state_changed = gtk_notebook_state_changed;
widget_class->focus_in_event = gtk_notebook_focus_in;
widget_class->focus = gtk_notebook_focus;
......@@ -1664,6 +1670,20 @@ gtk_notebook_button_press (GtkWidget *widget,
return TRUE;
}
static void
stop_scrolling (GtkNotebook *notebook)
{
if (notebook->timer)
{
gtk_timeout_remove (notebook->timer);
notebook->timer = 0;
notebook->need_timer = FALSE;
}
notebook->click_child = 0;
notebook->button = 0;
gtk_notebook_redraw_arrows (notebook);
}
static gint
gtk_notebook_button_release (GtkWidget *widget,
GdkEventButton *event)
......@@ -1680,18 +1700,7 @@ gtk_notebook_button_release (GtkWidget *widget,
if (event->button == notebook->button)
{
guint click_child;
if (notebook->timer)
{
g_source_remove (notebook->timer);
notebook->timer = 0;
notebook->need_timer = FALSE;
}
click_child = notebook->click_child;
notebook->click_child = 0;
notebook->button = 0;
gtk_notebook_redraw_arrows (notebook);
stop_scrolling (notebook);
return TRUE;
}
......@@ -1775,6 +1784,22 @@ gtk_notebook_motion_notify (GtkWidget *widget,
return TRUE;
}
static void
gtk_notebook_grab_notify (GtkWidget *widget,
gboolean was_grabbed)
{
if (!was_grabbed)
stop_scrolling (GTK_NOTEBOOK (widget));
}
static void
gtk_notebook_state_changed (GtkWidget *widget,
GtkStateType previous_state)
{
if (!GTK_WIDGET_IS_SENSITIVE (widget))
stop_scrolling (GTK_NOTEBOOK (widget));
}
static gint
gtk_notebook_focus_in (GtkWidget *widget,
GdkEventFocus *event)
......@@ -2808,7 +2833,7 @@ gtk_notebook_draw_arrow (GtkNotebook *notebook,
state_type = GTK_STATE_PRELIGHT;
}
else
state_type = GTK_STATE_NORMAL;
state_type = GTK_WIDGET_STATE (widget);
if (notebook->click_child == arrow)
shadow_type = GTK_SHADOW_IN;
......@@ -2830,7 +2855,7 @@ gtk_notebook_draw_arrow (GtkNotebook *notebook,
arrow = GTK_ARROW_UP;
gtk_paint_arrow (widget->style, widget->window, state_type,
shadow_type, NULL, GTK_WIDGET(notebook), "notebook",
shadow_type, NULL, widget, "notebook",
arrow, TRUE,
arrow_rect.x, arrow_rect.y, ARROW_SIZE, ARROW_SIZE);
}
......@@ -2849,7 +2874,7 @@ gtk_notebook_draw_arrow (GtkNotebook *notebook,
arrow = GTK_ARROW_DOWN;
gtk_paint_arrow (widget->style, widget->window, state_type,
shadow_type, NULL, GTK_WIDGET(notebook), "notebook",
shadow_type, NULL, widget, "notebook",
arrow, TRUE, arrow_rect.x + ARROW_SIZE + ARROW_SPACING,
arrow_rect.y, ARROW_SIZE, ARROW_SIZE);
}
......
......@@ -118,6 +118,10 @@ static gint gtk_range_enter_notify (GtkWidget *widget,
GdkEventCrossing *event);
static gint gtk_range_leave_notify (GtkWidget *widget,
GdkEventCrossing *event);
static void gtk_range_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static void gtk_range_state_changed (GtkWidget *widget,
GtkStateType previous_state);
static gint gtk_range_scroll_event (GtkWidget *widget,
GdkEventScroll *event);
static void gtk_range_style_set (GtkWidget *widget,
......@@ -233,6 +237,8 @@ gtk_range_class_init (GtkRangeClass *class)
widget_class->scroll_event = gtk_range_scroll_event;
widget_class->enter_notify_event = gtk_range_enter_notify;
widget_class->leave_notify_event = gtk_range_leave_notify;
widget_class->grab_notify = gtk_range_grab_notify;
widget_class->state_changed = gtk_range_state_changed;
widget_class->style_set = gtk_range_style_set;
class->move_slider = gtk_range_move_slider;
......@@ -1311,6 +1317,19 @@ update_slider_position (GtkRange *range,
gtk_range_internal_set_value (range, new_value);
}
static void stop_scrolling (GtkRange *range)
{
range_grab_remove (range);
gtk_range_remove_step_timer (range);
/* Flush any pending discontinuous/delayed updates */
gtk_range_update_value (range);
/* Just be lazy about this, if we scrolled it will all redraw anyway,
* so no point optimizing the button deactivate case
*/
gtk_widget_queue_draw (widget);
}
static gint
gtk_range_button_release (GtkWidget *widget,
GdkEventButton *event)
......@@ -1332,23 +1351,10 @@ gtk_range_button_release (GtkWidget *widget,
if (range->layout->grab_button == event->button)
{
MouseLocation grab_location;
grab_location = range->layout->grab_location;
range_grab_remove (range);
gtk_range_remove_step_timer (range);
if (grab_location == MOUSE_SLIDER)
if (range->layout->grab_location == MOUSE_SLIDER)
update_slider_position (range, range->layout->mouse_x, range->layout->mouse_y);
/* Flush any pending discontinuous/delayed updates */
gtk_range_update_value (range);
/* Just be lazy about this, if we scrolled it will all redraw anyway,
* so no point optimizing the button deactivate case
*/
gtk_widget_queue_draw (widget);
stop_scrolling (range);
return TRUE;
}
......@@ -1440,6 +1446,22 @@ gtk_range_leave_notify (GtkWidget *widget,
return TRUE;
}
static void
gtk_range_grab_notify (GtkWidget *widget,
gboolean was_grabbed)
{
if (!was_grabbed)
stop_scrolling (GTK_RANGE (widget));
}
static void
gtk_range_state_changed (GtkWidget *widget,
GtkStateType previous_state)
{
if (!GTK_WIDGET_IS_SENSITIVE (widget))
stop_scrolling (GTK_RANGE (widget));
}
static void
gtk_range_adjustment_changed (GtkAdjustment *adjustment,
gpointer data)
......
......@@ -955,16 +955,26 @@ static void
gtk_spin_button_grab_notify (GtkWidget *widget,
gboolean was_grabbed)
{
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
if (!was_grabbed)
gtk_spin_button_stop_spinning (GTK_SPIN_BUTTON (widget));
{
gtk_spin_button_stop_spinning (spin);
spin_button_redraw (spin);
}
}
static void
gtk_spin_button_state_changed (GtkWidget *widget,
GtkStateType previous_state)
{
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
if (!GTK_WIDGET_IS_SENSITIVE (widget))
gtk_spin_button_stop_spinning (GTK_SPIN_BUTTON (widget));
{
gtk_spin_button_stop_spinning (spin);
spin_button_redraw (spin);
}
}
static gint
......@@ -1006,6 +1016,9 @@ gtk_spin_button_stop_spinning (GtkSpinButton *spin)
spin->timer = 0;
spin->timer_step = spin->adjustment->step_increment;
spin->timer_calls = 0;
spin->click_child = NO_ARROW;
spin->button = 0;
}
static void
......@@ -1084,7 +1097,7 @@ gtk_spin_button_button_release (GtkWidget *widget,
if (event->button == spin->button)
{
guint click_child;
int click_child = spin->click_child;
gtk_spin_button_stop_spinning (spin);
......@@ -1094,7 +1107,7 @@ gtk_spin_button_button_release (GtkWidget *widget,
event->y <= widget->requisition.height &&
event->x <= arrow_size + 2 * widget->style->xthickness)
{
if (spin->click_child == GTK_ARROW_UP &&
if (click_child == GTK_ARROW_UP &&
event->y <= widget->requisition.height / 2)
{
gdouble diff;
......@@ -1103,7 +1116,7 @@ gtk_spin_button_button_release (GtkWidget *widget,
if (diff > EPSILON)
gtk_spin_button_real_spin (spin, diff);
}
else if (spin->click_child == GTK_ARROW_DOWN &&
else if (click_child == GTK_ARROW_DOWN &&
event->y > widget->requisition.height / 2)
{
gdouble diff;
......@@ -1114,9 +1127,6 @@ gtk_spin_button_button_release (GtkWidget *widget,
}
}
}
click_child = spin->click_child;
spin->click_child = NO_ARROW;
spin->button = 0;
spin_button_redraw (spin);
return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment