mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +03:00
Ticket #3251: mcviewer: grab focus on mouse click in QuickView mode.
(mcview_t): add new member 'active' to recognize current state in QuickView mode. (mcview_callback): toggle mcview_t::active in MGS_FOCUS and MSG_UNFOCUS event handlers. (do_mcview_event): use mcview_t::active to grab focus. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
d794397536
commit
f5c04331e1
@ -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))
|
||||
{
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user