Changeset 00bb6965 in mainline for uspace/console/gcons.c
- Timestamp:
- 2006-12-11T23:17:58Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- df496c5
- Parents:
- dff0a94
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/console/gcons.c
rdff0a94 r00bb6965 75 75 76 76 /** List of pixmaps identifying these icons */ 77 static int ic_pixmaps[CONS_LAST] = {-1, -1,-1,-1,-1,-1};77 static int ic_pixmaps[CONS_LAST] = {-1, -1, -1, -1, -1, -1}; 78 78 static int animation = -1; 79 79 … … 120 120 vp_switch(cstatus_vp[consnum]); 121 121 if (ic_pixmaps[state] != -1) 122 async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum], ic_pixmaps[state]); 123 124 if (state != CONS_DISCONNECTED && state != CONS_KERNEL && state != CONS_DISCONNECTED_SEL) { 125 snprintf(data, 5, "%d", consnum+1); 126 for (i=0;data[i];i++) 127 tran_putch(data[i], 1, 2+i); 122 async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum], 123 ic_pixmaps[state]); 124 125 if (state != CONS_DISCONNECTED && state != CONS_KERNEL && state != 126 CONS_DISCONNECTED_SEL) { 127 snprintf(data, 5, "%d", consnum + 1); 128 for (i=0; data[i]; i++) 129 tran_putch(data[i], 1, 2 + i); 128 130 } 129 131 } … … 138 140 139 141 if (active_console == KERNEL_CONSOLE) { 140 for (i =0; i < CONSOLE_COUNT; i++)142 for (i = 0; i < CONSOLE_COUNT; i++) 141 143 redraw_state(i); 142 144 if (animation != -1) … … 167 169 return; 168 170 169 if (consnum == active_console || console_state[consnum] == CONS_HAS_DATA) 171 if (consnum == active_console || console_state[consnum] == 172 CONS_HAS_DATA) 170 173 return; 171 174 … … 258 261 static int gcons_find_conbut(int x, int y) 259 262 { 260 int status_start = STATUS_START + (xres -800) / 2;;261 262 if (y < STATUS_TOP || y >= STATUS_TOP +STATUS_HEIGHT)263 int status_start = STATUS_START + (xres - 800) / 2;; 264 265 if (y < STATUS_TOP || y >= STATUS_TOP + STATUS_HEIGHT) 263 266 return -1; 264 267 … … 266 269 return -1; 267 270 268 if (x >= status_start + (STATUS_WIDTH +STATUS_SPACE)*CONSOLE_COUNT)271 if (x >= status_start + (STATUS_WIDTH + STATUS_SPACE) * CONSOLE_COUNT) 269 272 return -1; 270 273 if (((x - status_start) % (STATUS_WIDTH+STATUS_SPACE)) < STATUS_SPACE) 271 274 return -1; 272 275 273 return (x -status_start) / (STATUS_WIDTH+STATUS_SPACE);276 return (x - status_start) / (STATUS_WIDTH+STATUS_SPACE); 274 277 } 275 278 … … 315 318 316 319 /* Create area */ 317 shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); 320 shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | 321 MAP_ANONYMOUS, 0, 0); 318 322 if (shm == MAP_FAILED) 319 323 return; … … 321 325 memcpy(shm, logo, size); 322 326 /* Send area */ 323 rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL); 327 rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL, 328 NULL); 324 329 if (rc) 325 330 goto exit; 326 rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL); 331 rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0, 332 PROTO_READ, NULL, NULL, NULL); 327 333 if (rc) 328 334 goto drop; … … 352 358 set_style(MAIN_COLOR, MAIN_COLOR); 353 359 clear(); 354 draw_pixmap(_binary_helenos_ppm_start, (size_t)&_binary_helenos_ppm_size, xres-66, 2); 355 draw_pixmap(_binary_nameic_ppm_start, (size_t)&_binary_nameic_ppm_size, 5, 17); 356 357 for (i=0;i < CONSOLE_COUNT; i++) 360 draw_pixmap(_binary_helenos_ppm_start, (size_t) 361 &_binary_helenos_ppm_size, xres - 66, 2); 362 draw_pixmap(_binary_nameic_ppm_start, (size_t) 363 &_binary_nameic_ppm_size, 5, 17); 364 365 for (i=0;i < CONSOLE_COUNT; i++) 358 366 redraw_state(i); 359 367 vp_switch(console_vp); … … 373 381 374 382 /* Create area */ 375 shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); 383 shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | 384 MAP_ANONYMOUS, 0, 0); 376 385 if (shm == MAP_FAILED) 377 386 return -1; … … 379 388 memcpy(shm, data, size); 380 389 /* Send area */ 381 rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL); 390 rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL, 391 NULL); 382 392 if (rc) 383 393 goto exit; 384 rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL); 394 rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0, 395 PROTO_READ, NULL, NULL, NULL); 385 396 if (rc) 386 397 goto drop; … … 409 420 extern char _binary_anim_4_ppm_start[0]; 410 421 extern int _binary_anim_4_ppm_size; 422 411 423 static void make_anim(void) 412 424 { … … 414 426 int pm; 415 427 416 an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE], NULL); 428 an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE], 429 NULL); 417 430 if (an < 0) 418 431 return; 419 432 420 pm = make_pixmap(_binary_anim_1_ppm_start, (int)&_binary_anim_1_ppm_size); 433 pm = make_pixmap(_binary_anim_1_ppm_start, (int) 434 &_binary_anim_1_ppm_size); 421 435 async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 422 436 423 pm = make_pixmap(_binary_anim_2_ppm_start, (int)&_binary_anim_2_ppm_size); 437 pm = make_pixmap(_binary_anim_2_ppm_start, (int) 438 &_binary_anim_2_ppm_size); 424 439 async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 425 440 426 pm = make_pixmap(_binary_anim_3_ppm_start, (int)&_binary_anim_3_ppm_size); 441 pm = make_pixmap(_binary_anim_3_ppm_start, (int) 442 &_binary_anim_3_ppm_size); 427 443 async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 428 444 429 pm = make_pixmap(_binary_anim_4_ppm_start, (int)&_binary_anim_4_ppm_size); 445 pm = make_pixmap(_binary_anim_4_ppm_start, (int) 446 &_binary_anim_4_ppm_size); 430 447 async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 431 448 … … 443 460 extern char _binary_cons_kernel_ppm_start[0]; 444 461 extern int _binary_cons_kernel_ppm_size; 462 445 463 /** Initialize nice graphical console environment */ 446 464 void gcons_init(int phone) … … 461 479 /* create console viewport */ 462 480 /* Align width & height to character size */ 463 console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, 464 ALIGN_DOWN(xres-2*CONSOLE_MARGIN, 8),465 ALIGN_DOWN(yres-(CONSOLE_TOP+CONSOLE_MARGIN),16));481 console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, ALIGN_DOWN(xres - 482 2 * CONSOLE_MARGIN, 8), ALIGN_DOWN(yres - (CONSOLE_TOP + 483 CONSOLE_MARGIN), 16)); 466 484 if (console_vp < 0) 467 485 return; 468 486 469 487 /* Create status buttons */ 470 status_start += (xres-800) / 2; 471 for (i=0; i < CONSOLE_COUNT; i++) { 472 cstatus_vp[i] = vp_create(status_start+CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE), 473 STATUS_TOP, STATUS_WIDTH, STATUS_HEIGHT); 488 status_start += (xres - 800) / 2; 489 for (i = 0; i < CONSOLE_COUNT; i++) { 490 cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN + i * 491 (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP, 492 STATUS_WIDTH, STATUS_HEIGHT); 474 493 if (cstatus_vp[i] < 0) 475 494 return; … … 479 498 480 499 /* Initialize icons */ 481 ic_pixmaps[CONS_SELECTED] = make_pixmap(_binary_cons_selected_ppm_start, 482 (int)&_binary_cons_selected_ppm_size); 483 ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start, 484 (int)&_binary_cons_idle_ppm_size); 485 ic_pixmaps[CONS_HAS_DATA] = make_pixmap(_binary_cons_has_data_ppm_start, 486 (int)&_binary_cons_has_data_ppm_size); 487 ic_pixmaps[CONS_DISCONNECTED] = make_pixmap(_binary_cons_idle_ppm_start, 488 (int)&_binary_cons_idle_ppm_size); 500 ic_pixmaps[CONS_SELECTED] = 501 make_pixmap(_binary_cons_selected_ppm_start, (int) 502 &_binary_cons_selected_ppm_size); 503 ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start, (int) 504 &_binary_cons_idle_ppm_size); 505 ic_pixmaps[CONS_HAS_DATA] = 506 make_pixmap(_binary_cons_has_data_ppm_start, (int) 507 &_binary_cons_has_data_ppm_size); 508 ic_pixmaps[CONS_DISCONNECTED] = 509 make_pixmap(_binary_cons_idle_ppm_start, (int) 510 &_binary_cons_idle_ppm_size); 489 511 ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start, 490 (int)&_binary_cons_kernel_ppm_size);512 (int) &_binary_cons_kernel_ppm_size); 491 513 ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED]; 492 514
Note:
See TracChangeset
for help on using the changeset viewer.