scrolledwindow: Remove needless "dragging" field from Indicator struct

The "over" state already stays set while scrollbar dragging happens, there's
no need to double track that.

https://bugzilla.gnome.org/show_bug.cgi?id=746961
This commit is contained in:
Carlos Garnacho 2015-03-31 13:13:50 +02:00
parent eb26208c08
commit 960c229220

View File

@ -167,8 +167,7 @@ typedef struct
{ {
GtkWidget *scrollbar; GtkWidget *scrollbar;
GdkWindow *window; GdkWindow *window;
gboolean dragging; gboolean over; /* either mouse over, or while dragging */
gboolean over;
gint64 last_scroll_time; gint64 last_scroll_time;
guint conceil_timer; guint conceil_timer;
@ -3900,7 +3899,7 @@ maybe_hide_indicator (gpointer data)
Indicator *indicator = data; Indicator *indicator = data;
if (g_get_monotonic_time () - indicator->last_scroll_time >= INDICATOR_FADE_OUT_DELAY * 1000 && if (g_get_monotonic_time () - indicator->last_scroll_time >= INDICATOR_FADE_OUT_DELAY * 1000 &&
!indicator->over && !indicator->dragging) !indicator->over)
indicator_start_fade (indicator, 0.0); indicator_start_fade (indicator, 0.0);
return G_SOURCE_CONTINUE; return G_SOURCE_CONTINUE;
@ -3914,16 +3913,6 @@ indicator_value_changed (GtkAdjustment *adjustment,
indicator_start_fade (indicator, 1.0); indicator_start_fade (indicator, 1.0);
} }
static void
indicator_style_changed (GtkStyleContext *context,
Indicator *indicator)
{
if (gtk_style_context_has_class (context, "dragging"))
indicator->dragging = TRUE;
else
indicator->dragging = FALSE;
}
static void static void
setup_indicator (GtkScrolledWindow *scrolled_window, setup_indicator (GtkScrolledWindow *scrolled_window,
Indicator *indicator, Indicator *indicator,
@ -3947,8 +3936,6 @@ setup_indicator (GtkScrolledWindow *scrolled_window,
g_object_unref (scrollbar); g_object_unref (scrollbar);
gtk_style_context_add_class (context, "overlay-indicator"); gtk_style_context_add_class (context, "overlay-indicator");
g_signal_connect (context, "changed",
G_CALLBACK (indicator_style_changed), indicator);
g_signal_connect (adjustment, "value-changed", g_signal_connect (adjustment, "value-changed",
G_CALLBACK (indicator_value_changed), indicator); G_CALLBACK (indicator_value_changed), indicator);
@ -3975,7 +3962,6 @@ remove_indicator (GtkScrolledWindow *scrolled_window,
adjustment = gtk_range_get_adjustment (GTK_RANGE (scrollbar)); adjustment = gtk_range_get_adjustment (GTK_RANGE (scrollbar));
gtk_style_context_remove_class (context, "overlay-indicator"); gtk_style_context_remove_class (context, "overlay-indicator");
g_signal_handlers_disconnect_by_func (context, indicator_style_changed, indicator);
g_signal_handlers_disconnect_by_func (adjustment, indicator_value_changed, indicator); g_signal_handlers_disconnect_by_func (adjustment, indicator_value_changed, indicator);
if (indicator->conceil_timer) if (indicator->conceil_timer)
{ {
@ -4106,7 +4092,6 @@ indicator_reset (Indicator *indicator)
} }
indicator->scrollbar = NULL; indicator->scrollbar = NULL;
indicator->dragging = FALSE;
indicator->over = FALSE; indicator->over = FALSE;
indicator->current_pos = indicator->source_pos = indicator->target_pos = 0; indicator->current_pos = indicator->source_pos = indicator->target_pos = 0;
indicator->start_time = indicator->end_time = indicator->last_scroll_time = 0; indicator->start_time = indicator->end_time = indicator->last_scroll_time = 0;