[evolution-patches] [gal]patch for #46356--Can't change the color of the text with keyboard
- From: Eric Zhao <eric zhao sun com>
- To: evo-patch <evolution-patches lists ximian com>, Mike Kestne <mkestner ximian com>, JP Rosevear <jpr ximian com>
- Cc: eric zhao sun com
- Subject: [evolution-patches] [gal]patch for #46356--Can't change the color of the text with keyboard
- Date: Thu, 01 Apr 2004 20:09:03 +0800
Hi,
I posted this patch long ago, but it seemed that noboby has interest
on it. So I have to post it again, would anybody spend a little time
reviewing it? Thanks!
The attachment is a patch which tries to fix bug #46356. This bug can be
reproduced by the following steps:
1. Start evolution.
2. Click New Mail Message.
3. Input text, highlight the text.
4. Press Alt+m, then press t to open Text Properties dialog.
5. Press Tab key to put focus on the Color item.
6. Press Up, space, enter key to open the color picker.
Actual Results:
The color picker can't be opened.
Expected Results:
There should one way to open the color picker to change the color.
This bug is cauesed by that the focusable property of arrow-button in
gal-combo is erased, so the arrow-button can't be activated by keyboard.
And because a gnome-canvas is placed on the top of button, the
color-button can't display the focus area when focused . To make this
patch simple, I just draw a focus area on the top canvas when the button
is focused, and erase the area when the button lost focus.
--
Regards,
Eric.
Index: gal-combo-box.c
===================================================================
RCS file: /cvs/gnome/gal/gal/widgets/gal-combo-box.c,v
retrieving revision 1.1
diff -u -r1.1 gal-combo-box.c
--- gal-combo-box.c 17 Nov 2003 21:05:15 -0000 1.1
+++ gal-combo-box.c 12 Feb 2004 08:39:40 -0000
@@ -330,6 +330,7 @@
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK,
NULL, NULL, GDK_CURRENT_TIME);
+ gdk_keyboard_grab (combo_box->priv->toplevel->window, TRUE, GDK_CURRENT_TIME);
}
static int
@@ -401,7 +402,7 @@
*/
combo_box->priv->arrow_button = gtk_toggle_button_new ();
gtk_button_set_relief (GTK_BUTTON (combo_box->priv->arrow_button), GTK_RELIEF_NONE);
- GTK_WIDGET_UNSET_FLAGS (combo_box->priv->arrow_button, GTK_CAN_FOCUS);
+ /*GTK_WIDGET_UNSET_FLAGS (combo_box->priv->arrow_button, GTK_CAN_FOCUS); */
arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (combo_box->priv->arrow_button), arrow);
Index: color-palette.c
===================================================================
RCS file: /cvs/gnome/gal/gal/widgets/color-palette.c,v
retrieving revision 1.21
diff -u -r1.21 color-palette.c
--- color-palette.c 16 Nov 2002 23:42:17 -0000 1.21
+++ color-palette.c 12 Feb 2004 09:03:19 -0000
@@ -281,6 +281,35 @@
}
/*
+ * Repaint the canvas to erase the focus area when the button
+ * lost focus.
+ */
+static gboolean
+on_color_palette_button_focus_out (GtkWidget *button,
+ GdkEventFocus *event,
+ GtkWidget *canvas)
+{
+ gtk_widget_queue_draw (canvas);
+ return FALSE;
+}
+
+/*
+ * Paint the focus area on the top canvas when the button is focused.
+ */
+static gboolean
+on_color_palette_button_focus_in (GtkWidget *button,
+ GdkEventFocus *event,
+ GtkWidget *canvas)
+{
+ gtk_paint_focus (canvas->style, ((GtkLayout *)canvas)->bin_window,
+ GTK_WIDGET_STATE (canvas),
+ NULL, canvas, "button",
+ 0, 0, canvas->allocation.width,
+ canvas->allocation.height);
+ return FALSE;
+}
+
+/*
* Create the individual color buttons
*
* Utility function
@@ -305,10 +334,10 @@
item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (gnome_canvas_root
(GNOME_CANVAS (canvas))),
gnome_canvas_rect_get_type (),
- "x1", 0.0,
- "y1", 0.0,
- "x2", (double) COLOR_PREVIEW_WIDTH,
- "y2", (double) COLOR_PREVIEW_HEIGHT,
+ "x1", 2.0,
+ "y1", 2.0,
+ "x2", 2.0+(double) COLOR_PREVIEW_WIDTH,
+ "y2", 2.0+(double) COLOR_PREVIEW_HEIGHT,
"fill_color", color_name->color,
NULL);
@@ -320,6 +349,12 @@
g_signal_connect (button, "clicked",
G_CALLBACK (color_clicked), P);
+ g_signal_connect (button, "focus_in_event",
+ G_CALLBACK (on_color_palette_button_focus_in),
+ canvas);
+ g_signal_connect (button, "focus_out_event",
+ G_CALLBACK (on_color_palette_button_focus_out),
+ canvas);
gtk_object_set_user_data (GTK_OBJECT (button),
GINT_TO_POINTER (data));
return item;
Index: widget-color-combo.c
===================================================================
RCS file: /cvs/gnome/gal/gal/widgets/widget-color-combo.c,v
retrieving revision 1.46
diff -u -r1.46 widget-color-combo.c
--- widget-color-combo.c 17 Nov 2003 21:05:15 -0000 1.46
+++ widget-color-combo.c 12 Feb 2004 09:11:28 -0000
@@ -123,6 +123,40 @@
gdk_color_free (color);
}
+/*
+ * Repaint the canvas to erase the focus area when the button
+ * lost focus.
+ */
+static gboolean
+on_preview_button_focus_out (GtkWidget *button, GdkEventFocus *event,
+ GtkWidget *canvas)
+{
+ gtk_widget_queue_draw (canvas);
+ return FALSE;
+}
+
+/*
+ * Paint the focus area on the top canvas when the button is focused.
+ */
+static gboolean
+on_preview_button_focus_in (GtkWidget *button, GdkEventFocus *event,
+ GtkWidget *canvas)
+{
+ gint focus_width, focus_pad, focus_tune;
+ gtk_widget_style_get (GTK_WIDGET (canvas),
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
+ focus_tune = focus_width + focus_pad;
+ gtk_paint_focus (canvas->style, ((GtkLayout *)canvas)->bin_window,
+ GTK_WIDGET_STATE (canvas),
+ NULL, canvas, "preview-button",
+ focus_tune, focus_tune,
+ canvas->allocation.width - 2*focus_tune,
+ canvas->allocation.height - 2*focus_tune);
+ return FALSE;
+}
+
static void
cb_cust_color_clicked (GtkWidget *widget, ColorCombo *cc)
{
@@ -225,6 +259,10 @@
gtk_widget_set_usize (GTK_WIDGET (cc->preview_canvas), 24, 22);
g_signal_connect (cc->preview_button, "clicked",
G_CALLBACK (preview_clicked), cc);
+ g_signal_connect (cc->preview_button, "focus_in_event",
+ G_CALLBACK (on_preview_button_focus_in), cc->preview_canvas);
+ g_signal_connect (cc->preview_button, "focus_out_event",
+ G_CALLBACK (on_preview_button_focus_out), cc->preview_canvas);
color_table_setup (cc, no_color_label, color_group);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/ChangeLog,v
retrieving revision 1.856
diff -u -r1.856 ChangeLog
--- ChangeLog 21 Mar 2004 21:55:27 -0000 1.856
+++ ChangeLog 29 Mar 2004 07:26:33 -0000
@@ -1,3 +1,19 @@
+2004-03-29 Eric Zhao <eric zhao sun com>
+
+ fixed bugzilla #46356
+ * gal/widgets/color-palette.c: (on_color_palette_button_focus_out),
+ (on_color_palette_button_focus_in), (color_palette_button_new):
+ fixed the bug which caused the color-button can't display focus area
+ when focused. Tuned the color item so that it displays in the center
+ of canvas.
+ * gal/widgets/gal-combo-box.c: (gal_combo_box_popup_display),
+ (gal_combo_box_init): fixed the bug that neither the arrow button
+ nor the display widget can be focused with keyboard navigation.
+ * gal/widgets/widget-color-combo.c: (on_preview_button_focus_out),
+ (on_preview_button_focus_in), (color_combo_construct):
+ fixed the bug which caused the preview-button can't display focus
+ area when focused.
+
2004-03-21 Alastair McKinstry <mckinstry debian org>
* configure.in: Added "ga" (Irish) to ALL_LINGUAS.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]