aboutsummaryrefslogtreecommitdiff
path: root/scripts/kconfig/libcurses/pdckbd.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/libcurses/pdckbd.c')
-rw-r--r--scripts/kconfig/libcurses/pdckbd.c96
1 files changed, 54 insertions, 42 deletions
diff --git a/scripts/kconfig/libcurses/pdckbd.c b/scripts/kconfig/libcurses/pdckbd.c
index 958697140..cbab60d63 100644
--- a/scripts/kconfig/libcurses/pdckbd.c
+++ b/scripts/kconfig/libcurses/pdckbd.c
@@ -2,26 +2,6 @@
2 2
3#include "pdcwin.h" 3#include "pdcwin.h"
4 4
5/*man-start**************************************************************
6
7pdckbd
8------
9
10### Synopsis
11
12 unsigned long PDC_get_input_fd(void);
13
14### Description
15
16 PDC_get_input_fd() returns the file descriptor that PDCurses reads
17 its input from. It can be used for select().
18
19### Portability
20 X/Open ncurses NetBSD
21 PDC_get_input_fd - - -
22
23**man-end****************************************************************/
24
25/* These variables are used to store information about the next 5/* These variables are used to store information about the next
26 Input Event. */ 6 Input Event. */
27 7
@@ -210,7 +190,37 @@ static KPTAB kptab[] =
210 {0, 0, 0x27, ALT_FQUOTE, 0 }, /* 222 */ 190 {0, 0, 0x27, ALT_FQUOTE, 0 }, /* 222 */
211 {0, 0, 0, 0, 0 }, /* 223 */ 191 {0, 0, 0, 0, 0 }, /* 223 */
212 {0, 0, 0, 0, 0 }, /* 224 */ 192 {0, 0, 0, 0, 0 }, /* 224 */
213 {0, 0, 0, 0, 0 } /* 225 */ 193 {0, 0, 0, 0, 0 }, /* 225 */
194 {0, 0, 0, 0, 0 }, /* 226 */
195 {0, 0, 0, 0, 0 }, /* 227 */
196 {0, 0, 0, 0, 0 }, /* 228 */
197 {0, 0, 0, 0, 0 }, /* 229 */
198 {0, 0, 0, 0, 0 }, /* 230 */
199 {0, 0, 0, 0, 0 }, /* 231 */
200 {0, 0, 0, 0, 0 }, /* 232 */
201 {0, 0, 0, 0, 0 }, /* 233 */
202 {0, 0, 0, 0, 0 }, /* 234 */
203 {0, 0, 0, 0, 0 }, /* 235 */
204 {0, 0, 0, 0, 0 }, /* 236 */
205 {0, 0, 0, 0, 0 }, /* 237 */
206 {0, 0, 0, 0, 0 }, /* 238 */
207 {0, 0, 0, 0, 0 }, /* 239 */
208 {0, 0, 0, 0, 0 }, /* 240 */
209 {0, 0, 0, 0, 0 }, /* 241 */
210 {0, 0, 0, 0, 0 }, /* 242 */
211 {0, 0, 0, 0, 0 }, /* 243 */
212 {0, 0, 0, 0, 0 }, /* 244 */
213 {0, 0, 0, 0, 0 }, /* 245 */
214 {0, 0, 0, 0, 0 }, /* 246 */
215 {0, 0, 0, 0, 0 }, /* 247 */
216 {0, 0, 0, 0, 0 }, /* 248 */
217 {0, 0, 0, 0, 0 }, /* 249 */
218 {0, 0, 0, 0, 0 }, /* 250 */
219 {0, 0, 0, 0, 0 }, /* 251 */
220 {0, 0, 0, 0, 0 }, /* 252 */
221 {0, 0, 0, 0, 0 }, /* 253 */
222 {0, 0, 0, 0, 0 }, /* 254 */
223 {0, 0, 0, 0, 0 } /* 255 */
214}; 224};
215 225
216static KPTAB ext_kptab[] = 226static KPTAB ext_kptab[] =
@@ -233,16 +243,15 @@ static KPTAB ext_kptab[] =
233 243
234/* End of kptab[] */ 244/* End of kptab[] */
235 245
236unsigned long PDC_get_input_fd(void)
237{
238 PDC_LOG(("PDC_get_input_fd() - called\n"));
239
240 return 0L;
241}
242
243void PDC_set_keyboard_binary(bool on) 246void PDC_set_keyboard_binary(bool on)
244{ 247{
248 DWORD mode;
249
245 PDC_LOG(("PDC_set_keyboard_binary() - called\n")); 250 PDC_LOG(("PDC_set_keyboard_binary() - called\n"));
251
252 GetConsoleMode(pdc_con_in, &mode);
253 SetConsoleMode(pdc_con_in, !on ? (mode | ENABLE_PROCESSED_INPUT) :
254 (mode & ~ENABLE_PROCESSED_INPUT));
246} 255}
247 256
248/* check if a key or mouse event is waiting */ 257/* check if a key or mouse event is waiting */
@@ -352,7 +361,12 @@ static int _get_key_count(void)
352 361
353static int _process_key_event(void) 362static int _process_key_event(void)
354{ 363{
355 int key = (unsigned short)KEV.uChar.UnicodeChar; 364 int key =
365#ifdef PDC_WIDE
366 KEV.uChar.UnicodeChar;
367#else
368 KEV.uChar.AsciiChar;
369#endif
356 WORD vk = KEV.wVirtualKeyCode; 370 WORD vk = KEV.wVirtualKeyCode;
357 DWORD state = KEV.dwControlKeyState; 371 DWORD state = KEV.dwControlKeyState;
358 372
@@ -466,6 +480,9 @@ static int _process_mouse_event(void)
466 480
467 memset(&SP->mouse_status, 0, sizeof(MOUSE_STATUS)); 481 memset(&SP->mouse_status, 0, sizeof(MOUSE_STATUS));
468 482
483 SP->mouse_status.x = MEV.dwMousePosition.X;
484 SP->mouse_status.y = MEV.dwMousePosition.Y;
485
469 /* Handle scroll wheel */ 486 /* Handle scroll wheel */
470 487
471 if (MEV.dwEventFlags == 4) 488 if (MEV.dwEventFlags == 4)
@@ -473,9 +490,6 @@ static int _process_mouse_event(void)
473 SP->mouse_status.changes = (MEV.dwButtonState & 0xFF000000) ? 490 SP->mouse_status.changes = (MEV.dwButtonState & 0xFF000000) ?
474 PDC_MOUSE_WHEEL_DOWN : PDC_MOUSE_WHEEL_UP; 491 PDC_MOUSE_WHEEL_DOWN : PDC_MOUSE_WHEEL_UP;
475 492
476 SP->mouse_status.x = -1;
477 SP->mouse_status.y = -1;
478
479 memset(&old_mouse_status, 0, sizeof(old_mouse_status)); 493 memset(&old_mouse_status, 0, sizeof(old_mouse_status));
480 494
481 return KEY_MOUSE; 495 return KEY_MOUSE;
@@ -486,9 +500,6 @@ static int _process_mouse_event(void)
486 SP->mouse_status.changes = (MEV.dwButtonState & 0xFF000000) ? 500 SP->mouse_status.changes = (MEV.dwButtonState & 0xFF000000) ?
487 PDC_MOUSE_WHEEL_RIGHT : PDC_MOUSE_WHEEL_LEFT; 501 PDC_MOUSE_WHEEL_RIGHT : PDC_MOUSE_WHEEL_LEFT;
488 502
489 SP->mouse_status.x = -1;
490 SP->mouse_status.y = -1;
491
492 memset(&old_mouse_status, 0, sizeof(old_mouse_status)); 503 memset(&old_mouse_status, 0, sizeof(old_mouse_status));
493 504
494 return KEY_MOUSE; 505 return KEY_MOUSE;
@@ -537,9 +548,6 @@ static int _process_mouse_event(void)
537 } 548 }
538 } 549 }
539 550
540 SP->mouse_status.x = MEV.dwMousePosition.X;
541 SP->mouse_status.y = MEV.dwMousePosition.Y;
542
543 SP->mouse_status.changes = 0; 551 SP->mouse_status.changes = 0;
544 552
545 for (i = 0; i < 3; i++) 553 for (i = 0; i < 3; i++)
@@ -662,13 +670,17 @@ bool PDC_has_mouse(void)
662 670
663int PDC_mouse_set(void) 671int PDC_mouse_set(void)
664{ 672{
673 DWORD mode;
674
665 /* If turning on mouse input: Set ENABLE_MOUSE_INPUT, and clear 675 /* If turning on mouse input: Set ENABLE_MOUSE_INPUT, and clear
666 all other flags, including the extended flags; 676 all other flags, except processed input mode;
667 If turning off the mouse: Set QuickEdit Mode to the status it 677 If turning off the mouse: Set QuickEdit Mode to the status it
668 had on startup, and clear all other flags */ 678 had on startup, and clear all other flags, except etc. */
669 679
670 SetConsoleMode(pdc_con_in, SP->_trap_mbe ? 680 GetConsoleMode(pdc_con_in, &mode);
671 (ENABLE_MOUSE_INPUT|0x0088) : (pdc_quick_edit|0x0088)); 681 mode = (mode & 1) | 0x0088;
682 SetConsoleMode(pdc_con_in, mode | (SP->_trap_mbe ?
683 ENABLE_MOUSE_INPUT : pdc_quick_edit));
672 684
673 memset(&old_mouse_status, 0, sizeof(old_mouse_status)); 685 memset(&old_mouse_status, 0, sizeof(old_mouse_status));
674 686