Changeset 01f5e17 in mainline for uspace/srv/console/console.c
- Timestamp:
- 2007-09-26T15:23:59Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8c20b26
- Parents:
- c535273
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/console/console.c
rc535273 r01f5e17 68 68 } fb_info; 69 69 70 71 70 typedef struct { 72 71 keybuffer_t keybuffer; /**< Buffer for incoming keys. */ … … 125 124 { 126 125 async_msg_2(fb_info.phone, FB_SET_STYLE, style->fg_color, 127 126 style->bg_color); 128 127 } 129 128 … … 261 260 if (interbuffer) { 262 261 for (i = 0; i < conn->screenbuffer.size_x; i++) 263 for (j = 0; j < conn->screenbuffer.size_y; j++) 264 interbuffer[i + j * conn->screenbuffer.size_x] = 265 *get_field_at(&(conn->screenbuffer), 266 i, j); 262 for (j = 0; j < conn->screenbuffer.size_y; j++) { 263 unsigned int size_x; 264 265 size_x = conn->screenbuffer.size_x; 266 interbuffer[i + j * size_x] = 267 *get_field_at(&conn->screenbuffer, i, j); 268 } 267 269 /* This call can preempt, but we are already at the end */ 268 270 rc = async_req_2(fb_info.phone, FB_DRAW_TEXT_DATA, 0, 0, NULL, 269 270 } ;271 NULL); 272 } 271 273 272 274 if ((!interbuffer) || (rc != 0)) { … … 277 279 for (j = 0; j < conn->screenbuffer.size_y; j++) 278 280 for (i = 0; i < conn->screenbuffer.size_x; i++) { 279 field = get_field_at(& (conn->screenbuffer), i,280 281 field = get_field_at(&conn->screenbuffer, i, 282 j); 281 283 if (!style_same(*style, field->style)) 282 284 set_style(&field->style); 283 285 style = &field->style; 284 286 if ((field->character == ' ') && 285 286 287 (style_same(field->style, 288 conn->screenbuffer.style))) 287 289 continue; 288 290 … … 292 294 293 295 curs_goto(conn->screenbuffer.position_y, 294 296 conn->screenbuffer.position_x); 295 297 curs_visibility(conn->screenbuffer.is_cursor_visible); 296 298 … … 323 325 case KBD_MS_MOVE: 324 326 gcons_mouse_move(IPC_GET_ARG1(call), 325 327 IPC_GET_ARG2(call)); 326 328 retval = 0; 327 329 break; … … 350 352 conn->keyrequest_counter--; 351 353 ipc_answer_fast(fifo_pop(conn->keyrequests), 0, 352 354 c, 0); 353 355 break; 354 356 } … … 403 405 conn->keyrequest_counter--; 404 406 ipc_answer_fast(fifo_pop(conn->keyrequests), 405 407 ENOENT, 0, 0); 406 408 break; 407 409 } … … 423 425 case CONSOLE_GOTO: 424 426 screenbuffer_goto(&conn->screenbuffer, 425 427 IPC_GET_ARG2(call), IPC_GET_ARG1(call)); 426 428 if (consnum == active_console) 427 429 curs_goto(IPC_GET_ARG1(call), 428 430 IPC_GET_ARG2(call)); 429 431 break; 430 432 case CONSOLE_GETSIZE: … … 435 437 if (consnum == active_console) 436 438 async_req_2(fb_info.phone, FB_FLUSH, 0, 0, 437 439 NULL, NULL); 438 440 break; 439 441 case CONSOLE_SET_STYLE: 440 442 arg1 = IPC_GET_ARG1(call); 441 443 arg2 = IPC_GET_ARG2(call); 442 screenbuffer_set_style(&conn->screenbuffer, arg1, arg2); 444 screenbuffer_set_style(&conn->screenbuffer, arg1, 445 arg2); 443 446 if (consnum == active_console) 444 447 set_style_col(arg1, arg2); … … 511 514 async_msg_2(fb_info.phone, FB_VIEWPORT_DB, (sysarg_t) -1, 1); 512 515 513 async_req_2(fb_info.phone, FB_GET_CSIZE, 0, 0, & (fb_info.rows),514 &(fb_info.cols));516 async_req_2(fb_info.phone, FB_GET_CSIZE, 0, 0, &fb_info.rows, 517 &fb_info.cols); 515 518 set_style_col(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND); 516 519 clrscr(); … … 519 522 for (i = 0; i < CONSOLE_COUNT; i++) { 520 523 connections[i].used = 0; 521 keybuffer_init(& (connections[i].keybuffer));524 keybuffer_init(&connections[i].keybuffer); 522 525 523 connections[i].keyrequests.head = 524 526 connections[i].keyrequests.head = 0; 527 connections[i].keyrequests.tail = 0; 525 528 connections[i].keyrequests.items = MAX_KEYREQUESTS_BUFFERED; 526 529 connections[i].keyrequest_counter = 0; 527 530 528 if (screenbuffer_init(& (connections[i].screenbuffer),529 531 if (screenbuffer_init(&connections[i].screenbuffer, 532 fb_info.cols, fb_info.rows) == NULL) { 530 533 /* FIXME: handle error */ 531 534 return -1; … … 535 538 536 539 interbuffer = mmap(NULL, 537 538 540 sizeof(keyfield_t) * fb_info.cols * fb_info.rows, 541 PROTO_READ | PROTO_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); 539 542 if (!interbuffer) { 540 if (async_req_3(fb_info.phone, IPC_M_AS_AREA_SEND, (ipcarg_t) 541 interbuffer, 0, AS_AREA_READ, NULL, NULL, NULL) != 0) { 542 munmap(interbuffer, sizeof(keyfield_t) * fb_info.cols 543 * fb_info.rows); 543 if (async_req_3(fb_info.phone, IPC_M_AS_AREA_SEND, 544 (ipcarg_t) interbuffer, 0, AS_AREA_READ, NULL, NULL, 545 NULL) != 0) { 546 munmap(interbuffer, 547 sizeof(keyfield_t) * fb_info.cols * fb_info.rows); 544 548 interbuffer = NULL; 545 549 } … … 547 551 548 552 curs_goto(0, 0); 549 curs_visibility(connections[active_console].screenbuffer.is_cursor_visible); 553 curs_visibility( 554 connections[active_console].screenbuffer.is_cursor_visible); 550 555 551 556 /* Register at NS */
Note:
See TracChangeset
for help on using the changeset viewer.