Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2024 → Rev 2025

/trunk/uspace/console/gcons.c
74,7 → 74,7
static int fbphone;
 
/** List of pixmaps identifying these icons */
static int ic_pixmaps[CONS_LAST] = {-1,-1,-1,-1,-1,-1};
static int ic_pixmaps[CONS_LAST] = {-1, -1, -1, -1, -1, -1};
static int animation = -1;
 
static int active_console = 0;
119,12 → 119,14
 
vp_switch(cstatus_vp[consnum]);
if (ic_pixmaps[state] != -1)
async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum], ic_pixmaps[state]);
async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum],
ic_pixmaps[state]);
 
if (state != CONS_DISCONNECTED && state != CONS_KERNEL && state != CONS_DISCONNECTED_SEL) {
snprintf(data, 5, "%d", consnum+1);
for (i=0;data[i];i++)
tran_putch(data[i], 1, 2+i);
if (state != CONS_DISCONNECTED && state != CONS_KERNEL && state !=
CONS_DISCONNECTED_SEL) {
snprintf(data, 5, "%d", consnum + 1);
for (i=0; data[i]; i++)
tran_putch(data[i], 1, 2 + i);
}
}
 
137,7 → 139,7
return;
 
if (active_console == KERNEL_CONSOLE) {
for (i=0; i < CONSOLE_COUNT; i++)
for (i = 0; i < CONSOLE_COUNT; i++)
redraw_state(i);
if (animation != -1)
async_msg(fbphone, FB_ANIM_START, animation);
166,7 → 168,8
if (!use_gcons)
return;
 
if (consnum == active_console || console_state[consnum] == CONS_HAS_DATA)
if (consnum == active_console || console_state[consnum] ==
CONS_HAS_DATA)
return;
 
console_state[consnum] = CONS_HAS_DATA;
257,20 → 260,20
 
static int gcons_find_conbut(int x, int y)
{
int status_start = STATUS_START + (xres-800) / 2;;
int status_start = STATUS_START + (xres - 800) / 2;;
 
if (y < STATUS_TOP || y >= STATUS_TOP+STATUS_HEIGHT)
if (y < STATUS_TOP || y >= STATUS_TOP + STATUS_HEIGHT)
return -1;
if (x < status_start)
return -1;
if (x >= status_start + (STATUS_WIDTH+STATUS_SPACE)*CONSOLE_COUNT)
if (x >= status_start + (STATUS_WIDTH + STATUS_SPACE) * CONSOLE_COUNT)
return -1;
if (((x - status_start) % (STATUS_WIDTH+STATUS_SPACE)) < STATUS_SPACE)
return -1;
return (x-status_start) / (STATUS_WIDTH+STATUS_SPACE);
return (x - status_start) / (STATUS_WIDTH+STATUS_SPACE);
}
 
/** Handle mouse click
314,16 → 317,19
int rc;
 
/* Create area */
shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |
MAP_ANONYMOUS, 0, 0);
if (shm == MAP_FAILED)
return;
 
memcpy(shm, logo, size);
/* Send area */
rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL);
rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL,
NULL);
if (rc)
goto exit;
rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL);
rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
PROTO_READ, NULL, NULL, NULL);
if (rc)
goto drop;
/* Draw logo */
351,10 → 357,12
vp_switch(0);
set_style(MAIN_COLOR, MAIN_COLOR);
clear();
draw_pixmap(_binary_helenos_ppm_start, (size_t)&_binary_helenos_ppm_size, xres-66, 2);
draw_pixmap(_binary_nameic_ppm_start, (size_t)&_binary_nameic_ppm_size, 5, 17);
draw_pixmap(_binary_helenos_ppm_start, (size_t)
&_binary_helenos_ppm_size, xres - 66, 2);
draw_pixmap(_binary_nameic_ppm_start, (size_t)
&_binary_nameic_ppm_size, 5, 17);
 
for (i=0;i < CONSOLE_COUNT; i++)
for (i=0;i < CONSOLE_COUNT; i++)
redraw_state(i);
vp_switch(console_vp);
}
372,16 → 380,19
int pxid = -1;
 
/* Create area */
shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |
MAP_ANONYMOUS, 0, 0);
if (shm == MAP_FAILED)
return -1;
 
memcpy(shm, data, size);
/* Send area */
rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL);
rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL,
NULL);
if (rc)
goto exit;
rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL);
rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
PROTO_READ, NULL, NULL, NULL);
if (rc)
goto drop;
 
408,25 → 419,31
extern int _binary_anim_3_ppm_size;
extern char _binary_anim_4_ppm_start[0];
extern int _binary_anim_4_ppm_size;
 
static void make_anim(void)
{
int an;
int pm;
 
an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE], NULL);
an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE],
NULL);
if (an < 0)
return;
 
pm = make_pixmap(_binary_anim_1_ppm_start, (int)&_binary_anim_1_ppm_size);
pm = make_pixmap(_binary_anim_1_ppm_start, (int)
&_binary_anim_1_ppm_size);
async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
 
pm = make_pixmap(_binary_anim_2_ppm_start, (int)&_binary_anim_2_ppm_size);
pm = make_pixmap(_binary_anim_2_ppm_start, (int)
&_binary_anim_2_ppm_size);
async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
 
pm = make_pixmap(_binary_anim_3_ppm_start, (int)&_binary_anim_3_ppm_size);
pm = make_pixmap(_binary_anim_3_ppm_start, (int)
&_binary_anim_3_ppm_size);
async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
 
pm = make_pixmap(_binary_anim_4_ppm_start, (int)&_binary_anim_4_ppm_size);
pm = make_pixmap(_binary_anim_4_ppm_start, (int)
&_binary_anim_4_ppm_size);
async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
 
async_msg(fbphone, FB_ANIM_START, an);
442,6 → 459,7
extern int _binary_cons_has_data_ppm_size;
extern char _binary_cons_kernel_ppm_start[0];
extern int _binary_cons_kernel_ppm_size;
 
/** Initialize nice graphical console environment */
void gcons_init(int phone)
{
460,17 → 478,18
 
/* create console viewport */
/* Align width & height to character size */
console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP,
ALIGN_DOWN(xres-2*CONSOLE_MARGIN, 8),
ALIGN_DOWN(yres-(CONSOLE_TOP+CONSOLE_MARGIN),16));
console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, ALIGN_DOWN(xres -
2 * CONSOLE_MARGIN, 8), ALIGN_DOWN(yres - (CONSOLE_TOP +
CONSOLE_MARGIN), 16));
if (console_vp < 0)
return;
/* Create status buttons */
status_start += (xres-800) / 2;
for (i=0; i < CONSOLE_COUNT; i++) {
cstatus_vp[i] = vp_create(status_start+CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE),
STATUS_TOP, STATUS_WIDTH, STATUS_HEIGHT);
status_start += (xres - 800) / 2;
for (i = 0; i < CONSOLE_COUNT; i++) {
cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN + i *
(STATUS_WIDTH + STATUS_SPACE), STATUS_TOP,
STATUS_WIDTH, STATUS_HEIGHT);
if (cstatus_vp[i] < 0)
return;
vp_switch(cstatus_vp[i]);
478,16 → 497,19
}
/* Initialize icons */
ic_pixmaps[CONS_SELECTED] = make_pixmap(_binary_cons_selected_ppm_start,
(int)&_binary_cons_selected_ppm_size);
ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start,
(int)&_binary_cons_idle_ppm_size);
ic_pixmaps[CONS_HAS_DATA] = make_pixmap(_binary_cons_has_data_ppm_start,
(int)&_binary_cons_has_data_ppm_size);
ic_pixmaps[CONS_DISCONNECTED] = make_pixmap(_binary_cons_idle_ppm_start,
(int)&_binary_cons_idle_ppm_size);
ic_pixmaps[CONS_SELECTED] =
make_pixmap(_binary_cons_selected_ppm_start, (int)
&_binary_cons_selected_ppm_size);
ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start, (int)
&_binary_cons_idle_ppm_size);
ic_pixmaps[CONS_HAS_DATA] =
make_pixmap(_binary_cons_has_data_ppm_start, (int)
&_binary_cons_has_data_ppm_size);
ic_pixmaps[CONS_DISCONNECTED] =
make_pixmap(_binary_cons_idle_ppm_start, (int)
&_binary_cons_idle_ppm_size);
ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start,
(int)&_binary_cons_kernel_ppm_size);
(int) &_binary_cons_kernel_ppm_size);
ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED];
make_anim();