Rev 1501 | Rev 1509 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1501 | Rev 1505 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | #include <ipc/ipc.h> |
38 | #include <ipc/ipc.h> |
39 | #include <ipc/ns.h> |
39 | #include <ipc/ns.h> |
40 | #include <ipc/services.h> |
40 | #include <ipc/services.h> |
41 | #include <kernel/errno.h> |
41 | #include <kernel/errno.h> |
42 | #include <async.h> |
42 | #include <async.h> |
- | 43 | ||
43 | #include "font-8x16.h" |
44 | #include "font-8x16.h" |
44 | #include "helenos.xbm" |
45 | #include "helenos.xbm" |
45 | #include "fb.h" |
46 | #include "fb.h" |
- | 47 | #include "main.h" |
|
- | 48 | #include "../console/screenbuffer.h" |
|
46 | 49 | ||
47 | #define DEFAULT_BGCOLOR 0x000080 |
50 | #define DEFAULT_BGCOLOR 0x000080 |
48 | #define DEFAULT_FGCOLOR 0xffff00 |
51 | #define DEFAULT_FGCOLOR 0xffff00 |
49 | 52 | ||
50 | /***************************************************************/ |
53 | /***************************************************************/ |
Line 456... | Line 459... | ||
456 | vport->cur_row--; |
459 | vport->cur_row--; |
457 | } |
460 | } |
458 | cursor_print(vp); |
461 | cursor_print(vp); |
459 | } |
462 | } |
460 | 463 | ||
- | 464 | static void draw_text_data(int vp, keyfield_t *data) |
|
- | 465 | { |
|
- | 466 | viewport_t *vport = &viewports[vp]; |
|
- | 467 | int i; |
|
- | 468 | char c; |
|
- | 469 | ||
- | 470 | clear_port(vp); |
|
- | 471 | for (i=0; i < vport->cols * vport->rows; i++) { |
|
- | 472 | if (data[i].character == ' ') /* TODO: && data[i].style==vport->style */ |
|
- | 473 | continue; |
|
- | 474 | draw_char(vp, data[i].character, i/vport->rows, i % vport->cols); |
|
- | 475 | } |
|
- | 476 | cursor_print(vp); |
|
- | 477 | } |
|
- | 478 | ||
- | 479 | ||
461 | /** Function for handling connections to FB |
480 | /** Function for handling connections to FB |
462 | * |
481 | * |
463 | */ |
482 | */ |
464 | static void fb_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
483 | static void fb_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
465 | { |
484 | { |
Line 467... | Line 486... | ||
467 | ipc_call_t call; |
486 | ipc_call_t call; |
468 | int retval; |
487 | int retval; |
469 | int i; |
488 | int i; |
470 | unsigned int row,col; |
489 | unsigned int row,col; |
471 | char c; |
490 | char c; |
- | 491 | keyfield_t *interbuffer = NULL; |
|
- | 492 | size_t intersize = 0; |
|
472 | 493 | ||
473 | int vp = 0; |
494 | int vp = 0; |
474 | viewport_t *vport = &viewports[0]; |
495 | viewport_t *vport = &viewports[0]; |
475 | 496 | ||
476 | if (client_connected) { |
497 | if (client_connected) { |
Line 492... | Line 513... | ||
492 | /* cleanup other viewports */ |
513 | /* cleanup other viewports */ |
493 | for (i=1; i < MAX_VIEWPORTS; i++) |
514 | for (i=1; i < MAX_VIEWPORTS; i++) |
494 | vport->initialized = 0; |
515 | vport->initialized = 0; |
495 | ipc_answer_fast(callid,0,0,0); |
516 | ipc_answer_fast(callid,0,0,0); |
496 | return; /* Exit thread */ |
517 | return; /* Exit thread */ |
- | 518 | case IPC_M_AS_AREA_SEND: |
|
- | 519 | /* We accept one area for data interchange */ |
|
- | 520 | intersize = IPC_GET_ARG2(call); |
|
- | 521 | receive_comm_area(callid,&call,(void **)&interbuffer, |
|
- | 522 | sizeof(*interbuffer)*viewports[0].cols*viewports[0].rows); |
|
- | 523 | continue; |
|
- | 524 | ||
- | 525 | case FB_DRAW_TEXT_DATA: |
|
- | 526 | if (!interbuffer) { |
|
- | 527 | retval = EINVAL; |
|
- | 528 | break; |
|
- | 529 | } |
|
- | 530 | if (intersize < vport->cols*vport->rows*sizeof(*interbuffer)) { |
|
- | 531 | retval = EINVAL; |
|
- | 532 | break; |
|
- | 533 | } |
|
- | 534 | draw_text_data(vp, interbuffer); |
|
- | 535 | retval = 0; |
|
- | 536 | break; |
|
497 | case FB_PUTCHAR: |
537 | case FB_PUTCHAR: |
498 | c = IPC_GET_ARG1(call); |
538 | c = IPC_GET_ARG1(call); |
499 | row = IPC_GET_ARG2(call); |
539 | row = IPC_GET_ARG2(call); |
500 | col = IPC_GET_ARG3(call); |
540 | col = IPC_GET_ARG3(call); |
501 | if (row >= vport->rows || col >= vport->cols) { |
541 | if (row >= vport->rows || col >= vport->cols) { |