diff --git a/src/viewer/actions_cmd.c b/src/viewer/actions_cmd.c index c4d52b7b4..c96e8e308 100644 --- a/src/viewer/actions_cmd.c +++ b/src/viewer/actions_cmd.c @@ -679,10 +679,15 @@ mcview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void * return i; case MSG_FOCUS: + view->active = TRUE; view->dpy_bbar_dirty = TRUE; mcview_update (view); return MSG_HANDLED; + case MSG_UNFOCUS: + view->active = FALSE; + return MSG_HANDLED; + case MSG_DESTROY: if (mcview_is_in_panel (view)) { diff --git a/src/viewer/internal.h b/src/viewer/internal.h index f172c5b37..9562c527a 100644 --- a/src/viewer/internal.h +++ b/src/viewer/internal.h @@ -139,6 +139,7 @@ struct mcview_struct coord_cache_t *coord_cache; /* Cache for mapping offsets to cursor positions */ /* Display information */ + gboolean active; /* Active or not in QuickView mode */ screen_dimen dpy_frame_size; /* Size of the frame surrounding the real viewer */ off_t dpy_start; /* Offset of the displayed data */ off_t dpy_end; /* Offset after the displayed data */ diff --git a/src/viewer/mcviewer.c b/src/viewer/mcviewer.c index f55eecf77..eb8ec73c2 100644 --- a/src/viewer/mcviewer.c +++ b/src/viewer/mcviewer.c @@ -106,7 +106,7 @@ do_mcview_event (mcview_t * view, Gpm_Event * event, int *result) if ((local.type & (GPM_DOWN | GPM_DRAG)) == 0) return FALSE; - /* Wheel events */ + /* Wheel events. Allow them in the inactive panel */ if ((local.buttons & GPM_B_UP) != 0 && (local.type & GPM_DOWN) != 0) { mcview_move_up (view, 2); @@ -118,6 +118,10 @@ do_mcview_event (mcview_t * view, Gpm_Event * event, int *result) return TRUE; } + /* Grab focus */ + if (mcview_is_in_panel (view) && !view->active) + change_panel (); + x = local.x; y = local.y; @@ -207,6 +211,7 @@ mcview_new (int y, int x, int lines, int cols, gboolean is_panel) view->text_wrap_mode = FALSE; view->magic_mode = FALSE; + view->active = FALSE; view->dpy_frame_size = is_panel ? 1 : 0; view->converter = str_cnv_from_term;