[gnome-builder/wip/gtk4-port] libide/gui: allow clearing focus from terminal using status page



commit cd8af6a0a69e1e357446ed2689ace0fba0150b4a
Author: Christian Hergert <chergert redhat com>
Date:   Fri May 6 22:42:59 2022 -0700

    libide/gui: allow clearing focus from terminal using status page
    
    Fixes #1668

 src/libide/gui/ide-frame.c  | 14 ++++++++++++++
 src/libide/gui/ide-frame.ui |  6 ++++++
 2 files changed, 20 insertions(+)
---
diff --git a/src/libide/gui/ide-frame.c b/src/libide/gui/ide-frame.c
index fdd49ef9e..ac82f25be 100644
--- a/src/libide/gui/ide-frame.c
+++ b/src/libide/gui/ide-frame.c
@@ -171,6 +171,19 @@ ide_frame_reload_addins (IdeFrame *self)
   IDE_EXIT;
 }
 
+static void
+status_page_pressed_cb (IdeFrame        *self,
+                        double           x,
+                        double           y,
+                        int              n_press,
+                        GtkGestureClick *click)
+{
+  g_assert (IDE_IS_FRAME (self));
+  g_assert (GTK_IS_GESTURE_CLICK (click));
+
+  gtk_widget_child_focus (GTK_WIDGET (self), GTK_DIR_TAB_FORWARD);
+}
+
 static void
 ide_frame_constructed (GObject *object)
 {
@@ -265,6 +278,7 @@ ide_frame_class_init (IdeFrameClass *klass)
   g_object_class_install_properties (object_class, N_PROPS, properties);
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/libide-gui/ui/ide-frame.ui");
+  gtk_widget_class_bind_template_callback (widget_class, status_page_pressed_cb);
 }
 
 static void
diff --git a/src/libide/gui/ide-frame.ui b/src/libide/gui/ide-frame.ui
index 6c5befd86..90e978f9d 100644
--- a/src/libide/gui/ide-frame.ui
+++ b/src/libide/gui/ide-frame.ui
@@ -115,6 +115,12 @@
             </child>
           </object>
         </property>
+        <child>
+          <object class="GtkGestureClick">
+            <property name="propagation-phase">bubble</property>
+            <signal name="pressed" handler="status_page_pressed_cb" swapped="true" object="IdeFrame"/>
+          </object>
+        </child>
       </object>
     </property>
   </template>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]