2012-09-08 00:04:48 +02:00
|
|
|
Index: gtk+-3.5.2/gtk/deprecated/gtkfontsel.c
|
2010-08-24 22:32:30 +02:00
|
|
|
===================================================================
|
2012-09-08 00:04:48 +02:00
|
|
|
--- gtk+-3.5.2.orig/gtk/deprecated/gtkfontsel.c
|
|
|
|
+++ gtk+-3.5.2/gtk/deprecated/gtkfontsel.c
|
|
|
|
@@ -136,6 +136,8 @@ struct _GtkFontSelectionDialogPrivate
|
2010-09-14 04:33:45 +02:00
|
|
|
#define FONT_STYLE_LIST_WIDTH 170
|
|
|
|
#define FONT_SIZE_LIST_WIDTH 60
|
|
|
|
|
|
|
|
+#define DELAY_REAL_SELECTION_MS 75
|
|
|
|
+
|
|
|
|
/* These are what we use as the standard font sizes, for the size list.
|
|
|
|
*/
|
|
|
|
static const guint16 font_sizes[] = {
|
2012-09-08 00:04:48 +02:00
|
|
|
@@ -626,10 +628,23 @@ static void
|
2010-08-24 22:32:30 +02:00
|
|
|
gtk_font_selection_finalize (GObject *object)
|
|
|
|
{
|
2010-09-14 04:33:45 +02:00
|
|
|
GtkFontSelection *fontsel = GTK_FONT_SELECTION (object);
|
2010-08-24 22:32:30 +02:00
|
|
|
+ guint selection_timeout;
|
2010-09-14 04:33:45 +02:00
|
|
|
|
|
|
|
gtk_font_selection_ref_family (fontsel, NULL);
|
|
|
|
gtk_font_selection_ref_face (fontsel, NULL);
|
2010-08-24 22:32:30 +02:00
|
|
|
|
|
|
|
+ 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);
|
|
|
|
+
|
2010-09-14 04:33:45 +02:00
|
|
|
G_OBJECT_CLASS (gtk_font_selection_parent_class)->finalize (object);
|
|
|
|
}
|
2010-08-24 22:32:30 +02:00
|
|
|
|
2012-09-08 00:04:48 +02:00
|
|
|
@@ -666,6 +681,9 @@ gtk_font_selection_reload_fonts (GtkFont
|
2010-08-24 22:32:30 +02:00
|
|
|
PangoFontDescription *desc;
|
|
|
|
desc = gtk_font_selection_get_font_description (fontsel);
|
|
|
|
|
2010-09-14 04:33:45 +02:00
|
|
|
+ /* Disable selection timeout */
|
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "immediate-selection", GUINT_TO_POINTER (1));
|
|
|
|
+
|
2010-08-24 22:32:30 +02:00
|
|
|
gtk_font_selection_show_available_fonts (fontsel);
|
|
|
|
gtk_font_selection_show_available_sizes (fontsel, TRUE);
|
|
|
|
gtk_font_selection_show_available_styles (fontsel);
|
2012-09-08 00:04:48 +02:00
|
|
|
@@ -673,6 +691,9 @@ gtk_font_selection_reload_fonts (GtkFont
|
2010-08-24 22:32:30 +02:00
|
|
|
gtk_font_selection_select_font_desc (fontsel, desc, NULL, NULL);
|
|
|
|
gtk_font_selection_scroll_to_selection (fontsel);
|
|
|
|
|
2010-09-14 04:33:45 +02:00
|
|
|
+ /* Enable selection timeout */
|
2010-08-24 22:32:30 +02:00
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "immediate-selection", GUINT_TO_POINTER (0));
|
|
|
|
+
|
|
|
|
pango_font_description_free (desc);
|
|
|
|
}
|
|
|
|
}
|
2012-09-08 00:04:48 +02:00
|
|
|
@@ -752,21 +773,26 @@ gtk_font_selection_scroll_on_map (GtkWid
|
2010-08-24 22:32:30 +02: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)
|
|
|
|
{
|
|
|
|
GtkFontSelection *fontsel;
|
2010-09-24 00:06:04 +02:00
|
|
|
GtkFontSelectionPrivate *priv;
|
2010-09-14 04:33:45 +02:00
|
|
|
+ GtkTreeSelection *selection;
|
2010-08-24 22:32:30 +02:00
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
2010-09-14 04:33:45 +02:00
|
|
|
#ifdef INCLUDE_FONT_ENTRIES
|
2010-08-24 22:32:30 +02:00
|
|
|
const gchar *family_name;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+ if (!g_object_get_data (G_OBJECT (data), "immediate-selection"))
|
|
|
|
+ GDK_THREADS_ENTER ();
|
|
|
|
+
|
|
|
|
fontsel = GTK_FONT_SELECTION (data);
|
2010-09-14 04:33:45 +02:00
|
|
|
priv = fontsel->priv;
|
2010-08-24 22:32:30 +02:00
|
|
|
|
2010-09-14 04:33:45 +02:00
|
|
|
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->family_list));
|
|
|
|
+
|
2010-08-24 22:32:30 +02:00
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
|
|
|
{
|
2010-09-14 04:33:45 +02:00
|
|
|
PangoFontFamily *family;
|
2012-09-08 00:04:48 +02:00
|
|
|
@@ -787,6 +813,40 @@ gtk_font_selection_select_font (GtkTreeS
|
2010-08-24 22:32:30 +02: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;
|
|
|
|
+ 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);
|
|
|
|
+
|
|
|
|
+ if (immediate_selection)
|
|
|
|
+ {
|
|
|
|
+ gtk_font_selection_real_select_font (data);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
2010-09-14 04:33:45 +02:00
|
|
|
+ selection_timeout = g_timeout_add (DELAY_REAL_SELECTION_MS, gtk_font_selection_real_select_font, data);
|
2010-08-24 22:32:30 +02:00
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "font-selection-timeout", GUINT_TO_POINTER (selection_timeout));
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-09-08 00:04:48 +02:00
|
|
|
@@ -992,14 +1052,22 @@ gtk_font_selection_select_best_style (Gt
|
2010-08-24 22:32:30 +02: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)
|
|
|
|
{
|
2010-09-14 04:33:45 +02:00
|
|
|
GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
|
2010-09-24 00:06:04 +02:00
|
|
|
+ GtkFontSelectionPrivate *priv;
|
2010-08-24 22:32:30 +02:00
|
|
|
+ GtkTreeSelection *selection;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
2010-09-14 04:33:45 +02:00
|
|
|
|
2010-08-24 22:32:30 +02:00
|
|
|
+ if (!g_object_get_data (G_OBJECT (data), "immediate-selection"))
|
|
|
|
+ GDK_THREADS_ENTER ();
|
|
|
|
+
|
2010-09-14 04:33:45 +02:00
|
|
|
+ priv = fontsel->priv;
|
|
|
|
+
|
|
|
|
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->face_list));
|
2010-08-24 22:32:30 +02:00
|
|
|
+
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
|
|
|
{
|
|
|
|
PangoFontFace *face;
|
2012-09-08 00:04:48 +02:00
|
|
|
@@ -1011,6 +1079,40 @@ gtk_font_selection_select_style (GtkTree
|
2010-08-24 22:32:30 +02: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;
|
|
|
|
+ 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);
|
|
|
|
+
|
|
|
|
+ if (immediate_selection)
|
|
|
|
+ {
|
|
|
|
+ gtk_font_selection_real_select_style (data);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
2010-09-14 04:33:45 +02:00
|
|
|
+ selection_timeout = g_timeout_add (DELAY_REAL_SELECTION_MS, gtk_font_selection_real_select_style, data);
|
2010-08-24 22:32:30 +02:00
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "style-selection-timeout", GUINT_TO_POINTER (selection_timeout));
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-09-08 00:04:48 +02:00
|
|
|
@@ -1144,20 +1246,62 @@ gtk_font_selection_size_focus_out (GtkWi
|
2010-08-24 22:32:30 +02: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)
|
|
|
|
{
|
2010-09-14 04:33:45 +02:00
|
|
|
GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
|
2010-09-24 00:06:04 +02:00
|
|
|
+ GtkFontSelectionPrivate *priv;
|
2010-08-24 22:32:30 +02:00
|
|
|
+ GtkTreeSelection *selection;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gint new_size;
|
2010-09-14 04:33:45 +02:00
|
|
|
|
2010-08-24 22:32:30 +02:00
|
|
|
+ if (!g_object_get_data (G_OBJECT (data), "immediate-selection"))
|
|
|
|
+ GDK_THREADS_ENTER ();
|
|
|
|
+
|
2010-09-14 04:33:45 +02:00
|
|
|
+ priv = fontsel->priv;
|
|
|
|
+
|
|
|
|
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->size_list));
|
2010-08-24 22:32:30 +02:00
|
|
|
+
|
|
|
|
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;
|
|
|
|
+ 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);
|
|
|
|
+
|
|
|
|
+ if (immediate_selection)
|
|
|
|
+ {
|
|
|
|
+ gtk_font_selection_real_select_size (data);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
2010-09-14 04:33:45 +02:00
|
|
|
+ selection_timeout = g_timeout_add (DELAY_REAL_SELECTION_MS, gtk_font_selection_real_select_size, data);
|
2010-08-24 22:32:30 +02:00
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "size-selection-timeout", GUINT_TO_POINTER (selection_timeout));
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-09-08 00:04:48 +02:00
|
|
|
@@ -1475,6 +1619,9 @@ gtk_font_selection_select_font_desc (Gtk
|
2010-08-24 22:32:30 +02:00
|
|
|
if (!new_family)
|
|
|
|
return FALSE;
|
|
|
|
|
2010-09-14 04:33:45 +02:00
|
|
|
+ /* Disable selection timeout */
|
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "immediate-selection", GUINT_TO_POINTER (1));
|
|
|
|
+
|
2010-08-24 22:32:30 +02:00
|
|
|
if (pfamily)
|
|
|
|
*pfamily = new_family;
|
|
|
|
else
|
2012-09-08 00:04:48 +02:00
|
|
|
@@ -1525,6 +1672,9 @@ gtk_font_selection_select_font_desc (Gtk
|
2010-08-24 22:32:30 +02:00
|
|
|
|
|
|
|
gtk_font_selection_set_size (fontsel, pango_font_description_get_size (new_desc));
|
|
|
|
|
2010-09-14 04:33:45 +02:00
|
|
|
+ /* Enable selection timeout */
|
2010-08-24 22:32:30 +02:00
|
|
|
+ g_object_set_data (G_OBJECT (fontsel), "immediate-selection", GUINT_TO_POINTER (0));
|
|
|
|
+
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|