Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1500 → Rev 1499

/uspace/trunk/fb/fb.c
76,7 → 76,6
int bgcolor, fgcolor;
/* Auto-cursor position */
int cursor_active, cur_col, cur_row;
int cursor_shown;
} viewport_t;
 
#define MAX_VIEWPORTS 128
396,37 → 395,6
clear_port(0);
}
 
static void cursor_hide(int vp)
{
viewport_t *vport = &viewports[vp];
 
if (vport->cursor_active && vport->cursor_shown) {
invert_char(vp, vport->cur_row, vport->cur_col);
vport->cursor_shown = 0;
}
}
 
static void cursor_print(int vp)
{
viewport_t *vport = &viewports[vp];
 
/* Do not check for cursor_shown */
if (vport->cursor_active) {
invert_char(vp, vport->cur_row, vport->cur_col);
vport->cursor_shown = 1;
}
}
 
static void cursor_blink(int vp)
{
viewport_t *vport = &viewports[vp];
 
if (vport->cursor_shown)
cursor_hide(vp);
else
cursor_print(vp);
}
 
/** Draw character at given position relative to viewport
*
* @param vp Viewport identification
438,9 → 406,7
{
viewport_t *vport = &viewports[vp];
 
/* Optimize - do not hide cursor if we are going to overwrite it */
if (vport->cursor_active && vport->cursor_shown &&
(vport->cur_col != col || vport->cur_row != row))
if (vport->cursor_active && (vport->cur_col != col || vport->cur_row != row))
invert_char(vp, vport->cur_row, vport->cur_col);
draw_glyph(vp, c, col * COL_WIDTH, row * FONT_SCANLINES);
455,7 → 421,8
if (vport->cur_row >= vport->rows)
vport->cur_row--;
}
cursor_print(vp);
if (vport->cursor_active)
invert_char(vp, vport->cur_row, vport->cur_col);
}
 
/** Function for handling connections to FB
481,11 → 448,7
ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */
 
while (1) {
callid = async_get_call_timeout(&call,250000);
if (!callid) {
cursor_blink(vp);
continue;
}
callid = async_get_call(&call);
switch (IPC_GET_METHOD(call)) {
case IPC_M_PHONE_HUNGUP:
client_connected = 0;
508,7 → 471,8
continue; /* msg already answered */
case FB_CLEAR:
clear_port(vp);
cursor_print(vp);
if (vport->cursor_active)
invert_char(vp, vport->cur_row, vport->cur_col);
retval = 0;
break;
case FB_CURSOR_GOTO:
519,16 → 483,21
break;
}
retval = 0;
cursor_hide(vp);
if (viewports[vp].cursor_active) {
invert_char(vp, vport->cur_row, vport->cur_col);
invert_char(vp, row, col);
}
vport->cur_col = col;
vport->cur_row = row;
cursor_print(vp);
break;
case FB_CURSOR_VISIBILITY:
cursor_hide(vp);
vport->cursor_active = IPC_GET_ARG1(call);
cursor_print(vp);
i = IPC_GET_ARG1(call);
retval = 0;
if ((i && vport->cursor_active) || (!i && !vport->cursor_active))
break;
 
vport->cursor_active = i;
invert_char(vp, vport->cur_row, vport->cur_col);
break;
case FB_GET_CSIZE:
ipc_answer_fast(callid, 0, vport->rows, vport->cols);
539,9 → 508,11
retval = EINVAL;
break;
}
cursor_hide(vp);
if (vport->cursor_active)
invert_char(vp, vport->cur_row, vport->cur_col);
scroll_port(vp, i);
cursor_print(vp);
if (vport->cursor_active)
invert_char(vp, vport->cur_row, vport->cur_col);
retval = 0;
break;
case FB_VIEWPORT_SWITCH:
554,10 → 525,8
retval = EADDRNOTAVAIL;
break;
}
cursor_hide(vp);
vp = i;
vport = &viewports[vp];
cursor_print(vp);
retval = 0;
break;
case FB_VIEWPORT_CREATE: