mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-08 20:41:59 +03:00
Reorganization of is_abort_char() function.
src/tty/key.h: cleanup. Changed returned type of is_abort_char() function from int to gboolean. src/tty/key.c: moved is_abort_char() function here... src/tty/win.h: ...from here. src/dialog.c (dialog_handle_key): is_abort_char() function is used. Changed order of dialog key handling. Formatting.
This commit is contained in:
parent
c12ddff69b
commit
3720285612
30
src/dialog.c
30
src/dialog.c
@ -522,9 +522,22 @@ void dlg_stop (Dlg_head *h)
|
||||
h->running = 0;
|
||||
}
|
||||
|
||||
static inline void dialog_handle_key (Dlg_head *h, int d_key)
|
||||
static inline void
|
||||
dialog_handle_key (Dlg_head *h, int d_key)
|
||||
{
|
||||
switch (d_key){
|
||||
if (is_abort_char (d_key)) {
|
||||
h->ret_value = B_CANCEL;
|
||||
dlg_stop (h);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (d_key) {
|
||||
case '\n':
|
||||
case KEY_ENTER:
|
||||
h->ret_value = B_ENTER;
|
||||
dlg_stop (h);
|
||||
break;
|
||||
|
||||
case KEY_LEFT:
|
||||
case KEY_UP:
|
||||
dlg_one_up (h);
|
||||
@ -556,18 +569,7 @@ static inline void dialog_handle_key (Dlg_head *h, int d_key)
|
||||
doupdate ();
|
||||
break;
|
||||
|
||||
case '\n':
|
||||
case KEY_ENTER:
|
||||
h->ret_value = B_ENTER;
|
||||
h->running = 0;
|
||||
break;
|
||||
|
||||
case ESC_CHAR:
|
||||
case KEY_F (10):
|
||||
case XCTRL ('c'):
|
||||
case XCTRL ('g'):
|
||||
h->ret_value = B_CANCEL;
|
||||
dlg_stop (h);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -204,11 +204,6 @@ static void check_selects (fd_set *select_set)
|
||||
} while (retry);
|
||||
}
|
||||
|
||||
void channels_down (void)
|
||||
{
|
||||
disabled_channels++;
|
||||
}
|
||||
|
||||
void channels_up (void)
|
||||
{
|
||||
if (!disabled_channels)
|
||||
@ -217,6 +212,18 @@ void channels_up (void)
|
||||
disabled_channels--;
|
||||
}
|
||||
|
||||
void channels_down (void)
|
||||
{
|
||||
disabled_channels++;
|
||||
}
|
||||
|
||||
gboolean
|
||||
is_abort_char (int c)
|
||||
{
|
||||
return (c == XCTRL('c') || c == XCTRL('g') || c == ESC_CHAR ||
|
||||
c == KEY_F(10));
|
||||
}
|
||||
|
||||
typedef const struct {
|
||||
int code;
|
||||
const char *seq;
|
||||
|
@ -6,6 +6,8 @@
|
||||
#ifndef MC_KEY_H
|
||||
#define MC_KEY_H
|
||||
|
||||
#include "../../src/global.h" /* <glib.h> */
|
||||
|
||||
void init_key (void);
|
||||
void init_key_input_fd (void);
|
||||
void done_key (void);
|
||||
@ -47,9 +49,7 @@ void remove_select_channel (int fd);
|
||||
void channels_up (void);
|
||||
void channels_down (void);
|
||||
|
||||
/* Abort/Quit chars */
|
||||
int is_abort_char (int c);
|
||||
int is_quit_char (int c);
|
||||
gboolean is_abort_char (int c);
|
||||
|
||||
#define XCTRL(x) (KEY_M_CTRL | ((x) & 31))
|
||||
#define ALT(x) (KEY_M_ALT | (unsigned int)(x))
|
||||
|
@ -121,12 +121,6 @@ check_movement_keys (int key, int page_size, void *data, movefn backfn,
|
||||
}
|
||||
|
||||
/* Classification routines */
|
||||
int is_abort_char (int c)
|
||||
{
|
||||
return (c == XCTRL('c') || c == XCTRL('g') || c == ESC_CHAR ||
|
||||
c == KEY_F(10));
|
||||
}
|
||||
|
||||
void mc_raw_mode (void)
|
||||
{
|
||||
raw ();
|
||||
|
Loading…
Reference in New Issue
Block a user