diff options
| author | Ron Yorston <rmy@pobox.com> | 2024-01-06 12:44:21 +0000 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2024-01-06 12:44:21 +0000 |
| commit | cdee4a435a7d0d4abac29ea38f8bee9b53e9830e (patch) | |
| tree | cc330eff99a283ea2fffba201604cc550b155f44 /scripts | |
| parent | 5f2527702577d4ddcc5f059ba007e827b8ab779c (diff) | |
| download | busybox-w32-cdee4a435a7d0d4abac29ea38f8bee9b53e9830e.tar.gz busybox-w32-cdee4a435a7d0d4abac29ea38f8bee9b53e9830e.tar.bz2 busybox-w32-cdee4a435a7d0d4abac29ea38f8bee9b53e9830e.zip | |
Update PDCurses
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/kconfig/libcurses/README.md | 12 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/color.c | 140 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/curses.h | 80 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/curspriv.h | 30 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/getch.c | 56 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/initscr.c | 61 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/inopts.c | 56 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/outopts.c | 91 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/pad.c | 66 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/pdcdisp.c | 28 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/pdckbd.c | 96 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/pdcscrn.c | 65 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/pdcwin.h | 2 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/refresh.c | 12 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/touch.c | 31 | ||||
| -rw-r--r-- | scripts/kconfig/libcurses/window.c | 62 |
16 files changed, 610 insertions, 278 deletions
diff --git a/scripts/kconfig/libcurses/README.md b/scripts/kconfig/libcurses/README.md index 97ad342fe..81f5b2cbe 100644 --- a/scripts/kconfig/libcurses/README.md +++ b/scripts/kconfig/libcurses/README.md | |||
| @@ -7,14 +7,14 @@ port can just as easily be built for 64-bit systems. Windows 95 through | |||
| 7 | Windows 10 are covered. (Some features require later versions.) | 7 | Windows 10 are covered. (Some features require later versions.) |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | Distribution Status | ||
| 11 | ------------------- | ||
| 12 | |||
| 13 | The files in this directory are released to the public domain. | ||
| 14 | |||
| 15 | |||
| 16 | Acknowledgements | 10 | Acknowledgements |
| 17 | ---------------- | 11 | ---------------- |
| 18 | 12 | ||
| 19 | Windows console port was originally provided by Chris Szurgot | 13 | Windows console port was originally provided by Chris Szurgot |
| 20 | <szurgot@itribe.net> | 14 | <szurgot@itribe.net> |
| 15 | |||
| 16 | |||
| 17 | Distribution Status | ||
| 18 | ------------------- | ||
| 19 | |||
| 20 | The files in this directory are released to the public domain. | ||
diff --git a/scripts/kconfig/libcurses/color.c b/scripts/kconfig/libcurses/color.c index 83b2336f9..3335ae082 100644 --- a/scripts/kconfig/libcurses/color.c +++ b/scripts/kconfig/libcurses/color.c | |||
| @@ -17,7 +17,10 @@ color | |||
| 17 | int init_color(short color, short red, short green, short blue); | 17 | int init_color(short color, short red, short green, short blue); |
| 18 | int color_content(short color, short *red, short *green, short *blue); | 18 | int color_content(short color, short *red, short *green, short *blue); |
| 19 | 19 | ||
| 20 | int alloc_pair(int fg, int bg); | ||
| 20 | int assume_default_colors(int f, int b); | 21 | int assume_default_colors(int f, int b); |
| 22 | int find_pair(int fg, int bg); | ||
| 23 | int free_pair(int pair); | ||
| 21 | int use_default_colors(void); | 24 | int use_default_colors(void); |
| 22 | 25 | ||
| 23 | int PDC_set_line_color(short color); | 26 | int PDC_set_line_color(short color); |
| @@ -68,6 +71,13 @@ color | |||
| 68 | variable PDC_ORIGINAL_COLORS is set at the time start_color() is | 71 | variable PDC_ORIGINAL_COLORS is set at the time start_color() is |
| 69 | called, that's equivalent to calling use_default_colors(). | 72 | called, that's equivalent to calling use_default_colors(). |
| 70 | 73 | ||
| 74 | alloc_pair(), find_pair() and free_pair() are also from ncurses. | ||
| 75 | free_pair() marks a pair as unused; find_pair() returns an existing | ||
| 76 | pair with the specified foreground and background colors, if one | ||
| 77 | exists. And alloc_pair() returns such a pair whether or not it was | ||
| 78 | previously set, overwriting the oldest initialized pair if there are | ||
| 79 | no free pairs. | ||
| 80 | |||
| 71 | PDC_set_line_color() is used to set the color, globally, for the | 81 | PDC_set_line_color() is used to set the color, globally, for the |
| 72 | color of the lines drawn for the attributes: A_UNDERLINE, A_LEFT and | 82 | color of the lines drawn for the attributes: A_UNDERLINE, A_LEFT and |
| 73 | A_RIGHT. A value of -1 (the default) indicates that the current | 83 | A_RIGHT. A value of -1 (the default) indicates that the current |
| @@ -77,8 +87,9 @@ color | |||
| 77 | 87 | ||
| 78 | ### Return Value | 88 | ### Return Value |
| 79 | 89 | ||
| 80 | All functions return OK on success and ERR on error, except for | 90 | Most functions return OK on success and ERR on error. has_colors() |
| 81 | has_colors() and can_change_colors(), which return TRUE or FALSE. | 91 | and can_change_colors() return TRUE or FALSE. alloc_pair() and |
| 92 | find_pair() return a pair number, or -1 on error. | ||
| 82 | 93 | ||
| 83 | ### Portability | 94 | ### Portability |
| 84 | X/Open ncurses NetBSD | 95 | X/Open ncurses NetBSD |
| @@ -89,7 +100,10 @@ color | |||
| 89 | can_change_color Y Y Y | 100 | can_change_color Y Y Y |
| 90 | init_color Y Y Y | 101 | init_color Y Y Y |
| 91 | color_content Y Y Y | 102 | color_content Y Y Y |
| 103 | alloc_pair - Y - | ||
| 92 | assume_default_colors - Y Y | 104 | assume_default_colors - Y Y |
| 105 | find_pair - Y - | ||
| 106 | free_pair - Y - | ||
| 93 | use_default_colors - Y Y | 107 | use_default_colors - Y Y |
| 94 | PDC_set_line_color - - - | 108 | PDC_set_line_color - - - |
| 95 | 109 | ||
| @@ -101,11 +115,9 @@ color | |||
| 101 | int COLORS = 0; | 115 | int COLORS = 0; |
| 102 | int COLOR_PAIRS = PDC_COLOR_PAIRS; | 116 | int COLOR_PAIRS = PDC_COLOR_PAIRS; |
| 103 | 117 | ||
| 104 | /* pair_set[] tracks whether a pair has been set via init_pair() */ | ||
| 105 | |||
| 106 | static bool pair_set[PDC_COLOR_PAIRS]; | ||
| 107 | static bool default_colors = FALSE; | 118 | static bool default_colors = FALSE; |
| 108 | static short first_col = 0; | 119 | static short first_col = 0; |
| 120 | static int allocnum = 0; | ||
| 109 | 121 | ||
| 110 | int start_color(void) | 122 | int start_color(void) |
| 111 | { | 123 | { |
| @@ -123,8 +135,6 @@ int start_color(void) | |||
| 123 | 135 | ||
| 124 | PDC_init_atrtab(); | 136 | PDC_init_atrtab(); |
| 125 | 137 | ||
| 126 | memset(pair_set, 0, PDC_COLOR_PAIRS); | ||
| 127 | |||
| 128 | return OK; | 138 | return OK; |
| 129 | } | 139 | } |
| 130 | 140 | ||
| @@ -137,13 +147,9 @@ static void _normalize(short *fg, short *bg) | |||
| 137 | *bg = SP->orig_attr ? SP->orig_back : COLOR_BLACK; | 147 | *bg = SP->orig_attr ? SP->orig_back : COLOR_BLACK; |
| 138 | } | 148 | } |
| 139 | 149 | ||
| 140 | int init_pair(short pair, short fg, short bg) | 150 | static void _init_pair_core(short pair, short fg, short bg) |
| 141 | { | 151 | { |
| 142 | PDC_LOG(("init_pair() - called: pair %d fg %d bg %d\n", pair, fg, bg)); | 152 | PDC_PAIR *p = SP->atrtab + pair; |
| 143 | |||
| 144 | if (!SP || !SP->color_started || pair < 1 || pair >= COLOR_PAIRS || | ||
| 145 | fg < first_col || fg >= COLORS || bg < first_col || bg >= COLORS) | ||
| 146 | return ERR; | ||
| 147 | 153 | ||
| 148 | _normalize(&fg, &bg); | 154 | _normalize(&fg, &bg); |
| 149 | 155 | ||
| @@ -151,19 +157,27 @@ int init_pair(short pair, short fg, short bg) | |||
| 151 | curscr if this call to init_pair() alters a color pair created by | 157 | curscr if this call to init_pair() alters a color pair created by |
| 152 | the user. */ | 158 | the user. */ |
| 153 | 159 | ||
| 154 | if (pair_set[pair]) | 160 | if (p->set) |
| 155 | { | 161 | { |
| 156 | short oldfg, oldbg; | 162 | if (p->f != fg || p->b != bg) |
| 157 | |||
| 158 | PDC_pair_content(pair, &oldfg, &oldbg); | ||
| 159 | |||
| 160 | if (oldfg != fg || oldbg != bg) | ||
| 161 | curscr->_clear = TRUE; | 163 | curscr->_clear = TRUE; |
| 162 | } | 164 | } |
| 163 | 165 | ||
| 164 | PDC_init_pair(pair, fg, bg); | 166 | p->f = fg; |
| 167 | p->b = bg; | ||
| 168 | p->count = allocnum++; | ||
| 169 | p->set = TRUE; | ||
| 170 | } | ||
| 171 | |||
| 172 | int init_pair(short pair, short fg, short bg) | ||
| 173 | { | ||
| 174 | PDC_LOG(("init_pair() - called: pair %d fg %d bg %d\n", pair, fg, bg)); | ||
| 175 | |||
| 176 | if (!SP || !SP->color_started || pair < 1 || pair >= COLOR_PAIRS || | ||
| 177 | fg < first_col || fg >= COLORS || bg < first_col || bg >= COLORS) | ||
| 178 | return ERR; | ||
| 165 | 179 | ||
| 166 | pair_set[pair] = TRUE; | 180 | _init_pair_core(pair, fg, bg); |
| 167 | 181 | ||
| 168 | return OK; | 182 | return OK; |
| 169 | } | 183 | } |
| @@ -227,7 +241,10 @@ int pair_content(short pair, short *fg, short *bg) | |||
| 227 | if (pair < 0 || pair >= COLOR_PAIRS || !fg || !bg) | 241 | if (pair < 0 || pair >= COLOR_PAIRS || !fg || !bg) |
| 228 | return ERR; | 242 | return ERR; |
| 229 | 243 | ||
| 230 | return PDC_pair_content(pair, fg, bg); | 244 | *fg = SP->atrtab[pair].f; |
| 245 | *bg = SP->atrtab[pair].b; | ||
| 246 | |||
| 247 | return OK; | ||
| 231 | } | 248 | } |
| 232 | 249 | ||
| 233 | int assume_default_colors(int f, int b) | 250 | int assume_default_colors(int f, int b) |
| @@ -238,21 +255,7 @@ int assume_default_colors(int f, int b) | |||
| 238 | return ERR; | 255 | return ERR; |
| 239 | 256 | ||
| 240 | if (SP->color_started) | 257 | if (SP->color_started) |
| 241 | { | 258 | _init_pair_core(0, f, b); |
| 242 | short fg, bg, oldfg, oldbg; | ||
| 243 | |||
| 244 | fg = f; | ||
| 245 | bg = b; | ||
| 246 | |||
| 247 | _normalize(&fg, &bg); | ||
| 248 | |||
| 249 | PDC_pair_content(0, &oldfg, &oldbg); | ||
| 250 | |||
| 251 | if (oldfg != fg || oldbg != bg) | ||
| 252 | curscr->_clear = TRUE; | ||
| 253 | |||
| 254 | PDC_init_pair(0, fg, bg); | ||
| 255 | } | ||
| 256 | 259 | ||
| 257 | return OK; | 260 | return OK; |
| 258 | } | 261 | } |
| @@ -281,6 +284,7 @@ int PDC_set_line_color(short color) | |||
| 281 | 284 | ||
| 282 | void PDC_init_atrtab(void) | 285 | void PDC_init_atrtab(void) |
| 283 | { | 286 | { |
| 287 | PDC_PAIR *p = SP->atrtab; | ||
| 284 | short i, fg, bg; | 288 | short i, fg, bg; |
| 285 | 289 | ||
| 286 | if (SP->color_started && !default_colors) | 290 | if (SP->color_started && !default_colors) |
| @@ -294,5 +298,65 @@ void PDC_init_atrtab(void) | |||
| 294 | _normalize(&fg, &bg); | 298 | _normalize(&fg, &bg); |
| 295 | 299 | ||
| 296 | for (i = 0; i < PDC_COLOR_PAIRS; i++) | 300 | for (i = 0; i < PDC_COLOR_PAIRS; i++) |
| 297 | PDC_init_pair(i, fg, bg); | 301 | { |
| 302 | p[i].f = fg; | ||
| 303 | p[i].b = bg; | ||
| 304 | p[i].set = FALSE; | ||
| 305 | } | ||
| 306 | } | ||
| 307 | |||
| 308 | int free_pair(int pair) | ||
| 309 | { | ||
| 310 | if (pair < 1 || pair >= PDC_COLOR_PAIRS || !(SP->atrtab[pair].set)) | ||
| 311 | return ERR; | ||
| 312 | |||
| 313 | SP->atrtab[pair].set = FALSE; | ||
| 314 | return OK; | ||
| 315 | } | ||
| 316 | |||
| 317 | int find_pair(int fg, int bg) | ||
| 318 | { | ||
| 319 | int i; | ||
| 320 | PDC_PAIR *p = SP->atrtab; | ||
| 321 | |||
| 322 | for (i = 0; i < PDC_COLOR_PAIRS; i++) | ||
| 323 | if (p[i].set && p[i].f == fg && p[i].b == bg) | ||
| 324 | return i; | ||
| 325 | |||
| 326 | return -1; | ||
| 327 | } | ||
| 328 | |||
| 329 | static int _find_oldest() | ||
| 330 | { | ||
| 331 | int i, lowind = 0, lowval = 0; | ||
| 332 | PDC_PAIR *p = SP->atrtab; | ||
| 333 | |||
| 334 | for (i = 1; i < PDC_COLOR_PAIRS; i++) | ||
| 335 | { | ||
| 336 | if (!p[i].set) | ||
| 337 | return i; | ||
| 338 | |||
| 339 | if (!lowval || (p[i].count < lowval)) | ||
| 340 | { | ||
| 341 | lowind = i; | ||
| 342 | lowval = p[i].count; | ||
| 343 | } | ||
| 344 | } | ||
| 345 | |||
| 346 | return lowind; | ||
| 347 | } | ||
| 348 | |||
| 349 | int alloc_pair(int fg, int bg) | ||
| 350 | { | ||
| 351 | int i = find_pair(fg, bg); | ||
| 352 | |||
| 353 | if (-1 == i) | ||
| 354 | { | ||
| 355 | i = _find_oldest(); | ||
| 356 | |||
| 357 | if (ERR == init_pair(i, fg, bg)) | ||
| 358 | return -1; | ||
| 359 | } | ||
| 360 | |||
| 361 | return i; | ||
| 298 | } | 362 | } |
diff --git a/scripts/kconfig/libcurses/curses.h b/scripts/kconfig/libcurses/curses.h index b5b91fda3..e4ba3776a 100644 --- a/scripts/kconfig/libcurses/curses.h +++ b/scripts/kconfig/libcurses/curses.h | |||
| @@ -9,26 +9,26 @@ | |||
| 9 | 9 | ||
| 10 | Define before inclusion (only those needed): | 10 | Define before inclusion (only those needed): |
| 11 | 11 | ||
| 12 | XCURSES True if compiling for X11. | 12 | XCURSES if building / built for X11 |
| 13 | PDC_RGB True if you want to use RGB color definitions | 13 | PDC_RGB if you want to use RGB color definitions |
| 14 | (Red = 1, Green = 2, Blue = 4) instead of BGR. | 14 | (Red = 1, Green = 2, Blue = 4) instead of BGR |
| 15 | PDC_WIDE True if building wide-character support. | 15 | PDC_WIDE if building / built with wide-character support |
| 16 | PDC_DLL_BUILD True if building a Windows DLL. | 16 | PDC_DLL_BUILD if building / built as a Windows DLL |
| 17 | PDC_NCMOUSE Use the ncurses mouse API instead | 17 | PDC_NCMOUSE to use the ncurses mouse API instead |
| 18 | of PDCurses' traditional mouse API. | 18 | of PDCurses' traditional mouse API |
| 19 | 19 | ||
| 20 | Defined by this header: | 20 | Defined by this header: |
| 21 | 21 | ||
| 22 | PDCURSES Enables access to PDCurses-only routines. | 22 | PDCURSES PDCurses-only features are available |
| 23 | PDC_BUILD Defines API build version. | 23 | PDC_BUILD API build version |
| 24 | PDC_VER_MAJOR Major version number | 24 | PDC_VER_MAJOR major version number |
| 25 | PDC_VER_MINOR Minor version number | 25 | PDC_VER_MINOR minor version number |
| 26 | PDC_VERDOT Version string | 26 | PDC_VERDOT version string |
| 27 | 27 | ||
| 28 | **man-end****************************************************************/ | 28 | **man-end****************************************************************/ |
| 29 | 29 | ||
| 30 | #define PDCURSES 1 | 30 | #define PDCURSES 1 |
| 31 | #define PDC_BUILD 3900 | 31 | #define PDC_BUILD 3907 |
| 32 | #define PDC_VER_MAJOR 3 | 32 | #define PDC_VER_MAJOR 3 |
| 33 | #define PDC_VER_MINOR 9 | 33 | #define PDC_VER_MINOR 9 |
| 34 | #define PDC_VERDOT "3.9" | 34 | #define PDC_VERDOT "3.9" |
| @@ -300,8 +300,29 @@ typedef struct _win /* definition of a window */ | |||
| 300 | int _delayms; /* milliseconds of delay for getch() */ | 300 | int _delayms; /* milliseconds of delay for getch() */ |
| 301 | int _parx, _pary; /* coords relative to parent (0,0) */ | 301 | int _parx, _pary; /* coords relative to parent (0,0) */ |
| 302 | struct _win *_parent; /* subwin's pointer to parent win */ | 302 | struct _win *_parent; /* subwin's pointer to parent win */ |
| 303 | |||
| 304 | /* these are used only if this is a pad */ | ||
| 305 | struct pdat | ||
| 306 | { | ||
| 307 | int _pad_y; | ||
| 308 | int _pad_x; | ||
| 309 | int _pad_top; | ||
| 310 | int _pad_left; | ||
| 311 | int _pad_bottom; | ||
| 312 | int _pad_right; | ||
| 313 | } _pad; /* Pad-properties structure */ | ||
| 303 | } WINDOW; | 314 | } WINDOW; |
| 304 | 315 | ||
| 316 | /* Color pair structure */ | ||
| 317 | |||
| 318 | typedef struct | ||
| 319 | { | ||
| 320 | short f; /* foreground color */ | ||
| 321 | short b; /* background color */ | ||
| 322 | int count; /* allocation order */ | ||
| 323 | bool set; /* pair has been set */ | ||
| 324 | } PDC_PAIR; | ||
| 325 | |||
| 305 | /* Avoid using the SCREEN struct directly -- use the corresponding | 326 | /* Avoid using the SCREEN struct directly -- use the corresponding |
| 306 | functions if possible. This struct may eventually be made private. */ | 327 | functions if possible. This struct may eventually be made private. */ |
| 307 | 328 | ||
| @@ -347,15 +368,6 @@ typedef struct | |||
| 347 | bool key_code; /* TRUE if last key is a special key; | 368 | bool key_code; /* TRUE if last key is a special key; |
| 348 | used internally by get_wch() */ | 369 | used internally by get_wch() */ |
| 349 | MOUSE_STATUS mouse_status; /* last returned mouse status */ | 370 | MOUSE_STATUS mouse_status; /* last returned mouse status */ |
| 350 | #ifdef XCURSES | ||
| 351 | bool sb_on; | ||
| 352 | int sb_viewport_y; | ||
| 353 | int sb_viewport_x; | ||
| 354 | int sb_total_y; | ||
| 355 | int sb_total_x; | ||
| 356 | int sb_cur_y; | ||
| 357 | int sb_cur_x; | ||
| 358 | #endif | ||
| 359 | short line_color; /* color of line attributes - default -1 */ | 371 | short line_color; /* color of line attributes - default -1 */ |
| 360 | attr_t termattrs; /* attribute capabilities */ | 372 | attr_t termattrs; /* attribute capabilities */ |
| 361 | WINDOW *lastscr; /* the last screen image */ | 373 | WINDOW *lastscr; /* the last screen image */ |
| @@ -364,6 +376,13 @@ typedef struct | |||
| 364 | bool dirty; /* redraw on napms() after init_color() */ | 376 | bool dirty; /* redraw on napms() after init_color() */ |
| 365 | int sel_start; /* start of selection (y * COLS + x) */ | 377 | int sel_start; /* start of selection (y * COLS + x) */ |
| 366 | int sel_end; /* end of selection */ | 378 | int sel_end; /* end of selection */ |
| 379 | int *c_buffer; /* character buffer */ | ||
| 380 | int c_pindex; /* putter index */ | ||
| 381 | int c_gindex; /* getter index */ | ||
| 382 | int *c_ungch; /* array of ungotten chars */ | ||
| 383 | int c_ungind; /* ungetch() push index */ | ||
| 384 | int c_ungmax; /* allocated size of ungetch() buffer */ | ||
| 385 | PDC_PAIR *atrtab; /* table of color pairs */ | ||
| 367 | } SCREEN; | 386 | } SCREEN; |
| 368 | 387 | ||
| 369 | /*---------------------------------------------------------------------- | 388 | /*---------------------------------------------------------------------- |
| @@ -1275,14 +1294,29 @@ PDCEX mmask_t getmouse(void); | |||
| 1275 | 1294 | ||
| 1276 | /* ncurses */ | 1295 | /* ncurses */ |
| 1277 | 1296 | ||
| 1297 | PDCEX int alloc_pair(int, int); | ||
| 1278 | PDCEX int assume_default_colors(int, int); | 1298 | PDCEX int assume_default_colors(int, int); |
| 1279 | PDCEX const char *curses_version(void); | 1299 | PDCEX const char *curses_version(void); |
| 1300 | PDCEX int find_pair(int, int); | ||
| 1301 | PDCEX int free_pair(int); | ||
| 1280 | PDCEX bool has_key(int); | 1302 | PDCEX bool has_key(int); |
| 1303 | PDCEX bool is_cleared(const WINDOW *); | ||
| 1304 | PDCEX bool is_idcok(const WINDOW *); | ||
| 1305 | PDCEX bool is_idlok(const WINDOW *); | ||
| 1306 | PDCEX bool is_immedok(const WINDOW *); | ||
| 1281 | PDCEX bool is_keypad(const WINDOW *); | 1307 | PDCEX bool is_keypad(const WINDOW *); |
| 1282 | PDCEX bool is_leaveok(const WINDOW *); | 1308 | PDCEX bool is_leaveok(const WINDOW *); |
| 1309 | PDCEX bool is_nodelay(const WINDOW *); | ||
| 1310 | PDCEX bool is_notimeout(const WINDOW *); | ||
| 1283 | PDCEX bool is_pad(const WINDOW *); | 1311 | PDCEX bool is_pad(const WINDOW *); |
| 1312 | PDCEX bool is_scrollok(const WINDOW *); | ||
| 1313 | PDCEX bool is_subwin(const WINDOW *); | ||
| 1314 | PDCEX bool is_syncok(const WINDOW *); | ||
| 1284 | PDCEX int set_tabsize(int); | 1315 | PDCEX int set_tabsize(int); |
| 1285 | PDCEX int use_default_colors(void); | 1316 | PDCEX int use_default_colors(void); |
| 1317 | PDCEX int wgetdelay(const WINDOW *); | ||
| 1318 | PDCEX WINDOW *wgetparent(const WINDOW *); | ||
| 1319 | PDCEX int wgetscrreg(const WINDOW *, int *, int *); | ||
| 1286 | PDCEX int wresize(WINDOW *, int, int); | 1320 | PDCEX int wresize(WINDOW *, int, int); |
| 1287 | 1321 | ||
| 1288 | PDCEX bool has_mouse(void); | 1322 | PDCEX bool has_mouse(void); |
| @@ -1331,7 +1365,6 @@ PDCEX int PDC_freeclipboard(char *); | |||
| 1331 | PDCEX int PDC_getclipboard(char **, long *); | 1365 | PDCEX int PDC_getclipboard(char **, long *); |
| 1332 | PDCEX int PDC_setclipboard(const char *, long); | 1366 | PDCEX int PDC_setclipboard(const char *, long); |
| 1333 | 1367 | ||
| 1334 | PDCEX unsigned long PDC_get_input_fd(void); | ||
| 1335 | PDCEX unsigned long PDC_get_key_modifiers(void); | 1368 | PDCEX unsigned long PDC_get_key_modifiers(void); |
| 1336 | PDCEX int PDC_return_key_modifiers(bool); | 1369 | PDCEX int PDC_return_key_modifiers(bool); |
| 1337 | 1370 | ||
| @@ -1381,6 +1414,7 @@ PDCEX int wunderscore(WINDOW *); | |||
| 1381 | /* Deprecated */ | 1414 | /* Deprecated */ |
| 1382 | 1415 | ||
| 1383 | #define PDC_save_key_modifiers(x) (OK) | 1416 | #define PDC_save_key_modifiers(x) (OK) |
| 1417 | #define PDC_get_input_fd() 0 | ||
| 1384 | 1418 | ||
| 1385 | /* return codes from PDC_getclipboard() and PDC_setclipboard() calls */ | 1419 | /* return codes from PDC_getclipboard() and PDC_setclipboard() calls */ |
| 1386 | 1420 | ||
diff --git a/scripts/kconfig/libcurses/curspriv.h b/scripts/kconfig/libcurses/curspriv.h index 8bb712a8e..5a6ec1550 100644 --- a/scripts/kconfig/libcurses/curspriv.h +++ b/scripts/kconfig/libcurses/curspriv.h | |||
| @@ -7,16 +7,23 @@ | |||
| 7 | #define CURSES_LIBRARY | 7 | #define CURSES_LIBRARY |
| 8 | #include "curses.h" | 8 | #include "curses.h" |
| 9 | 9 | ||
| 10 | #ifdef __cplusplus | ||
| 11 | extern "C" { | ||
| 12 | #endif | ||
| 13 | |||
| 10 | #if defined(__TURBOC__) || defined(__EMX__) || defined(__DJGPP__) || \ | 14 | #if defined(__TURBOC__) || defined(__EMX__) || defined(__DJGPP__) || \ |
| 11 | defined(PDC_99) || defined(__WATCOMC__) | 15 | defined(PDC_99) || defined(__WATCOMC__) |
| 12 | # ifndef HAVE_VSSCANF | 16 | # ifndef HAVE_VSSCANF |
| 13 | # define HAVE_VSSCANF /* have vsscanf() */ | 17 | # define HAVE_VSSCANF 1 /* have vsscanf() */ |
| 14 | # endif | 18 | # endif |
| 15 | #endif | 19 | #endif |
| 16 | 20 | ||
| 17 | #if defined(PDC_99) || defined(__WATCOMC__) | 21 | #if defined(PDC_99) || defined(__WATCOMC__) |
| 22 | # ifndef HAVE_SNPRINTF | ||
| 23 | # define HAVE_SNPRINTF 1 /* have snprintf() */ | ||
| 24 | # endif | ||
| 18 | # ifndef HAVE_VSNPRINTF | 25 | # ifndef HAVE_VSNPRINTF |
| 19 | # define HAVE_VSNPRINTF /* have vsnprintf() */ | 26 | # define HAVE_VSNPRINTF 1 /* have vsnprintf() */ |
| 20 | # endif | 27 | # endif |
| 21 | #endif | 28 | #endif |
| 22 | 29 | ||
| @@ -51,6 +58,7 @@ bool PDC_can_change_color(void); | |||
| 51 | int PDC_color_content(short, short *, short *, short *); | 58 | int PDC_color_content(short, short *, short *, short *); |
| 52 | bool PDC_check_key(void); | 59 | bool PDC_check_key(void); |
| 53 | int PDC_curs_set(int); | 60 | int PDC_curs_set(int); |
| 61 | void PDC_doupdate(void); | ||
| 54 | void PDC_flushinp(void); | 62 | void PDC_flushinp(void); |
| 55 | int PDC_get_columns(void); | 63 | int PDC_get_columns(void); |
| 56 | int PDC_get_cursor_mode(void); | 64 | int PDC_get_cursor_mode(void); |
| @@ -59,19 +67,20 @@ int PDC_get_rows(void); | |||
| 59 | void PDC_gotoyx(int, int); | 67 | void PDC_gotoyx(int, int); |
| 60 | bool PDC_has_mouse(void); | 68 | bool PDC_has_mouse(void); |
| 61 | int PDC_init_color(short, short, short, short); | 69 | int PDC_init_color(short, short, short, short); |
| 62 | void PDC_init_pair(short, short, short); | ||
| 63 | int PDC_modifiers_set(void); | 70 | int PDC_modifiers_set(void); |
| 64 | int PDC_mouse_set(void); | 71 | int PDC_mouse_set(void); |
| 65 | void PDC_napms(int); | 72 | void PDC_napms(int); |
| 66 | int PDC_pair_content(short, short *, short *); | ||
| 67 | void PDC_reset_prog_mode(void); | 73 | void PDC_reset_prog_mode(void); |
| 68 | void PDC_reset_shell_mode(void); | 74 | void PDC_reset_shell_mode(void); |
| 69 | int PDC_resize_screen(int, int); | 75 | int PDC_resize_screen(int, int); |
| 70 | void PDC_restore_screen_mode(int); | 76 | void PDC_restore_screen_mode(int); |
| 71 | void PDC_save_screen_mode(int); | 77 | void PDC_save_screen_mode(int); |
| 78 | #ifdef XCURSES | ||
| 79 | void PDC_set_args(int, char **); | ||
| 80 | #endif | ||
| 72 | void PDC_scr_close(void); | 81 | void PDC_scr_close(void); |
| 73 | void PDC_scr_free(void); | 82 | void PDC_scr_free(void); |
| 74 | int PDC_scr_open(int, char **); | 83 | int PDC_scr_open(void); |
| 75 | void PDC_set_keyboard_binary(bool); | 84 | void PDC_set_keyboard_binary(bool); |
| 76 | void PDC_transform_line(int, int, int, const chtype *); | 85 | void PDC_transform_line(int, int, int, const chtype *); |
| 77 | const char *PDC_sysname(void); | 86 | const char *PDC_sysname(void); |
| @@ -100,8 +109,6 @@ size_t PDC_wcstombs(char *, const wchar_t *, size_t); | |||
| 100 | 109 | ||
| 101 | /* Internal macros for attributes */ | 110 | /* Internal macros for attributes */ |
| 102 | 111 | ||
| 103 | #define PDC_COLOR_PAIRS 256 | ||
| 104 | |||
| 105 | #ifndef max | 112 | #ifndef max |
| 106 | # define max(a,b) (((a) > (b)) ? (a) : (b)) | 113 | # define max(a,b) (((a) > (b)) ? (a) : (b)) |
| 107 | #endif | 114 | #endif |
| @@ -113,7 +120,14 @@ size_t PDC_wcstombs(char *, const wchar_t *, size_t); | |||
| 113 | 120 | ||
| 114 | #define PDC_CLICK_PERIOD 150 /* time to wait for a click, if | 121 | #define PDC_CLICK_PERIOD 150 /* time to wait for a click, if |
| 115 | not set by mouseinterval() */ | 122 | not set by mouseinterval() */ |
| 123 | #define PDC_COLOR_PAIRS 256 | ||
| 124 | #define PDC_MAXCOL 768 /* maximum possible COLORS; may be less */ | ||
| 125 | |||
| 126 | #define _INBUFSIZ 512 /* size of terminal input buffer */ | ||
| 127 | #define NUNGETCH 256 /* max # chars to ungetch() */ | ||
| 116 | 128 | ||
| 117 | #define PDC_MAXCOL 768 /* maximum possible COLORS; may be less */ | 129 | #ifdef __cplusplus |
| 130 | } | ||
| 131 | #endif | ||
| 118 | 132 | ||
| 119 | #endif /* __CURSES_INTERNALS__ */ | 133 | #endif /* __CURSES_INTERNALS__ */ |
diff --git a/scripts/kconfig/libcurses/getch.c b/scripts/kconfig/libcurses/getch.c index fa0c674b5..8719ca39c 100644 --- a/scripts/kconfig/libcurses/getch.c +++ b/scripts/kconfig/libcurses/getch.c | |||
| @@ -93,14 +93,6 @@ getch | |||
| 93 | 93 | ||
| 94 | #include <stdlib.h> | 94 | #include <stdlib.h> |
| 95 | 95 | ||
| 96 | #define _INBUFSIZ 512 /* size of terminal input buffer */ | ||
| 97 | #define NUNGETCH 256 /* max # chars to ungetch() */ | ||
| 98 | |||
| 99 | static int c_pindex = 0; /* putter index */ | ||
| 100 | static int c_gindex = 1; /* getter index */ | ||
| 101 | static int c_ungind = 0; /* ungetch() push index */ | ||
| 102 | static int c_ungch[NUNGETCH]; /* array of ungotten chars */ | ||
| 103 | |||
| 104 | static int _get_box(int *y_start, int *y_end, int *x_start, int *x_end) | 96 | static int _get_box(int *y_start, int *y_end, int *x_start, int *x_end) |
| 105 | { | 97 | { |
| 106 | int start, end; | 98 | int start, end; |
| @@ -166,7 +158,7 @@ static void _copy(void) | |||
| 166 | 158 | ||
| 167 | #ifdef PDC_WIDE | 159 | #ifdef PDC_WIDE |
| 168 | wtmp = malloc((len + 1) * sizeof(wchar_t)); | 160 | wtmp = malloc((len + 1) * sizeof(wchar_t)); |
| 169 | len *= 3; | 161 | len *= 4; |
| 170 | #endif | 162 | #endif |
| 171 | tmp = malloc(len + 1); | 163 | tmp = malloc(len + 1); |
| 172 | 164 | ||
| @@ -204,7 +196,7 @@ static int _paste(void) | |||
| 204 | # define PASTE paste | 196 | # define PASTE paste |
| 205 | #endif | 197 | #endif |
| 206 | char *paste; | 198 | char *paste; |
| 207 | long len; | 199 | long len, newmax; |
| 208 | int key; | 200 | int key; |
| 209 | 201 | ||
| 210 | key = PDC_getclipboard(&paste, &len); | 202 | key = PDC_getclipboard(&paste, &len); |
| @@ -215,6 +207,14 @@ static int _paste(void) | |||
| 215 | wpaste = malloc(len * sizeof(wchar_t)); | 207 | wpaste = malloc(len * sizeof(wchar_t)); |
| 216 | len = PDC_mbstowcs(wpaste, paste, len); | 208 | len = PDC_mbstowcs(wpaste, paste, len); |
| 217 | #endif | 209 | #endif |
| 210 | newmax = len + SP->c_ungind; | ||
| 211 | if (newmax > SP->c_ungmax) | ||
| 212 | { | ||
| 213 | SP->c_ungch = realloc(SP->c_ungch, newmax * sizeof(int)); | ||
| 214 | if (!SP->c_ungch) | ||
| 215 | return -1; | ||
| 216 | SP->c_ungmax = newmax; | ||
| 217 | } | ||
| 218 | while (len > 1) | 218 | while (len > 1) |
| 219 | PDC_ungetch(PASTE[--len]); | 219 | PDC_ungetch(PASTE[--len]); |
| 220 | key = *PASTE; | 220 | key = *PASTE; |
| @@ -322,7 +322,6 @@ static int _mouse_key(void) | |||
| 322 | 322 | ||
| 323 | int wgetch(WINDOW *win) | 323 | int wgetch(WINDOW *win) |
| 324 | { | 324 | { |
| 325 | static int buffer[_INBUFSIZ]; /* character buffer */ | ||
| 326 | int key, waitcount; | 325 | int key, waitcount; |
| 327 | 326 | ||
| 328 | PDC_LOG(("wgetch() - called\n")); | 327 | PDC_LOG(("wgetch() - called\n")); |
| @@ -357,18 +356,18 @@ int wgetch(WINDOW *win) | |||
| 357 | 356 | ||
| 358 | /* if ungotten char exists, remove and return it */ | 357 | /* if ungotten char exists, remove and return it */ |
| 359 | 358 | ||
| 360 | if (c_ungind) | 359 | if (SP->c_ungind) |
| 361 | return c_ungch[--c_ungind]; | 360 | return SP->c_ungch[--(SP->c_ungind)]; |
| 362 | 361 | ||
| 363 | /* if normal and data in buffer */ | 362 | /* if normal and data in buffer */ |
| 364 | 363 | ||
| 365 | if ((!SP->raw_inp && !SP->cbreak) && (c_gindex < c_pindex)) | 364 | if ((!SP->raw_inp && !SP->cbreak) && (SP->c_gindex < SP->c_pindex)) |
| 366 | return buffer[c_gindex++]; | 365 | return SP->c_buffer[SP->c_gindex++]; |
| 367 | 366 | ||
| 368 | /* prepare to buffer data */ | 367 | /* prepare to buffer data */ |
| 369 | 368 | ||
| 370 | c_pindex = 0; | 369 | SP->c_pindex = 0; |
| 371 | c_gindex = 0; | 370 | SP->c_gindex = 0; |
| 372 | 371 | ||
| 373 | /* to get here, no keys are buffered. go and get one. */ | 372 | /* to get here, no keys are buffered. go and get one. */ |
| 374 | 373 | ||
| @@ -453,17 +452,17 @@ int wgetch(WINDOW *win) | |||
| 453 | 452 | ||
| 454 | if (key == '\b') | 453 | if (key == '\b') |
| 455 | { | 454 | { |
| 456 | if (c_pindex > c_gindex) | 455 | if (SP->c_pindex > SP->c_gindex) |
| 457 | c_pindex--; | 456 | SP->c_pindex--; |
| 458 | } | 457 | } |
| 459 | else | 458 | else |
| 460 | if (c_pindex < _INBUFSIZ - 2) | 459 | if (SP->c_pindex < _INBUFSIZ - 2) |
| 461 | buffer[c_pindex++] = key; | 460 | SP->c_buffer[SP->c_pindex++] = key; |
| 462 | 461 | ||
| 463 | /* if we got a line */ | 462 | /* if we got a line */ |
| 464 | 463 | ||
| 465 | if (key == '\n' || key == '\r') | 464 | if (key == '\n' || key == '\r') |
| 466 | return buffer[c_gindex++]; | 465 | return SP->c_buffer[SP->c_gindex++]; |
| 467 | } | 466 | } |
| 468 | } | 467 | } |
| 469 | 468 | ||
| @@ -491,10 +490,10 @@ int PDC_ungetch(int ch) | |||
| 491 | { | 490 | { |
| 492 | PDC_LOG(("ungetch() - called\n")); | 491 | PDC_LOG(("ungetch() - called\n")); |
| 493 | 492 | ||
| 494 | if (c_ungind >= NUNGETCH) /* pushback stack full */ | 493 | if (SP->c_ungind >= SP->c_ungmax) /* pushback stack full */ |
| 495 | return ERR; | 494 | return ERR; |
| 496 | 495 | ||
| 497 | c_ungch[c_ungind++] = ch; | 496 | SP->c_ungch[SP->c_ungind++] = ch; |
| 498 | 497 | ||
| 499 | return OK; | 498 | return OK; |
| 500 | } | 499 | } |
| @@ -503,11 +502,14 @@ int flushinp(void) | |||
| 503 | { | 502 | { |
| 504 | PDC_LOG(("flushinp() - called\n")); | 503 | PDC_LOG(("flushinp() - called\n")); |
| 505 | 504 | ||
| 505 | if (!SP) | ||
| 506 | return ERR; | ||
| 507 | |||
| 506 | PDC_flushinp(); | 508 | PDC_flushinp(); |
| 507 | 509 | ||
| 508 | c_gindex = 1; /* set indices to kill buffer */ | 510 | SP->c_gindex = 1; /* set indices to kill buffer */ |
| 509 | c_pindex = 0; | 511 | SP->c_pindex = 0; |
| 510 | c_ungind = 0; /* clear c_ungch array */ | 512 | SP->c_ungind = 0; /* clear SP->c_ungch array */ |
| 511 | 513 | ||
| 512 | return OK; | 514 | return OK; |
| 513 | } | 515 | } |
diff --git a/scripts/kconfig/libcurses/initscr.c b/scripts/kconfig/libcurses/initscr.c index be0b2a066..66940a3cf 100644 --- a/scripts/kconfig/libcurses/initscr.c +++ b/scripts/kconfig/libcurses/initscr.c | |||
| @@ -10,7 +10,7 @@ initscr | |||
| 10 | ### Synopsis | 10 | ### Synopsis |
| 11 | 11 | ||
| 12 | WINDOW *initscr(void); | 12 | WINDOW *initscr(void); |
| 13 | WINDOW *Xinitscr(int argc, char *argv[]); | 13 | WINDOW *Xinitscr(int argc, char **argv); |
| 14 | int endwin(void); | 14 | int endwin(void); |
| 15 | bool isendwin(void); | 15 | bool isendwin(void); |
| 16 | SCREEN *newterm(const char *type, FILE *outfd, FILE *infd); | 16 | SCREEN *newterm(const char *type, FILE *outfd, FILE *infd); |
| @@ -116,19 +116,20 @@ MOUSE_STATUS Mouse_status; | |||
| 116 | extern RIPPEDOFFLINE linesripped[5]; | 116 | extern RIPPEDOFFLINE linesripped[5]; |
| 117 | extern char linesrippedoff; | 117 | extern char linesrippedoff; |
| 118 | 118 | ||
| 119 | #ifndef XCURSES | 119 | WINDOW *initscr(void) |
| 120 | static | ||
| 121 | #endif | ||
| 122 | WINDOW *Xinitscr(int argc, char *argv[]) | ||
| 123 | { | 120 | { |
| 124 | int i; | 121 | int i; |
| 125 | 122 | ||
| 126 | PDC_LOG(("Xinitscr() - called\n")); | 123 | PDC_LOG(("initscr() - called\n")); |
| 127 | 124 | ||
| 128 | if (SP && SP->alive) | 125 | if (SP && SP->alive) |
| 129 | return NULL; | 126 | return NULL; |
| 130 | 127 | ||
| 131 | if (PDC_scr_open(argc, argv) == ERR) | 128 | SP = calloc(1, sizeof(SCREEN)); |
| 129 | if (!SP) | ||
| 130 | return NULL; | ||
| 131 | |||
| 132 | if (PDC_scr_open() == ERR) | ||
| 132 | { | 133 | { |
| 133 | fprintf(stderr, "initscr(): Unable to create SP\n"); | 134 | fprintf(stderr, "initscr(): Unable to create SP\n"); |
| 134 | exit(8); | 135 | exit(8); |
| @@ -157,8 +158,8 @@ WINDOW *Xinitscr(int argc, char *argv[]) | |||
| 157 | 158 | ||
| 158 | SP->orig_cursor = PDC_get_cursor_mode(); | 159 | SP->orig_cursor = PDC_get_cursor_mode(); |
| 159 | 160 | ||
| 160 | LINES = SP->lines; | 161 | LINES = SP->lines = PDC_get_rows(); |
| 161 | COLS = SP->cols; | 162 | COLS = SP->cols = PDC_get_columns(); |
| 162 | 163 | ||
| 163 | if (LINES < 2 || COLS < 2) | 164 | if (LINES < 2 || COLS < 2) |
| 164 | { | 165 | { |
| @@ -225,6 +226,9 @@ WINDOW *Xinitscr(int argc, char *argv[]) | |||
| 225 | else | 226 | else |
| 226 | curscr->_clear = TRUE; | 227 | curscr->_clear = TRUE; |
| 227 | 228 | ||
| 229 | SP->atrtab = calloc(PDC_COLOR_PAIRS, sizeof(PDC_PAIR)); | ||
| 230 | if (!SP->atrtab) | ||
| 231 | return NULL; | ||
| 228 | PDC_init_atrtab(); /* set up default colors */ | 232 | PDC_init_atrtab(); /* set up default colors */ |
| 229 | 233 | ||
| 230 | MOUSE_X_POS = MOUSE_Y_POS = -1; | 234 | MOUSE_X_POS = MOUSE_Y_POS = -1; |
| @@ -239,15 +243,30 @@ WINDOW *Xinitscr(int argc, char *argv[]) | |||
| 239 | 243 | ||
| 240 | sprintf(ttytype, "pdcurses|PDCurses for %s", PDC_sysname()); | 244 | sprintf(ttytype, "pdcurses|PDCurses for %s", PDC_sysname()); |
| 241 | 245 | ||
| 246 | SP->c_buffer = malloc(_INBUFSIZ * sizeof(int)); | ||
| 247 | if (!SP->c_buffer) | ||
| 248 | return NULL; | ||
| 249 | SP->c_pindex = 0; | ||
| 250 | SP->c_gindex = 1; | ||
| 251 | |||
| 252 | SP->c_ungch = malloc(NUNGETCH * sizeof(int)); | ||
| 253 | if (!SP->c_ungch) | ||
| 254 | return NULL; | ||
| 255 | SP->c_ungind = 0; | ||
| 256 | SP->c_ungmax = NUNGETCH; | ||
| 257 | |||
| 242 | return stdscr; | 258 | return stdscr; |
| 243 | } | 259 | } |
| 244 | 260 | ||
| 245 | WINDOW *initscr(void) | 261 | #ifdef XCURSES |
| 262 | WINDOW *Xinitscr(int argc, char **argv) | ||
| 246 | { | 263 | { |
| 247 | PDC_LOG(("initscr() - called\n")); | 264 | PDC_LOG(("Xinitscr() - called\n")); |
| 248 | 265 | ||
| 249 | return Xinitscr(0, NULL); | 266 | PDC_set_args(argc, argv); |
| 267 | return initscr(); | ||
| 250 | } | 268 | } |
| 269 | #endif | ||
| 251 | 270 | ||
| 252 | int endwin(void) | 271 | int endwin(void) |
| 253 | { | 272 | { |
| @@ -274,7 +293,7 @@ SCREEN *newterm(const char *type, FILE *outfd, FILE *infd) | |||
| 274 | { | 293 | { |
| 275 | PDC_LOG(("newterm() - called\n")); | 294 | PDC_LOG(("newterm() - called\n")); |
| 276 | 295 | ||
| 277 | return Xinitscr(0, NULL) ? SP : NULL; | 296 | return initscr() ? SP : NULL; |
| 278 | } | 297 | } |
| 279 | 298 | ||
| 280 | SCREEN *set_term(SCREEN *new) | 299 | SCREEN *set_term(SCREEN *new) |
| @@ -290,9 +309,13 @@ void delscreen(SCREEN *sp) | |||
| 290 | { | 309 | { |
| 291 | PDC_LOG(("delscreen() - called\n")); | 310 | PDC_LOG(("delscreen() - called\n")); |
| 292 | 311 | ||
| 293 | if (sp != SP) | 312 | if (!SP || sp != SP) |
| 294 | return; | 313 | return; |
| 295 | 314 | ||
| 315 | free(SP->c_ungch); | ||
| 316 | free(SP->c_buffer); | ||
| 317 | free(SP->atrtab); | ||
| 318 | |||
| 296 | PDC_slk_free(); /* free the soft label keys, if needed */ | 319 | PDC_slk_free(); /* free the soft label keys, if needed */ |
| 297 | 320 | ||
| 298 | delwin(stdscr); | 321 | delwin(stdscr); |
| @@ -304,8 +327,9 @@ void delscreen(SCREEN *sp) | |||
| 304 | 327 | ||
| 305 | SP->alive = FALSE; | 328 | SP->alive = FALSE; |
| 306 | 329 | ||
| 307 | PDC_scr_free(); /* free SP */ | 330 | PDC_scr_free(); |
| 308 | 331 | ||
| 332 | free(SP); | ||
| 309 | SP = (SCREEN *)NULL; | 333 | SP = (SCREEN *)NULL; |
| 310 | } | 334 | } |
| 311 | 335 | ||
| @@ -316,10 +340,17 @@ int resize_term(int nlines, int ncols) | |||
| 316 | if (!stdscr || PDC_resize_screen(nlines, ncols) == ERR) | 340 | if (!stdscr || PDC_resize_screen(nlines, ncols) == ERR) |
| 317 | return ERR; | 341 | return ERR; |
| 318 | 342 | ||
| 343 | SP->resized = FALSE; | ||
| 344 | |||
| 319 | SP->lines = PDC_get_rows(); | 345 | SP->lines = PDC_get_rows(); |
| 320 | LINES = SP->lines - SP->linesrippedoff - SP->slklines; | 346 | LINES = SP->lines - SP->linesrippedoff - SP->slklines; |
| 321 | SP->cols = COLS = PDC_get_columns(); | 347 | SP->cols = COLS = PDC_get_columns(); |
| 322 | 348 | ||
| 349 | if (SP->cursrow >= SP->lines) | ||
| 350 | SP->cursrow = SP->lines - 1; | ||
| 351 | if (SP->curscol >= SP->cols) | ||
| 352 | SP->curscol = SP->cols - 1; | ||
| 353 | |||
| 323 | if (wresize(curscr, SP->lines, SP->cols) == ERR || | 354 | if (wresize(curscr, SP->lines, SP->cols) == ERR || |
| 324 | wresize(stdscr, LINES, COLS) == ERR || | 355 | wresize(stdscr, LINES, COLS) == ERR || |
| 325 | wresize(SP->lastscr, SP->lines, SP->cols) == ERR) | 356 | wresize(SP->lastscr, SP->lines, SP->cols) == ERR) |
diff --git a/scripts/kconfig/libcurses/inopts.c b/scripts/kconfig/libcurses/inopts.c index 918b7d1af..30e18f611 100644 --- a/scripts/kconfig/libcurses/inopts.c +++ b/scripts/kconfig/libcurses/inopts.c | |||
| @@ -27,12 +27,15 @@ inopts | |||
| 27 | void qiflush(void); | 27 | void qiflush(void); |
| 28 | void timeout(int delay); | 28 | void timeout(int delay); |
| 29 | void wtimeout(WINDOW *win, int delay); | 29 | void wtimeout(WINDOW *win, int delay); |
| 30 | int wgetdelay(const WINDOW *win); | ||
| 30 | int typeahead(int fildes); | 31 | int typeahead(int fildes); |
| 31 | 32 | ||
| 32 | int crmode(void); | 33 | int crmode(void); |
| 33 | int nocrmode(void); | 34 | int nocrmode(void); |
| 34 | 35 | ||
| 35 | bool is_keypad(const WINDOW *win); | 36 | bool is_keypad(const WINDOW *win); |
| 37 | bool is_nodelay(const WINDOW *win); | ||
| 38 | bool is_notimeout(const WINDOW *win); | ||
| 36 | 39 | ||
| 37 | ### Description | 40 | ### Description |
| 38 | 41 | ||
| @@ -83,6 +86,8 @@ inopts | |||
| 83 | delay is given; i.e., 1-99 will wait 50ms, 100-149 will wait 100ms, | 86 | delay is given; i.e., 1-99 will wait 50ms, 100-149 will wait 100ms, |
| 84 | etc. | 87 | etc. |
| 85 | 88 | ||
| 89 | wgetdelay() returns the delay timeout as set in wtimeout(). | ||
| 90 | |||
| 86 | intrflush(), notimeout(), noqiflush(), qiflush() and typeahead() do | 91 | intrflush(), notimeout(), noqiflush(), qiflush() and typeahead() do |
| 87 | nothing in PDCurses, but are included for compatibility with other | 92 | nothing in PDCurses, but are included for compatibility with other |
| 88 | curses implementations. | 93 | curses implementations. |
| @@ -92,10 +97,13 @@ inopts | |||
| 92 | 97 | ||
| 93 | is_keypad() reports whether the specified window is in keypad mode. | 98 | is_keypad() reports whether the specified window is in keypad mode. |
| 94 | 99 | ||
| 100 | is_nodelay() reports whether the specified window is in nodelay mode. | ||
| 101 | |||
| 95 | ### Return Value | 102 | ### Return Value |
| 96 | 103 | ||
| 97 | All functions except is_keypad() and the void functions return OK on | 104 | is_keypad() and is_nodelay() return TRUE or FALSE. is_notimeout() is |
| 98 | success and ERR on error. | 105 | provided for compatibility with other curses implementations, and |
| 106 | always returns FALSE. All others return OK on success and ERR on error. | ||
| 99 | 107 | ||
| 100 | ### Portability | 108 | ### Portability |
| 101 | X/Open ncurses NetBSD | 109 | X/Open ncurses NetBSD |
| @@ -117,10 +125,13 @@ inopts | |||
| 117 | qiflush Y Y Y | 125 | qiflush Y Y Y |
| 118 | timeout Y Y Y | 126 | timeout Y Y Y |
| 119 | wtimeout Y Y Y | 127 | wtimeout Y Y Y |
| 128 | wgetdelay - Y - | ||
| 120 | typeahead Y Y Y | 129 | typeahead Y Y Y |
| 121 | crmode Y Y Y | 130 | crmode Y Y Y |
| 122 | nocrmode Y Y Y | 131 | nocrmode Y Y Y |
| 123 | is_keypad - Y Y | 132 | is_keypad - Y Y |
| 133 | is_nodelay - Y - | ||
| 134 | is_notimeout - Y - | ||
| 124 | 135 | ||
| 125 | **man-end****************************************************************/ | 136 | **man-end****************************************************************/ |
| 126 | 137 | ||
| @@ -295,11 +306,11 @@ void qiflush(void) | |||
| 295 | PDC_LOG(("qiflush() - called\n")); | 306 | PDC_LOG(("qiflush() - called\n")); |
| 296 | } | 307 | } |
| 297 | 308 | ||
| 298 | int typeahead(int fildes) | 309 | void timeout(int delay) |
| 299 | { | 310 | { |
| 300 | PDC_LOG(("typeahead() - called\n")); | 311 | PDC_LOG(("timeout() - called\n")); |
| 301 | 312 | ||
| 302 | return OK; | 313 | wtimeout(stdscr, delay); |
| 303 | } | 314 | } |
| 304 | 315 | ||
| 305 | void wtimeout(WINDOW *win, int delay) | 316 | void wtimeout(WINDOW *win, int delay) |
| @@ -336,11 +347,21 @@ void wtimeout(WINDOW *win, int delay) | |||
| 336 | } | 347 | } |
| 337 | } | 348 | } |
| 338 | 349 | ||
| 339 | void timeout(int delay) | 350 | int wgetdelay(const WINDOW *win) |
| 340 | { | 351 | { |
| 341 | PDC_LOG(("timeout() - called\n")); | 352 | PDC_LOG(("wgetdelay() - called\n")); |
| 342 | 353 | ||
| 343 | wtimeout(stdscr, delay); | 354 | if (!win) |
| 355 | return 0; | ||
| 356 | |||
| 357 | return win->_delayms; | ||
| 358 | } | ||
| 359 | |||
| 360 | int typeahead(int fildes) | ||
| 361 | { | ||
| 362 | PDC_LOG(("typeahead() - called\n")); | ||
| 363 | |||
| 364 | return OK; | ||
| 344 | } | 365 | } |
| 345 | 366 | ||
| 346 | int crmode(void) | 367 | int crmode(void) |
| @@ -366,3 +387,22 @@ bool is_keypad(const WINDOW *win) | |||
| 366 | 387 | ||
| 367 | return win->_use_keypad; | 388 | return win->_use_keypad; |
| 368 | } | 389 | } |
| 390 | |||
| 391 | bool is_nodelay(const WINDOW *win) | ||
| 392 | { | ||
| 393 | PDC_LOG(("is_nodelay() - called\n")); | ||
| 394 | |||
| 395 | if (!win) | ||
| 396 | return FALSE; | ||
| 397 | |||
| 398 | return win->_nodelay; | ||
| 399 | } | ||
| 400 | |||
| 401 | bool is_notimeout(const WINDOW *win) | ||
| 402 | { | ||
| 403 | (void) win; | ||
| 404 | |||
| 405 | PDC_LOG(("is_notimeout() - called - returning FALSE...\n")); | ||
| 406 | |||
| 407 | return FALSE; | ||
| 408 | } | ||
diff --git a/scripts/kconfig/libcurses/outopts.c b/scripts/kconfig/libcurses/outopts.c index 28f93f1f2..e0a55e437 100644 --- a/scripts/kconfig/libcurses/outopts.c +++ b/scripts/kconfig/libcurses/outopts.c | |||
| @@ -16,11 +16,17 @@ outopts | |||
| 16 | int leaveok(WINDOW *win, bool bf); | 16 | int leaveok(WINDOW *win, bool bf); |
| 17 | int setscrreg(int top, int bot); | 17 | int setscrreg(int top, int bot); |
| 18 | int wsetscrreg(WINDOW *win, int top, int bot); | 18 | int wsetscrreg(WINDOW *win, int top, int bot); |
| 19 | int wgetscrreg(const WINDOW *win, int *top, int *bot); | ||
| 19 | int scrollok(WINDOW *win, bool bf); | 20 | int scrollok(WINDOW *win, bool bf); |
| 20 | 21 | ||
| 21 | int raw_output(bool bf); | 22 | int raw_output(bool bf); |
| 22 | 23 | ||
| 24 | bool is_cleared(const WINDOW *win); | ||
| 25 | bool is_idlok(const WINDOW *win); | ||
| 26 | bool is_idcok(const WINDOW *win); | ||
| 27 | bool is_immedok(const WINDOW *win); | ||
| 23 | bool is_leaveok(const WINDOW *win); | 28 | bool is_leaveok(const WINDOW *win); |
| 29 | bool is_scrollok(const WINDOW *win); | ||
| 24 | 30 | ||
| 25 | ### Description | 31 | ### Description |
| 26 | 32 | ||
| @@ -42,19 +48,31 @@ outopts | |||
| 42 | will cause all lines in the scrolling region to scroll up one line. | 48 | will cause all lines in the scrolling region to scroll up one line. |
| 43 | setscrreg() is the stdscr version. | 49 | setscrreg() is the stdscr version. |
| 44 | 50 | ||
| 51 | wgetscrreg() gets the top and bottom margins as set in wsetscrreg(). | ||
| 52 | |||
| 45 | idlok() and idcok() do nothing in PDCurses, but are provided for | 53 | idlok() and idcok() do nothing in PDCurses, but are provided for |
| 46 | compatibility with other curses implementations. | 54 | compatibility with other curses implementations, likewise is_idlok() |
| 55 | and is_idcok(). | ||
| 47 | 56 | ||
| 48 | raw_output() enables the output of raw characters using the standard | 57 | raw_output() enables the output of raw characters using the standard |
| 49 | *add* and *ins* curses functions (that is, it disables translation of | 58 | *add* and *ins* curses functions (that is, it disables translation of |
| 50 | control characters). | 59 | control characters). |
| 51 | 60 | ||
| 61 | is_cleared() reports whether the specified window causes clear at next | ||
| 62 | refresh. | ||
| 63 | |||
| 64 | is_immedok() reports whether the specified window is in immedok mode. | ||
| 65 | |||
| 52 | is_leaveok() reports whether the specified window is in leaveok mode. | 66 | is_leaveok() reports whether the specified window is in leaveok mode. |
| 53 | 67 | ||
| 68 | is_scrollok() reports whether the specified window allows scrolling. | ||
| 69 | |||
| 54 | ### Return Value | 70 | ### Return Value |
| 55 | 71 | ||
| 56 | All functions except is_leaveok() return OK on success and ERR on | 72 | is_cleared(), is_immedok(), is_leaveok() and is_scrollok() return TRUE |
| 57 | error. | 73 | or FALSE. is_idlok() and is_idcok() are provided for compatibility with |
| 74 | other curses implementations, and always return FALSE. All others | ||
| 75 | return OK on success and ERR on error. | ||
| 58 | 76 | ||
| 59 | ### Portability | 77 | ### Portability |
| 60 | X/Open ncurses NetBSD | 78 | X/Open ncurses NetBSD |
| @@ -65,8 +83,14 @@ outopts | |||
| 65 | leaveok Y Y Y | 83 | leaveok Y Y Y |
| 66 | setscrreg Y Y Y | 84 | setscrreg Y Y Y |
| 67 | wsetscrreg Y Y Y | 85 | wsetscrreg Y Y Y |
| 86 | wgetscrreg - Y - | ||
| 68 | scrollok Y Y Y | 87 | scrollok Y Y Y |
| 88 | is_cleared - Y - | ||
| 89 | is_idlok - Y - | ||
| 90 | is_idcok - Y - | ||
| 91 | is_immedok - Y - | ||
| 69 | is_leaveok - Y Y | 92 | is_leaveok - Y Y |
| 93 | is_scrollok - Y - | ||
| 70 | raw_output - - - | 94 | raw_output - - - |
| 71 | 95 | ||
| 72 | **man-end****************************************************************/ | 96 | **man-end****************************************************************/ |
| @@ -140,6 +164,19 @@ int wsetscrreg(WINDOW *win, int top, int bottom) | |||
| 140 | return ERR; | 164 | return ERR; |
| 141 | } | 165 | } |
| 142 | 166 | ||
| 167 | int wgetscrreg(const WINDOW *win, int *top, int *bot) | ||
| 168 | { | ||
| 169 | PDC_LOG(("wgetscrreg() - called\n")); | ||
| 170 | |||
| 171 | if (!win || !top || !bot) | ||
| 172 | return ERR; | ||
| 173 | |||
| 174 | *top = win->_tmarg; | ||
| 175 | *bot = win->_bmarg; | ||
| 176 | |||
| 177 | return OK; | ||
| 178 | } | ||
| 179 | |||
| 143 | int scrollok(WINDOW *win, bool bf) | 180 | int scrollok(WINDOW *win, bool bf) |
| 144 | { | 181 | { |
| 145 | PDC_LOG(("scrollok() - called\n")); | 182 | PDC_LOG(("scrollok() - called\n")); |
| @@ -164,6 +201,44 @@ int raw_output(bool bf) | |||
| 164 | return OK; | 201 | return OK; |
| 165 | } | 202 | } |
| 166 | 203 | ||
| 204 | bool is_cleared(const WINDOW *win) | ||
| 205 | { | ||
| 206 | PDC_LOG(("is_cleared() - called\n")); | ||
| 207 | |||
| 208 | if (!win) | ||
| 209 | return FALSE; | ||
| 210 | |||
| 211 | return win->_clear; | ||
| 212 | } | ||
| 213 | |||
| 214 | bool is_idlok(const WINDOW *win) | ||
| 215 | { | ||
| 216 | (void) win; | ||
| 217 | |||
| 218 | PDC_LOG(("is_idlok() - called\n")); | ||
| 219 | |||
| 220 | return FALSE; | ||
| 221 | } | ||
| 222 | |||
| 223 | bool is_idcok(const WINDOW *win) | ||
| 224 | { | ||
| 225 | (void) win; | ||
| 226 | |||
| 227 | PDC_LOG(("is_idcok() - called\n")); | ||
| 228 | |||
| 229 | return FALSE; | ||
| 230 | } | ||
| 231 | |||
| 232 | bool is_immedok(const WINDOW *win) | ||
| 233 | { | ||
| 234 | PDC_LOG(("is_immedok() - called\n")); | ||
| 235 | |||
| 236 | if (!win) | ||
| 237 | return FALSE; | ||
| 238 | |||
| 239 | return win->_immed; | ||
| 240 | } | ||
| 241 | |||
| 167 | bool is_leaveok(const WINDOW *win) | 242 | bool is_leaveok(const WINDOW *win) |
| 168 | { | 243 | { |
| 169 | PDC_LOG(("is_leaveok() - called\n")); | 244 | PDC_LOG(("is_leaveok() - called\n")); |
| @@ -173,3 +248,13 @@ bool is_leaveok(const WINDOW *win) | |||
| 173 | 248 | ||
| 174 | return win->_leaveit; | 249 | return win->_leaveit; |
| 175 | } | 250 | } |
| 251 | |||
| 252 | bool is_scrollok(const WINDOW *win) | ||
| 253 | { | ||
| 254 | PDC_LOG(("is_scrollok() - called\n")); | ||
| 255 | |||
| 256 | if (!win) | ||
| 257 | return FALSE; | ||
| 258 | |||
| 259 | return win->_scroll; | ||
| 260 | } | ||
diff --git a/scripts/kconfig/libcurses/pad.c b/scripts/kconfig/libcurses/pad.c index 5003ecbb4..3dfdfe5d6 100644 --- a/scripts/kconfig/libcurses/pad.c +++ b/scripts/kconfig/libcurses/pad.c | |||
| @@ -75,11 +75,6 @@ pad | |||
| 75 | 75 | ||
| 76 | #include <string.h> | 76 | #include <string.h> |
| 77 | 77 | ||
| 78 | /* save values for pechochar() */ | ||
| 79 | |||
| 80 | static int save_pminrow, save_pmincol; | ||
| 81 | static int save_sminrow, save_smincol, save_smaxrow, save_smaxcol; | ||
| 82 | |||
| 83 | WINDOW *newpad(int nlines, int ncols) | 78 | WINDOW *newpad(int nlines, int ncols) |
| 84 | { | 79 | { |
| 85 | WINDOW *win; | 80 | WINDOW *win; |
| @@ -96,16 +91,12 @@ WINDOW *newpad(int nlines, int ncols) | |||
| 96 | werase(win); | 91 | werase(win); |
| 97 | 92 | ||
| 98 | win->_flags = _PAD; | 93 | win->_flags = _PAD; |
| 99 | 94 | win->_pad._pad_y = 0; | |
| 100 | /* save default values in case pechochar() is the first call to | 95 | win->_pad._pad_x = 0; |
| 101 | prefresh(). */ | 96 | win->_pad._pad_top = 0; |
| 102 | 97 | win->_pad._pad_left = 0; | |
| 103 | save_pminrow = 0; | 98 | win->_pad._pad_bottom = min(LINES, nlines) - 1; |
| 104 | save_pmincol = 0; | 99 | win->_pad._pad_right = min(COLS, ncols) - 1; |
| 105 | save_sminrow = 0; | ||
| 106 | save_smincol = 0; | ||
| 107 | save_smaxrow = min(LINES, nlines) - 1; | ||
| 108 | save_smaxcol = min(COLS, ncols) - 1; | ||
| 109 | 100 | ||
| 110 | return win; | 101 | return win; |
| 111 | } | 102 | } |
| @@ -151,16 +142,12 @@ WINDOW *subpad(WINDOW *orig, int nlines, int ncols, int begy, int begx) | |||
| 151 | win->_y[i] = orig->_y[begy + i] + begx; | 142 | win->_y[i] = orig->_y[begy + i] + begx; |
| 152 | 143 | ||
| 153 | win->_flags = _SUBPAD; | 144 | win->_flags = _SUBPAD; |
| 154 | 145 | win->_pad._pad_y = 0; | |
| 155 | /* save default values in case pechochar() is the first call | 146 | win->_pad._pad_x = 0; |
| 156 | to prefresh(). */ | 147 | win->_pad._pad_top = 0; |
| 157 | 148 | win->_pad._pad_left = 0; | |
| 158 | save_pminrow = 0; | 149 | win->_pad._pad_bottom = min(LINES, nlines) - 1; |
| 159 | save_pmincol = 0; | 150 | win->_pad._pad_right = min(COLS, ncols) - 1; |
| 160 | save_sminrow = 0; | ||
| 161 | save_smincol = 0; | ||
| 162 | save_smaxrow = min(LINES, nlines) - 1; | ||
| 163 | save_smaxcol = min(COLS, ncols) - 1; | ||
| 164 | 151 | ||
| 165 | return win; | 152 | return win; |
| 166 | } | 153 | } |
| @@ -179,14 +166,11 @@ int prefresh(WINDOW *win, int py, int px, int sy1, int sx1, int sy2, int sx2) | |||
| 179 | int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, int sy2, int sx2) | 166 | int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, int sy2, int sx2) |
| 180 | { | 167 | { |
| 181 | int num_cols; | 168 | int num_cols; |
| 182 | int sline = sy1; | 169 | int sline; |
| 183 | int pline = py; | 170 | int pline; |
| 184 | 171 | ||
| 185 | PDC_LOG(("pnoutrefresh() - called\n")); | 172 | PDC_LOG(("pnoutrefresh() - called\n")); |
| 186 | 173 | ||
| 187 | if (!w || !(w->_flags & (_PAD|_SUBPAD)) || (sy2 >= LINES) || (sx2 >= COLS)) | ||
| 188 | return ERR; | ||
| 189 | |||
| 190 | if (py < 0) | 174 | if (py < 0) |
| 191 | py = 0; | 175 | py = 0; |
| 192 | if (px < 0) | 176 | if (px < 0) |
| @@ -196,9 +180,14 @@ int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, int sy2, int sx2) | |||
| 196 | if (sx1 < 0) | 180 | if (sx1 < 0) |
| 197 | sx1 = 0; | 181 | sx1 = 0; |
| 198 | 182 | ||
| 199 | if (sy2 < sy1 || sx2 < sx1) | 183 | if ((!w || !(w->_flags & (_PAD|_SUBPAD)) || |
| 184 | (sy2 >= LINES) || (sx2 >= COLS)) || | ||
| 185 | (sy2 < sy1) || (sx2 < sx1)) | ||
| 200 | return ERR; | 186 | return ERR; |
| 201 | 187 | ||
| 188 | sline = sy1; | ||
| 189 | pline = py; | ||
| 190 | |||
| 202 | num_cols = min((sx2 - sx1 + 1), (w->_maxx - px)); | 191 | num_cols = min((sx2 - sx1 + 1), (w->_maxx - px)); |
| 203 | 192 | ||
| 204 | while (sline <= sy2) | 193 | while (sline <= sy2) |
| @@ -240,6 +229,13 @@ int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, int sy2, int sx2) | |||
| 240 | curscr->_curx = (w->_curx - px) + sx1; | 229 | curscr->_curx = (w->_curx - px) + sx1; |
| 241 | } | 230 | } |
| 242 | 231 | ||
| 232 | w->_pad._pad_y = py; | ||
| 233 | w->_pad._pad_x = px; | ||
| 234 | w->_pad._pad_top = sy1; | ||
| 235 | w->_pad._pad_left = sx1; | ||
| 236 | w->_pad._pad_bottom = sy2; | ||
| 237 | w->_pad._pad_right = sx2; | ||
| 238 | |||
| 243 | return OK; | 239 | return OK; |
| 244 | } | 240 | } |
| 245 | 241 | ||
| @@ -250,8 +246,8 @@ int pechochar(WINDOW *pad, chtype ch) | |||
| 250 | if (waddch(pad, ch) == ERR) | 246 | if (waddch(pad, ch) == ERR) |
| 251 | return ERR; | 247 | return ERR; |
| 252 | 248 | ||
| 253 | return prefresh(pad, save_pminrow, save_pmincol, save_sminrow, | 249 | return prefresh(pad, pad->_pad._pad_y, pad->_pad._pad_x, pad->_pad._pad_top, |
| 254 | save_smincol, save_smaxrow, save_smaxcol); | 250 | pad->_pad._pad_left, pad->_pad._pad_bottom, pad->_pad._pad_right); |
| 255 | } | 251 | } |
| 256 | 252 | ||
| 257 | #ifdef PDC_WIDE | 253 | #ifdef PDC_WIDE |
| @@ -262,8 +258,8 @@ int pecho_wchar(WINDOW *pad, const cchar_t *wch) | |||
| 262 | if (!wch || (waddch(pad, *wch) == ERR)) | 258 | if (!wch || (waddch(pad, *wch) == ERR)) |
| 263 | return ERR; | 259 | return ERR; |
| 264 | 260 | ||
| 265 | return prefresh(pad, save_pminrow, save_pmincol, save_sminrow, | 261 | return prefresh(pad, pad->_pad._pad_y, pad->_pad._pad_x, pad->_pad._pad_top, |
| 266 | save_smincol, save_smaxrow, save_smaxcol); | 262 | pad->_pad._pad_left, pad->_pad._pad_bottom, pad->_pad._pad_right); |
| 267 | } | 263 | } |
| 268 | #endif | 264 | #endif |
| 269 | 265 | ||
diff --git a/scripts/kconfig/libcurses/pdcdisp.c b/scripts/kconfig/libcurses/pdcdisp.c index a0a4a0659..f6115ecb0 100644 --- a/scripts/kconfig/libcurses/pdcdisp.c +++ b/scripts/kconfig/libcurses/pdcdisp.c | |||
| @@ -153,7 +153,7 @@ void _new_packet(attr_t attr, int lineno, int x, int len, const chtype *srcp) | |||
| 153 | return; | 153 | return; |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | PDC_pair_content(PAIR_NUMBER(attr), &fore, &back); | 156 | pair_content(PAIR_NUMBER(attr), &fore, &back); |
| 157 | ansi = pdc_ansi || (fore >= 16 || back >= 16); | 157 | ansi = pdc_ansi || (fore >= 16 || back >= 16); |
| 158 | blink = (SP->termattrs & A_BLINK) && (attr & A_BLINK); | 158 | blink = (SP->termattrs & A_BLINK) && (attr & A_BLINK); |
| 159 | 159 | ||
| @@ -181,8 +181,13 @@ void _new_packet(attr_t attr, int lineno, int x, int len, const chtype *srcp) | |||
| 181 | chtype ch = srcp[j]; | 181 | chtype ch = srcp[j]; |
| 182 | 182 | ||
| 183 | if (ch & A_ALTCHARSET && !(ch & 0xff80)) | 183 | if (ch & A_ALTCHARSET && !(ch & 0xff80)) |
| 184 | { | ||
| 184 | ch = acs_map[ch & 0x7f]; | 185 | ch = acs_map[ch & 0x7f]; |
| 185 | 186 | ||
| 187 | if (pdc_wt && (ch & A_CHARTEXT) < ' ') | ||
| 188 | goto NONANSI; | ||
| 189 | } | ||
| 190 | |||
| 186 | if (blink && blinked_off) | 191 | if (blink && blinked_off) |
| 187 | ch = ' '; | 192 | ch = ' '; |
| 188 | 193 | ||
| @@ -198,6 +203,7 @@ void _new_packet(attr_t attr, int lineno, int x, int len, const chtype *srcp) | |||
| 198 | #endif | 203 | #endif |
| 199 | } | 204 | } |
| 200 | else | 205 | else |
| 206 | NONANSI: | ||
| 201 | { | 207 | { |
| 202 | CHAR_INFO buffer[512]; | 208 | CHAR_INFO buffer[512]; |
| 203 | COORD bufSize, bufPos; | 209 | COORD bufSize, bufPos; |
| @@ -276,7 +282,17 @@ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) | |||
| 276 | 282 | ||
| 277 | void PDC_blink_text(void) | 283 | void PDC_blink_text(void) |
| 278 | { | 284 | { |
| 285 | CONSOLE_CURSOR_INFO cci; | ||
| 279 | int i, j, k; | 286 | int i, j, k; |
| 287 | bool oldvis; | ||
| 288 | |||
| 289 | GetConsoleCursorInfo(pdc_con_out, &cci); | ||
| 290 | oldvis = cci.bVisible; | ||
| 291 | if (oldvis) | ||
| 292 | { | ||
| 293 | cci.bVisible = FALSE; | ||
| 294 | SetConsoleCursorInfo(pdc_con_out, &cci); | ||
| 295 | } | ||
| 280 | 296 | ||
| 281 | if (!(SP->termattrs & A_BLINK)) | 297 | if (!(SP->termattrs & A_BLINK)) |
| 282 | blinked_off = FALSE; | 298 | blinked_off = FALSE; |
| @@ -299,5 +315,15 @@ void PDC_blink_text(void) | |||
| 299 | } | 315 | } |
| 300 | 316 | ||
| 301 | PDC_gotoyx(SP->cursrow, SP->curscol); | 317 | PDC_gotoyx(SP->cursrow, SP->curscol); |
| 318 | if (oldvis) | ||
| 319 | { | ||
| 320 | cci.bVisible = TRUE; | ||
| 321 | SetConsoleCursorInfo(pdc_con_out, &cci); | ||
| 322 | } | ||
| 323 | |||
| 302 | pdc_last_blink = GetTickCount(); | 324 | pdc_last_blink = GetTickCount(); |
| 303 | } | 325 | } |
| 326 | |||
| 327 | void PDC_doupdate(void) | ||
| 328 | { | ||
| 329 | } | ||
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 | |||
| 7 | pdckbd | ||
| 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 | ||
| 216 | static KPTAB ext_kptab[] = | 226 | static KPTAB ext_kptab[] = |
| @@ -233,16 +243,15 @@ static KPTAB ext_kptab[] = | |||
| 233 | 243 | ||
| 234 | /* End of kptab[] */ | 244 | /* End of kptab[] */ |
| 235 | 245 | ||
| 236 | unsigned long PDC_get_input_fd(void) | ||
| 237 | { | ||
| 238 | PDC_LOG(("PDC_get_input_fd() - called\n")); | ||
| 239 | |||
| 240 | return 0L; | ||
| 241 | } | ||
| 242 | |||
| 243 | void PDC_set_keyboard_binary(bool on) | 246 | void 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 | ||
| 353 | static int _process_key_event(void) | 362 | static 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 | ||
| 663 | int PDC_mouse_set(void) | 671 | int 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 | ||
diff --git a/scripts/kconfig/libcurses/pdcscrn.c b/scripts/kconfig/libcurses/pdcscrn.c index e6640a379..e2f4ddd90 100644 --- a/scripts/kconfig/libcurses/pdcscrn.c +++ b/scripts/kconfig/libcurses/pdcscrn.c | |||
| @@ -4,10 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
| 6 | 6 | ||
| 7 | /* COLOR_PAIR to attribute encoding table. */ | ||
| 8 | |||
| 9 | static struct {short f, b;} atrtab[PDC_COLOR_PAIRS]; | ||
| 10 | |||
| 11 | /* Color component table */ | 7 | /* Color component table */ |
| 12 | 8 | ||
| 13 | PDCCOLOR pdc_color[PDC_MAXCOL]; | 9 | PDCCOLOR pdc_color[PDC_MAXCOL]; |
| @@ -36,7 +32,7 @@ static short ansitocurs[16] = | |||
| 36 | 32 | ||
| 37 | short pdc_curstoreal[16], pdc_curstoansi[16]; | 33 | short pdc_curstoreal[16], pdc_curstoansi[16]; |
| 38 | short pdc_oldf, pdc_oldb, pdc_oldu; | 34 | short pdc_oldf, pdc_oldb, pdc_oldu; |
| 39 | bool pdc_conemu, pdc_ansi; | 35 | bool pdc_conemu, pdc_wt, pdc_ansi; |
| 40 | 36 | ||
| 41 | enum { PDC_RESTORE_NONE, PDC_RESTORE_BUFFER }; | 37 | enum { PDC_RESTORE_NONE, PDC_RESTORE_BUFFER }; |
| 42 | 38 | ||
| @@ -363,9 +359,6 @@ void PDC_scr_close(void) | |||
| 363 | 359 | ||
| 364 | void PDC_scr_free(void) | 360 | void PDC_scr_free(void) |
| 365 | { | 361 | { |
| 366 | if (SP) | ||
| 367 | free(SP); | ||
| 368 | |||
| 369 | if (pdc_con_out != std_con_out) | 362 | if (pdc_con_out != std_con_out) |
| 370 | { | 363 | { |
| 371 | CloseHandle(pdc_con_out); | 364 | CloseHandle(pdc_con_out); |
| @@ -376,10 +369,10 @@ void PDC_scr_free(void) | |||
| 376 | SetConsoleCtrlHandler(_ctrl_break, FALSE); | 369 | SetConsoleCtrlHandler(_ctrl_break, FALSE); |
| 377 | } | 370 | } |
| 378 | 371 | ||
| 379 | /* open the physical screen -- allocate SP, miscellaneous intialization, | 372 | /* open the physical screen -- miscellaneous initialization, may save |
| 380 | and may save the existing screen for later restoration */ | 373 | the existing screen for later restoration */ |
| 381 | 374 | ||
| 382 | int PDC_scr_open(int argc, char **argv) | 375 | int PDC_scr_open(void) |
| 383 | { | 376 | { |
| 384 | const char *str; | 377 | const char *str; |
| 385 | CONSOLE_SCREEN_BUFFER_INFO csbi; | 378 | CONSOLE_SCREEN_BUFFER_INFO csbi; |
| @@ -389,11 +382,6 @@ int PDC_scr_open(int argc, char **argv) | |||
| 389 | 382 | ||
| 390 | PDC_LOG(("PDC_scr_open() - called\n")); | 383 | PDC_LOG(("PDC_scr_open() - called\n")); |
| 391 | 384 | ||
| 392 | SP = calloc(1, sizeof(SCREEN)); | ||
| 393 | |||
| 394 | if (!SP) | ||
| 395 | return ERR; | ||
| 396 | |||
| 397 | for (i = 0; i < 16; i++) | 385 | for (i = 0; i < 16; i++) |
| 398 | { | 386 | { |
| 399 | pdc_curstoreal[realtocurs[i]] = i; | 387 | pdc_curstoreal[realtocurs[i]] = i; |
| @@ -413,9 +401,10 @@ int PDC_scr_open(int argc, char **argv) | |||
| 413 | 401 | ||
| 414 | is_nt = !(GetVersion() & 0x80000000); | 402 | is_nt = !(GetVersion() & 0x80000000); |
| 415 | 403 | ||
| 416 | str = getenv("ConEmuANSI"); | 404 | pdc_wt = !!getenv("WT_SESSION"); |
| 405 | str = pdc_wt ? NULL : getenv("ConEmuANSI"); | ||
| 417 | pdc_conemu = !!str; | 406 | pdc_conemu = !!str; |
| 418 | pdc_ansi = pdc_conemu ? !strcmp(str, "ON") : FALSE; | 407 | pdc_ansi = pdc_wt ? TRUE : pdc_conemu ? !strcmp(str, "ON") : FALSE; |
| 419 | 408 | ||
| 420 | GetConsoleScreenBufferInfo(pdc_con_out, &csbi); | 409 | GetConsoleScreenBufferInfo(pdc_con_out, &csbi); |
| 421 | GetConsoleScreenBufferInfo(pdc_con_out, &orig_scr); | 410 | GetConsoleScreenBufferInfo(pdc_con_out, &orig_scr); |
| @@ -427,9 +416,6 @@ int PDC_scr_open(int argc, char **argv) | |||
| 427 | 416 | ||
| 428 | pdc_quick_edit = old_console_mode & 0x0040; | 417 | pdc_quick_edit = old_console_mode & 0x0040; |
| 429 | 418 | ||
| 430 | SP->lines = (str = getenv("LINES")) ? atoi(str) : PDC_get_rows(); | ||
| 431 | SP->cols = (str = getenv("COLS")) ? atoi(str) : PDC_get_columns(); | ||
| 432 | |||
| 433 | SP->mouse_wait = PDC_CLICK_PERIOD; | 419 | SP->mouse_wait = PDC_CLICK_PERIOD; |
| 434 | SP->audible = TRUE; | 420 | SP->audible = TRUE; |
| 435 | 421 | ||
| @@ -437,22 +423,6 @@ int PDC_scr_open(int argc, char **argv) | |||
| 437 | if (pdc_ansi) | 423 | if (pdc_ansi) |
| 438 | SP->termattrs |= A_UNDERLINE | A_ITALIC; | 424 | SP->termattrs |= A_UNDERLINE | A_ITALIC; |
| 439 | 425 | ||
| 440 | if (SP->lines < 2 || SP->lines > csbi.dwMaximumWindowSize.Y) | ||
| 441 | { | ||
| 442 | fprintf(stderr, "LINES value must be >= 2 and <= %d: got %d\n", | ||
| 443 | csbi.dwMaximumWindowSize.Y, SP->lines); | ||
| 444 | |||
| 445 | return ERR; | ||
| 446 | } | ||
| 447 | |||
| 448 | if (SP->cols < 2 || SP->cols > csbi.dwMaximumWindowSize.X) | ||
| 449 | { | ||
| 450 | fprintf(stderr, "COLS value must be >= 2 and <= %d: got %d\n", | ||
| 451 | csbi.dwMaximumWindowSize.X, SP->cols); | ||
| 452 | |||
| 453 | return ERR; | ||
| 454 | } | ||
| 455 | |||
| 456 | SP->orig_fore = csbi.wAttributes & 0x0f; | 426 | SP->orig_fore = csbi.wAttributes & 0x0f; |
| 457 | SP->orig_back = (csbi.wAttributes & 0xf0) >> 4; | 427 | SP->orig_back = (csbi.wAttributes & 0xf0) >> 4; |
| 458 | 428 | ||
| @@ -586,9 +556,6 @@ int PDC_resize_screen(int nlines, int ncols) | |||
| 586 | 556 | ||
| 587 | PDC_flushinp(); | 557 | PDC_flushinp(); |
| 588 | 558 | ||
| 589 | SP->resized = FALSE; | ||
| 590 | SP->cursrow = SP->curscol = 0; | ||
| 591 | |||
| 592 | return OK; | 559 | return OK; |
| 593 | } | 560 | } |
| 594 | 561 | ||
| @@ -645,20 +612,6 @@ void PDC_save_screen_mode(int i) | |||
| 645 | { | 612 | { |
| 646 | } | 613 | } |
| 647 | 614 | ||
| 648 | void PDC_init_pair(short pair, short fg, short bg) | ||
| 649 | { | ||
| 650 | atrtab[pair].f = fg; | ||
| 651 | atrtab[pair].b = bg; | ||
| 652 | } | ||
| 653 | |||
| 654 | int PDC_pair_content(short pair, short *fg, short *bg) | ||
| 655 | { | ||
| 656 | *fg = atrtab[pair].f; | ||
| 657 | *bg = atrtab[pair].b; | ||
| 658 | |||
| 659 | return OK; | ||
| 660 | } | ||
| 661 | |||
| 662 | bool PDC_can_change_color(void) | 615 | bool PDC_can_change_color(void) |
| 663 | { | 616 | { |
| 664 | return is_nt; | 617 | return is_nt; |
| @@ -666,7 +619,7 @@ bool PDC_can_change_color(void) | |||
| 666 | 619 | ||
| 667 | int PDC_color_content(short color, short *red, short *green, short *blue) | 620 | int PDC_color_content(short color, short *red, short *green, short *blue) |
| 668 | { | 621 | { |
| 669 | if (color < 16 && !pdc_conemu) | 622 | if (color < 16 && !(pdc_conemu || pdc_wt)) |
| 670 | { | 623 | { |
| 671 | COLORREF *color_table = _get_colors(); | 624 | COLORREF *color_table = _get_colors(); |
| 672 | 625 | ||
| @@ -705,7 +658,7 @@ int PDC_init_color(short color, short red, short green, short blue) | |||
| 705 | return OK; | 658 | return OK; |
| 706 | } | 659 | } |
| 707 | 660 | ||
| 708 | if (color < 16 && !pdc_conemu) | 661 | if (color < 16 && !(pdc_conemu || pdc_wt)) |
| 709 | { | 662 | { |
| 710 | COLORREF *color_table = _get_colors(); | 663 | COLORREF *color_table = _get_colors(); |
| 711 | 664 | ||
diff --git a/scripts/kconfig/libcurses/pdcwin.h b/scripts/kconfig/libcurses/pdcwin.h index f23a71fd1..cee76931b 100644 --- a/scripts/kconfig/libcurses/pdcwin.h +++ b/scripts/kconfig/libcurses/pdcwin.h | |||
| @@ -22,6 +22,6 @@ extern DWORD pdc_quick_edit; | |||
| 22 | extern DWORD pdc_last_blink; | 22 | extern DWORD pdc_last_blink; |
| 23 | extern short pdc_curstoreal[16], pdc_curstoansi[16]; | 23 | extern short pdc_curstoreal[16], pdc_curstoansi[16]; |
| 24 | extern short pdc_oldf, pdc_oldb, pdc_oldu; | 24 | extern short pdc_oldf, pdc_oldb, pdc_oldu; |
| 25 | extern bool pdc_conemu, pdc_ansi; | 25 | extern bool pdc_conemu, pdc_wt, pdc_ansi; |
| 26 | 26 | ||
| 27 | extern void PDC_blink_text(void); | 27 | extern void PDC_blink_text(void); |
diff --git a/scripts/kconfig/libcurses/refresh.c b/scripts/kconfig/libcurses/refresh.c index c7122332e..306f4efb3 100644 --- a/scripts/kconfig/libcurses/refresh.c +++ b/scripts/kconfig/libcurses/refresh.c | |||
| @@ -64,8 +64,16 @@ int wnoutrefresh(WINDOW *win) | |||
| 64 | 64 | ||
| 65 | PDC_LOG(("wnoutrefresh() - called: win=%p\n", win)); | 65 | PDC_LOG(("wnoutrefresh() - called: win=%p\n", win)); |
| 66 | 66 | ||
| 67 | if ( !win || (win->_flags & (_PAD|_SUBPAD)) ) | 67 | if (!win) |
| 68 | return ERR; | 68 | return ERR; |
| 69 | if (is_pad(win)) | ||
| 70 | return pnoutrefresh(win, | ||
| 71 | win->_pad._pad_y, | ||
| 72 | win->_pad._pad_x, | ||
| 73 | win->_pad._pad_top, | ||
| 74 | win->_pad._pad_left, | ||
| 75 | win->_pad._pad_bottom, | ||
| 76 | win->_pad._pad_right); | ||
| 69 | 77 | ||
| 70 | begy = win->_begy; | 78 | begy = win->_begy; |
| 71 | begx = win->_begx; | 79 | begx = win->_begx; |
| @@ -215,6 +223,8 @@ int doupdate(void) | |||
| 215 | SP->cursrow = curscr->_cury; | 223 | SP->cursrow = curscr->_cury; |
| 216 | SP->curscol = curscr->_curx; | 224 | SP->curscol = curscr->_curx; |
| 217 | 225 | ||
| 226 | PDC_doupdate(); | ||
| 227 | |||
| 218 | return OK; | 228 | return OK; |
| 219 | } | 229 | } |
| 220 | 230 | ||
diff --git a/scripts/kconfig/libcurses/touch.c b/scripts/kconfig/libcurses/touch.c index 619fbc6e1..2fd03cce5 100644 --- a/scripts/kconfig/libcurses/touch.c +++ b/scripts/kconfig/libcurses/touch.c | |||
| @@ -168,31 +168,40 @@ bool is_wintouched(WINDOW *win) | |||
| 168 | 168 | ||
| 169 | int touchoverlap(const WINDOW *win1, WINDOW *win2) | 169 | int touchoverlap(const WINDOW *win1, WINDOW *win2) |
| 170 | { | 170 | { |
| 171 | int y, endy, endx, starty, startx; | 171 | int y, endy, endx, starty, startx, begy1, begx1, begy2, begx2; |
| 172 | 172 | ||
| 173 | PDC_LOG(("touchoverlap() - called: win1=%p win2=%p\n", win1, win2)); | 173 | PDC_LOG(("touchoverlap() - called: win1=%p win2=%p\n", win1, win2)); |
| 174 | 174 | ||
| 175 | if (!win1 || !win2) | 175 | if (!win1 || !win2) |
| 176 | return ERR; | 176 | return ERR; |
| 177 | 177 | ||
| 178 | starty = max(win1->_begy, win2->_begy); | 178 | begy1 = win1->_begy; |
| 179 | startx = max(win1->_begx, win2->_begx); | 179 | begx1 = win1->_begx; |
| 180 | endy = min(win1->_maxy + win1->_begy, win2->_maxy + win2->_begy); | 180 | begy2 = win2->_begy; |
| 181 | endx = min(win1->_maxx + win1->_begx, win2->_maxx + win2->_begx); | 181 | begx2 = win2->_begy; |
| 182 | |||
| 183 | starty = max(begy1, begy2); | ||
| 184 | startx = max(begx1, begx2); | ||
| 185 | endy = min(win1->_maxy + begy1, win2->_maxy + begy2); | ||
| 186 | endx = min(win1->_maxx + begx1, win2->_maxx + begx2); | ||
| 182 | 187 | ||
| 183 | if (starty >= endy || startx >= endx) | 188 | if (starty >= endy || startx >= endx) |
| 184 | return OK; | 189 | return OK; |
| 185 | 190 | ||
| 186 | starty -= win2->_begy; | 191 | starty -= begy2; |
| 187 | startx -= win2->_begx; | 192 | startx -= begx2; |
| 188 | endy -= win2->_begy; | 193 | endy -= begy2; |
| 189 | endx -= win2->_begx; | 194 | endx -= begx2; |
| 190 | endx -= 1; | 195 | endx -= 1; |
| 191 | 196 | ||
| 192 | for (y = starty; y < endy; y++) | 197 | for (y = starty; y < endy; y++) |
| 193 | { | 198 | { |
| 194 | win2->_firstch[y] = startx; | 199 | int first = win2->_firstch[y]; |
| 195 | win2->_lastch[y] = endx; | 200 | |
| 201 | if (first == _NO_CHANGE || win2->_lastch[y] < endx) | ||
| 202 | win2->_lastch[y] = endx; | ||
| 203 | if (first == _NO_CHANGE || first > startx) | ||
| 204 | win2->_firstch[y] = startx; | ||
| 196 | } | 205 | } |
| 197 | 206 | ||
| 198 | return OK; | 207 | return OK; |
diff --git a/scripts/kconfig/libcurses/window.c b/scripts/kconfig/libcurses/window.c index 495d7dbea..4ae5b0861 100644 --- a/scripts/kconfig/libcurses/window.c +++ b/scripts/kconfig/libcurses/window.c | |||
| @@ -15,10 +15,13 @@ window | |||
| 15 | WINDOW *subwin(WINDOW* orig, int nlines, int ncols, | 15 | WINDOW *subwin(WINDOW* orig, int nlines, int ncols, |
| 16 | int begy, int begx); | 16 | int begy, int begx); |
| 17 | WINDOW *dupwin(WINDOW *win); | 17 | WINDOW *dupwin(WINDOW *win); |
| 18 | WINDOW *wgetparent(const WINDOW *win); | ||
| 18 | int delwin(WINDOW *win); | 19 | int delwin(WINDOW *win); |
| 19 | int mvwin(WINDOW *win, int y, int x); | 20 | int mvwin(WINDOW *win, int y, int x); |
| 20 | int mvderwin(WINDOW *win, int pary, int parx); | 21 | int mvderwin(WINDOW *win, int pary, int parx); |
| 21 | int syncok(WINDOW *win, bool bf); | 22 | int syncok(WINDOW *win, bool bf); |
| 23 | bool is_subwin(const WINDOW *win); | ||
| 24 | bool is_syncok(const WINDOW *win); | ||
| 22 | void wsyncup(WINDOW *win); | 25 | void wsyncup(WINDOW *win); |
| 23 | void wcursyncup(WINDOW *win); | 26 | void wcursyncup(WINDOW *win); |
| 24 | void wsyncdown(WINDOW *win); | 27 | void wsyncdown(WINDOW *win); |
| @@ -64,11 +67,19 @@ window | |||
| 64 | 67 | ||
| 65 | dupwin() creates an exact duplicate of the window win. | 68 | dupwin() creates an exact duplicate of the window win. |
| 66 | 69 | ||
| 70 | wgetparent() returns the parent WINDOW pointer for subwindows, or NULL | ||
| 71 | for windows having no parent. | ||
| 72 | |||
| 67 | wsyncup() causes a touchwin() of all of the window's parents. | 73 | wsyncup() causes a touchwin() of all of the window's parents. |
| 68 | 74 | ||
| 69 | If wsyncok() is called with a second argument of TRUE, this causes a | 75 | If syncok() is called with a second argument of TRUE, this causes a |
| 70 | wsyncup() to be called every time the window is changed. | 76 | wsyncup() to be called every time the window is changed. |
| 71 | 77 | ||
| 78 | is_subwin() reports whether the specified window is a subwindow, | ||
| 79 | created by subwin() or derwin(). | ||
| 80 | |||
| 81 | is_syncok() reports whether the specified window is in syncok mode. | ||
| 82 | |||
| 72 | wcursyncup() causes the current cursor position of all of a window's | 83 | wcursyncup() causes the current cursor position of all of a window's |
| 73 | ancestors to reflect the current cursor position of the current | 84 | ancestors to reflect the current cursor position of the current |
| 74 | window. | 85 | window. |
| @@ -101,6 +112,8 @@ window | |||
| 101 | syncok() return OK or ERR. wsyncup(), wcursyncup() and wsyncdown() | 112 | syncok() return OK or ERR. wsyncup(), wcursyncup() and wsyncdown() |
| 102 | return nothing. | 113 | return nothing. |
| 103 | 114 | ||
| 115 | is_subwin() and is_syncok() returns TRUE or FALSE. | ||
| 116 | |||
| 104 | ### Errors | 117 | ### Errors |
| 105 | 118 | ||
| 106 | It is an error to call resize_window() before calling initscr(). | 119 | It is an error to call resize_window() before calling initscr(). |
| @@ -119,8 +132,11 @@ window | |||
| 119 | derwin Y Y Y | 132 | derwin Y Y Y |
| 120 | mvderwin Y Y Y | 133 | mvderwin Y Y Y |
| 121 | dupwin Y Y Y | 134 | dupwin Y Y Y |
| 135 | wgetparent - Y - | ||
| 122 | wsyncup Y Y Y | 136 | wsyncup Y Y Y |
| 123 | syncok Y Y Y | 137 | syncok Y Y Y |
| 138 | is_subwin - Y - | ||
| 139 | is_syncok - Y - | ||
| 124 | wcursyncup Y Y Y | 140 | wcursyncup Y Y Y |
| 125 | wsyncdown Y Y Y | 141 | wsyncdown Y Y Y |
| 126 | wresize - Y Y | 142 | wresize - Y Y |
| @@ -185,6 +201,15 @@ WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx) | |||
| 185 | win->_bmarg = nlines - 1; | 201 | win->_bmarg = nlines - 1; |
| 186 | win->_parx = win->_pary = -1; | 202 | win->_parx = win->_pary = -1; |
| 187 | 203 | ||
| 204 | /* initialize pad variables*/ | ||
| 205 | |||
| 206 | win->_pad._pad_y = -1; | ||
| 207 | win->_pad._pad_x = -1; | ||
| 208 | win->_pad._pad_top = -1; | ||
| 209 | win->_pad._pad_left = -1; | ||
| 210 | win->_pad._pad_bottom = -1; | ||
| 211 | win->_pad._pad_right = -1; | ||
| 212 | |||
| 188 | /* init to say window all changed */ | 213 | /* init to say window all changed */ |
| 189 | 214 | ||
| 190 | touchwin(win); | 215 | touchwin(win); |
| @@ -319,9 +344,9 @@ WINDOW *subwin(WINDOW *orig, int nlines, int ncols, int begy, int begx) | |||
| 319 | k = begx - orig->_begx; | 344 | k = begx - orig->_begx; |
| 320 | 345 | ||
| 321 | if (!nlines) | 346 | if (!nlines) |
| 322 | nlines = orig->_maxy - 1 - j; | 347 | nlines = orig->_maxy - j; |
| 323 | if (!ncols) | 348 | if (!ncols) |
| 324 | ncols = orig->_maxx - 1 - k; | 349 | ncols = orig->_maxx - k; |
| 325 | 350 | ||
| 326 | win = PDC_makenew(nlines, ncols, begy, begx); | 351 | win = PDC_makenew(nlines, ncols, begy, begx); |
| 327 | if (!win) | 352 | if (!win) |
| @@ -438,6 +463,16 @@ WINDOW *dupwin(WINDOW *win) | |||
| 438 | return new; | 463 | return new; |
| 439 | } | 464 | } |
| 440 | 465 | ||
| 466 | WINDOW *wgetparent(const WINDOW *win) | ||
| 467 | { | ||
| 468 | PDC_LOG(("wgetparent() - called\n")); | ||
| 469 | |||
| 470 | if (!win || !win->_parent) | ||
| 471 | return NULL; | ||
| 472 | |||
| 473 | return win->_parent; | ||
| 474 | } | ||
| 475 | |||
| 441 | WINDOW *resize_window(WINDOW *win, int nlines, int ncols) | 476 | WINDOW *resize_window(WINDOW *win, int nlines, int ncols) |
| 442 | { | 477 | { |
| 443 | WINDOW *new; | 478 | WINDOW *new; |
| @@ -488,6 +523,7 @@ WINDOW *resize_window(WINDOW *win, int nlines, int ncols) | |||
| 488 | if (!new) | 523 | if (!new) |
| 489 | return (WINDOW *)NULL; | 524 | return (WINDOW *)NULL; |
| 490 | 525 | ||
| 526 | new->_bkgd = win->_bkgd; | ||
| 491 | werase(new); | 527 | werase(new); |
| 492 | 528 | ||
| 493 | copywin(win, new, 0, 0, 0, 0, min(win->_maxy, new->_maxy) - 1, | 529 | copywin(win, new, 0, 0, 0, 0, min(win->_maxy, new->_maxy) - 1, |
| @@ -554,6 +590,26 @@ int syncok(WINDOW *win, bool bf) | |||
| 554 | return OK; | 590 | return OK; |
| 555 | } | 591 | } |
| 556 | 592 | ||
| 593 | bool is_subwin(const WINDOW *win) | ||
| 594 | { | ||
| 595 | PDC_LOG(("is_subwin() - called\n")); | ||
| 596 | |||
| 597 | if (!win) | ||
| 598 | return FALSE; | ||
| 599 | |||
| 600 | return ((win->_flags & _SUBWIN) ? TRUE : FALSE); | ||
| 601 | } | ||
| 602 | |||
| 603 | bool is_syncok(const WINDOW *win) | ||
| 604 | { | ||
| 605 | PDC_LOG(("is_syncok() - called\n")); | ||
| 606 | |||
| 607 | if (!win) | ||
| 608 | return FALSE; | ||
| 609 | |||
| 610 | return win->_sync; | ||
| 611 | } | ||
| 612 | |||
| 557 | void wcursyncup(WINDOW *win) | 613 | void wcursyncup(WINDOW *win) |
| 558 | { | 614 | { |
| 559 | WINDOW *tmp; | 615 | WINDOW *tmp; |
