Made button-press timeouts which work like key repeat timeouts
2005-11-22 Michael Natterer <mitch@imendio.com> Made button-press timeouts which work like key repeat timeouts configurable. Addresses bug #142582: * gtk/gtksettings.c: added properties "gtk-timeout-initial" and "gtk-timeout-repeat" which defalt to 200/20 (ms). Use the values from GtkSettings instead of hardcoding them (the repeat value is either taken as-is for fast repeat or multiplied by 5 for slow repeat). Changed all places to use these two standard initial/repeat timings: * gtk/gtkcalendar.c (unchanged 200/20) * gtk/gtknotebook.c (unchanged 200/100) * gtk/gtkpathbar.c (changed from 300/150 to 200/100) * gtk/gtkrange.c (changed from 250/100 to 200/100) * gtk/gtkspinbutton.c (unchanged 200/20)
This commit is contained in:
committed by
Michael Natterer
parent
1097260aa7
commit
dfa4870b74
@ -37,9 +37,8 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
#define SCROLL_INITIAL_DELAY 250 /* must hold button this long before ... */
|
||||
#define SCROLL_LATER_DELAY 100 /* ... it starts repeating at this rate */
|
||||
#define UPDATE_DELAY 300 /* Delay for queued update */
|
||||
#define SCROLL_DELAY_FACTOR 5 /* Scroll repeat multiplier */
|
||||
#define UPDATE_DELAY 300 /* Delay for queued update */
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
@ -2693,14 +2692,18 @@ second_timeout (gpointer data)
|
||||
static gboolean
|
||||
initial_timeout (gpointer data)
|
||||
{
|
||||
GtkRange *range;
|
||||
GtkRange *range;
|
||||
GtkSettings *settings;
|
||||
guint timeout;
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
settings = gtk_widget_get_settings (GTK_WIDGET (data));
|
||||
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
|
||||
|
||||
range = GTK_RANGE (data);
|
||||
range->timer->timeout_id =
|
||||
g_timeout_add (SCROLL_LATER_DELAY,
|
||||
second_timeout,
|
||||
range);
|
||||
range->timer->timeout_id = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
|
||||
second_timeout,
|
||||
range);
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
/* remove self */
|
||||
@ -2711,15 +2714,20 @@ static void
|
||||
gtk_range_add_step_timer (GtkRange *range,
|
||||
GtkScrollType step)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
guint timeout;
|
||||
|
||||
g_return_if_fail (range->timer == NULL);
|
||||
g_return_if_fail (step != GTK_SCROLL_NONE);
|
||||
|
||||
|
||||
settings = gtk_widget_get_settings (GTK_WIDGET (range));
|
||||
g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
|
||||
|
||||
range->timer = g_new (GtkRangeStepTimer, 1);
|
||||
|
||||
range->timer->timeout_id =
|
||||
g_timeout_add (SCROLL_INITIAL_DELAY,
|
||||
initial_timeout,
|
||||
range);
|
||||
range->timer->timeout_id = g_timeout_add (timeout,
|
||||
initial_timeout,
|
||||
range);
|
||||
range->timer->step = step;
|
||||
|
||||
gtk_range_scroll (range, range->timer->step);
|
||||
|
||||
Reference in New Issue
Block a user