[gnome-builder] GbDocumentStack: work around some focus issues in GtkStack
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] GbDocumentStack: work around some focus issues in GtkStack
- Date: Sun, 14 Dec 2014 01:18:59 +0000 (UTC)
commit 6b8dcea1a69ef977253a5071d14f9c4a4dd6f1a2
Author: Christian Hergert <christian hergert me>
Date: Sat Dec 13 17:18:38 2014 -0800
GbDocumentStack: work around some focus issues in GtkStack
src/documents/gb-document-stack.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/documents/gb-document-stack.c b/src/documents/gb-document-stack.c
index 4b107bd..4606aa8 100644
--- a/src/documents/gb-document-stack.c
+++ b/src/documents/gb-document-stack.c
@@ -73,6 +73,7 @@ gb_document_stack_remove_view (GbDocumentStack *stack,
GbDocumentView *view)
{
GbDocument *document = NULL;
+ GtkWidget *toplevel;
GtkWidget *visible_child;
GtkWidget *controls;
gboolean visible;
@@ -86,6 +87,18 @@ gb_document_stack_remove_view (GbDocumentStack *stack,
g_object_ref (view);
+ /*
+ * WORKAROUND:
+ *
+ * Clear the focus before we start removing stuff. Otherwise GtkStack
+ * can get pretty unhappy and segfault. Needs more investigation, but
+ * seems to help a bit. We refocus the new visible child afterwards
+ * anyway, so not too big of a deal.
+ */
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (stack));
+ if (GTK_IS_WINDOW (toplevel))
+ gtk_window_set_focus (GTK_WINDOW (toplevel), NULL);
+
/* Notify the document view it is being closed */
gb_document_view_close (view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]