Subversion Repositories HelenOS

Rev

Rev 1574 | Rev 1578 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1574 Rev 1575
Line 245... Line 245...
245
        for (i = 0; i < conn->screenbuffer.size_x; i++)
245
        for (i = 0; i < conn->screenbuffer.size_x; i++)
246
            for (j = 0; j < conn->screenbuffer.size_y; j++)
246
            for (j = 0; j < conn->screenbuffer.size_y; j++)
247
                interbuffer[i + j*conn->screenbuffer.size_x] = *get_field_at(&(conn->screenbuffer),i, j);
247
                interbuffer[i + j*conn->screenbuffer.size_x] = *get_field_at(&(conn->screenbuffer),i, j);
248
        /* This call can preempt, but we are already at the end */
248
        /* This call can preempt, but we are already at the end */
249
        sync_send_2(fb_info.phone, FB_DRAW_TEXT_DATA, 0, 0, NULL, NULL);       
249
        sync_send_2(fb_info.phone, FB_DRAW_TEXT_DATA, 0, 0, NULL, NULL);       
250
        curs_visibility(1);
250
        curs_visibility(conn->screenbuffer.is_cursor_visible);
251
    } else {
251
    } else {
252
        curs_visibility(0);
-
 
253
        clrscr();
252
        clrscr();
254
       
253
       
255
        for (i = 0; i < conn->screenbuffer.size_x; i++)
254
        for (i = 0; i < conn->screenbuffer.size_x; i++)
256
            for (j = 0; j < conn->screenbuffer.size_y; j++) {
255
            for (j = 0; j < conn->screenbuffer.size_y; j++) {
257
                c = get_field_at(&(conn->screenbuffer),i, j)->character;
256
                c = get_field_at(&(conn->screenbuffer),i, j)->character;
258
                if (c && c != ' ')
257
                if (c && c != ' ')
259
                    prtchr(c, j, i);
258
                    prtchr(c, j, i);
260
            }
259
            }
261
       
260
       
262
        curs_visibility(1);
261
        curs_visibility(conn->screenbuffer.is_cursor_visible);
263
    }
262
    }
264
}
263
}
265
 
264
 
266
/** Handler for keyboard */
265
/** Handler for keyboard */
267
static void keyboard_events(ipc_callid_t iid, ipc_call_t *icall)
266
static void keyboard_events(ipc_callid_t iid, ipc_call_t *icall)
Line 379... Line 378...
379
            screenbuffer_set_style(&(connections[consnum].screenbuffer),arg1, arg2);
378
            screenbuffer_set_style(&(connections[consnum].screenbuffer),arg1, arg2);
380
            if (consnum == active_console)
379
            if (consnum == active_console)
381
                set_style_col(arg1, arg2);
380
                set_style_col(arg1, arg2);
382
               
381
               
383
            break;
382
            break;
-
 
383
        case CONSOLE_CURSOR_VISIBILITY:
-
 
384
            arg1 = IPC_GET_ARG1(call);
-
 
385
            connections[consnum].screenbuffer.is_cursor_visible = arg1;
-
 
386
            if (consnum == active_console)
-
 
387
                curs_visibility(arg1);
-
 
388
            break;
384
        case CONSOLE_GETCHAR:
389
        case CONSOLE_GETCHAR:
385
            if (keybuffer_empty(&(connections[consnum].keybuffer))) {
390
            if (keybuffer_empty(&(connections[consnum].keybuffer))) {
386
                /* buffer is empty -> store request */
391
                /* buffer is empty -> store request */
387
                if (connections[consnum].keyrequest_counter < MAX_KEYREQUESTS_BUFFERED) {      
392
                if (connections[consnum].keyrequest_counter < MAX_KEYREQUESTS_BUFFERED) {      
388
                    fifo_push(connections[consnum].keyrequests, callid);
393
                    fifo_push(connections[consnum].keyrequests, callid);
Line 391... Line 396...
391
                    /* no key available and too many requests => fail */
396
                    /* no key available and too many requests => fail */
392
                    ipc_answer_fast(callid, ELIMIT, 0, 0);
397
                    ipc_answer_fast(callid, ELIMIT, 0, 0);
393
                }
398
                }
394
                continue;
399
                continue;
395
            };
400
            };
396
            keybuffer_pop(&(connections[consnum].keybuffer), (char *)&arg1);
401
            keybuffer_pop(&(connections[consnum].keybuffer), (int *)&arg1);
397
           
402
           
398
            break;
403
            break;
399
        }
404
        }
400
        ipc_answer_fast(callid, 0, arg1, arg2);
405
        ipc_answer_fast(callid, 0, arg1, arg2);
401
    }
406
    }
Line 462... Line 467...
462
        }
467
        }
463
    }
468
    }
464
 
469
 
465
    async_new_connection(phonehash, 0, NULL, keyboard_events);
470
    async_new_connection(phonehash, 0, NULL, keyboard_events);
466
   
471
   
467
    sync_send_2(fb_info.phone, FB_CURSOR_GOTO, 0, 0, NULL, NULL);
472
    curs_goto(0,0);
468
    nsend_call(fb_info.phone, FB_CURSOR_VISIBILITY, 1);
473
    curs_visibility(connections[active_console].screenbuffer.is_cursor_visible);
469
 
474
 
470
    /* Register at NS */
475
    /* Register at NS */
471
    if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, &phonehash) != 0) {
476
    if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, &phonehash) != 0) {
472
        return -1;
477
        return -1;
473
    };
478
    };