]> git.ipfire.org Git - thirdparty/newt.git/blame - newt.c
Mouse support
[thirdparty/newt.git] / newt.c
CommitLineData
139f06bc 1#include <slang.h>
6fb96a3f 2#include <stdio.h>
3#include <stdlib.h>
4#include <string.h>
ae1235d0 5#include <sys/signal.h>
6fb96a3f 6#include <sys/time.h>
7#include <sys/types.h>
91be88a7 8#include <termios.h>
6fb96a3f 9#include <unistd.h>
10
11#include "newt.h"
12#include "newt_pr.h"
13
6fb96a3f 14struct Window {
15 int height, width, top, left;
16 short * buffer;
aa47774f 17 char * title;
6fb96a3f 18};
19
20struct keymap {
21 char * str;
22 int code;
23 char * tc;
24};
25
a1f11019 26static struct Window windowStack[20];
27static struct Window * currentWindow = NULL;
6fb96a3f 28
a1f11019 29static char * helplineStack[20];
30static char ** currentHelpline = NULL;
31
32static int cursorRow, cursorCol;
ae1235d0 33static int needResize;
81361f3e 34
45f6c4fd 35static const char * defaultHelpLine =
7d4604a9 36" <Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen"
37;
38
57c466b0 39const struct newtColors newtDefaultColorPalette = {
45f6c4fd 40 "white", "blue", /* root fg, bg */
6fb96a3f 41 "black", "lightgray", /* border fg, bg */
42 "black", "lightgray", /* window fg, bg */
43 "white", "black", /* shadow fg, bg */
44 "red", "lightgray", /* title fg, bg */
f026c7eb 45 "lightgray", "red", /* button fg, bg */
46 "red", "lightgray", /* active button fg, bg */
47 "yellow", "blue", /* checkbox fg, bg */
f5c911c1 48 "blue", "brown", /* active checkbox fg, bg */
f026c7eb 49 "yellow", "blue", /* entry box fg, bg */
8735cc88 50 "blue", "lightgray", /* label fg, bg */
f026c7eb 51 "black", "lightgray", /* listbox fg, bg */
52 "yellow", "blue", /* active listbox fg, bg */
53 "black", "lightgray", /* textbox fg, bg */
54 "lightgray", "black", /* active textbox fg, bg */
81361f3e 55 "white", "blue", /* help line */
56 "yellow", "blue", /* root text */
c92910bd 57 "blue", /* scale full */
3cf3e1b9 58 "red", /* scale empty */
a1f11019 59 "blue", "lightgray", /* disabled entry fg, bg */
39dd7d98 60 "white", "blue", /* compact button fg, bg */
46263d9e 61 "yellow", "red", /* active & sel listbox */
62 "black", "brown" /* selected listbox */
6fb96a3f 63};
64
57c466b0 65static const struct keymap keymap[] = {
6fb96a3f 66 { "\033OA", NEWT_KEY_UP, "kh" },
67 { "\033[A", NEWT_KEY_UP, "ku" },
68 { "\033OB", NEWT_KEY_DOWN, "kd" },
69 { "\033[B", NEWT_KEY_DOWN, "kd" },
70 { "\033[C", NEWT_KEY_RIGHT, "kr" },
71 { "\033OC", NEWT_KEY_RIGHT, "kr" },
72 { "\033[D", NEWT_KEY_LEFT, "kl" },
73 { "\033OD", NEWT_KEY_LEFT, "kl" },
74 { "\033[H", NEWT_KEY_HOME, "kh" },
75 { "\033[1~", NEWT_KEY_HOME, "kh" },
76 { "\033Ow", NEWT_KEY_END, "kH" },
77 { "\033[4~", NEWT_KEY_END, "kH" },
78
79 { "\033[3~", NEWT_KEY_DELETE, "kl" },
80
e6e86d9d 81 { "\033\t", NEWT_KEY_UNTAB, NULL },
82
f026c7eb 83 { "\033[5~", NEWT_KEY_PGUP, NULL },
84 { "\033[6~", NEWT_KEY_PGDN, NULL },
4d3db9e2 85 { "\033V", NEWT_KEY_PGUP, "kH" },
86 { "\033v", NEWT_KEY_PGUP, "kH" },
f026c7eb 87
91be88a7 88 { "\033[[A", NEWT_KEY_F1, NULL },
89 { "\033[[B", NEWT_KEY_F2, NULL },
90 { "\033[[C", NEWT_KEY_F3, NULL },
91 { "\033[[D", NEWT_KEY_F4, NULL },
92 { "\033[[E", NEWT_KEY_F5, NULL },
93
2db1ec9f 94 { "\033[11~", NEWT_KEY_F1, NULL },
eedf3ffa 95 { "\033[12~", NEWT_KEY_F2, NULL },
96 { "\033[13~", NEWT_KEY_F3, NULL },
97 { "\033[14~", NEWT_KEY_F4, NULL },
98 { "\033[15~", NEWT_KEY_F5, NULL },
99 { "\033[17~", NEWT_KEY_F6, NULL },
100 { "\033[18~", NEWT_KEY_F7, NULL },
101 { "\033[19~", NEWT_KEY_F8, NULL },
102 { "\033[20~", NEWT_KEY_F9, NULL },
103 { "\033[21~", NEWT_KEY_F10, NULL },
104 { "\033[23~", NEWT_KEY_F11, NULL },
2db1ec9f 105 { "\033[24~", NEWT_KEY_F12, NULL },
106
6fb96a3f 107 { NULL, 0, NULL }, /* LEAVE this one */
108};
88d3e0a3 109static char keyPrefix = '\033';
110
d4109c37 111static const char * version = "Newt windowing library version " VERSION
88d3e0a3 112 " - (C) 1996 Red Hat Software. "
113 "Redistributable under the term of the Library "
d8dec55f 114 "GNU Public License. "
d4663248 115 "Written by Erik Troan\n";
6fb96a3f 116
b7c1b763 117static newtSuspendCallback suspendCallback = NULL;
118
119void newtSetSuspendCallback(newtSuspendCallback cb) {
120 suspendCallback = cb;
121}
122
ae1235d0 123static void handleSigwinch(int signum) {
124 needResize = 1;
125}
126
127static int getkeyInterruptHook(void) {
128 return -1;
129}
130
327436b3 131void newtFlushInput(void) {
132 while (SLang_input_pending(0)) {
133 SLang_getkey();
134 }
135}
136
6fb96a3f 137void newtRefresh(void) {
138 SLsmg_refresh();
139}
140
3cf3e1b9 141void newtSuspend(void) {
142 SLsmg_suspend_smg();
143 SLang_reset_tty();
144}
145
146void newtResume(void) {
147 SLsmg_resume_smg ();
148 SLsmg_refresh();
149 SLang_init_tty(0, 0, 0);
150}
151
6fb96a3f 152void newtCls(void) {
81361f3e 153 SLsmg_set_color(NEWT_COLORSET_ROOT);
6fb96a3f 154 SLsmg_gotorc(0, 0);
155 SLsmg_erase_eos();
156
157 newtRefresh();
158}
159
ae1235d0 160void newtResizeScreen(int redraw) {
161 newtPushHelpLine("");
162
163 SLtt_get_screen_size();
164 SLang_init_tty(0, 0, 0);
165
166 SLsmg_touch_lines (0, SLtt_Screen_Rows - 1);
167
168 /* I don't know why I need this */
169 SLsmg_refresh();
170
171 newtPopHelpLine();
172
173 if (redraw)
174 SLsmg_refresh();
175}
176
6fb96a3f 177int newtInit(void) {
7d4604a9 178 char * MonoValue, * MonoEnv = "NEWT_MONO";
91be88a7 179
88d3e0a3 180 /* use the version variable just to be sure it gets included */
181 strlen(version);
182
6fb96a3f 183 SLtt_get_terminfo();
ae1235d0 184 SLtt_get_screen_size();
91be88a7 185
7d4604a9 186 MonoValue = getenv(MonoEnv);
187 if ( MonoValue == NULL ) {
188 SLtt_Use_Ansi_Colors = 1;
189 } else {
190 SLtt_Use_Ansi_Colors = 0;
191 }
6fb96a3f 192
193 SLsmg_init_smg();
194 SLang_init_tty(0, 0, 0);
45f6c4fd 195
6fb96a3f 196 newtSetColors(newtDefaultColorPalette);
197 /*initKeymap();*/
198
199 /*SLtt_set_cursor_visibility(0);*/
200
ae1235d0 201 /*memset(&sa, 0, sizeof(sa));
202 sa.sa_handler = handleSigwinch;
203 sigaction(SIGWINCH, &sa, NULL);*/
204
205 SLsignal_intr(SIGWINCH, handleSigwinch);
206 SLang_getkey_intr_hook = getkeyInterruptHook;
207
45f6c4fd 208
209
6fb96a3f 210 return 0;
211}
212
213int newtFinished(void) {
214 SLsmg_gotorc(SLtt_Screen_Rows - 1, 0);
215 SLsmg_refresh();
216 SLsmg_reset_smg();
217 SLang_reset_tty();
218
219 return 0;
220}
221
222void newtSetColors(struct newtColors colors) {
81361f3e 223 SLtt_set_color(NEWT_COLORSET_ROOT, "", colors.rootFg, colors.rootBg);
224 SLtt_set_color(NEWT_COLORSET_BORDER, "", colors.borderFg, colors.borderBg);
225 SLtt_set_color(NEWT_COLORSET_WINDOW, "", colors.windowFg, colors.windowBg);
226 SLtt_set_color(NEWT_COLORSET_SHADOW, "", colors.shadowFg, colors.shadowBg);
227 SLtt_set_color(NEWT_COLORSET_TITLE, "", colors.titleFg, colors.titleBg);
228 SLtt_set_color(NEWT_COLORSET_BUTTON, "", colors.buttonFg, colors.buttonBg);
45f6c4fd 229 SLtt_set_color(NEWT_COLORSET_ACTBUTTON, "", colors.actButtonFg,
6fb96a3f 230 colors.actButtonBg);
45f6c4fd 231 SLtt_set_color(NEWT_COLORSET_CHECKBOX, "", colors.checkboxFg,
81361f3e 232 colors.checkboxBg);
45f6c4fd 233 SLtt_set_color(NEWT_COLORSET_ACTCHECKBOX, "", colors.actCheckboxFg,
6fb96a3f 234 colors.actCheckboxBg);
81361f3e 235 SLtt_set_color(NEWT_COLORSET_ENTRY, "", colors.entryFg, colors.entryBg);
236 SLtt_set_color(NEWT_COLORSET_LABEL, "", colors.labelFg, colors.labelBg);
45f6c4fd 237 SLtt_set_color(NEWT_COLORSET_LISTBOX, "", colors.listboxFg,
81361f3e 238 colors.listboxBg);
45f6c4fd 239 SLtt_set_color(NEWT_COLORSET_ACTLISTBOX, "", colors.actListboxFg,
81361f3e 240 colors.actListboxBg);
45f6c4fd 241 SLtt_set_color(NEWT_COLORSET_TEXTBOX, "", colors.textboxFg,
81361f3e 242 colors.textboxBg);
45f6c4fd 243 SLtt_set_color(NEWT_COLORSET_ACTTEXTBOX, "", colors.actTextboxFg,
81361f3e 244 colors.actTextboxBg);
45f6c4fd 245 SLtt_set_color(NEWT_COLORSET_HELPLINE, "", colors.helpLineFg,
81361f3e 246 colors.helpLineBg);
45f6c4fd 247 SLtt_set_color(NEWT_COLORSET_ROOTTEXT, "", colors.rootTextFg,
81361f3e 248 colors.rootTextBg);
3cf3e1b9 249
250 SLtt_set_color(NEWT_COLORSET_EMPTYSCALE, "", "black",
251 colors.emptyScale);
252 SLtt_set_color(NEWT_COLORSET_FULLSCALE, "", "black",
253 colors.fullScale);
a1f11019 254 SLtt_set_color(NEWT_COLORSET_DISENTRY, "", colors.disabledEntryFg,
255 colors.disabledEntryBg);
39dd7d98 256
257 SLtt_set_color(NEWT_COLORSET_COMPACTBUTTON, "", colors.compactButtonFg,
258 colors.compactButtonBg);
45f6c4fd 259
46263d9e 260 SLtt_set_color(NEWT_COLORSET_ACTSELLISTBOX, "", colors.actSelListboxFg,
261 colors.actSelListboxBg);
262 SLtt_set_color(NEWT_COLORSET_SELLISTBOX, "", colors.selListboxFg,
263 colors.selListboxBg);
6fb96a3f 264}
265
266int newtGetKey(void) {
267 int key;
268 char buf[10], * chptr = buf;
57c466b0 269 const struct keymap * curr;
6fb96a3f 270
b7c1b763 271 do {
272 key = SLang_getkey();
ae1235d0 273 if (key == 0xFFFF) {
274 if (needResize)
275 return NEWT_KEY_RESIZE;
276
277 /* ignore other signals */
278 continue;
279 }
280
b7c1b763 281 if (key == NEWT_KEY_SUSPEND && suspendCallback)
282 suspendCallback();
283 } while (key == NEWT_KEY_SUSPEND);
6fb96a3f 284
285 switch (key) {
2d68ac53 286 case 'v' | 0x80:
287 case 'V' | 0x80:
4d3db9e2 288 return NEWT_KEY_PGUP;
289
290 case 22:
2d68ac53 291 return NEWT_KEY_PGDN;
292
4d3db9e2 293 return NEWT_KEY_BKSPC;
6fb96a3f 294 case 0x7f:
295 return NEWT_KEY_BKSPC;
296
297 case 0x08:
298 return NEWT_KEY_BKSPC;
299
300 default:
301 if (key != keyPrefix) return key;
302 }
303
304 memset(buf, 0, sizeof(buf));
305
306 *chptr++ = key;
4a2c2148 307 while (SLang_input_pending(5)) {
6fb96a3f 308 key = SLang_getkey();
2db1ec9f 309 if (key == keyPrefix) {
310 /* he hit unknown keys too many times -- start over */
311 memset(buf, 0, sizeof(buf));
312 chptr = buf;
313 }
314
6fb96a3f 315 *chptr++ = key;
316
317 /* this search should use bsearch(), but when we only look through
318 a list of 20 (or so) keymappings, it's probably faster just to
319 do a inline linear search */
320
321 for (curr = keymap; curr->code; curr++) {
322 if (curr->str) {
323 if (!strcmp(curr->str, buf))
324 return curr->code;
325 }
326 }
327 }
328
329 for (curr = keymap; curr->code; curr++) {
330 if (curr->str) {
331 if (!strcmp(curr->str, buf))
332 return curr->code;
333 }
334 }
335
336 /* Looks like we were a bit overzealous in reading characters. Return
337 just the first character, and put everything else back in the buffer
338 for later */
339
340 chptr--;
45f6c4fd 341 while (chptr > buf)
6fb96a3f 342 SLang_ungetkey(*chptr--);
343
344 return *chptr;
345}
346
347void newtWaitForKey(void) {
348 newtRefresh();
349
350 SLang_getkey();
351 newtClearKeyBuffer();
352}
353
354void newtClearKeyBuffer(void) {
355 while (SLang_input_pending(1)) {
356 SLang_getkey();
357 }
358}
359
45f6c4fd 360int newtOpenWindow(int left, int top, int width, int height,
d4109c37 361 const char * title) {
46263d9e 362 int j, row, col;
d4663248 363 int n;
44de2c93 364 int i;
6fb96a3f 365
327436b3 366 newtFlushInput();
367
6fb96a3f 368 if (!currentWindow) {
369 currentWindow = windowStack;
370 } else {
371 currentWindow++;
372 }
373
374 currentWindow->left = left;
375 currentWindow->top = top;
376 currentWindow->width = width;
377 currentWindow->height = height;
649a0152 378 currentWindow->title = title ? strdup(title) : NULL;
6fb96a3f 379
380 currentWindow->buffer = malloc(sizeof(short) * (width + 3) * (height + 3));
381
382 row = top - 1;
d4663248 383 col = left - 1;
384 n = 0;
6fb96a3f 385 for (j = 0; j < height + 3; j++, row++) {
d4663248 386 SLsmg_gotorc(row, col);
387 SLsmg_read_raw(currentWindow->buffer + n,
388 currentWindow->width + 3);
389 n += currentWindow->width + 3;
6fb96a3f 390 }
391
81361f3e 392 SLsmg_set_color(NEWT_COLORSET_BORDER);
6fb96a3f 393 SLsmg_draw_box(top - 1, left - 1, height + 2, width + 2);
394
aa47774f 395 if (currentWindow->title) {
396 i = strlen(currentWindow->title) + 4;
6fb96a3f 397 i = ((width - i) / 2) + left;
398 SLsmg_gotorc(top - 1, i);
399 SLsmg_set_char_set(1);
400 SLsmg_write_char(SLSMG_RTEE_CHAR);
401 SLsmg_set_char_set(0);
402 SLsmg_write_char(' ');
81361f3e 403 SLsmg_set_color(NEWT_COLORSET_TITLE);
d4109c37 404 SLsmg_write_string((char *)currentWindow->title);
81361f3e 405 SLsmg_set_color(NEWT_COLORSET_BORDER);
6fb96a3f 406 SLsmg_write_char(' ');
407 SLsmg_set_char_set(1);
408 SLsmg_write_char(SLSMG_LTEE_CHAR);
409 SLsmg_set_char_set(0);
410 }
411
81361f3e 412 SLsmg_set_color(NEWT_COLORSET_WINDOW);
6fb96a3f 413 SLsmg_fill_region(top, left, height, width, ' ');
414
81361f3e 415 SLsmg_set_color(NEWT_COLORSET_SHADOW);
6fb96a3f 416 SLsmg_fill_region(top + height + 1, left, 1, width + 2, ' ');
417 SLsmg_fill_region(top, left + width + 1, height + 1, 1, ' ');
418
419 for (i = top; i < (top + height + 1); i++) {
420 SLsmg_gotorc(i, left + width + 1);
421 SLsmg_write_string(" ");
422 }
44de2c93 423
424 return 0;
6fb96a3f 425}
426
f16e164f 427int newtCenteredWindow(int width, int height, const char * title) {
428 int top, left;
429
430 top = (SLtt_Screen_Rows - height) / 2;
431
45f6c4fd 432 /* I don't know why, but this seems to look better */
f16e164f 433 if ((SLtt_Screen_Rows % 2) && (top % 2)) top--;
434
435 left = (SLtt_Screen_Cols - width) / 2;
436
437 newtOpenWindow(left, top, width, height, title);
438
439 return 0;
440}
441
6fb96a3f 442void newtPopWindow(void) {
443 int j, row, col;
45f6c4fd 444 int n = 0;
6fb96a3f 445
446 row = col = 0;
447
448 row = currentWindow->top - 1;
449 col = currentWindow->left - 1;
450 for (j = 0; j < currentWindow->height + 3; j++, row++) {
451 SLsmg_gotorc(row, col);
d4663248 452 SLsmg_write_raw(currentWindow->buffer + n,
6fb96a3f 453 currentWindow->width + 3);
454 n += currentWindow->width + 3;
455 }
456
457 free(currentWindow->buffer);
aa47774f 458 free(currentWindow->title);
6fb96a3f 459
45f6c4fd 460 if (currentWindow == windowStack)
6fb96a3f 461 currentWindow = NULL;
462 else
463 currentWindow--;
464
465 SLsmg_set_char_set(0);
466
467 newtRefresh();
468}
469
45f6c4fd 470void newtGetWindowPos(int * x, int * y) {
471 if (currentWindow) {
472 *x = currentWindow->left;
473 *y = currentWindow->top;
474 } else
475 *x = *y = 0;
476}
477
a1f11019 478void newtGetrc(int * row, int * col) {
479 *row = cursorRow;
480 *col = cursorCol;
481}
482
483void newtGotorc(int newRow, int newCol) {
484 if (currentWindow) {
485 newRow += currentWindow->top;
486 newCol += currentWindow->left;
487 }
488
489 cursorRow = newRow;
490 cursorCol = newCol;
491 SLsmg_gotorc(cursorRow, cursorCol);
6fb96a3f 492}
493
494void newtDrawBox(int left, int top, int width, int height, int shadow) {
495 if (currentWindow) {
496 top += currentWindow->top;
497 left += currentWindow->left;
498 }
499
500 SLsmg_draw_box(top, left, height, width);
501
502 if (shadow) {
81361f3e 503 SLsmg_set_color(NEWT_COLORSET_SHADOW);
6fb96a3f 504 SLsmg_fill_region(top + height, left + 1, 1, width - 1, ' ');
505 SLsmg_fill_region(top + 1, left + width, height, 1, ' ');
506 }
507}
508
509void newtClearBox(int left, int top, int width, int height) {
510 if (currentWindow) {
511 top += currentWindow->top;
512 left += currentWindow->left;
513 }
514
515 SLsmg_fill_region(top, left, height, width, ' ');
516}
517
45f6c4fd 518#if 0
6fb96a3f 519/* This doesn't seem to work quite right. I don't know why not, but when
520 I rsh from an rxvt into a box and run this code, the machine returns
521 console key's (\033[B) rather then xterm ones (\033OB). */
522static void initKeymap(void) {
523 struct keymap * curr;
524
525 for (curr = keymap; curr->code; curr++) {
526 if (!curr->str)
527 curr->str = SLtt_tgetstr(curr->tc);
528 }
529
530 /* Newt's keymap handling is a bit broken. It assumes that any extended
531 keystrokes begin with ESC. If you're using a homebrek terminal you
532 will probably need to fix this, or just yell at me and I'll be so
533 ashamed of myself for doing it this way I'll fix it */
534
535 keyPrefix = 0x1b; /* ESC */
536}
537#endif
538
539void newtDelay(int usecs) {
540 fd_set set;
541 struct timeval tv;
542
543 FD_ZERO(&set);
544
545 tv.tv_sec = usecs / 1000000;
546 tv.tv_usec = usecs % 1000000;
547
548 select(0, &set, &set, &set, &tv);
549}
8735cc88 550
45c366b1 551struct eventResult newtDefaultEventHandler(newtComponent c,
8735cc88 552 struct event ev) {
553 struct eventResult er;
554
555 er.result = ER_IGNORED;
556 return er;
557}
81361f3e 558
7d4604a9 559void newtRedrawHelpLine(void) {
81361f3e 560 char * buf;
561
562 SLsmg_set_color(NEWT_COLORSET_HELPLINE);
45f6c4fd 563
81361f3e 564 buf = alloca(SLtt_Screen_Cols + 1);
565 memset(buf, ' ', SLtt_Screen_Cols);
566 buf[SLtt_Screen_Cols] = '\0';
567
568 if (currentHelpline)
569 memcpy(buf, *currentHelpline, strlen(*currentHelpline));
570
571 SLsmg_gotorc(SLtt_Screen_Rows - 1, 0);
572 SLsmg_write_string(buf);
573}
574
d4109c37 575void newtPushHelpLine(const char * text) {
7d4604a9 576 if (!text)
577 text = defaultHelpLine;
45f6c4fd 578
81361f3e 579 if (currentHelpline)
580 (*(++currentHelpline)) = strdup(text);
581 else {
582 currentHelpline = helplineStack;
583 *currentHelpline = strdup(text);
584 }
585
7d4604a9 586 newtRedrawHelpLine();
81361f3e 587}
588
589void newtPopHelpLine(void) {
590 if (!currentHelpline) return;
591
592 free(*currentHelpline);
593 if (currentHelpline == helplineStack)
594 currentHelpline = NULL;
595 else
596 currentHelpline--;
597
7d4604a9 598 newtRedrawHelpLine();
81361f3e 599}
600
39280c3a 601void newtDrawRootText(int col, int row, const char * text) {
81361f3e 602 SLsmg_set_color(NEWT_COLORSET_ROOTTEXT);
7d4604a9 603
604 if (col < 0) {
605 col = SLtt_Screen_Cols + col;
606 }
607
608 if (row < 0) {
39280c3a 609 row = SLtt_Screen_Rows + row;
7d4604a9 610 }
45f6c4fd 611
81361f3e 612 SLsmg_gotorc(row, col);
d4109c37 613 SLsmg_write_string((char *)text);
81361f3e 614}
a1f11019 615
616int newtSetFlags(int oldFlags, int newFlags, enum newtFlagsSense sense) {
617 switch (sense) {
618 case NEWT_FLAGS_SET:
619 return oldFlags | newFlags;
620
621 case NEWT_FLAGS_RESET:
45f6c4fd 622 return oldFlags & (~newFlags);
a1f11019 623
69bf2308 624 case NEWT_FLAGS_TOGGLE:
625 return oldFlags ^ newFlags;
626
a1f11019 627 default:
628 return oldFlags;
629 }
630}
69bf2308 631
632void newtBell(void)
633{
721584c3 634 SLtt_beep();
635}
636
637void newtGetScreenSize(int * cols, int * rows) {
638 if (rows) *rows = SLtt_Screen_Rows;
639 if (cols) *cols = SLtt_Screen_Cols;
69bf2308 640}
8f52cd47 641
642void newtDefaultPlaceHandler(newtComponent c, int newLeft, int newTop) {
643 c->left = newLeft;
644 c->top = newTop;
645}
646
647void newtDefaultMappedHandler(newtComponent c, int isMapped) {
648 c->isMapped = isMapped;
649}