Patrick Georgi | 3b77b72 | 2011-07-07 15:41:53 +0200 | [diff] [blame] | 1 | /* Public Domain Curses */ |
| 2 | |
| 3 | #include "pdcdos.h" |
| 4 | |
| 5 | RCSID("$Id: pdcsetsc.c,v 1.39 2008/07/13 16:08:17 wmcbrine Exp $") |
| 6 | |
| 7 | /*man-start************************************************************** |
| 8 | |
| 9 | Name: pdcsetsc |
| 10 | |
| 11 | Synopsis: |
| 12 | int PDC_set_blink(bool blinkon); |
| 13 | void PDC_set_title(const char *title); |
| 14 | |
| 15 | Description: |
| 16 | PDC_set_blink() toggles whether the A_BLINK attribute sets an |
| 17 | actual blink mode (TRUE), or sets the background color to high |
| 18 | intensity (FALSE). The default is platform-dependent (FALSE in |
Stefan Reinauer | e11835e | 2011-10-31 12:54:00 -0700 | [diff] [blame] | 19 | most cases). It returns OK if it could set the state to match |
| 20 | the given parameter, ERR otherwise. Current platforms also |
| 21 | adjust the value of COLORS according to this function -- 16 for |
Patrick Georgi | 3b77b72 | 2011-07-07 15:41:53 +0200 | [diff] [blame] | 22 | FALSE, and 8 for TRUE. |
| 23 | |
| 24 | PDC_set_title() sets the title of the window in which the curses |
| 25 | program is running. This function may not do anything on some |
| 26 | platforms. (Currently it only works in Win32 and X11.) |
| 27 | |
| 28 | Portability X/Open BSD SYS V |
| 29 | PDC_set_blink - - - |
| 30 | PDC_set_title - - - |
| 31 | |
| 32 | **man-end****************************************************************/ |
| 33 | |
| 34 | int PDC_curs_set(int visibility) |
| 35 | { |
| 36 | PDCREGS regs; |
| 37 | int ret_vis, start, end; |
| 38 | |
| 39 | PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); |
| 40 | |
| 41 | ret_vis = SP->visibility; |
| 42 | SP->visibility = visibility; |
| 43 | |
| 44 | switch (visibility) |
| 45 | { |
| 46 | case 0: /* invisible */ |
| 47 | start = 32; |
| 48 | end = 0; /* was 32 */ |
| 49 | break; |
| 50 | case 2: /* highly visible */ |
| 51 | start = 0; /* full-height block */ |
| 52 | end = 7; |
| 53 | break; |
| 54 | default: /* normal visibility */ |
| 55 | start = (SP->orig_cursor >> 8) & 0xff; |
| 56 | end = SP->orig_cursor & 0xff; |
| 57 | } |
| 58 | |
| 59 | /* if scrnmode is not set, some BIOSes hang */ |
| 60 | |
| 61 | regs.h.ah = 0x01; |
Stefan Reinauer | e11835e | 2011-10-31 12:54:00 -0700 | [diff] [blame] | 62 | regs.h.al = (unsigned char)pdc_scrnmode; |
Patrick Georgi | 3b77b72 | 2011-07-07 15:41:53 +0200 | [diff] [blame] | 63 | regs.h.ch = (unsigned char)start; |
| 64 | regs.h.cl = (unsigned char)end; |
| 65 | PDCINT(0x10, regs); |
| 66 | |
| 67 | return ret_vis; |
| 68 | } |
| 69 | |
| 70 | void PDC_set_title(const char *title) |
| 71 | { |
| 72 | PDC_LOG(("PDC_set_title() - called: <%s>\n", title)); |
| 73 | } |
| 74 | |
| 75 | int PDC_set_blink(bool blinkon) |
| 76 | { |
| 77 | PDCREGS regs; |
| 78 | |
| 79 | switch (pdc_adapter) |
| 80 | { |
| 81 | case _EGACOLOR: |
| 82 | case _EGAMONO: |
| 83 | case _VGACOLOR: |
| 84 | case _VGAMONO: |
| 85 | regs.W.ax = 0x1003; |
| 86 | regs.W.bx = blinkon; |
| 87 | |
| 88 | PDCINT(0x10, regs); |
| 89 | |
| 90 | if (pdc_color_started) |
| 91 | COLORS = blinkon ? 8 : 16; |
| 92 | |
| 93 | break; |
| 94 | default: |
| 95 | COLORS = 8; |
| 96 | } |
| 97 | |
| 98 | return (COLORS - (blinkon * 8) != 8) ? OK : ERR; |
| 99 | } |