From 3b21f3119c844eb59c2c54183b77bf71bf61f224 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 15 Mar 2001 22:47:47 +0000 Subject: Make this take an extra argument saying whether or not to grab the * gal/widgets/e-canvas.c (e_canvas_item_grab_focus): Make this take an extra argument saying whether or not to grab the widget-level focus. * gal/e-text/e-text.c (e_text_event): Update arguments to e_canvas_item_grab_focus. svn path=/trunk/; revision=8745 --- widgets/misc/e-canvas.c | 11 ++++++----- widgets/misc/e-canvas.h | 2 +- widgets/text/e-text.c | 4 ++-- 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 -- cgit