From 75e6584ab3b06a02be37b447c397271c0d120b01 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 12 Feb 2013 01:34:04 +0100 Subject: Prefix keycode defines with MP_ Do this to reduce conflicts with , which contains some conflicting defines. This changes the meaning of MP_KEY_DOWN: KEY_DOWN is renamed to MP_KEY_DOWN (cursor down key) MP_KEY_DOWN is renamed to MP_KEY_STATE_DOWN (modifier for key down state) --- osdep/getch2-win.c | 28 ++++++++++---------- osdep/getch2.c | 76 +++++++++++++++++++++++++++--------------------------- 2 files changed, 52 insertions(+), 52 deletions(-) (limited to 'osdep') diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c index 4bef70b418..2edb537076 100644 --- a/osdep/getch2-win.c +++ b/osdep/getch2-win.c @@ -108,37 +108,37 @@ static int getch2_internal(void) switch(eventbuffer[i].Event.KeyEvent.wVirtualKeyCode) { case VK_HOME: - return KEY_HOME; + return MP_KEY_HOME; case VK_END: - return KEY_END; + return MP_KEY_END; case VK_DELETE: - return KEY_DEL; + return MP_KEY_DEL; case VK_INSERT: - return KEY_INS; + return MP_KEY_INS; case VK_BACK: - return KEY_BS; + return MP_KEY_BS; case VK_PRIOR: - return KEY_PGUP; + return MP_KEY_PGUP; case VK_NEXT: - return KEY_PGDWN; + return MP_KEY_PGDWN; case VK_RETURN: - return KEY_ENTER; + return MP_KEY_ENTER; case VK_ESCAPE: - return KEY_ESC; + return MP_KEY_ESC; case VK_LEFT: - return KEY_LEFT; + return MP_KEY_LEFT; case VK_UP: - return KEY_UP; + return MP_KEY_UP; case VK_RIGHT: - return KEY_RIGHT; + return MP_KEY_RIGHT; case VK_DOWN: - return KEY_DOWN; + return MP_KEY_DOWN; case VK_SHIFT: continue; } /*check for function keys*/ if(0x87 >= eventbuffer[i].Event.KeyEvent.wVirtualKeyCode && eventbuffer[i].Event.KeyEvent.wVirtualKeyCode >= 0x70) - return KEY_F + 1 + eventbuffer[i].Event.KeyEvent.wVirtualKeyCode - 0x70; + return MP_KEY_F + 1 + eventbuffer[i].Event.KeyEvent.wVirtualKeyCode - 0x70; /*only characters should be remaining*/ //printf("getch2: YOU PRESSED \"%c\" \n",eventbuffer[i].Event.KeyEvent.uChar.AsciiChar); diff --git a/osdep/getch2.c b/osdep/getch2.c index 63aaa75bf1..d9966d57ed 100644 --- a/osdep/getch2.c +++ b/osdep/getch2.c @@ -119,28 +119,28 @@ int load_termcap(char *termtype){ if(screen_height<1 || screen_height>255) screen_height=24; erase_to_end_of_line= tgetstr("ce",&term_p); - termcap_add("kP",KEY_PGUP); - termcap_add("kN",KEY_PGDWN); - termcap_add("kh",KEY_HOME); - termcap_add("kH",KEY_END); - termcap_add("kI",KEY_INS); - termcap_add("kD",KEY_DEL); - termcap_add("kb",KEY_BS); - termcap_add("kl",KEY_LEFT); - termcap_add("kd",KEY_DOWN); - termcap_add("ku",KEY_UP); - termcap_add("kr",KEY_RIGHT); - termcap_add("k0",KEY_F+0); - termcap_add("k1",KEY_F+1); - termcap_add("k2",KEY_F+2); - termcap_add("k3",KEY_F+3); - termcap_add("k4",KEY_F+4); - termcap_add("k5",KEY_F+5); - termcap_add("k6",KEY_F+6); - termcap_add("k7",KEY_F+7); - termcap_add("k8",KEY_F+8); - termcap_add("k9",KEY_F+9); - termcap_add("k;",KEY_F+10); + termcap_add("kP",MP_KEY_PGUP); + termcap_add("kN",MP_KEY_PGDWN); + termcap_add("kh",MP_KEY_HOME); + termcap_add("kH",MP_KEY_END); + termcap_add("kI",MP_KEY_INS); + termcap_add("kD",MP_KEY_DEL); + termcap_add("kb",MP_KEY_BS); + termcap_add("kl",MP_KEY_LEFT); + termcap_add("kd",MP_KEY_DOWN); + termcap_add("ku",MP_KEY_UP); + termcap_add("kr",MP_KEY_RIGHT); + termcap_add("k0",MP_KEY_F+0); + termcap_add("k1",MP_KEY_F+1); + termcap_add("k2",MP_KEY_F+2); + termcap_add("k3",MP_KEY_F+3); + termcap_add("k4",MP_KEY_F+4); + termcap_add("k5",MP_KEY_F+5); + termcap_add("k6",MP_KEY_F+6); + termcap_add("k7",MP_KEY_F+7); + termcap_add("k8",MP_KEY_F+8); + termcap_add("k9",MP_KEY_F+9); + termcap_add("k;",MP_KEY_F+10); return getch2_key_db; } @@ -192,20 +192,20 @@ bool getch2(struct mp_fifo *fifo) code = getch2_buf[0]; /* Check the well-known codes... */ if (code != 27) { - if (code == 'A'-64) code = KEY_HOME; - else if (code == 'E'-64) code = KEY_END; - else if (code == 'D'-64) code = KEY_DEL; - else if (code == 'H'-64) code = KEY_BS; - else if (code == 'U'-64) code = KEY_PGUP; - else if (code == 'V'-64) code = KEY_PGDWN; - else if (code == 8 || code==127) code = KEY_BS; + if (code == 'A'-64) code = MP_KEY_HOME; + else if (code == 'E'-64) code = MP_KEY_END; + else if (code == 'D'-64) code = MP_KEY_DEL; + else if (code == 'H'-64) code = MP_KEY_BS; + else if (code == 'U'-64) code = MP_KEY_PGUP; + else if (code == 'V'-64) code = MP_KEY_PGDWN; + else if (code == 8 || code==127) code = MP_KEY_BS; else if (code == 10 || code==13) { if (getch2_len > 1) { int c = getch2_buf[1]; if ((c == 10 || c == 13) && (c != code)) len = 2; } - code = KEY_ENTER; + code = MP_KEY_ENTER; } else { int utf8len = bstr_parse_utf8_code_length(code); if (utf8len > 0 && utf8len <= getch2_len) { @@ -221,19 +221,19 @@ bool getch2(struct mp_fifo *fifo) else if (getch2_len > 1) { int c = getch2_buf[1]; if (c == 27) { - code = KEY_ESC; + code = MP_KEY_ESC; len = 2; goto found; } if (c >= '0' && c <= '9') { - code = c-'0'+KEY_F; + code = c-'0'+MP_KEY_F; len = 2; goto found; } if (getch2_len >= 4 && c == '[' && getch2_buf[2] == '[') { int c = getch2_buf[3]; if (c >= 'A' && c < 'A'+12) { - code = KEY_F+1 + c-'A'; + code = MP_KEY_F+1 + c-'A'; len = 4; goto found; } @@ -241,9 +241,9 @@ bool getch2(struct mp_fifo *fifo) if ((c == '[' || c == 'O') && getch2_len >= 3) { int c = getch2_buf[2]; const int ctable[] = { - KEY_UP, KEY_DOWN, KEY_RIGHT, KEY_LEFT, 0, - KEY_END, KEY_PGDWN, KEY_HOME, KEY_PGUP, 0, 0, KEY_INS, 0, 0, 0, - KEY_F+1, KEY_F+2, KEY_F+3, KEY_F+4}; + MP_KEY_UP, MP_KEY_DOWN, MP_KEY_RIGHT, MP_KEY_LEFT, 0, + MP_KEY_END, MP_KEY_PGDWN, MP_KEY_HOME, MP_KEY_PGUP, 0, 0, MP_KEY_INS, 0, 0, 0, + MP_KEY_F+1, MP_KEY_F+2, MP_KEY_F+3, MP_KEY_F+4}; if (c >= 'A' && c <= 'S') if (ctable[c - 'A']) { code = ctable[c - 'A']; @@ -253,7 +253,7 @@ bool getch2(struct mp_fifo *fifo) } if (getch2_len >= 4 && c == '[' && getch2_buf[3] == '~') { int c = getch2_buf[2]; - const int ctable[8] = {KEY_HOME, KEY_INS, KEY_DEL, KEY_END, KEY_PGUP, KEY_PGDWN, KEY_HOME, KEY_END}; + const int ctable[8] = {MP_KEY_HOME, MP_KEY_INS, MP_KEY_DEL, MP_KEY_END, MP_KEY_PGUP, MP_KEY_PGDWN, MP_KEY_HOME, MP_KEY_END}; if (c >= '1' && c <= '8') { code = ctable[c - '1']; len = 4; @@ -270,7 +270,7 @@ bool getch2(struct mp_fifo *fifo) int a = i*10 + j; for (i = 0; i < 20; i++) if (ftable[i] == a) { - code = KEY_F+1 + i; + code = MP_KEY_F+1 + i; len = 5; goto found; } -- cgit v1.2.3