2009-04-23 21:30:40 +02:00
|
|
|
Index: gtk+-2.16.0/gtk/gtkfontsel.c
|
2009-02-06 18:31:01 +01:00
|
|
|
===================================================================
|
2009-04-23 21:30:40 +02:00
|
|
|
--- gtk+-2.16.0.orig/gtk/gtkfontsel.c
|
|
|
|
+++ gtk+-2.16.0/gtk/gtkfontsel.c
|
2009-02-06 18:31:01 +01:00
|
|
|
@@ -588,11 +588,24 @@ static void
|
2007-01-05 16:49:44 +01:00
|
|
|
gtk_font_selection_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GtkFontSelection *fontsel;
|
|
|
|
+ guint selection_timeout;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_FONT_SELECTION (object));
|
|
|
|
|
|
|
|
fontsel = GTK_FONT_SELECTION (object);
|
|
|
|
|
|
|
|
+ selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "font-selection-timeout"));
|
|
|
|
+ if (selection_timeout)
|
|
|
|
+ g_source_remove (selection_timeout);
|
|
|
|
+
|
|
|
|
+ selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "style-selection-timeout"));
|
|
|
|
+ if (selection_timeout)
|
|
|
|
+ g_source_remove (selection_timeout);
|
|
|
|
+
|
|
|
|
+ selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "size-selection-timeout"));
|
|
|
|
+ if (selection_timeout)
|
|
|
|
+ g_source_remove (selection_timeout);
|
|
|
|
+
|
|
|
|
if (fontsel->font)
|
|
|
|
gdk_font_unref (fontsel->font);
|
2008-07-24 22:44:01 +02:00
|
|
|
|
2009-02-06 18:31:01 +01:00
|
|
|
@@ -631,6 +644,9 @@ gtk_font_selection_reload_fonts (GtkFont
|
|
|
|
PangoFontDescription *desc;
|
|
|
|
desc = gtk_font_selection_get_font_description (fontsel);
|
|
|
|
|
|
|
|
+ /* Disable selection timeout */
|
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "immediate-selection", GUINT_TO_POINTER (1));
|
|
|
|
+
|
2008-07-24 22:44:01 +02:00
|
|
|
gtk_font_selection_show_available_fonts (fontsel);
|
|
|
|
gtk_font_selection_show_available_sizes (fontsel, TRUE);
|
|
|
|
gtk_font_selection_show_available_styles (fontsel);
|
2009-04-23 21:30:40 +02:00
|
|
|
@@ -638,6 +654,9 @@ gtk_font_selection_reload_fonts (GtkFont
|
|
|
|
gtk_font_selection_select_font_desc (fontsel, desc, NULL, NULL);
|
2009-02-06 18:31:01 +01:00
|
|
|
gtk_font_selection_scroll_to_selection (fontsel);
|
|
|
|
|
2009-04-23 21:30:40 +02:00
|
|
|
+ /* Enable selection timeout */
|
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "immediate-selection", GUINT_TO_POINTER (0));
|
|
|
|
+
|
2009-02-06 18:31:01 +01:00
|
|
|
pango_font_description_free (desc);
|
2008-07-24 22:44:01 +02:00
|
|
|
}
|
|
|
|
}
|
2009-02-06 18:31:01 +01:00
|
|
|
@@ -714,10 +733,10 @@ gtk_font_selection_scroll_on_map (GtkWid
|
2007-01-05 16:49:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This is called when a family is selected in the list. */
|
|
|
|
-static void
|
|
|
|
-gtk_font_selection_select_font (GtkTreeSelection *selection,
|
|
|
|
- gpointer data)
|
|
|
|
+static gboolean
|
|
|
|
+gtk_font_selection_real_select_font (gpointer data)
|
|
|
|
{
|
|
|
|
+ GtkTreeSelection *selection;
|
|
|
|
GtkFontSelection *fontsel;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
2009-02-06 18:31:01 +01:00
|
|
|
@@ -725,7 +744,11 @@ gtk_font_selection_select_font (GtkTreeS
|
2007-01-05 16:49:44 +01:00
|
|
|
const gchar *family_name;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+ if (!g_object_get_data (G_OBJECT (data), "immediate-selection"))
|
|
|
|
+ GDK_THREADS_ENTER ();
|
|
|
|
+
|
|
|
|
fontsel = GTK_FONT_SELECTION (data);
|
|
|
|
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->family_list));
|
|
|
|
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
|
|
|
{
|
2009-02-06 18:31:01 +01:00
|
|
|
@@ -747,6 +770,40 @@ gtk_font_selection_select_font (GtkTreeS
|
2007-01-05 16:49:44 +01:00
|
|
|
|
|
|
|
g_object_unref (family);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "font-selection-timeout", GUINT_TO_POINTER (0));
|
|
|
|
+
|
|
|
|
+ if (!g_object_get_data (G_OBJECT (fontsel), "immediate-selection"))
|
|
|
|
+ GDK_THREADS_LEAVE ();
|
|
|
|
+
|
|
|
|
+ /* Remove ourselves */
|
|
|
|
+ return FALSE;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void
|
|
|
|
+gtk_font_selection_select_font (GtkTreeSelection *selection,
|
|
|
|
+ gpointer data)
|
|
|
|
+{
|
|
|
|
+ GtkFontSelection *fontsel;
|
|
|
|
+ guint selection_timeout = 0;
|
2008-07-24 22:44:01 +02:00
|
|
|
+ guint immediate_selection = 0;
|
2007-01-05 16:49:44 +01:00
|
|
|
+
|
|
|
|
+ fontsel = GTK_FONT_SELECTION (data);
|
|
|
|
+ selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "font-selection-timeout"));
|
2008-07-24 22:44:01 +02:00
|
|
|
+ immediate_selection = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "immediate-selection"));
|
2007-01-05 16:49:44 +01:00
|
|
|
+
|
|
|
|
+ if (selection_timeout)
|
|
|
|
+ g_source_remove (selection_timeout);
|
|
|
|
+
|
2008-07-24 22:44:01 +02:00
|
|
|
+ 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));
|
|
|
|
+ }
|
2007-01-05 16:49:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-02-06 18:31:01 +01:00
|
|
|
@@ -949,14 +1006,20 @@ gtk_font_selection_select_best_style (Gt
|
2007-01-05 16:49:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* This is called when a style is selected in the list. */
|
|
|
|
-static void
|
|
|
|
-gtk_font_selection_select_style (GtkTreeSelection *selection,
|
|
|
|
- gpointer data)
|
|
|
|
+static gboolean
|
|
|
|
+gtk_font_selection_real_select_style (gpointer data)
|
|
|
|
{
|
|
|
|
- GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
|
|
|
|
+ GtkTreeSelection *selection;
|
|
|
|
+ GtkFontSelection *fontsel;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
+ if (!g_object_get_data (G_OBJECT (data), "immediate-selection"))
|
|
|
|
+ GDK_THREADS_ENTER ();
|
|
|
|
+
|
|
|
|
+ fontsel = GTK_FONT_SELECTION (data);
|
|
|
|
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->face_list));
|
|
|
|
+
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
|
|
|
{
|
|
|
|
PangoFontFace *face;
|
2009-02-06 18:31:01 +01:00
|
|
|
@@ -968,6 +1031,40 @@ gtk_font_selection_select_style (GtkTree
|
2007-01-05 16:49:44 +01:00
|
|
|
|
|
|
|
gtk_font_selection_show_available_sizes (fontsel, FALSE);
|
|
|
|
gtk_font_selection_select_best_size (fontsel);
|
|
|
|
+
|
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "style-selection-timeout", GUINT_TO_POINTER (0));
|
|
|
|
+
|
|
|
|
+ if (!g_object_get_data (G_OBJECT (fontsel), "immediate-selection"))
|
|
|
|
+ GDK_THREADS_LEAVE ();
|
|
|
|
+
|
|
|
|
+ /* Remove ourselves */
|
|
|
|
+ return FALSE;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void
|
|
|
|
+gtk_font_selection_select_style (GtkTreeSelection *selection,
|
|
|
|
+ gpointer data)
|
|
|
|
+{
|
|
|
|
+ GtkFontSelection *fontsel;
|
|
|
|
+ guint selection_timeout = 0;
|
2008-07-24 22:44:01 +02:00
|
|
|
+ guint immediate_selection = 0;
|
2007-01-05 16:49:44 +01:00
|
|
|
+
|
|
|
|
+ fontsel = GTK_FONT_SELECTION (data);
|
|
|
|
+ selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "style-selection-timeout"));
|
2008-07-24 22:44:01 +02:00
|
|
|
+ immediate_selection = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "immediate-selection"));
|
2007-01-05 16:49:44 +01:00
|
|
|
+
|
|
|
|
+ if (selection_timeout)
|
|
|
|
+ g_source_remove (selection_timeout);
|
|
|
|
+
|
2008-07-24 22:44:01 +02:00
|
|
|
+ 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));
|
|
|
|
+ }
|
2007-01-05 16:49:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-06 18:31:01 +01:00
|
|
|
@@ -1100,22 +1197,60 @@ gtk_font_selection_size_focus_out (GtkWi
|
2007-01-05 16:49:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This is called when a size is selected in the list. */
|
|
|
|
-static void
|
|
|
|
-gtk_font_selection_select_size (GtkTreeSelection *selection,
|
|
|
|
- gpointer data)
|
|
|
|
+static gboolean
|
|
|
|
+gtk_font_selection_real_select_size (gpointer data)
|
|
|
|
{
|
|
|
|
+ GtkTreeSelection *selection;
|
|
|
|
GtkFontSelection *fontsel;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gint new_size;
|
|
|
|
|
|
|
|
+ if (!g_object_get_data (G_OBJECT (data), "immediate-selection"))
|
|
|
|
+ GDK_THREADS_ENTER ();
|
|
|
|
+
|
|
|
|
fontsel = GTK_FONT_SELECTION (data);
|
|
|
|
-
|
|
|
|
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->size_list));
|
|
|
|
+
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
|
|
|
{
|
|
|
|
gtk_tree_model_get (model, &iter, SIZE_COLUMN, &new_size, -1);
|
|
|
|
gtk_font_selection_set_size (fontsel, new_size * PANGO_SCALE);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "size-selection-timeout", GUINT_TO_POINTER (0));
|
|
|
|
+
|
|
|
|
+ if (!g_object_get_data (G_OBJECT (fontsel), "immediate-selection"))
|
|
|
|
+ GDK_THREADS_LEAVE ();
|
|
|
|
+
|
|
|
|
+ /* Remove ourselves */
|
|
|
|
+ return FALSE;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void
|
|
|
|
+gtk_font_selection_select_size (GtkTreeSelection *selection,
|
|
|
|
+ gpointer data)
|
|
|
|
+{
|
|
|
|
+ GtkFontSelection *fontsel;
|
|
|
|
+ guint selection_timeout = 0;
|
2008-07-24 22:44:01 +02:00
|
|
|
+ guint immediate_selection = 0;
|
2007-01-05 16:49:44 +01:00
|
|
|
+
|
|
|
|
+ fontsel = GTK_FONT_SELECTION (data);
|
|
|
|
+ selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "size-selection-timeout"));
|
2008-07-24 22:44:01 +02:00
|
|
|
+ immediate_selection = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "immediate-selection"));
|
2007-01-05 16:49:44 +01:00
|
|
|
+
|
|
|
|
+ if (selection_timeout)
|
|
|
|
+ g_source_remove (selection_timeout);
|
|
|
|
+
|
2008-07-24 22:44:01 +02:00
|
|
|
+ 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));
|
|
|
|
+ }
|
2007-01-05 16:49:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-06 18:31:01 +01:00
|
|
|
@@ -1449,6 +1584,9 @@ gtk_font_selection_select_font_desc (Gtk
|
2008-07-24 22:44:01 +02:00
|
|
|
if (!new_family)
|
|
|
|
return FALSE;
|
|
|
|
|
2009-02-06 18:31:01 +01:00
|
|
|
+ /* Disable selection timeout */
|
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "immediate-selection", GUINT_TO_POINTER (1));
|
|
|
|
+
|
|
|
|
if (pfamily)
|
|
|
|
*pfamily = new_family;
|
|
|
|
else
|
|
|
|
@@ -1499,6 +1637,9 @@ gtk_font_selection_select_font_desc (Gtk
|
2008-07-24 22:44:01 +02:00
|
|
|
|
2009-02-06 18:31:01 +01:00
|
|
|
gtk_font_selection_set_size (fontsel, pango_font_description_get_size (new_desc));
|
2008-07-24 22:44:01 +02:00
|
|
|
|
|
|
|
+ /* Enable selection timeout */
|
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "immediate-selection", GUINT_TO_POINTER (0));
|
|
|
|
+
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|