[gnome-clocks] Fix keyboard event handling



commit ca7e27d9cd1de4e454917f81384653e34617e4f1
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon Mar 9 21:22:02 2015 +0100

    Fix keyboard event handling
    
    It seems like the hack using pointers does not work anymore, but
    we can not use a normal vala cast.
    While at it also leave standalone mode using ESC.

 src/window.vala |   10 ++++++++--
 src/world.vala  |    5 +++++
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/window.vala b/src/window.vala
index eb4bc16..4fb8bfc 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -143,8 +143,14 @@ public class Window : Gtk.ApplicationWindow {
 
     public override bool key_press_event (Gdk.EventKey event) {
         uint keyval;
-        if (((Gdk.Event*)(&event))->get_keyval (out keyval) && keyval == Gdk.Key.Escape) {
-            return ((Clock) stack.visible_child).escape_pressed ();
+        bool handled = false;
+
+        if (((Gdk.Event)(event)).get_keyval (out keyval) && keyval == Gdk.Key.Escape) {
+            handled = ((Clock) stack.visible_child).escape_pressed ();
+        }
+
+        if (handled) {
+            return true;
         }
 
         return base.key_press_event (event);
diff --git a/src/world.vala b/src/world.vala
index a24e1aa..1ebca32 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -438,6 +438,11 @@ public class Face : Gtk.Stack, Clocks.Clock {
     }
 
     public bool escape_pressed () {
+        if (visible_child == standalone) {
+            reset_view ();
+            return true;
+        }
+
         return content_view.escape_pressed ();
     }
 


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