drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / payloads / libpayload / curses / PDCurses / os2 / pdcsetsc.c
blobbc28b03acac3c1259db6c3211d2c526e1382a9b8
1 /* Public Domain Curses */
3 #include "pdcos2.h"
5 RCSID("$Id: pdcsetsc.c,v 1.44 2008/07/14 04:24:51 wmcbrine Exp $")
7 /*man-start**************************************************************
9 Name: pdcsetsc
11 Synopsis:
12 int PDC_set_blink(bool blinkon);
13 void PDC_set_title(const char *title);
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
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
22 FALSE, and 8 for TRUE.
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.)
28 Portability X/Open BSD SYS V
29 PDC_set_blink - - -
30 PDC_set_title - - -
32 **man-end****************************************************************/
34 int PDC_curs_set(int visibility)
36 #ifndef EMXVIDEO
37 VIOCURSORINFO pvioCursorInfo;
38 #endif
39 int ret_vis, hidden = 0, start = 0, end = 0;
41 PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
43 ret_vis = SP->visibility;
44 SP->visibility = visibility;
46 switch(visibility)
48 case 0: /* invisible */
49 #ifdef EMXVIDEO
50 start = end = 0;
51 #else
52 start = pdc_font / 4;
53 end = pdc_font;
54 hidden = -1;
55 #endif
56 break;
58 case 2: /* highly visible */
59 start = 2; /* almost full-height block */
60 end = pdc_font - 1;
61 break;
63 default: /* normal visibility */
64 start = (SP->orig_cursor >> 8) & 0xff;
65 end = SP->orig_cursor & 0xff;
68 #ifdef EMXVIDEO
69 if (!visibility)
70 v_hidecursor();
71 else
72 v_ctype(start, end);
73 #else
74 pvioCursorInfo.yStart = (USHORT)start;
75 pvioCursorInfo.cEnd = (USHORT)end;
76 pvioCursorInfo.cx = (USHORT)1;
77 pvioCursorInfo.attr = hidden;
78 VioSetCurType((PVIOCURSORINFO)&pvioCursorInfo, 0);
79 #endif
80 return ret_vis;
83 void PDC_set_title(const char *title)
85 PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
88 int PDC_set_blink(bool blinkon)
90 #ifndef EMXVIDEO
91 USHORT statebuf[3], result;
93 statebuf[0] = 6; /* length */
94 statebuf[1] = 2; /* blink/intensity */
95 statebuf[2] = !blinkon;
97 result = VioSetState(&statebuf, 0);
98 VioGetState(&statebuf, 0); /* needed? */
100 if (pdc_color_started)
101 COLORS = statebuf[2] ? 16 : 8;
103 return (result == 0) ? OK : ERR;
104 #else
105 if (pdc_color_started)
106 COLORS = 16;
108 return blinkon ? ERR : OK;
109 #endif