diff --git a/curses.h b/curses.h index d18b1097..35dd0603 100644 --- a/curses.h +++ b/curses.h @@ -28,7 +28,7 @@ Defined by this header: **man-end****************************************************************/ #define PDCURSES 1 -#define PDC_BUILD 3811 +#define PDC_BUILD 3812 #define PDC_VER_MAJOR 3 #define PDC_VER_MINOR 8 #define PDC_VERDOT "3.8" @@ -342,8 +342,6 @@ typedef struct to be restored, and how */ unsigned long key_modifiers; /* key modifiers (SHIFT, CONTROL, etc.) on last key press */ - bool save_key_modifiers; /* TRUE if each key modifiers saved - with each key press */ bool return_key_modifiers; /* TRUE if modifier keys are returned as "real" keys */ bool key_code; /* TRUE if last key is a special key; @@ -1335,7 +1333,6 @@ PDCEX int PDC_setclipboard(const char *, long); PDCEX unsigned long PDC_get_input_fd(void); PDCEX unsigned long PDC_get_key_modifiers(void); PDCEX int PDC_return_key_modifiers(bool); -PDCEX int PDC_save_key_modifiers(bool); #ifdef XCURSES PDCEX WINDOW *Xinitscr(int, char **); @@ -1380,6 +1377,10 @@ PDCEX int wunderscore(WINDOW *); # define getmouse(x) nc_getmouse(x) #endif +/* Deprecated */ + +#define PDC_save_key_modifiers(x) (OK) + /* return codes from PDC_getclipboard() and PDC_setclipboard() calls */ #define PDC_CLIP_SUCCESS 0 diff --git a/demos/testcurs.c b/demos/testcurs.c index 5cc4d91e..278836c0 100644 --- a/demos/testcurs.c +++ b/demos/testcurs.c @@ -376,7 +376,6 @@ void inputTest(WINDOW *win) #ifdef PDCURSES mouse_set(ALL_MOUSE_EVENTS); - PDC_save_key_modifiers(TRUE); PDC_return_key_modifiers(TRUE); #endif curs_set(0); /* turn cursor off */ @@ -494,7 +493,6 @@ void inputTest(WINDOW *win) #ifdef PDCURSES mouse_set(0L); - PDC_save_key_modifiers(FALSE); PDC_return_key_modifiers(FALSE); #endif wclear(win); diff --git a/dos/pdckbd.c b/dos/pdckbd.c index 10234ef8..64724eba 100644 --- a/dos/pdckbd.c +++ b/dos/pdckbd.c @@ -364,20 +364,17 @@ int PDC_get_key(void) key = regs.h.al; scan = regs.h.ah; - if (SP->save_key_modifiers) - { - if (shift_status & 3) - SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; + if (shift_status & 3) + SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; - if (shift_status & 4) - SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; + if (shift_status & 4) + SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; - if (shift_status & 8) - SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; + if (shift_status & 8) + SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; - if (shift_status & 0x20) - SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; - } + if (shift_status & 0x20) + SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; if (scan == 0x1c && key == 0x0a) /* ^Enter */ key = CTL_ENTER; diff --git a/man/MANUAL.md b/man/MANUAL.md index bf0829db..455fed3c 100644 --- a/man/MANUAL.md +++ b/man/MANUAL.md @@ -882,7 +882,6 @@ getch int unget_wch(const wchar_t wch); unsigned long PDC_get_key_modifiers(void); - int PDC_save_key_modifiers(bool flag); int PDC_return_key_modifiers(bool flag); ### Description @@ -921,8 +920,7 @@ getch PDC_get_key_modifiers() returns the keyboard modifiers (shift, control, alt, numlock) effective at the time of the last getch() - call, if PDC_save_key_modifiers(TRUE) has been called before the - getch(). Use the macros PDC_KEY_MODIFIER_* to determine which + call. Use the macros PDC_KEY_MODIFIER_* to determine which modifier(s) were set. PDC_return_key_modifiers() tells getch() to return modifier keys pressed alone as keystrokes (KEY_ALT_L, etc.). These may not work on all platforms. diff --git a/os2/pdckbd.c b/os2/pdckbd.c index b3c6154e..26726d10 100644 --- a/os2/pdckbd.c +++ b/os2/pdckbd.c @@ -329,20 +329,17 @@ int PDC_get_key(void) key = keyInfo.chChar; scan = keyInfo.chScan; - if (SP->save_key_modifiers) - { - if (keyInfo.fsState & KBDSTF_ALT) - SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; + if (keyInfo.fsState & KBDSTF_ALT) + SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; - if (keyInfo.fsState & KBDSTF_CONTROL) - SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; + if (keyInfo.fsState & KBDSTF_CONTROL) + SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; - if (keyInfo.fsState & KBDSTF_NUMLOCK_ON) - SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; + if (keyInfo.fsState & KBDSTF_NUMLOCK_ON) + SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; - if (keyInfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT)) - SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; - } + if (keyInfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT)) + SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; if (scan == 0x1c && key == 0x0a) /* ^Enter */ key = CTL_ENTER; diff --git a/pdcurses/getch.c b/pdcurses/getch.c index f3f85b0c..e8fb158c 100644 --- a/pdcurses/getch.c +++ b/pdcurses/getch.c @@ -23,7 +23,6 @@ getch int unget_wch(const wchar_t wch); unsigned long PDC_get_key_modifiers(void); - int PDC_save_key_modifiers(bool flag); int PDC_return_key_modifiers(bool flag); ### Description @@ -62,8 +61,7 @@ getch PDC_get_key_modifiers() returns the keyboard modifiers (shift, control, alt, numlock) effective at the time of the last getch() - call, if PDC_save_key_modifiers(TRUE) has been called before the - getch(). Use the macros PDC_KEY_MODIFIER_* to determine which + call. Use the macros PDC_KEY_MODIFIER_* to determine which modifier(s) were set. PDC_return_key_modifiers() tells getch() to return modifier keys pressed alone as keystrokes (KEY_ALT_L, etc.). These may not work on all platforms. @@ -355,17 +353,6 @@ unsigned long PDC_get_key_modifiers(void) return SP->key_modifiers; } -int PDC_save_key_modifiers(bool flag) -{ - PDC_LOG(("PDC_save_key_modifiers() - called\n")); - - if (!SP) - return ERR; - - SP->save_key_modifiers = flag; - return OK; -} - int PDC_return_key_modifiers(bool flag) { PDC_LOG(("PDC_return_key_modifiers() - called\n")); diff --git a/pdcurses/initscr.c b/pdcurses/initscr.c index 776ee7df..49bd56c2 100644 --- a/pdcurses/initscr.c +++ b/pdcurses/initscr.c @@ -139,7 +139,6 @@ WINDOW *Xinitscr(int argc, char *argv[]) SP->raw_inp = FALSE; /* tty I/O modes */ SP->cbreak = TRUE; SP->key_modifiers = 0L; - SP->save_key_modifiers = FALSE; SP->return_key_modifiers = FALSE; SP->echo = TRUE; SP->visibility = 1; diff --git a/sdl1/pdckbd.c b/sdl1/pdckbd.c index 8175d216..712bfbe5 100644 --- a/sdl1/pdckbd.c +++ b/sdl1/pdckbd.c @@ -160,20 +160,17 @@ static int _process_key_event(void) oldkey = event.key.keysym.sym; - if (SP->save_key_modifiers) - { - if (event.key.keysym.mod & KMOD_NUM) - SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; + if (event.key.keysym.mod & KMOD_NUM) + SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; - if (event.key.keysym.mod & KMOD_SHIFT) - SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; + if (event.key.keysym.mod & KMOD_SHIFT) + SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; - if (event.key.keysym.mod & KMOD_CTRL) - SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; + if (event.key.keysym.mod & KMOD_CTRL) + SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; - if (event.key.keysym.mod & KMOD_ALT) - SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; - } + if (event.key.keysym.mod & KMOD_ALT) + SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; for (i = 0; key_table[i].keycode; i++) { diff --git a/wincon/pdckbd.c b/wincon/pdckbd.c index 273b7157..95869714 100644 --- a/wincon/pdckbd.c +++ b/wincon/pdckbd.c @@ -361,23 +361,20 @@ static int _process_key_event(void) SP->key_code = TRUE; - /* Save the key modifiers if required. Do this first to allow to - detect e.g. a pressed CTRL key after a hit of NUMLOCK. */ + /* Save the key modifiers. Do this first to allow to detect e.g. a + pressed CTRL key after a hit of NUMLOCK. */ - if (SP->save_key_modifiers) - { - if (state & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)) - SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; + if (state & (LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)) + SP->key_modifiers |= PDC_KEY_MODIFIER_ALT; - if (state & SHIFT_PRESSED) - SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; + if (state & SHIFT_PRESSED) + SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT; - if (state & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED)) - SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; + if (state & (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED)) + SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL; - if (state & NUMLOCK_ON) - SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; - } + if (state & NUMLOCK_ON) + SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; /* Handle modifier keys hit by themselves */ diff --git a/x11/x11.c b/x11/x11.c index fff81eed..968e15b3 100644 --- a/x11/x11.c +++ b/x11/x11.c @@ -1038,28 +1038,25 @@ static void XCursesKeyPress(Widget w, XEvent *event, String *params, PDC_LOG(("%s:Keysym %x %d\n", XCLOGMSG, XKeycodeToKeysym(XCURSESDISPLAY, event->xkey.keycode, key), key)); - if (SP->save_key_modifiers) - { - /* 0x10: usually, numlock modifier */ + /* 0x10: usually, numlock modifier */ - if (event->xkey.state & Mod2Mask) - modifier |= PDC_KEY_MODIFIER_NUMLOCK; + if (event->xkey.state & Mod2Mask) + modifier |= PDC_KEY_MODIFIER_NUMLOCK; - /* 0x01: shift modifier */ + /* 0x01: shift modifier */ - if (event->xkey.state & ShiftMask) - modifier |= PDC_KEY_MODIFIER_SHIFT; + if (event->xkey.state & ShiftMask) + modifier |= PDC_KEY_MODIFIER_SHIFT; - /* 0x04: control modifier */ + /* 0x04: control modifier */ - if (event->xkey.state & ControlMask) - modifier |= PDC_KEY_MODIFIER_CONTROL; + if (event->xkey.state & ControlMask) + modifier |= PDC_KEY_MODIFIER_CONTROL; - /* 0x08: usually, alt modifier */ + /* 0x08: usually, alt modifier */ - if (event->xkey.state & Mod1Mask) - modifier |= PDC_KEY_MODIFIER_ALT; - } + if (event->xkey.state & Mod1Mask) + modifier |= PDC_KEY_MODIFIER_ALT; for (i = 0; key_table[i].keycode; i++) { diff --git a/x11new/x11.c b/x11new/x11.c index ffdfd92d..8d56dcde 100644 --- a/x11new/x11.c +++ b/x11new/x11.c @@ -1037,28 +1037,25 @@ unsigned long XCursesKeyPress(XEvent *event) PDC_LOG(("%s:Keysym %x %d\n", XCLOGMSG, XKeycodeToKeysym(XCURSESDISPLAY, event->xkey.keycode, key), key)); - if (SP->save_key_modifiers) - { - /* 0x10: usually, numlock modifier */ + /* 0x10: usually, numlock modifier */ - if (event->xkey.state & Mod2Mask) - modifier |= PDC_KEY_MODIFIER_NUMLOCK; + if (event->xkey.state & Mod2Mask) + modifier |= PDC_KEY_MODIFIER_NUMLOCK; - /* 0x01: shift modifier */ + /* 0x01: shift modifier */ - if (event->xkey.state & ShiftMask) - modifier |= PDC_KEY_MODIFIER_SHIFT; + if (event->xkey.state & ShiftMask) + modifier |= PDC_KEY_MODIFIER_SHIFT; - /* 0x04: control modifier */ + /* 0x04: control modifier */ - if (event->xkey.state & ControlMask) - modifier |= PDC_KEY_MODIFIER_CONTROL; + if (event->xkey.state & ControlMask) + modifier |= PDC_KEY_MODIFIER_CONTROL; - /* 0x08: usually, alt modifier */ + /* 0x08: usually, alt modifier */ - if (event->xkey.state & Mod1Mask) - modifier |= PDC_KEY_MODIFIER_ALT; - } + if (event->xkey.state & Mod1Mask) + modifier |= PDC_KEY_MODIFIER_ALT; for (i = 0; key_table[i].keycode; i++) {