1 /****************************************************************************
2 * Copyright 2018,2020 Thomas E. Dickey *
3 * Copyright 2008-2016,2017 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************/
30 /****************************************************************************
31 * Author: Juergen Pfeifer *
32 * and: Thomas E. Dickey *
33 ****************************************************************************/
36 * TODO - improve screen-repainting performance, using implied wraparound to reduce write's
37 * TODO - make it optional whether screen is restored or not when non-buffered
40 #include <curses.priv.h>
42 #if (defined(__MINGW32__) || defined(__MINGW64__))
49 #define CUR TerminalType(my_term).
51 MODULE_ID("$Id: win32_driver.c,v 1.2 2020/11/21 23:35:56 tom Exp $")
53 #define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
54 #define EXP_OPTIMIZE 0
56 static bool console_initialized = FALSE;
58 #define AssertTCB() assert(TCB != 0 && (TCB->magic == WINMAGIC))
59 #define validateConsoleHandle() (AssertTCB() , console_initialized ||\
60 (console_initialized=\
61 _nc_console_checkinit(TRUE,FALSE)))
62 #define SetSP() assert(TCB->csp != 0); sp = TCB->csp; (void) sp
63 #define AdjustY() (WINCONSOLE.buffered ?\
64 0 : (int) WINCONSOLE.SBI.srWindow.Top)
65 #define RevAttr(attr) (WORD) (((attr) & 0xff00) | \
66 ((((attr) & 0x07) << 4) | \
67 (((attr) & 0x70) >> 4)))
70 #define write_screen WriteConsoleOutputW
71 #define read_screen ReadConsoleOutputW
73 #define write_screen WriteConsoleOutput
74 #define read_screen ReadConsoleOutput
78 MapAttr(WORD res, attr_t ch)
84 if (p > 0 && p < CON_NUMPAIRS) {
86 a = WINCONSOLE.pairs[p];
87 res = (WORD) ((res & 0xff00) | a);
95 if (ch & A_STANDOUT) {
96 res = RevAttr(res) | BACKGROUND_INTENSITY;
100 res |= FOREGROUND_INTENSITY;
103 res |= BACKGROUND_INTENSITY;
108 #if 0 /* def TRACE */
110 dump_screen(const char *fn, int ln)
112 int max_cells = (WINCONSOLE.SBI.dwSize.Y *
113 (1 + WINCONSOLE.SBI.dwSize.X)) + 1;
114 char output[max_cells];
115 CHAR_INFO save_screen[max_cells];
117 SMALL_RECT save_region;
120 T(("dump_screen %s@%d", fn, ln));
122 save_region.Top = WINCONSOLE.SBI.srWindow.Top;
123 save_region.Left = WINCONSOLE.SBI.srWindow.Left;
124 save_region.Bottom = WINCONSOLE.SBI.srWindow.Bottom;
125 save_region.Right = WINCONSOLE.SBI.srWindow.Right;
127 save_size.X = (SHORT) (save_region.Right - save_region.Left + 1);
128 save_size.Y = (SHORT) (save_region.Bottom - save_region.Top + 1);
130 bufferCoord.X = bufferCoord.Y = 0;
132 if (read_screen(WINCONSOLE.hdl,
141 for (i = save_region.Top; i <= save_region.Bottom; ++i) {
142 for (j = save_region.Left; j <= save_region.Right; ++j) {
143 output[k++] = save_screen[ij++].Char.AsciiChar;
149 T(("DUMP: %d,%d - %d,%d",
159 #define dump_screen(fn,ln) /* nothing */
162 #if USE_WIDEC_SUPPORT
164 * TODO: support surrogate pairs
165 * TODO: support combining characters
167 * TODO: _nc_wacs should be part of sp.
170 con_write16(TERMINAL_CONTROL_BLOCK * TCB,
171 int y, int x, cchar_t *str, int limit)
174 CHAR_INFO *ci = TypeAlloca(CHAR_INFO, limit);
184 for (i = actual = 0; i < limit; i++) {
188 ci[actual].Char.UnicodeChar = CharOf(ch);
189 ci[actual].Attributes = MapAttr(WINCONSOLE.SBI.wAttributes,
191 if (AttrOf(ch) & A_ALTCHARSET) {
193 int which = CharOf(ch);
196 && CharOf(_nc_wacs[which]) != 0) {
197 ci[actual].Char.UnicodeChar = CharOf(_nc_wacs[which]);
199 ci[actual].Char.UnicodeChar = ' ';
208 siz.X = (SHORT) actual;
211 rec.Left = (SHORT) x;
212 rec.Top = (SHORT) (y + AdjustY());
213 rec.Right = (SHORT) (x + limit - 1);
214 rec.Bottom = rec.Top;
216 return write_screen(WINCONSOLE.hdl, ci, siz, loc, &rec);
218 #define con_write(tcb, y, x, str, n) con_write16(tcb, y, x, str, n)
221 con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n)
223 CHAR_INFO *ci = TypeAlloca(CHAR_INFO, n);
233 for (i = 0; i < n; i++) {
235 ci[i].Char.AsciiChar = ChCharOf(ch);
236 ci[i].Attributes = MapAttr(WINCONSOLE.SBI.wAttributes,
238 if (ChAttrOf(ch) & A_ALTCHARSET) {
240 ci[i].Char.AsciiChar =
241 ChCharOf(NCURSES_SP_NAME(_nc_acs_char) (sp, ChCharOf(ch)));
250 rec.Left = (short) x;
252 rec.Right = (short) (x + n - 1);
253 rec.Bottom = rec.Top;
255 return write_screen(WINCONSOLE.hdl, ci, siz, loc, &rec);
257 #define con_write(tcb, y, x, str, n) con_write8(tcb, y, x, str, n)
262 * Comparing new/current screens, determine the last column-index for a change
263 * beginning on the given row,col position. Unlike a serial terminal, there is
264 * no cost for "moving" the "cursor" on the line as we update it.
267 find_end_of_change(SCREEN *sp, int row, int col)
270 struct ldat *curdat = CurScreen(sp)->_line + row;
271 struct ldat *newdat = NewScreen(sp)->_line + row;
273 while (col <= newdat->lastchar) {
274 #if USE_WIDEC_SUPPORT
275 if (isWidecExt(curdat->text[col]) ||
276 isWidecExt(newdat->text[col])) {
278 } else if (memcmp(&curdat->text[col],
280 sizeof(curdat->text[0]))) {
286 if (curdat->text[col] != newdat->text[col]) {
298 * Given a row,col position at the end of a change-chunk, look for the
299 * beginning of the next change-chunk.
302 find_next_change(SCREEN *sp, int row, int col)
304 struct ldat *curdat = CurScreen(sp)->_line + row;
305 struct ldat *newdat = NewScreen(sp)->_line + row;
306 int result = newdat->lastchar + 1;
308 while (++col <= newdat->lastchar) {
309 #if USE_WIDEC_SUPPORT
310 if (isWidecExt(curdat->text[col]) !=
311 isWidecExt(newdat->text[col])) {
314 } else if (memcmp(&curdat->text[col],
316 sizeof(curdat->text[0]))) {
321 if (curdat->text[col] != newdat->text[col]) {
330 #define EndChange(first) \
331 find_end_of_change(sp, y, first)
332 #define NextChange(last) \
333 find_next_change(sp, y, last)
335 #endif /* EXP_OPTIMIZE */
337 #define MARK_NOCHANGE(win,row) \
338 win->_line[row].firstchar = _NOCHANGE; \
339 win->_line[row].lastchar = _NOCHANGE
342 restore_original_screen(void)
346 SMALL_RECT save_region = WINCONSOLE.save_region;
348 T(("... restoring %s", WINCONSOLE.window_only ?
349 "window" : "entire buffer"));
351 bufferCoord.X = (SHORT) (WINCONSOLE.window_only ?
352 WINCONSOLE.SBI.srWindow.Left : 0);
353 bufferCoord.Y = (SHORT) (WINCONSOLE.window_only ?
354 WINCONSOLE.SBI.srWindow.Top : 0);
356 if (write_screen(WINCONSOLE.hdl,
357 WINCONSOLE.save_screen,
358 WINCONSOLE.save_size,
362 mvcur(-1, -1, LINES - 2, 0);
363 T(("... restore original screen contents ok %dx%d (%d,%d - %d,%d)",
364 WINCONSOLE.save_size.Y,
365 WINCONSOLE.save_size.X,
371 T(("... restore original screen contents err"));
377 wcon_name(TERMINAL_CONTROL_BLOCK * TCB)
380 return "win32console";
384 wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
387 int y, nonempty, n, x0, x1, Width, Height;
390 T((T_CALLED("win32con::wcon_doupdate(%p)"), TCB));
391 if (validateConsoleHandle()) {
394 Width = screen_columns(sp);
395 Height = screen_lines(sp);
396 nonempty = min(Height, NewScreen(sp)->_maxy + 1);
398 T(("... %dx%d clear cur:%d new:%d",
400 CurScreen(sp)->_clear,
401 NewScreen(sp)->_clear));
403 if (SP_PARM->_endwin == ewSuspend) {
405 T(("coming back from shell mode"));
406 NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_ARG);
408 NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_ARG);
409 NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_ARG);
410 SP_PARM->_mouse_resume(SP_PARM);
412 SP_PARM->_endwin = ewRunning;
415 if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) {
417 #if USE_WIDEC_SUPPORT
418 cchar_t *empty = TypeAlloca(cchar_t, Width);
424 for (x = 0; x < Width; x++)
425 setcchar(&empty[x], blank, 0, 0, 0);
427 chtype *empty = TypeAlloca(chtype, Width);
429 for (x = 0; x < Width; x++)
433 for (y = 0; y < nonempty; y++) {
434 con_write(TCB, y, 0, empty, Width);
436 CurScreen(sp)->_line[y].text,
437 (size_t) Width * sizeof(empty[0]));
439 CurScreen(sp)->_clear = FALSE;
440 NewScreen(sp)->_clear = FALSE;
441 touchwin(NewScreen(sp));
442 T(("... cleared %dx%d lines @%d of screen", nonempty, Width,
446 for (y = 0; y < nonempty; y++) {
447 x0 = NewScreen(sp)->_line[y].firstchar;
448 if (x0 != _NOCHANGE) {
451 int limit = NewScreen(sp)->_line[y].lastchar;
452 while ((x1 = EndChange(x0)) <= limit) {
453 while ((x2 = NextChange(x1)) <=
454 limit && x2 <= (x1 + 2)) {
458 memcpy(&CurScreen(sp)->_line[y].text[x0],
459 &NewScreen(sp)->_line[y].text[x0],
460 n * sizeof(CurScreen(sp)->_line[y].text[x0]));
464 &CurScreen(sp)->_line[y].text[x0], n);
468 /* mark line changed successfully */
469 if (y <= NewScreen(sp)->_maxy) {
470 MARK_NOCHANGE(NewScreen(sp), y);
472 if (y <= CurScreen(sp)->_maxy) {
473 MARK_NOCHANGE(CurScreen(sp), y);
476 x1 = NewScreen(sp)->_line[y].lastchar;
479 memcpy(&CurScreen(sp)->_line[y].text[x0],
480 &NewScreen(sp)->_line[y].text[x0],
482 sizeof(CurScreen(sp)->_line[y].text[x0]));
486 &CurScreen(sp)->_line[y].text[x0], n);
488 /* mark line changed successfully */
489 if (y <= NewScreen(sp)->_maxy) {
490 MARK_NOCHANGE(NewScreen(sp), y);
492 if (y <= CurScreen(sp)->_maxy) {
493 MARK_NOCHANGE(CurScreen(sp), y);
500 /* put everything back in sync */
501 for (y = nonempty; y <= NewScreen(sp)->_maxy; y++) {
502 MARK_NOCHANGE(NewScreen(sp), y);
504 for (y = nonempty; y <= CurScreen(sp)->_maxy; y++) {
505 MARK_NOCHANGE(CurScreen(sp), y);
508 if (!NewScreen(sp)->_leaveok) {
509 CurScreen(sp)->_curx = NewScreen(sp)->_curx;
510 CurScreen(sp)->_cury = NewScreen(sp)->_cury;
512 TCB->drv->td_hwcur(TCB,
515 CurScreen(sp)->_cury,
516 CurScreen(sp)->_curx);
518 _nc_console_selectActiveHandle();
525 wcon_CanHandle(TERMINAL_CONTROL_BLOCK * TCB,
527 int *errret GCC_UNUSED)
531 T((T_CALLED("win32con::wcon_CanHandle(%p)"), TCB));
533 assert((TCB != 0) && (tname != 0));
535 TCB->magic = WINMAGIC;
537 if (tname == 0 || *tname == 0) {
538 if (!_nc_console_vt_supported())
540 } else if (tname != 0 && *tname == '#') {
542 * Use "#" (a character which cannot begin a terminal's name) to
543 * select specific driver from the table.
545 * In principle, we could have more than one non-terminfo driver,
548 size_t n = strlen(tname + 1);
550 && ((strncmp(tname + 1, "win32console", n) == 0)
551 || (strncmp(tname + 1, "win32con", n) == 0))) {
554 } else if (tname != 0 && stricmp(tname, "unknown") == 0) {
559 * This is intentional, to avoid unnecessary breakage of applications
560 * using <term.h> symbols.
562 if (code && (TerminalType(&TCB->term).Booleans == 0)) {
563 _nc_init_termtype(&TerminalType(&TCB->term));
564 #if NCURSES_EXT_NUMBERS
565 _nc_export_termtype2(&TCB->term.type, &TerminalType(&TCB->term));
570 if (_nc_console_test(0)) {
571 T(("isTermInfoConsole=TRUE"));
572 WINCONSOLE.isTermInfoConsole = TRUE;
579 wcon_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB,
585 int high = (WINCONSOLE.SBI.srWindow.Bottom -
586 WINCONSOLE.SBI.srWindow.Top + 1);
587 int wide = (WINCONSOLE.SBI.srWindow.Right -
588 WINCONSOLE.SBI.srWindow.Left + 1);
589 int max_cells = (high * wide);
592 CHAR_INFO *this_screen = TypeAlloca(CHAR_INFO, max_cells);
593 CHAR_INFO *that_screen = TypeAlloca(CHAR_INFO, max_cells);
595 SMALL_RECT this_region;
598 if (validateConsoleHandle()) {
600 this_region.Top = WINCONSOLE.SBI.srWindow.Top;
601 this_region.Left = WINCONSOLE.SBI.srWindow.Left;
602 this_region.Bottom = WINCONSOLE.SBI.srWindow.Bottom;
603 this_region.Right = WINCONSOLE.SBI.srWindow.Right;
605 this_size.X = (SHORT) wide;
606 this_size.Y = (SHORT) high;
608 bufferCoord.X = this_region.Left;
609 bufferCoord.Y = this_region.Top;
612 read_screen(WINCONSOLE.hdl,
620 sizeof(CHAR_INFO) * (size_t) max_cells);
622 for (i = 0; i < max_cells; i++) {
623 that_screen[i].Attributes =
624 RevAttr(that_screen[i].Attributes);
627 write_screen(WINCONSOLE.hdl, that_screen, this_size,
628 bufferCoord, &this_region);
630 write_screen(WINCONSOLE.hdl, this_screen, this_size,
631 bufferCoord, &this_region);
634 MessageBeep(MB_ICONWARNING); /* MB_OK might be better */
642 wcon_print(TERMINAL_CONTROL_BLOCK * TCB,
643 char *data GCC_UNUSED,
655 wcon_defaultcolors(TERMINAL_CONTROL_BLOCK * TCB,
669 wcon_setcolor(TERMINAL_CONTROL_BLOCK * TCB,
672 int (*outc) (SCREEN *, int) GCC_UNUSED)
675 if (validateConsoleHandle()) {
676 WORD a = _nc_console_MapColor(fore, color);
677 a |= (WORD) ((WINCONSOLE.SBI.wAttributes) & (fore ? 0xfff8 : 0xff8f));
678 SetConsoleTextAttribute(WINCONSOLE.hdl, a);
679 _nc_console_get_SBI();
684 wcon_rescol(TERMINAL_CONTROL_BLOCK * TCB)
689 if (validateConsoleHandle()) {
690 WORD a = FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN;
691 SetConsoleTextAttribute(WINCONSOLE.hdl, a);
692 _nc_console_get_SBI();
699 wcon_rescolors(TERMINAL_CONTROL_BLOCK * TCB)
711 wcon_size(TERMINAL_CONTROL_BLOCK * TCB, int *Lines, int *Cols)
715 T((T_CALLED("win32con::wcon_size(%p)"), TCB));
717 if (validateConsoleHandle() &&
718 (Lines != NULL) && (Cols != NULL)) {
719 _nc_console_size(Lines, Cols);
726 wcon_setsize(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED,
735 wcon_sgmode(TERMINAL_CONTROL_BLOCK * TCB, int setFlag, TTY * buf)
739 T((T_CALLED("win32con::wcon_sgmode(TCB=(%p),setFlag=%d,TTY=(%p)"),
741 if (buf != NULL && validateConsoleHandle()) {
744 _nc_console_setmode(WINCONSOLE.hdl, buf);
745 TCB->term.Nttyb = *buf;
747 _nc_console_getmode(WINCONSOLE.hdl, &(TCB->term.Nttyb));
748 *buf = TCB->term.Nttyb;
759 wcon_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag)
762 TERMINAL *_term = (TERMINAL *) TCB;
765 if (validateConsoleHandle()) {
768 T((T_CALLED("win32con::wcon_mode(%p, progFlag=%d, defFlag=%d)"),
769 TCB, progFlag, defFlag));
771 WINCONSOLE.progMode = progFlag;
772 WINCONSOLE.lastOut = progFlag ? WINCONSOLE.hdl : WINCONSOLE.out;
773 SetConsoleActiveScreenBuffer(WINCONSOLE.lastOut);
775 if (progFlag) /* prog mode */ {
777 if ((wcon_sgmode(TCB, FALSE, &(_term->Nttyb)) == OK)) {
781 /* reset_prog_mode */
782 if (wcon_sgmode(TCB, TRUE, &(_term->Nttyb)) == OK) {
785 _nc_keypad(sp, TRUE);
787 if (!WINCONSOLE.buffered) {
788 _nc_console_set_scrollback(FALSE, &WINCONSOLE.SBI);
793 T(("... buffered:%d, clear:%d",
794 WINCONSOLE.buffered, CurScreen(sp)->_clear));
795 } else { /* shell mode */
798 if (wcon_sgmode(TCB, FALSE, &(_term->Ottyb)) == OK) {
802 /* reset_shell_mode */
804 _nc_keypad(sp, FALSE);
805 NCURSES_SP_NAME(_nc_flush) (sp);
807 code = wcon_sgmode(TCB, TRUE, &(_term->Ottyb));
808 if (!WINCONSOLE.buffered) {
809 _nc_console_set_scrollback(TRUE, &WINCONSOLE.save_SBI);
810 if (!restore_original_screen())
813 SetConsoleCursorInfo(WINCONSOLE.hdl, &WINCONSOLE.save_CI);
822 wcon_screen_init(SCREEN *sp GCC_UNUSED)
827 wcon_wrap(SCREEN *sp GCC_UNUSED)
832 wcon_release(TERMINAL_CONTROL_BLOCK * TCB)
834 T((T_CALLED("win32con::wcon_release(%p)"), TCB));
844 wcon_init(TERMINAL_CONTROL_BLOCK * TCB)
846 T((T_CALLED("win32con::wcon_init(%p)"), TCB));
850 if (!(console_initialized = _nc_console_checkinit(TRUE, FALSE))) {
855 TCB->info.initcolor = TRUE;
856 TCB->info.canchange = FALSE;
857 TCB->info.hascolor = TRUE;
858 TCB->info.caninit = TRUE;
860 TCB->info.maxpairs = CON_NUMPAIRS;
861 TCB->info.maxcolors = 8;
862 TCB->info.numlabels = 0;
863 TCB->info.labelwidth = 0;
864 TCB->info.labelheight = 0;
865 TCB->info.nocolorvideo = 1;
866 TCB->info.tabsize = 8;
868 TCB->info.numbuttons = WINCONSOLE.numButtons;
869 TCB->info.defaultPalette = _nc_cga_palette;
876 wcon_initpair(TERMINAL_CONTROL_BLOCK * TCB,
883 if (validateConsoleHandle()) {
886 if ((pair > 0) && (pair < CON_NUMPAIRS) && (f >= 0) && (f < 8)
887 && (b >= 0) && (b < 8)) {
888 WINCONSOLE.pairs[pair] =
889 _nc_console_MapColor(true, f) |
890 _nc_console_MapColor(false, b);
896 wcon_initcolor(TERMINAL_CONTROL_BLOCK * TCB,
897 int color GCC_UNUSED,
909 wcon_do_color(TERMINAL_CONTROL_BLOCK * TCB,
910 int old_pair GCC_UNUSED,
912 int reverse GCC_UNUSED,
913 int (*outc) (SCREEN *, int) GCC_UNUSED
923 wcon_initmouse(TERMINAL_CONTROL_BLOCK * TCB)
927 if (validateConsoleHandle()) {
930 sp->_mouse_type = M_TERM_DRIVER;
935 wcon_testmouse(TERMINAL_CONTROL_BLOCK * TCB,
937 EVENTLIST_2nd(_nc_eventlist * evl))
942 if (validateConsoleHandle()) {
945 if (sp->_drv_mouse_head < sp->_drv_mouse_tail) {
948 rc = TCBOf(sp)->drv->td_twait(TCBOf(sp),
960 wcon_mvcur(TERMINAL_CONTROL_BLOCK * TCB,
961 int yold GCC_UNUSED, int xold GCC_UNUSED,
967 if (validateConsoleHandle()) {
970 loc.Y = (short) (y + AdjustY());
971 SetConsoleCursorPosition(WINCONSOLE.hdl, loc);
978 wcon_hwlabel(TERMINAL_CONTROL_BLOCK * TCB,
979 int labnum GCC_UNUSED,
980 char *text GCC_UNUSED)
989 wcon_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB,
990 int OnFlag GCC_UNUSED)
999 wcon_conattr(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED)
1001 chtype res = A_NORMAL;
1002 res |= (A_BOLD | A_DIM | A_REVERSE | A_STANDOUT | A_COLOR);
1007 wcon_setfilter(TERMINAL_CONTROL_BLOCK * TCB)
1016 wcon_initacs(TERMINAL_CONTROL_BLOCK * TCB,
1017 chtype *real_map GCC_UNUSED,
1018 chtype *fake_map GCC_UNUSED)
1020 #define DATA(a,b) { a, b }
1025 DATA('a', 0xb1), /* ACS_CKBOARD */
1026 DATA('f', 0xf8), /* ACS_DEGREE */
1027 DATA('g', 0xf1), /* ACS_PLMINUS */
1028 DATA('j', 0xd9), /* ACS_LRCORNER */
1029 DATA('l', 0xda), /* ACS_ULCORNER */
1030 DATA('k', 0xbf), /* ACS_URCORNER */
1031 DATA('m', 0xc0), /* ACS_LLCORNER */
1032 DATA('n', 0xc5), /* ACS_PLUS */
1033 DATA('q', 0xc4), /* ACS_HLINE */
1034 DATA('t', 0xc3), /* ACS_LTEE */
1035 DATA('u', 0xb4), /* ACS_RTEE */
1036 DATA('v', 0xc1), /* ACS_BTEE */
1037 DATA('w', 0xc2), /* ACS_TTEE */
1038 DATA('x', 0xb3), /* ACS_VLINE */
1039 DATA('y', 0xf3), /* ACS_LEQUAL */
1040 DATA('z', 0xf2), /* ACS_GEQUAL */
1041 DATA('0', 0xdb), /* ACS_BLOCK */
1042 DATA('{', 0xe3), /* ACS_PI */
1043 DATA('}', 0x9c), /* ACS_STERLING */
1044 DATA(',', 0xae), /* ACS_LARROW */
1045 DATA('+', 0xaf), /* ACS_RARROW */
1046 DATA('~', 0xf9), /* ACS_BULLET */
1052 if (validateConsoleHandle()) {
1055 for (n = 0; n < SIZEOF(table); ++n) {
1056 real_map[table[n].acs_code] =
1057 (chtype) table[n].use_code | A_ALTCHARSET;
1059 sp->_screen_acs_map[table[n].acs_code] = TRUE;
1065 wcon_twait(TERMINAL_CONTROL_BLOCK * TCB,
1069 EVENTLIST_2nd(_nc_eventlist * evl))
1074 if (validateConsoleHandle()) {
1077 code = _nc_console_twait(sp,
1081 timeleft EVENTLIST_2nd(evl));
1087 wcon_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf)
1092 T((T_CALLED("win32con::wcon_read(%p)"), TCB));
1095 if (validateConsoleHandle()) {
1098 n = _nc_console_read(sp, WINCONSOLE.inp, buf);
1104 wcon_nap(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int ms)
1106 T((T_CALLED("win32con::wcon_nap(%p, %d)"), TCB, ms));
1112 wcon_cursorSet(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int mode)
1116 T((T_CALLED("win32con:wcon_cursorSet(%d)"), mode));
1117 if (validateConsoleHandle()) {
1118 CONSOLE_CURSOR_INFO this_CI = WINCONSOLE.save_CI;
1121 this_CI.bVisible = FALSE;
1126 this_CI.dwSize = 100;
1129 SetConsoleCursorInfo(WINCONSOLE.hdl, &this_CI);
1135 wcon_kyExist(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int keycode)
1139 T((T_CALLED("win32con::wcon_kyExist(%d)"), keycode));
1140 found = _nc_console_keyExist(keycode);
1145 wcon_kpad(TERMINAL_CONTROL_BLOCK * TCB, int flag GCC_UNUSED)
1150 T((T_CALLED("win32con::wcon_kpad(%p, %d)"), TCB, flag));
1152 if (validateConsoleHandle()) {
1163 wcon_keyok(TERMINAL_CONTROL_BLOCK * TCB,
1170 T((T_CALLED("win32con::wcon_keyok(%p, %d, %d)"), TCB, keycode, flag));
1172 if (validateConsoleHandle()) {
1175 code = _nc_console_keyok(keycode, flag);
1181 NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_WIN_DRIVER = {
1183 wcon_name, /* Name */
1184 wcon_CanHandle, /* CanHandle */
1185 wcon_init, /* init */
1186 wcon_release, /* release */
1187 wcon_size, /* size */
1188 wcon_sgmode, /* sgmode */
1189 wcon_conattr, /* conattr */
1190 wcon_mvcur, /* hwcur */
1191 wcon_mode, /* mode */
1192 wcon_rescol, /* rescol */
1193 wcon_rescolors, /* rescolors */
1194 wcon_setcolor, /* color */
1195 wcon_dobeepflash, /* DoBeepFlash */
1196 wcon_initpair, /* initpair */
1197 wcon_initcolor, /* initcolor */
1198 wcon_do_color, /* docolor */
1199 wcon_initmouse, /* initmouse */
1200 wcon_testmouse, /* testmouse */
1201 wcon_setfilter, /* setfilter */
1202 wcon_hwlabel, /* hwlabel */
1203 wcon_hwlabelOnOff, /* hwlabelOnOff */
1204 wcon_doupdate, /* update */
1205 wcon_defaultcolors, /* defaultcolors */
1206 wcon_print, /* print */
1207 wcon_size, /* getsize */
1208 wcon_setsize, /* setsize */
1209 wcon_initacs, /* initacs */
1210 wcon_screen_init, /* scinit */
1211 wcon_wrap, /* scexit */
1212 wcon_twait, /* twait */
1213 wcon_read, /* read */
1215 wcon_kpad, /* kpad */
1216 wcon_keyok, /* kyOk */
1217 wcon_kyExist, /* kyExist */
1218 wcon_cursorSet /* cursorSet */
1221 #endif /* _NC_WINDOWS */