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:
Michael Natterer
2005-11-22 12:40:15 +00:00
committed by Michael Natterer
parent 1097260aa7
commit dfa4870b74
8 changed files with 152 additions and 48 deletions

View File

@ -39,12 +39,11 @@
#include "gtkalias.h"
#define TAB_OVERLAP 2
#define TAB_CURVATURE 1
#define ARROW_SIZE 12
#define ARROW_SPACING 0
#define NOTEBOOK_INIT_SCROLL_DELAY (200)
#define NOTEBOOK_SCROLL_DELAY (100)
#define TAB_OVERLAP 2
#define TAB_CURVATURE 1
#define ARROW_SIZE 12
#define ARROW_SPACING 0
#define SCROLL_DELAY_FACTOR 5
enum {
@ -1715,8 +1714,13 @@ gtk_notebook_arrow_button_press (GtkNotebook *notebook,
if (!notebook->timer)
{
notebook->timer = g_timeout_add (NOTEBOOK_INIT_SCROLL_DELAY,
(GSourceFunc) gtk_notebook_timer,
GtkSettings *settings = gtk_widget_get_settings (widget);
guint timeout;
g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
notebook->timer = g_timeout_add (timeout,
(GSourceFunc) gtk_notebook_timer,
(gpointer) notebook);
notebook->need_timer = TRUE;
}
@ -2584,11 +2588,17 @@ gtk_notebook_timer (GtkNotebook *notebook)
{
gtk_notebook_do_arrow (notebook, notebook->click_child);
if (notebook->need_timer)
if (notebook->need_timer)
{
GtkSettings *settings;
guint timeout;
settings = gtk_widget_get_settings (GTK_WIDGET (notebook));
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
notebook->need_timer = FALSE;
notebook->timer = g_timeout_add (NOTEBOOK_SCROLL_DELAY,
(GSourceFunc) gtk_notebook_timer,
notebook->timer = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
(GSourceFunc) gtk_notebook_timer,
(gpointer) notebook);
}
else