[gnome-builder] layout: refocus previous grid item
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] layout: refocus previous grid item
- Date: Fri, 21 Jul 2017 20:45:21 +0000 (UTC)
commit ed903cd07c48543a9d0848df4736107d65b0f0aa
Author: Christian Hergert <chergert redhat com>
Date: Fri Jul 21 13:42:24 2017 -0700
layout: refocus previous grid item
When something requests focusing the grid, defer that focus to
the most recently focused view.
libide/layout/ide-layout-grid.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/libide/layout/ide-layout-grid.c b/libide/layout/ide-layout-grid.c
index cca244f..1bd66aa 100644
--- a/libide/layout/ide-layout-grid.c
+++ b/libide/layout/ide-layout-grid.c
@@ -333,6 +333,23 @@ ide_layout_grid_remove (GtkContainer *container,
}
static void
+ide_layout_grid_grab_focus (GtkWidget *widget)
+{
+ IdeLayoutGrid *self = (IdeLayoutGrid *)widget;
+ IdeLayoutView *view;
+
+ g_assert (IDE_IS_LAYOUT_GRID (self));
+
+ if (NULL != (view = ide_layout_grid_get_current_view (self)))
+ {
+ gtk_widget_grab_focus (GTK_WIDGET (view));
+ return;
+ }
+
+ GTK_WIDGET_CLASS (ide_layout_grid_parent_class)->grab_focus (widget);
+}
+
+static void
ide_layout_grid_finalize (GObject *object)
{
IdeLayoutGrid *self = (IdeLayoutGrid *)object;
@@ -402,6 +419,7 @@ ide_layout_grid_class_init (IdeLayoutGridClass *klass)
object_class->get_property = ide_layout_grid_get_property;
object_class->set_property = ide_layout_grid_set_property;
+ widget_class->grab_focus = ide_layout_grid_grab_focus;
widget_class->hierarchy_changed = ide_layout_grid_hierarchy_changed;
container_class->add = ide_layout_grid_add;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]