[gnome-shell] focus-manager: Add navigate_from_event method



commit 092586c9313c27fa756709c3c5c2385247405f5f
Author: Tanner Doshier <doshitan gmail com>
Date:   Fri May 3 20:31:51 2013 -0500

    focus-manager: Add navigate_from_event method
    
    This will be used to implement key navigation inside the calendar without
    having to listen to key events manually.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=667434

 src/st/st-focus-manager.c |   23 +++++++++++++++++++++++
 src/st/st-focus-manager.h |    2 ++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/st/st-focus-manager.c b/src/st/st-focus-manager.c
index e12ec46..e7166dd 100644
--- a/src/st/st-focus-manager.c
+++ b/src/st/st-focus-manager.c
@@ -233,3 +233,26 @@ st_focus_manager_get_group (StFocusManager *manager,
 
   return ST_WIDGET (actor);
 }
+
+/**
+ * st_focus_manager_navigate_from_event:
+ * @manager: the #StFocusManager
+ * @event: a #ClutterEvent
+ *
+ * Try to navigate from @event as if it bubbled all the way up to
+ * the stage. This is useful in complex event handling situations
+ * where you want key navigation, but a parent might be stopping
+ * the key navigation event from bubbling all the way up to the stage.
+ *
+ * Returns: Whether a new actor was navigated to
+ */
+gboolean
+st_focus_manager_navigate_from_event (StFocusManager *manager,
+                                      ClutterEvent   *event)
+{
+  if (event->type != CLUTTER_KEY_PRESS)
+    return FALSE;
+
+  ClutterActor *stage = CLUTTER_ACTOR (event->key.stage);
+  return st_focus_manager_stage_event (stage, event, manager);
+}
diff --git a/src/st/st-focus-manager.h b/src/st/st-focus-manager.h
index e708f48..d4b9551 100644
--- a/src/st/st-focus-manager.h
+++ b/src/st/st-focus-manager.h
@@ -75,6 +75,8 @@ void            st_focus_manager_remove_group  (StFocusManager *manager,
                                                 StWidget       *root);
 StWidget       *st_focus_manager_get_group     (StFocusManager *manager,
                                                 StWidget       *widget);
+gboolean        st_focus_manager_navigate_from_event (StFocusManager *manager,
+                                                      ClutterEvent   *event);
 
 G_END_DECLS
 


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