mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 04:22:34 +03:00
Added option to enable/disable close dialog by mouse click outside of it.
Disabled by default. This option is available in ini file only. setup.h: declare mouse_close_dialog variable. setup.h: read/write mouse_close_dialog variable from/to ini file. dialog.c: use mouse_close_dialog variable to control the single left click outside of dialog.
This commit is contained in:
parent
3be2491d1e
commit
92353b3848
10
src/dialog.c
10
src/dialog.c
@ -38,6 +38,7 @@
|
||||
#include "execute.h" /* suspend_cmd() */
|
||||
#include "main.h" /* slow_terminal */
|
||||
#include "strutil.h"
|
||||
#include "setup.h" /* mouse_close_dialog */
|
||||
|
||||
#define waddc(w,y1,x1,c) move (w->y+y1, w->x+x1); addch (c)
|
||||
|
||||
@ -48,6 +49,9 @@ Dlg_head *current_dlg = 0;
|
||||
/* A hook list for idle events */
|
||||
Hook *idle_hook = 0;
|
||||
|
||||
/* left click outside of dialog closes it */
|
||||
int mouse_close_dialog = 0;
|
||||
|
||||
static void dlg_broadcast_msg_to (Dlg_head * h, widget_msg_t message,
|
||||
int reverse, int flags);
|
||||
|
||||
@ -686,9 +690,9 @@ dlg_mouse_event (Dlg_head * h, Gpm_Event * event)
|
||||
int y = event->y;
|
||||
|
||||
/* close the dialog by mouse click out of dialog area */
|
||||
if (!h->fullscreen && ((event->type & GPM_DOWN) != 0)
|
||||
&& !((x > h->x) && (x <= h->x + h->cols)
|
||||
&& (y > h->y) && (y <= h->y + h->lines))) {
|
||||
if (mouse_close_dialog && !h->fullscreen
|
||||
&& ((event->buttons & GPM_B_LEFT) != 0) && ((event->type & GPM_DOWN) != 0) /* left click */
|
||||
&& !((x > h->x) && (x <= h->x + h->cols) && (y > h->y) && (y <= h->y + h->lines))) {
|
||||
h->ret_value = B_CANCEL;
|
||||
dlg_stop (h);
|
||||
return MOU_NORMAL;
|
||||
|
@ -178,6 +178,7 @@ static const struct {
|
||||
{ "confirm_view_dir", &confirm_view_dir },
|
||||
{ "mouse_move_pages", &mouse_move_pages },
|
||||
{ "mouse_move_pages_viewer", &mouse_move_pages_viewer },
|
||||
{ "mouse_close_dialog", &mouse_close_dialog},
|
||||
{ "fast_refresh", &fast_refresh },
|
||||
{ "navigate_with_arrows", &navigate_with_arrows },
|
||||
{ "drop_menus", &drop_menus },
|
||||
|
@ -31,6 +31,8 @@ extern int startup_left_mode;
|
||||
extern int startup_right_mode;
|
||||
extern int verbose;
|
||||
|
||||
extern int mouse_close_dialog;
|
||||
|
||||
#define PROFILE_NAME ".mc/ini"
|
||||
#define HOTLIST_FILENAME ".mc/hotlist"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user