X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/c3092f0f56a7d416da8c506ae6d222d5d67e5379..072cbb13b64a376f132a0ec10e2554a7086bee26:/src/vikwindow.c diff --git a/src/vikwindow.c b/src/vikwindow.c index 9e5842bd..8e8fa89d 100644 --- a/src/vikwindow.c +++ b/src/vikwindow.c @@ -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 ********************************************************/