--- gtk/gtkfontsel.c +++ gtk/gtkfontsel.c @@ -595,9 +595,15 @@ if (gtk_widget_has_screen (GTK_WIDGET (fontsel))) { + /* Disable selection timeout */ + g_object_set_data (G_OBJECT (fontsel), "immediate-selection", GUINT_TO_POINTER (1)); + gtk_font_selection_show_available_fonts (fontsel); gtk_font_selection_show_available_sizes (fontsel, TRUE); gtk_font_selection_show_available_styles (fontsel); + + /* Enable selection timeout */ + g_object_set_data (G_OBJECT (fontsel), "immediate-selection", GUINT_TO_POINTER (0)); } } @@ -712,15 +718,24 @@ { GtkFontSelection *fontsel; guint selection_timeout = 0; + guint immediate_selection = 0; fontsel = GTK_FONT_SELECTION (data); selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "font-selection-timeout")); + immediate_selection = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "immediate-selection")); if (selection_timeout) g_source_remove (selection_timeout); - selection_timeout = g_timeout_add (200, gtk_font_selection_real_select_font, data); - g_object_set_data (G_OBJECT (fontsel), "font-selection-timeout", GUINT_TO_POINTER (selection_timeout)); + if (immediate_selection) + { + gtk_font_selection_real_select_font (data); + } + else + { + selection_timeout = g_timeout_add (200, gtk_font_selection_real_select_font, data); + g_object_set_data (G_OBJECT (fontsel), "font-selection-timeout", GUINT_TO_POINTER (selection_timeout)); + } } static int @@ -965,15 +980,24 @@ { GtkFontSelection *fontsel; guint selection_timeout = 0; + guint immediate_selection = 0; fontsel = GTK_FONT_SELECTION (data); selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "style-selection-timeout")); + immediate_selection = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "immediate-selection")); if (selection_timeout) g_source_remove (selection_timeout); - selection_timeout = g_timeout_add (200, gtk_font_selection_real_select_style, data); - g_object_set_data (G_OBJECT (fontsel), "style-selection-timeout", GUINT_TO_POINTER (selection_timeout)); + if (immediate_selection) + { + gtk_font_selection_real_select_style (data); + } + else + { + selection_timeout = g_timeout_add (200, gtk_font_selection_real_select_style, data); + g_object_set_data (G_OBJECT (fontsel), "style-selection-timeout", GUINT_TO_POINTER (selection_timeout)); + } } static void @@ -1142,15 +1166,24 @@ { GtkFontSelection *fontsel; guint selection_timeout = 0; + guint immediate_selection = 0; fontsel = GTK_FONT_SELECTION (data); selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "size-selection-timeout")); + immediate_selection = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "immediate-selection")); if (selection_timeout) g_source_remove (selection_timeout); - selection_timeout = g_timeout_add (200, gtk_font_selection_real_select_size, data); - g_object_set_data (G_OBJECT (fontsel), "size-selection-timeout", GUINT_TO_POINTER (selection_timeout)); + if (immediate_selection) + { + gtk_font_selection_real_select_size (data); + } + else + { + selection_timeout = g_timeout_add (200, gtk_font_selection_real_select_size, data); + g_object_set_data (G_OBJECT (fontsel), "size-selection-timeout", GUINT_TO_POINTER (selection_timeout)); + } } static void @@ -1334,6 +1367,9 @@ if (!new_family) return FALSE; + /* Disable selection timeout */ + g_object_set_data (G_OBJECT (fontsel), "immediate-selection", GUINT_TO_POINTER (1)); + fontsel->family = new_family; set_cursor_to_iter (GTK_TREE_VIEW (fontsel->family_list), &iter); gtk_font_selection_show_available_styles (fontsel); @@ -1383,6 +1419,9 @@ pango_font_description_free (new_desc); + /* Enable selection timeout */ + g_object_set_data (G_OBJECT (fontsel), "immediate-selection", GUINT_TO_POINTER (0)); + return TRUE; }