Re: Bug List
- From: Damon Chaplin <damon helixcode com>
- To: Owen Taylor <otaylor redhat com>
- Cc: gtk-devel-list gnome org
- Subject: Re: Bug List
- Date: Mon, 11 Dec 2000 14:28:29 +0000
#3123: Gimp text tool: ignoring font size (fwd)
Subject: gtk+; Reported by: Aaron Sherman <ajs ajs com>; 400 days old.
#25675: [gimp-bug] Manually entered font size is ignored
Subject: gtk+; Reported by: mguesdon oxymium net; 67 days old.
I think this may be because currently we only update the font size if the
Return key is pressed, and not on "focus_out" events.
This patch may help.
(Of course the manually-entered font size really is ignored if the size is
not available for the selected font - it chooses the closest available.
Maybe this confuses people a bit.)
Damon
--- gtkfontsel.c.orig Fri May 19 05:49:51 2000
+++ gtkfontsel.c Mon Dec 11 14:21:02 2000
@@ -305,9 +305,12 @@
gpointer data);
static void gtk_font_selection_show_available_sizes
(GtkFontSelection *fs);
-static gint gtk_font_selection_size_key_press (GtkWidget *w,
- GdkEventKey *event,
- gpointer data);
+static void gtk_font_selection_size_entry_activate (GtkWidget *w,
+ gpointer data);
+static gboolean gtk_font_selection_size_entry_focus_out (GtkWidget *w,
+ GdkEvent *event,
+ gpointer data);
+static void gtk_font_selection_update_size (GtkFontSelection *fontsel);
static void gtk_font_selection_select_best_size (GtkFontSelection *fs);
static void gtk_font_selection_select_size (GtkWidget *w,
gint row,
@@ -534,8 +537,11 @@
gtk_widget_show (fontsel->size_entry);
gtk_table_attach (GTK_TABLE (table), fontsel->size_entry, 2, 3, 1, 2,
GTK_FILL, 0, 0, 0);
- gtk_signal_connect (GTK_OBJECT (fontsel->size_entry), "key_press_event",
- (GtkSignalFunc) gtk_font_selection_size_key_press,
+ gtk_signal_connect (GTK_OBJECT (fontsel->size_entry), "activate",
+ (GtkSignalFunc) gtk_font_selection_size_entry_activate,
+ fontsel);
+ gtk_signal_connect (GTK_OBJECT (fontsel->size_entry), "focus_out_event",
+ (GtkSignalFunc) gtk_font_selection_size_entry_focus_out,
fontsel);
/* Create the clists */
@@ -1498,51 +1504,55 @@
/* If the user hits return in the font size entry, we change to the new font
size. */
-static gint
-gtk_font_selection_size_key_press (GtkWidget *w,
- GdkEventKey *event,
- gpointer data)
+static void
+gtk_font_selection_size_entry_activate (GtkWidget *w,
+ gpointer data)
+{
+ gtk_font_selection_update_size (GTK_FONT_SELECTION (data));
+}
+
+
+static gboolean
+gtk_font_selection_size_entry_focus_out (GtkWidget *w,
+ GdkEvent *event,
+ gpointer data)
+{
+ gtk_font_selection_update_size (GTK_FONT_SELECTION (data));
+ return FALSE;
+}
+
+
+static void
+gtk_font_selection_update_size (GtkFontSelection *fontsel)
{
- GtkFontSelection *fontsel;
gint new_size;
gfloat new_size_float;
gchar *text;
-
-#ifdef FONTSEL_DEBUG
- g_message("In size_key_press\n");
-#endif
- fontsel = GTK_FONT_SELECTION(data);
-
- if (event->keyval == GDK_Return)
+
+ text = gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry));
+ if (fontsel->metric == GTK_FONT_METRIC_PIXELS)
{
- text = gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry));
- if (fontsel->metric == GTK_FONT_METRIC_PIXELS)
- {
- new_size = atoi (text);
- if (new_size < 2)
- new_size = 2;
- }
- else
- {
- new_size_float = atof (text) * 10;
- new_size = (gint) new_size_float;
- if (new_size < 20)
- new_size = 20;
- }
-
- /* Remember that this size was set explicitly. */
- fontsel->selected_size = new_size;
+ new_size = atoi (text);
+ if (new_size < 2)
+ new_size = 2;
+ }
+ else
+ {
+ new_size_float = atof (text) * 10;
+ new_size = (gint) new_size_float;
+ if (new_size < 20)
+ new_size = 20;
+ }
- /* Check if the font size has changed, and return if it hasn't. */
- if (fontsel->size == new_size)
- return TRUE;
+ /* Remember that this size was set explicitly. */
+ fontsel->selected_size = new_size;
+ /* Check if the font size has changed, and return if it hasn't. */
+ if (fontsel->size != new_size)
+ {
fontsel->size = new_size;
gtk_font_selection_select_best_size (fontsel);
- return TRUE;
}
-
- return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]