Changeset 88c3151 in mainline
- Timestamp:
- 2006-06-01T15:27:38Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3993b3d
- Parents:
- a2ae4f4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
fb/fb.c
ra2ae4f4 r88c3151 78 78 int bgcolor, fgcolor; 79 79 /* Auto-cursor position */ 80 int cursor_active, cur_ x, cur_y;80 int cursor_active, cur_col, cur_row; 81 81 } viewport_t; 82 82 … … 197 197 } 198 198 } 199 200 /** Optimized scroll for windows that cover whole lines */201 //static void scroll_optim(int vp, int rows)202 //{203 /* TODO */204 //}205 199 206 200 /** Scroll port up/down … … 323 317 return ELIMIT; 324 318 325 viewports[i].initialized = 1; 319 if (width ==0 || height == 0 || 320 x+width > screen.xres || y+height > screen.yres) 321 return EINVAL; 322 if (width < FONT_SCANLINES || height < COL_WIDTH) 323 return EINVAL; 324 326 325 viewports[i].x = x; 327 326 viewports[i].y = y; … … 335 334 viewports[i].fgcolor = DEFAULT_FGCOLOR; 336 335 336 viewports[i].initialized = 1; 337 337 338 return i; 338 339 } … … 415 416 } 416 417 418 static void draw_char(int vp, char c, unsigned int col, unsigned int row) 419 { 420 viewport_t *vport = &viewports[vp]; 421 422 if (vport->cursor_active && (vport->cur_col != col || vport->cur_row != row)) 423 invert_char(vp, vport->cur_col,vport->cur_row); 424 425 draw_glyph(vp, c, col, row); 426 427 if (vport->cursor_active) { 428 vport->cur_col++; 429 if (vport->cur_col>= vport->cols) { 430 vport->cur_col = 0; 431 vport->cur_row++; 432 if (vport->cur_row >= vport->rows) 433 vport->cur_row--; 434 } 435 invert_char(vp, vport->cur_col,vport->cur_row); 436 } 437 } 438 417 439 void client_connection(ipc_callid_t iid, ipc_call_t *icall) 418 440 { … … 423 445 unsigned int row,col; 424 446 char c; 447 425 448 int vp = 0; 449 viewport_t *vport = &viewports[0]; 426 450 427 451 if (client_connected) { … … 429 453 return; 430 454 } 455 client_connected = 1; 431 456 ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */ 432 457 … … 438 463 /* cleanup other viewports */ 439 464 for (i=1; i < MAX_VIEWPORTS; i++) 440 v iewports[i].initialized = 0;465 vport->initialized = 0; 441 466 ipc_answer_fast(callid,0,0,0); 442 467 return; /* Exit thread */ … … 445 470 row = IPC_GET_ARG2(call); 446 471 col = IPC_GET_ARG3(call); 447 if (row >= v iewports[vp].rows || col >= viewports[vp].cols) {472 if (row >= vport->rows || col >= vport->cols) { 448 473 retval = EINVAL; 449 474 break; 450 475 } 451 476 ipc_answer_fast(callid,0,0,0); 452 draw_glyph(vp,c, row, col); 477 478 draw_char(vp, c, row, col); 453 479 continue; /* msg already answered */ 454 480 case FB_CLEAR: 455 481 clear_port(vp); 482 if (vport->cursor_active) 483 invert_char(vp, vport->cur_col,vport->cur_row); 456 484 retval = 0; 457 485 break; 458 /* case FB_CURSOR_GOTO: */ 459 /* retval = 0; */ 460 /* break; */ 461 /* case FB_CURSOR_VISIBILITY: */ 462 /* retval = 0; */ 463 /* break; */ 486 case FB_CURSOR_GOTO: 487 row = IPC_GET_ARG1(call); 488 col = IPC_GET_ARG2(call); 489 if (row >= vport->rows || col >= vport->cols) { 490 retval = EINVAL; 491 break; 492 } 493 retval = 0; 494 if (viewports[vp].cursor_active) { 495 invert_char(vp, vport->cur_col,vport->cur_row); 496 invert_char(vp, col, row); 497 } 498 vport->cur_col = col; 499 vport->cur_row = row; 500 break; 501 case FB_CURSOR_VISIBILITY: 502 i = IPC_GET_ARG1(call); 503 retval = 0; 504 if ((i && vport->cursor_active) || (!i && !vport->cursor_active)) 505 break; 506 507 vport->cursor_active = i; 508 invert_char(vp, vport->cur_col,vport->cur_row); 509 break; 464 510 case FB_GET_CSIZE: 465 ipc_answer_fast(callid, 0, viewports[vp].rows, viewports[vp].cols); 511 ipc_answer_fast(callid, 0, vport->rows, vport->cols); 512 continue; 513 case FB_SCROLL: 514 i = IPC_GET_ARG1(call); 515 if (i > vport->rows || i < (- (int)vport->rows)) { 516 retval = EINVAL; 517 break; 518 } 519 if (vport->cursor_active) 520 invert_char(vp, vport->cur_col,vport->cur_row); 521 scroll_port(vp, i); 522 if (vport->cursor_active) 523 invert_char(vp, vport->cur_col,vport->cur_row); 524 retval = 0; 525 break; 526 case FB_VIEWPORT_SWITCH: 527 i = IPC_GET_ARG1(call); 528 if (i < 0 || i >= MAX_VIEWPORTS) { 529 retval = EINVAL; 530 break; 531 } 532 if (! viewports[i].initialized ) { 533 retval = EADDRNOTAVAIL; 534 break; 535 } 536 vp = i; 537 vport = &viewports[vp]; 538 retval = 0; 539 break; 540 case FB_VIEWPORT_CREATE: 541 retval = viewport_create(IPC_GET_ARG1(call) >> 16, 542 IPC_GET_ARG1(call) & 0xffff, 543 IPC_GET_ARG2(call) >> 16, 544 IPC_GET_ARG2(call) & 0xffff); 545 break; 546 case FB_VIEWPORT_DELETE: 547 i = IPC_GET_ARG1(call); 548 if (i < 0 || i >= MAX_VIEWPORTS) { 549 retval = EINVAL; 550 break; 551 } 552 if (! viewports[i].initialized ) { 553 retval = EADDRNOTAVAIL; 554 break; 555 } 556 viewports[i].initialized = 0; 557 retval = 0; 558 break; 559 case FB_SET_STYLE: 560 vport->fgcolor = IPC_GET_ARG1(call); 561 vport->bgcolor = IPC_GET_ARG2(call); 562 retval = 0; 563 break; 564 case FB_GET_RESOLUTION: 565 ipc_answer_fast(callid, 0, screen.xres,screen.yres); 466 566 continue; 467 567 default: 468 568 retval = ENOENT; 469 569 } 470 retval = ENOENT;471 570 ipc_answer_fast(callid,retval,0,0); 472 571 } -
init/init.c
ra2ae4f4 r88c3151 381 381 ipcarg_t result; 382 382 int phoneid; 383 int vp; 383 384 384 385 // printf("Test: Starting connect...\n"); 385 386 phoneid = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0);387 386 388 387 while ((phoneid = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0)) < 0) { … … 391 390 }; 392 391 393 // printf("Test: Connected: %d\n", res); 394 // printf("Test: pinging.\n"); 395 while (1) { 396 res = ipc_call_sync(phoneid, FB_GET_VFB, 0xbeef,&result); 397 // printf("Test: Retval: %d - received: %c\n", res, result); 398 // printf("%c", result); 399 } 400 401 // printf("Test: Hangin up\n"); 392 usleep(100000); 393 vp = ipc_call_sync_3(phoneid, FB_VIEWPORT_CREATE, (200 << 16) | 300, (200 << 16) | 150,0,NULL,NULL,NULL); 394 if (! ipc_call_sync(phoneid, FB_VIEWPORT_SWITCH, vp, NULL)) { 395 ipc_call_sync_2(phoneid, FB_SET_STYLE, 0, 0xffffff, NULL, NULL); 396 ipc_call_sync(phoneid, FB_CLEAR, 0, NULL); 397 ipc_call_sync_3(phoneid, FB_PUTCHAR, 'X', 0,0, NULL, NULL, NULL); 398 } 399 402 400 ipc_hangup(phoneid); 403 401 } … … 448 446 // test_async_kbd(); 449 447 // test_fb(); 450 test_console();448 // test_console(); 451 449 452 450 printf("\nBye.\n"); -
libc/include/ipc/fb.h
ra2ae4f4 r88c3151 7 7 #define __libc__FB_H__ 8 8 9 #define FB_PUTCHAR 1025 10 #define FB_CLEAR 1026 11 #define FB_GET_CSIZE 1027 12 9 #define FB_PUTCHAR 1025 10 #define FB_CLEAR 1026 11 #define FB_GET_CSIZE 1027 12 #define FB_CURSOR_VISIBILITY 1028 13 #define FB_CURSOR_GOTO 1029 14 #define FB_SCROLL 1030 15 #define FB_VIEWPORT_SWITCH 1031 16 #define FB_VIEWPORT_CREATE 1032 17 #define FB_VIEWPORT_DELETE 1033 18 #define FB_SET_STYLE 1034 19 #define FB_GET_RESOLUTION 1035 13 20 14 21 #endif
Note:
See TracChangeset
for help on using the changeset viewer.