[gnome-builder/wip/mwleeds/replace: 184/185] command-bar: Allow command bar actions to steal focus
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/mwleeds/replace: 184/185] command-bar: Allow command bar actions to steal focus
- Date: Fri, 1 Jul 2016 17:33:35 +0000 (UTC)
commit 4aa985f919774cbdf80787189062786a25f1c116
Author: Matthew Leeds <mleeds redhat com>
Date: Fri Jul 1 11:59:44 2016 -0400
command-bar: Allow command bar actions to steal focus
Currently, gb_command_bar_hide grabs focus on whatever was focused
before the command bar popped up, or on the workbench. But if a command
bar action causes another widget to appear, we want to leave that in
focus. For example, the substitute action with the 'c' option will have
that behavior (:%s/this/that/gc).
https://bugzilla.gnome.org/show_bug.cgi?id=765635
plugins/command-bar/gb-command-bar.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/plugins/command-bar/gb-command-bar.c b/plugins/command-bar/gb-command-bar.c
index 06fb815..eb4e86a 100644
--- a/plugins/command-bar/gb-command-bar.c
+++ b/plugins/command-bar/gb-command-bar.c
@@ -193,17 +193,23 @@ void
gb_command_bar_hide (GbCommandBar *self)
{
GtkWidget *focus;
+ gboolean had_focus;
g_return_if_fail (GB_IS_COMMAND_BAR (self));
+ had_focus = gtk_widget_is_focus (GTK_WIDGET (self->entry));
+
gtk_revealer_set_reveal_child (GTK_REVEALER (self), FALSE);
- if (self->last_focus)
- focus = find_alternate_focus (self->last_focus);
- else
- focus = GTK_WIDGET (self->workbench);
+ if (had_focus)
+ {
+ if (self->last_focus)
+ focus = find_alternate_focus (self->last_focus);
+ else
+ focus = GTK_WIDGET (self->workbench);
- gtk_widget_grab_focus (focus);
+ gtk_widget_grab_focus (focus);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]