[gnome-builder/wip/gtk4-port: 344/736] libide/editor: ensure focus when opening pages
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 344/736] libide/editor: ensure focus when opening pages
- Date: Tue, 26 Apr 2022 01:46:24 +0000 (UTC)
commit ebc6ed6d6eec063caa53a9b43877c94cfa4020e3
Author: Christian Hergert <chergert redhat com>
Date: Sat Apr 2 03:22:38 2022 -0700
libide/editor: ensure focus when opening pages
src/libide/editor/ide-editor-page.c | 8 ++++++++
src/libide/editor/ide-editor.c | 2 ++
2 files changed, 10 insertions(+)
---
diff --git a/src/libide/editor/ide-editor-page.c b/src/libide/editor/ide-editor-page.c
index c990d1b79..129f169db 100644
--- a/src/libide/editor/ide-editor-page.c
+++ b/src/libide/editor/ide-editor-page.c
@@ -46,6 +46,12 @@ ide_editor_page_set_buffer (IdeEditorPage *self,
gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->view), GTK_TEXT_BUFFER (buffer));
}
+static gboolean
+ide_editor_page_grab_focus (GtkWidget *widget)
+{
+ return gtk_widget_grab_focus (GTK_WIDGET (IDE_EDITOR_PAGE (widget)->view));
+}
+
static void
ide_editor_page_dispose (GObject *object)
{
@@ -108,6 +114,8 @@ ide_editor_page_class_init (IdeEditorPageClass *klass)
object_class->get_property = ide_editor_page_get_property;
object_class->set_property = ide_editor_page_set_property;
+ widget_class->grab_focus = ide_editor_page_grab_focus;
+
/**
* IdeEditorPage:buffer:
*
diff --git a/src/libide/editor/ide-editor.c b/src/libide/editor/ide-editor.c
index a6121eb75..97151de55 100644
--- a/src/libide/editor/ide-editor.c
+++ b/src/libide/editor/ide-editor.c
@@ -162,6 +162,8 @@ focus_complete (Focus *focus,
gtk_text_buffer_select_range (GTK_TEXT_BUFFER (focus->buffer), &iter, &iter);
ide_source_view_scroll_to_insert (view);
}
+
+ gtk_widget_grab_focus (GTK_WIDGET (page));
}
focus_free (focus);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]