Changeset 9f1362d4 in mainline for uspace/srv/hid/console
- Timestamp:
- 2010-04-19T19:58:18Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 369a5f8
- Parents:
- caad59a
- Location:
- uspace/srv/hid/console
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/console/console.c
rcaad59a r9f1362d4 71 71 /** Information about framebuffer */ 72 72 struct { 73 int phone; /**< Framebuffer phone */74 ipcarg_t cols; /**< Framebuffer columns */75 ipcarg_t rows; /**< Framebuffer rows */76 i nt color_cap; /**< Color capabilities (FB_CCAP_xxx) */73 int phone; /**< Framebuffer phone */ 74 ipcarg_t cols; /**< Framebuffer columns */ 75 ipcarg_t rows; /**< Framebuffer rows */ 76 ipcarg_t color_cap; /**< Color capabilities (FB_CCAP_xxx) */ 77 77 } fb_info; 78 78 … … 99 99 /** Information on row-span yet unsent to FB driver. */ 100 100 struct { 101 size_t col; /**< Leftmost column of the span. */102 size_t row; /**< Row where the span lies. */103 size_t cnt; /**< Width of the span. */101 ipcarg_t col; /**< Leftmost column of the span. */ 102 ipcarg_t row; /**< Row where the span lies. */ 103 ipcarg_t cnt; /**< Width of the span. */ 104 104 } fb_pending; 105 105 … … 117 117 } 118 118 119 static void curs_goto( size_t x, size_t y)119 static void curs_goto(ipcarg_t x, ipcarg_t y) 120 120 { 121 121 async_msg_2(fb_info.phone, FB_CURSOR_GOTO, x, y); … … 147 147 } 148 148 149 static void set_style( int style)149 static void set_style(uint8_t style) 150 150 { 151 151 async_msg_1(fb_info.phone, FB_SET_STYLE, style); 152 152 } 153 153 154 static void set_color( int fgcolor, int bgcolor, int flags)154 static void set_color(uint8_t fgcolor, uint8_t bgcolor, uint8_t flags) 155 155 { 156 156 async_msg_3(fb_info.phone, FB_SET_COLOR, fgcolor, bgcolor, flags); 157 157 } 158 158 159 static void set_rgb_color( int fgcolor, int bgcolor)159 static void set_rgb_color(uint32_t fgcolor, uint32_t bgcolor) 160 160 { 161 161 async_msg_2(fb_info.phone, FB_SET_RGB_COLOR, fgcolor, bgcolor); … … 178 178 } 179 179 180 static int ccap_fb_to_con(i nt ccap_fb, int *ccap_con)180 static int ccap_fb_to_con(ipcarg_t ccap_fb, ipcarg_t *ccap_con) 181 181 { 182 182 switch (ccap_fb) { 183 case FB_CCAP_NONE: *ccap_con = CONSOLE_CCAP_NONE; break; 184 case FB_CCAP_STYLE: *ccap_con = CONSOLE_CCAP_STYLE; break; 185 case FB_CCAP_INDEXED: *ccap_con = CONSOLE_CCAP_INDEXED; break; 186 case FB_CCAP_RGB: *ccap_con = CONSOLE_CCAP_RGB; break; 187 default: return EINVAL; 188 } 189 183 case FB_CCAP_NONE: 184 *ccap_con = CONSOLE_CCAP_NONE; 185 break; 186 case FB_CCAP_STYLE: 187 *ccap_con = CONSOLE_CCAP_STYLE; 188 break; 189 case FB_CCAP_INDEXED: 190 *ccap_con = CONSOLE_CCAP_INDEXED; 191 break; 192 case FB_CCAP_RGB: 193 *ccap_con = CONSOLE_CCAP_RGB; 194 break; 195 default: 196 return EINVAL; 197 } 198 190 199 return EOK; 191 200 } … … 226 235 * 227 236 */ 228 static void cell_mark_changed( size_t col, size_t row)237 static void cell_mark_changed(ipcarg_t col, ipcarg_t row) 229 238 { 230 239 if (fb_pending.cnt != 0) { … … 253 262 { 254 263 bool flush_cursor = false; 255 264 256 265 switch (ch) { 257 266 case '\n': … … 297 306 async_msg_1(fb_info.phone, FB_SCROLL, 1); 298 307 } 299 308 300 309 if (cons == active_console && flush_cursor) 301 310 curs_goto(cons->scr.position_x, cons->scr.position_y); … … 327 336 328 337 if (cons != kernel_console) { 329 size_t x;330 size_t y;331 int rc = 0;332 333 338 async_serialize_start(); 334 339 … … 344 349 set_attrs(&cons->scr.attrs); 345 350 curs_visibility(false); 351 352 ipcarg_t x; 353 ipcarg_t y; 354 int rc = 0; 355 346 356 if (interbuffer) { 347 357 for (y = 0; y < cons->scr.size_y; y++) { … … 390 400 /* Ignore parameters, the connection is already opened */ 391 401 while (true) { 392 393 402 ipc_call_t call; 394 403 ipc_callid_t callid = async_get_call(&call); … … 433 442 static void mouse_events(ipc_callid_t iid, ipc_call_t *icall) 434 443 { 435 int button, press;436 int dx, dy;437 int newcon;438 439 444 /* Ignore parameters, the connection is already opened */ 440 445 while (true) { 441 442 446 ipc_call_t call; 443 447 ipc_callid_t callid = async_get_call(&call); 444 448 445 449 int retval; 446 450 447 451 switch (IPC_GET_METHOD(call)) { 448 452 case IPC_M_PHONE_HUNGUP: … … 450 454 return; 451 455 case MEVENT_BUTTON: 452 button = IPC_GET_ARG1(call); 453 press = IPC_GET_ARG2(call); 454 if (button == 1) { 455 newcon = gcons_mouse_btn(press); 456 if (IPC_GET_ARG1(call) == 1) { 457 int newcon = gcons_mouse_btn((bool) IPC_GET_ARG2(call)); 456 458 if (newcon != -1) 457 459 change_console(&consoles[newcon]); … … 460 462 break; 461 463 case MEVENT_MOVE: 462 dx = IPC_GET_ARG1(call); 463 dy = IPC_GET_ARG2(call); 464 gcons_mouse_move(dx, dy); 464 gcons_mouse_move((int) IPC_GET_ARG1(call), 465 (int) IPC_GET_ARG2(call)); 465 466 retval = 0; 466 467 break; … … 520 521 console_event_t ev; 521 522 fibril_mutex_lock(&input_mutex); 523 522 524 recheck: 523 525 while ((keybuffer_pop(&cons->keybuffer, &ev)) && (pos < size)) { … … 536 538 goto recheck; 537 539 } 540 538 541 fibril_mutex_unlock(&input_mutex); 539 542 } … … 542 545 { 543 546 console_event_t ev; 544 547 545 548 fibril_mutex_lock(&input_mutex); 549 546 550 recheck: 547 551 if (keybuffer_pop(&cons->keybuffer, &ev)) { … … 551 555 goto recheck; 552 556 } 557 553 558 fibril_mutex_unlock(&input_mutex); 554 559 } … … 580 585 ipcarg_t arg2; 581 586 ipcarg_t arg3; 582 583 int cons_ccap; 587 584 588 int rc; 585 589 … … 622 626 if (cons == active_console) { 623 627 async_req_0_0(fb_info.phone, FB_FLUSH); 624 625 628 curs_goto(cons->scr.position_x, cons->scr.position_y); 626 629 } … … 650 653 break; 651 654 case CONSOLE_GET_COLOR_CAP: 652 rc = ccap_fb_to_con(fb_info.color_cap, & cons_ccap);655 rc = ccap_fb_to_con(fb_info.color_cap, &arg1); 653 656 if (rc != EOK) { 654 657 ipc_answer_0(callid, rc); 655 658 continue; 656 659 } 657 arg1 = cons_ccap;658 660 break; 659 661 case CONSOLE_SET_STYLE: … … 714 716 return false; 715 717 } 716 718 717 719 kbd_phone = fd_phone(input_fd); 718 720 if (kbd_phone < 0) { … … 720 722 return false; 721 723 } 722 724 723 725 /* NB: The callback connection is slotted for removal */ 724 726 ipcarg_t phonehash; … … 727 729 return false; 728 730 } 729 731 730 732 async_new_connection(phonehash, 0, NULL, keyboard_events); 731 733 732 734 /* Connect to mouse device */ 733 735 mouse_phone = -1; 734 736 int mouse_fd = open("/dev/hid_in/mouse", O_RDONLY); 735 737 736 738 if (mouse_fd < 0) { 737 739 printf(NAME ": Notice - failed opening %s\n", "/dev/hid_in/mouse"); 738 740 goto skip_mouse; 739 741 } 740 742 741 743 mouse_phone = fd_phone(mouse_fd); 742 744 if (mouse_phone < 0) { … … 744 746 goto skip_mouse; 745 747 } 746 748 747 749 if (ipc_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) { 748 750 printf(NAME ": Failed to create callback from mouse device\n"); … … 750 752 goto skip_mouse; 751 753 } 752 754 753 755 async_new_connection(phonehash, 0, NULL, mouse_events); 754 756 skip_mouse: 755 757 756 758 /* Connect to framebuffer driver */ 757 759 fb_info.phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_VIDEO, 0, 0); … … 760 762 return -1; 761 763 } 762 764 763 765 /* Register driver */ 764 766 int rc = devmap_driver_register(NAME, client_connection); … … 772 774 773 775 /* Synchronize, the gcons could put something in queue */ 774 ipcarg_t color_cap;775 776 async_req_0_0(fb_info.phone, FB_FLUSH); 776 777 async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.cols, &fb_info.rows); 777 async_req_0_1(fb_info.phone, FB_GET_COLOR_CAP, &color_cap); 778 fb_info.color_cap = color_cap; 778 async_req_0_1(fb_info.phone, FB_GET_COLOR_CAP, &fb_info.color_cap); 779 779 780 780 /* Set up shared memory buffer. */ -
uspace/srv/hid/console/gcons.c
rcaad59a r9f1362d4 54 54 #define STATUS_HEIGHT 48 55 55 56 #define MAIN_COLOR 0xffffff 56 #define COLOR_MAIN 0xffffff 57 #define COLOR_FOREGROUND 0x202020 58 #define COLOR_BACKGROUND 0xffffff 59 60 extern char _binary_gfx_helenos_ppm_start[0]; 61 extern int _binary_gfx_helenos_ppm_size; 62 extern char _binary_gfx_nameic_ppm_start[0]; 63 extern int _binary_gfx_nameic_ppm_size; 64 65 extern char _binary_gfx_anim_1_ppm_start[0]; 66 extern int _binary_gfx_anim_1_ppm_size; 67 extern char _binary_gfx_anim_2_ppm_start[0]; 68 extern int _binary_gfx_anim_2_ppm_size; 69 extern char _binary_gfx_anim_3_ppm_start[0]; 70 extern int _binary_gfx_anim_3_ppm_size; 71 extern char _binary_gfx_anim_4_ppm_start[0]; 72 extern int _binary_gfx_anim_4_ppm_size; 73 74 extern char _binary_gfx_cons_selected_ppm_start[0]; 75 extern int _binary_gfx_cons_selected_ppm_size; 76 extern char _binary_gfx_cons_idle_ppm_start[0]; 77 extern int _binary_gfx_cons_idle_ppm_size; 78 extern char _binary_gfx_cons_has_data_ppm_start[0]; 79 extern int _binary_gfx_cons_has_data_ppm_size; 80 extern char _binary_gfx_cons_kernel_ppm_start[0]; 81 extern int _binary_gfx_cons_kernel_ppm_size; 57 82 58 83 static bool use_gcons = false; … … 82 107 static size_t active_console = 0; 83 108 84 s ize_t mouse_x;85 s ize_t mouse_y;86 87 bool btn_pressed;88 s ize_t btn_x;89 s ize_t btn_y;109 static ipcarg_t mouse_x = 0; 110 static ipcarg_t mouse_y= 0; 111 112 static bool btn_pressed = false; 113 static ipcarg_t btn_x = 0; 114 static ipcarg_t btn_y = 0; 90 115 91 116 static void vp_switch(int vp) … … 95 120 96 121 /** Create view port */ 97 static int vp_create( size_t x, size_t y, size_t width, size_t height)122 static int vp_create(ipcarg_t x, ipcarg_t y, ipcarg_t width, ipcarg_t height) 98 123 { 99 124 return async_req_2_0(fbphone, FB_VIEWPORT_CREATE, (x << 16) | y, … … 112 137 113 138 /** Transparent putchar */ 114 static void tran_putch(wchar_t ch, size_t col, size_t row)139 static void tran_putch(wchar_t ch, ipcarg_t col, ipcarg_t row) 115 140 { 116 141 async_msg_3(fbphone, FB_PUTCHAR, ch, col, row); … … 259 284 void gcons_mouse_move(ssize_t dx, ssize_t dy) 260 285 { 261 mouse_x = limit(mouse_x + dx, 0, xres); 262 mouse_y = limit(mouse_y + dy, 0, yres); 263 286 ssize_t nx = (ssize_t) mouse_x + dx; 287 ssize_t ny = (ssize_t) mouse_y + dy; 288 289 mouse_x = (size_t) limit(nx, 0, xres); 290 mouse_y = (size_t) limit(ny, 0, yres); 291 264 292 if (active_console != KERNEL_CONSOLE) 265 293 async_msg_2(fbphone, FB_POINTER_MOVE, mouse_x, mouse_y); 266 294 } 267 295 268 static int gcons_find_conbut(i nt x, int y)269 { 270 i nt status_start = STATUS_START + (xres - 800) / 2;296 static int gcons_find_conbut(ipcarg_t x, ipcarg_t y) 297 { 298 ipcarg_t status_start = STATUS_START + (xres - 800) / 2; 271 299 272 300 if ((y < STATUS_TOP) || (y >= STATUS_TOP + STATUS_HEIGHT)) … … 278 306 if (x >= status_start + (STATUS_WIDTH + STATUS_SPACE) * CONSOLE_COUNT) 279 307 return -1; 308 280 309 if (((x - status_start) % (STATUS_WIDTH + STATUS_SPACE)) < STATUS_SPACE) 281 310 return -1; 282 311 283 return (x - status_start) / (STATUS_WIDTH + STATUS_SPACE); 312 ipcarg_t btn = (x - status_start) / (STATUS_WIDTH + STATUS_SPACE); 313 314 if (btn < CONSOLE_COUNT) 315 return btn; 316 317 return -1; 284 318 } 285 319 … … 287 321 * 288 322 * @param state New state (true - pressed, false - depressed) 323 * 289 324 */ 290 325 int gcons_mouse_btn(bool state) 291 326 { 292 int conbut; 327 /* Ignore mouse clicks if no buttons 328 are drawn at all */ 329 if (xres < 800) 330 return -1; 293 331 294 332 if (state) { 295 conbut = gcons_find_conbut(mouse_x, mouse_y);333 int conbut = gcons_find_conbut(mouse_x, mouse_y); 296 334 if (conbut != -1) { 297 335 btn_pressed = true; … … 307 345 btn_pressed = false; 308 346 309 conbut = gcons_find_conbut(mouse_x, mouse_y);347 int conbut = gcons_find_conbut(mouse_x, mouse_y); 310 348 if (conbut == gcons_find_conbut(btn_x, btn_y)) 311 349 return conbut; … … 313 351 return -1; 314 352 } 315 316 353 317 354 /** Draw a PPM pixmap to framebuffer … … 321 358 * @param x Coordinate of upper left corner 322 359 * @param y Coordinate of upper left corner 323 */ 324 static void draw_pixmap(char *logo, size_t size, int x, int y) 325 { 326 char *shm; 327 int rc; 328 360 * 361 */ 362 static void draw_pixmap(char *logo, size_t size, ipcarg_t x, ipcarg_t y) 363 { 329 364 /* Create area */ 330 shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |365 char *shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | 331 366 MAP_ANONYMOUS, 0, 0); 332 367 if (shm == MAP_FAILED) … … 336 371 337 372 /* Send area */ 338 rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm);373 int rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm); 339 374 if (rc) 340 375 goto exit; … … 356 391 } 357 392 358 extern char _binary_gfx_helenos_ppm_start[0];359 extern int _binary_gfx_helenos_ppm_size;360 extern char _binary_gfx_nameic_ppm_start[0];361 extern int _binary_gfx_nameic_ppm_size;362 363 393 /** Redraws console graphics */ 364 394 void gcons_redraw_console(void) 365 395 { 366 int i;367 368 396 if (!use_gcons) 369 397 return; 370 398 371 399 vp_switch(0); 372 set_rgb_color( MAIN_COLOR, MAIN_COLOR);400 set_rgb_color(COLOR_MAIN, COLOR_MAIN); 373 401 clear(); 374 402 draw_pixmap(_binary_gfx_helenos_ppm_start, … … 377 405 (size_t) &_binary_gfx_nameic_ppm_size, 5, 17); 378 406 407 unsigned int i; 379 408 for (i = 0; i < CONSOLE_COUNT; i++) 380 409 redraw_state(i); … … 393 422 static int make_pixmap(char *data, size_t size) 394 423 { 395 char *shm;396 int rc;397 int pxid = -1;398 399 424 /* Create area */ 400 shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |425 char *shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | 401 426 MAP_ANONYMOUS, 0, 0); 402 427 if (shm == MAP_FAILED) … … 405 430 memcpy(shm, data, size); 406 431 432 int pxid = -1; 433 407 434 /* Send area */ 408 rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm);435 int rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm); 409 436 if (rc) 410 437 goto exit; … … 432 459 } 433 460 434 extern char _binary_gfx_anim_1_ppm_start[0];435 extern int _binary_gfx_anim_1_ppm_size;436 extern char _binary_gfx_anim_2_ppm_start[0];437 extern int _binary_gfx_anim_2_ppm_size;438 extern char _binary_gfx_anim_3_ppm_start[0];439 extern int _binary_gfx_anim_3_ppm_size;440 extern char _binary_gfx_anim_4_ppm_start[0];441 extern int _binary_gfx_anim_4_ppm_size;442 443 461 static void make_anim(void) 444 462 { 445 int an = async_req_1_0(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE]); 463 int an = async_req_1_0(fbphone, FB_ANIM_CREATE, 464 cstatus_vp[KERNEL_CONSOLE]); 446 465 if (an < 0) 447 466 return; … … 467 486 animation = an; 468 487 } 469 470 extern char _binary_gfx_cons_selected_ppm_start[0];471 extern int _binary_gfx_cons_selected_ppm_size;472 extern char _binary_gfx_cons_idle_ppm_start[0];473 extern int _binary_gfx_cons_idle_ppm_size;474 extern char _binary_gfx_cons_has_data_ppm_start[0];475 extern int _binary_gfx_cons_has_data_ppm_size;476 extern char _binary_gfx_cons_kernel_ppm_start[0];477 extern int _binary_gfx_cons_kernel_ppm_size;478 488 479 489 /** Initialize nice graphical console environment */ … … 500 510 501 511 /* Create status buttons */ 502 size_t status_start = STATUS_START + (xres - 800) / 2;512 ipcarg_t status_start = STATUS_START + (xres - 800) / 2; 503 513 size_t i; 504 514 for (i = 0; i < CONSOLE_COUNT; i++) { … … 511 521 512 522 vp_switch(cstatus_vp[i]); 513 set_rgb_color( 0x202020, 0xffffff);523 set_rgb_color(COLOR_FOREGROUND, COLOR_BACKGROUND); 514 524 } 515 525 -
uspace/srv/hid/console/gcons.h
rcaad59a r9f1362d4 38 38 #include <sys/types.h> 39 39 40 void gcons_init(int phone);40 void gcons_init(int); 41 41 42 42 void gcons_redraw_console(void); 43 void gcons_change_console(size_t index);44 void gcons_notify_char(size_t index);43 void gcons_change_console(size_t); 44 void gcons_notify_char(size_t); 45 45 void gcons_in_kernel(void); 46 46 47 void gcons_notify_connect(size_t index);48 void gcons_notify_disconnect(size_t index);47 void gcons_notify_connect(size_t); 48 void gcons_notify_disconnect(size_t); 49 49 50 void gcons_mouse_move(ssize_t dx, ssize_t dy);50 void gcons_mouse_move(ssize_t, ssize_t); 51 51 int gcons_mouse_btn(bool state); 52 52 -
uspace/srv/hid/console/keybuffer.h
rcaad59a r9f1362d4 47 47 typedef struct { 48 48 console_event_t fifo[KEYBUFFER_SIZE]; 49 unsigned longhead;50 unsigned longtail;51 unsigned longitems;49 size_t head; 50 size_t tail; 51 size_t items; 52 52 } keybuffer_t; 53 53 -
uspace/srv/hid/console/screenbuffer.c
rcaad59a r9f1362d4 67 67 * 68 68 */ 69 screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, size_t size_x, size_t size_y) 69 screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, ipcarg_t size_x, 70 ipcarg_t size_y) 70 71 { 71 72 scr->buffer = (keyfield_t *) malloc(sizeof(keyfield_t) * size_x * size_y); … … 109 110 * 110 111 */ 111 void screenbuffer_clear_line(screenbuffer_t *scr, size_t line)112 void screenbuffer_clear_line(screenbuffer_t *scr, ipcarg_t line) 112 113 { 113 size_t x;114 ipcarg_t x; 114 115 115 116 for (x = 0; x < scr->size_x; x++) { … … 140 141 * 141 142 */ 142 void screenbuffer_goto(screenbuffer_t *scr, size_t x, size_t y)143 void screenbuffer_goto(screenbuffer_t *scr, ipcarg_t x, ipcarg_t y) 143 144 { 144 145 scr->position_x = x % scr->size_x; … … 166 167 * 167 168 */ 168 void screenbuffer_set_color(screenbuffer_t *scr, uint8_t fg_color, uint8_t bg_color, uint8_t flags) 169 void screenbuffer_set_color(screenbuffer_t *scr, uint8_t fg_color, 170 uint8_t bg_color, uint8_t flags) 169 171 { 170 172 scr->attrs.t = at_idx; … … 181 183 * 182 184 */ 183 void screenbuffer_set_rgb_color(screenbuffer_t *scr, uint32_t fg_color, uint32_t bg_color) 185 void screenbuffer_set_rgb_color(screenbuffer_t *scr, uint32_t fg_color, 186 uint32_t bg_color) 184 187 { 185 188 scr->attrs.t = at_rgb; -
uspace/srv/hid/console/screenbuffer.h
rcaad59a r9f1362d4 38 38 #include <stdint.h> 39 39 #include <sys/types.h> 40 #include <ipc/ipc.h> 40 41 #include <bool.h> 41 42 42 #define DEFAULT_FOREGROUND 0x0 43 #define DEFAULT_FOREGROUND 0x000000 /**< default console foreground color */ 43 44 #define DEFAULT_BACKGROUND 0xf0f0f0 /**< default console background color */ 44 45 … … 82 83 keyfield_t *buffer; /**< Screen content - characters and 83 84 their attributes (used as a circular buffer) */ 84 size_t size_x;/**< Number of columns */85 size_t size_y;/**< Number of rows */85 ipcarg_t size_x; /**< Number of columns */ 86 ipcarg_t size_y; /**< Number of rows */ 86 87 87 88 /** Coordinates of last printed character for determining cursor position */ 88 size_t position_x;89 size_t position_y;89 ipcarg_t position_x; 90 ipcarg_t position_y; 90 91 91 92 attrs_t attrs; /**< Current attributes. */ … … 107 108 * 108 109 */ 109 static inline keyfield_t *get_field_at(screenbuffer_t *scr, size_t x, size_t y)110 static inline keyfield_t *get_field_at(screenbuffer_t *scr, ipcarg_t x, ipcarg_t y) 110 111 { 111 112 return scr->buffer + x + ((y + scr->top_line) % scr->size_y) * scr->size_x; … … 140 141 } 141 142 143 extern void screenbuffer_putchar(screenbuffer_t *, wchar_t); 144 extern screenbuffer_t *screenbuffer_init(screenbuffer_t *, ipcarg_t, ipcarg_t); 142 145 143 void screenbuffer_putchar(screenbuffer_t *scr, wchar_t c); 144 screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, size_t size_x, size_t size_y); 145 146 void screenbuffer_clear(screenbuffer_t *scr); 147 void screenbuffer_clear_line(screenbuffer_t *scr, size_t line); 148 void screenbuffer_copy_buffer(screenbuffer_t *scr, keyfield_t *dest); 149 void screenbuffer_goto(screenbuffer_t *scr, size_t x, size_t y); 150 void screenbuffer_set_style(screenbuffer_t *scr, uint8_t style); 151 void screenbuffer_set_color(screenbuffer_t *scr, uint8_t fg_color, 152 uint8_t bg_color, uint8_t attr); 153 void screenbuffer_set_rgb_color(screenbuffer_t *scr, uint32_t fg_color, 154 uint32_t bg_color); 146 extern void screenbuffer_clear(screenbuffer_t *); 147 extern void screenbuffer_clear_line(screenbuffer_t *, ipcarg_t); 148 extern void screenbuffer_copy_buffer(screenbuffer_t *, keyfield_t *); 149 extern void screenbuffer_goto(screenbuffer_t *, ipcarg_t, ipcarg_t); 150 extern void screenbuffer_set_style(screenbuffer_t *, uint8_t); 151 extern void screenbuffer_set_color(screenbuffer_t *, uint8_t, uint8_t, uint8_t); 152 extern void screenbuffer_set_rgb_color(screenbuffer_t *, uint32_t, uint32_t); 155 153 156 154 #endif
Note:
See TracChangeset
for help on using the changeset viewer.