]> git.street.me.uk Git - andy/viking.git/blobdiff - src/vikwindow.c
[DOC] Improve reference documentation for babel.c
[andy/viking.git] / src / vikwindow.c
index 9e5842bd816fd682098601bb7377e27c5d4d1a69..8e8fa89d88c9d1803943f6281fb3ded82594d0bf 100644 (file)
@@ -373,6 +373,11 @@ static gboolean key_press_event( VikWindow *vw, GdkEventKey *event, gpointer dat
       return vw->vt->tools[vw->vt->active_tool].ti.key_press(vl, event, vw->vt->tools[vw->vt->active_tool].state);
   }
 
+  // No layer - but enable window tool keypress processing - these should be able to handle a NULL layer
+  if ( vw->vt->tools[vw->vt->active_tool].ti.key_press ) {
+    return vw->vt->tools[vw->vt->active_tool].ti.key_press ( vl, event, vw->vt->tools[vw->vt->active_tool].state );
+  }
+
   /* Restore Main Menu via Escape key if the user has hidden it */
   /* This key is more likely to be used as they may not remember the function key */
   if ( event->keyval == GDK_Escape ) {
@@ -992,6 +997,16 @@ static void ruler_deactivate (VikLayer *vl, ruler_tool_state_t *s)
   draw_update ( s->vw );
 }
 
+static gboolean ruler_key_press (VikLayer *vl, GdkEventKey *event, ruler_tool_state_t *s)
+{
+  if (event->keyval == GDK_Escape) {
+    s->has_oldcoord = FALSE;
+    ruler_deactivate ( vl, s );
+    return TRUE;
+  }
+  return FALSE;
+}
+
 static VikToolInterface ruler_tool = 
   { "Ruler", 
     (VikToolConstructorFunc) ruler_create,
@@ -1001,7 +1016,7 @@ static VikToolInterface ruler_tool =
     (VikToolMouseFunc) ruler_click, 
     (VikToolMouseMoveFunc) ruler_move, 
     (VikToolMouseFunc) ruler_release,
-    NULL,
+    (VikToolKeyFunc) ruler_key_press,
     GDK_CURSOR_IS_PIXMAP,
     &cursor_ruler_pixbuf };
 /*** end ruler code ********************************************************/