Get and use double-click speed from GtkSettings (Bug #103218).

2003-05-29  Ray Strode  <halfline@hawaii.rr.com>

	Get and use double-click speed from GtkSettings (Bug #103218).

	* src/ui.c, src/ui.h:
	add function meta_ui_get_double_click_timeout for looking up
	the global double-click speed.

	* src/display.c, src/display.h: remove double_click_time
	field from MetaDisplay and use meta_ui_get_double_click_timeout
	instead.
This commit is contained in:
Ray Strode 2003-05-30 02:53:42 +00:00 committed by Ray Strode
parent f441033959
commit d1a853557b
5 changed files with 35 additions and 4 deletions

View File

@ -1,3 +1,15 @@
2003-05-29 Ray Strode <halfline@hawaii.rr.com>
Get and use double-click speed from GtkSettings (Bug #103218).
* src/ui.c, src/ui.h:
add function meta_ui_get_double_click_timeout for looking up
the global double-click speed.
* src/display.c, src/display.h: remove double_click_time
field from MetaDisplay and use meta_ui_get_double_click_timeout
instead.
2003-05-29 Rob Adams <robadams@ucla.edu> 2003-05-29 Rob Adams <robadams@ucla.edu>
* src/main.c (main): chdir to the user's home directory on * src/main.c (main): chdir to the user's home directory on

View File

@ -459,7 +459,6 @@ meta_display_open (const char *name)
display->window_ids = g_hash_table_new (meta_unsigned_long_hash, display->window_ids = g_hash_table_new (meta_unsigned_long_hash,
meta_unsigned_long_equal); meta_unsigned_long_equal);
display->double_click_time = 250;
display->last_button_time = 0; display->last_button_time = 0;
display->last_button_xwindow = None; display->last_button_xwindow = None;
display->last_button_num = 0; display->last_button_num = 0;
@ -1152,7 +1151,7 @@ event_callback (XEvent *event,
/* mark double click events, kind of a hack, oh well. */ /* mark double click events, kind of a hack, oh well. */
if (((int)event->xbutton.button) == display->last_button_num && if (((int)event->xbutton.button) == display->last_button_num &&
event->xbutton.window == display->last_button_xwindow && event->xbutton.window == display->last_button_xwindow &&
event->xbutton.time < (display->last_button_time + display->double_click_time)) event->xbutton.time < (display->last_button_time + meta_ui_get_double_click_timeout ()))
{ {
display->is_double_click = TRUE; display->is_double_click = TRUE;
meta_topic (META_DEBUG_EVENTS, meta_topic (META_DEBUG_EVENTS,

View File

@ -205,7 +205,6 @@ struct _MetaDisplay
Window no_focus_window; Window no_focus_window;
/* for double click */ /* for double click */
int double_click_time;
Time last_button_time; Time last_button_time;
Window last_button_xwindow; Window last_button_xwindow;
int last_button_num; int last_button_num;

View File

@ -765,3 +765,23 @@ meta_stock_icons_init (void)
g_object_unref (G_OBJECT (factory)); g_object_unref (G_OBJECT (factory));
} }
int
meta_ui_get_double_click_timeout (void)
{
GtkSettings *settings;
GObjectClass *klass;
int timeout = 0;
settings = gtk_settings_get_default ();
klass = G_OBJECT_CLASS (GTK_SETTINGS_GET_CLASS (settings));
if (g_object_class_find_property (klass, "gtk-double-click-time") == NULL)
{
return 250;
}
g_object_get (G_OBJECT (settings), "gtk-double-click-time", &timeout, NULL);
return timeout;
}

View File

@ -165,7 +165,8 @@ gboolean meta_ui_parse_modifier (const char *accel,
gboolean meta_ui_window_is_widget (MetaUI *ui, gboolean meta_ui_window_is_widget (MetaUI *ui,
Window xwindow); Window xwindow);
int meta_ui_get_double_click_timeout (void);
#include "tabpopup.h" #include "tabpopup.h"
#endif #endif