1
1

White-space and indentation fixes. Rewrote the expressions for the

*_PRESSED constants to emphasize they are in fact bit masks.
Этот коммит содержится в:
Roland Illig 2006-01-07 12:49:08 +00:00
родитель 63a504ffed
Коммит 58337baa8d

Просмотреть файл

@ -76,11 +76,10 @@
#define ESCMODE_TIMEOUT 1000000
/* Linux console keyboard modifiers */
#define SHIFT_PRESSED 1
#define ALTR_PRESSED 2
#define CONTROL_PRESSED 4
#define ALTL_PRESSED 8
#define SHIFT_PRESSED (1 << 0)
#define ALTR_PRESSED (1 << 1)
#define CONTROL_PRESSED (1 << 2)
#define ALTL_PRESSED (1 << 3)
int mou_auto_repeat = 100;
int double_click_speed = 250;
@ -99,7 +98,7 @@ typedef struct key_def {
} key_def;
/* This holds all the key definitions */
static key_def *keys = 0;
static key_def *keys = NULL;
static int input_fd;
static int disabled_channels = 0; /* Disable channels checking */
@ -123,7 +122,7 @@ typedef struct SelectList {
ph_pqc_f ph_query_cursor;
#endif
static SelectList *select_list = 0;
static SelectList *select_list = NULL;
void add_select_channel (int fd, select_fn callback, void *info)
{
@ -140,7 +139,7 @@ void add_select_channel (int fd, select_fn callback, void *info)
void delete_select_channel (int fd)
{
SelectList *p = select_list;
SelectList *p_prev = 0;
SelectList *p_prev = NULL;
SelectList *p_next;
while (p) {
@ -170,7 +169,7 @@ inline static int add_selects (fd_set *select_set)
if (disabled_channels)
return 0;
for (p = select_list; p; p = p->next){
for (p = select_list; p; p = p->next) {
FD_SET (p->fd, select_set);
if (p->fd > top_fd)
top_fd = p->fd;
@ -192,7 +191,7 @@ static void check_selects (fd_set *select_set)
void channels_down (void)
{
disabled_channels ++;
disabled_channels++;
}
void channels_up (void)
@ -383,13 +382,13 @@ static key_define_t qansi_key_defines[] =
{KEY_M_ALT | 'z', ESC_STR "Nz", MCKEY_NOACTION}, /* Alt-z */
{KEY_KP_SUBTRACT, ESC_STR "[S", MCKEY_NOACTION}, /* Gr-Minus */
{KEY_KP_ADD, ESC_STR "[T", MCKEY_NOACTION}, /* Gr-Plus */
{0, 0, MCKEY_NOACTION},
{0, NULL, MCKEY_NOACTION},
};
static key_define_t mc_default_keys [] = {
{ ESC_CHAR, ESC_STR, MCKEY_ESCAPE },
{ ESC_CHAR, ESC_STR ESC_STR, MCKEY_NOACTION },
{ 0, 0, MCKEY_NOACTION },
{ 0, NULL, MCKEY_NOACTION },
};
static void
@ -397,8 +396,8 @@ define_sequences (key_define_t *kd)
{
int i;
for (i = 0; kd [i].code; i++)
define_sequence(kd [i].code, kd [i].seq, kd [i].action);
for (i = 0; kd[i].code != 0; i++)
define_sequence(kd[i].code, kd[i].seq, kd[i].action);
}
#ifdef HAVE_TEXTMODE_X11_SUPPORT
@ -468,7 +467,7 @@ init_key (void)
/* Load the qansi-m key definitions
if we are running under the qansi-m terminal */
if ((term) && (strncmp (term, "qansi-m", 7) == 0)) {
if (term != NULL && (strncmp (term, "qansi-m", 7) == 0)) {
define_sequences (qansi_key_defines);
}
}
@ -500,7 +499,7 @@ xmouse_get_event (Gpm_Event *ev)
/* There seems to be no way of knowing which button was released */
/* So we assume all the buttons were released */
if (btn == 3){
if (btn == 3) {
if (last_btn) {
ev->type = GPM_UP | (GPM_SINGLE << clicks);
ev->buttons = 0;
@ -519,7 +518,7 @@ xmouse_get_event (Gpm_Event *ev)
ev->type = GPM_DOWN;
GET_TIME (tv2);
if (tv1.tv_sec && (DIF_TIME (tv1,tv2) < double_click_speed)){
if (tv1.tv_sec && (DIF_TIME (tv1,tv2) < double_click_speed)) {
clicks++;
clicks %= 3;
} else
@ -561,7 +560,7 @@ static key_def *create_sequence (const char *seq, int code, int action)
{
key_def *base, *p, *attach;
for (base = attach = NULL; *seq; seq++){
for (base = attach = NULL; *seq; seq++) {
p = g_new (key_def, 1);
if (!base) base = p;
if (attach) attach->child = p;
@ -606,10 +605,10 @@ int define_sequence (int code, const char *seq, int action)
if (strlen (seq) > SEQ_BUFFER_LEN-1)
return 0;
for (base = keys; (base != 0) && *seq; ){
if (*seq == base->ch){
if (base->child == 0){
if (*(seq+1)){
for (base = keys; (base != 0) && *seq; ) {
if (*seq == base->ch) {
if (base->child == 0) {
if (*(seq+1)) {
base->child = create_sequence (seq+1, code, action);
return 1;
} else {
@ -779,14 +778,14 @@ int get_key_code (int no_delay)
}
pend_send:
if (pending_keys){
if (pending_keys) {
int d = *pending_keys++;
check_pend:
if (!*pending_keys){
if (!*pending_keys) {
pending_keys = 0;
seq_append = 0;
}
if (d == ESC_CHAR && pending_keys){
if (d == ESC_CHAR && pending_keys) {
d = ALT(*pending_keys++);
goto check_pend;
}
@ -832,7 +831,7 @@ int get_key_code (int no_delay)
}
return -1;
}
} else if (c == -1){
} else if (c == -1) {
/* Maybe we got an incomplete match.
This we do only in delay mode, since otherwise
getch can return -1 at any time. */
@ -857,10 +856,10 @@ int get_key_code (int no_delay)
this = keys->child;
}
}
while (this){
if (c == this->ch){
if (this->child){
if (!push_char (c)){
while (this) {
if (c == this->ch) {
if (this->child) {
if (!push_char (c)) {
pending_keys = seq_buffer;
goto pend_send;
}
@ -938,12 +937,12 @@ try_channels (int set_timeout)
int v;
int maxfdp;
while (1){
while (1) {
FD_ZERO (&select_set);
FD_SET (input_fd, &select_set); /* Add stdin */
maxfdp = max (add_selects (&select_set), input_fd);
if (set_timeout){
if (set_timeout) {
timeout.tv_sec = 0;
timeout.tv_usec = 100000;
timeptr = &timeout;
@ -951,7 +950,7 @@ try_channels (int set_timeout)
timeptr = 0;
v = select (maxfdp + 1, &select_set, NULL, NULL, timeptr);
if (v > 0){
if (v > 0) {
check_selects (&select_set);
if (FD_ISSET (input_fd, &select_set))
return;
@ -966,7 +965,7 @@ static int getch_with_delay (void)
/* This routine could be used on systems without mouse support,
so we need to do the select check :-( */
while (1){
while (1) {
if (!pending_keys)
try_channels (0);