aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/misc/e-canvas.c11
-rw-r--r--widgets/misc/e-canvas.h2
-rw-r--r--widgets/text/e-text.c4
3 files changed, 9 insertions, 8 deletions
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c
index ffc3a333f8..f5f6ed77a9 100644
--- a/widgets/misc/e-canvas.c
+++ b/widgets/misc/e-canvas.c
@@ -288,13 +288,14 @@ e_canvas_key (GtkWidget *widget, GdkEventKey *event)
/**
* e_canvas_item_grab_focus:
* @item: A canvas item.
+ * @widget_too: Whether or not to grab the widget-level focus too
*
- * Makes the specified item take the keyboard focus, so all keyboard events will
- * be sent to it. If the canvas widget itself did not have the focus, it grabs
- * it as well.
+ * Makes the specified item take the keyboard focus, so all keyboard
+ * events will be sent to it. If the canvas widget itself did not have
+ * the focus and @widget_too is %TRUE, it grabs that focus as well.
**/
void
-e_canvas_item_grab_focus (GnomeCanvasItem *item)
+e_canvas_item_grab_focus (GnomeCanvasItem *item, gboolean widget_too)
{
GnomeCanvasItem *focused_item;
GdkEvent ev;
@@ -316,7 +317,7 @@ e_canvas_item_grab_focus (GnomeCanvasItem *item)
item->canvas->focused_item = item;
- if (!GTK_WIDGET_HAS_FOCUS (GTK_WIDGET(item->canvas))) {
+ if (widget_too && !GTK_WIDGET_HAS_FOCUS (GTK_WIDGET(item->canvas))) {
gtk_widget_grab_focus (GTK_WIDGET (item->canvas));
}
diff --git a/widgets/misc/e-canvas.h b/widgets/misc/e-canvas.h
index b13a9dd2ab..c143d74fe2 100644
--- a/widgets/misc/e-canvas.h
+++ b/widgets/misc/e-canvas.h
@@ -97,7 +97,7 @@ GtkWidget *e_canvas_new (void);
/* Used to send all of the keystroke events to a specific item as well as
* GDK_FOCUS_CHANGE events.
*/
-void e_canvas_item_grab_focus (GnomeCanvasItem *item);
+void e_canvas_item_grab_focus (GnomeCanvasItem *item, gboolean widget_too);
void e_canvas_item_request_reflow (GnomeCanvasItem *item);
void e_canvas_item_request_parent_reflow (GnomeCanvasItem *item);
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index e6e11750eb..121100d37f 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -2982,7 +2982,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event)
&& event->button.button == 1) {
GdkEventButton button = event->button;
- e_canvas_item_grab_focus (item);
+ e_canvas_item_grab_focus (item, TRUE);
e_tep_event.type = GDK_BUTTON_RELEASE;
e_tep_event.button.time = button.time;
@@ -2999,7 +2999,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event)
&& text->editable
&& (event->button.button == 1 ||
event->button.button == 2)) {
- e_canvas_item_grab_focus (item);
+ e_canvas_item_grab_focus (item, TRUE);
}
#endif