Subversion Repositories HelenOS-historic

Rev

Rev 1486 | Rev 1490 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1486 Rev 1489
Line 266... Line 266...
266
    for (y = 0; y < FONT_SCANLINES; y++)
266
    for (y = 0; y < FONT_SCANLINES; y++)
267
        draw_glyph_line(vp ,fb_font[glyph * FONT_SCANLINES + y], col * COL_WIDTH, row * FONT_SCANLINES + y);
267
        draw_glyph_line(vp ,fb_font[glyph * FONT_SCANLINES + y], col * COL_WIDTH, row * FONT_SCANLINES + y);
268
}
268
}
269
 
269
 
270
/** Invert character at given position */
270
/** Invert character at given position */
271
static void invert_char(int vp,unsigned int col, unsigned int row)
271
static void invert_char(int vp,unsigned int row, unsigned int col)
272
{
272
{
273
    unsigned int x;
273
    unsigned int x;
274
    unsigned int y;
274
    unsigned int y;
275
 
275
 
276
    for (x = 0; x < COL_WIDTH; x++)
276
    for (x = 0; x < COL_WIDTH; x++)
Line 331... Line 331...
331
    viewports[i].cols = width / COL_WIDTH;
331
    viewports[i].cols = width / COL_WIDTH;
332
 
332
 
333
    viewports[i].bgcolor = DEFAULT_BGCOLOR;
333
    viewports[i].bgcolor = DEFAULT_BGCOLOR;
334
    viewports[i].fgcolor = DEFAULT_FGCOLOR;
334
    viewports[i].fgcolor = DEFAULT_FGCOLOR;
335
   
335
   
-
 
336
    viewports[i].cur_col = 0;
-
 
337
    viewports[i].cur_row = 0;
-
 
338
    viewports[i].cursor_active = 0;
-
 
339
 
336
    viewports[i].initialized = 1;
340
    viewports[i].initialized = 1;
337
 
341
 
338
    return i;
342
    return i;
339
}
343
}
340
 
344
 
Line 413... Line 417...
413
    screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline);
417
    screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline);
414
 
418
 
415
    return 0;
419
    return 0;
416
}
420
}
417
 
421
 
418
static void draw_char(int vp, char c, unsigned int col, unsigned int row)
422
static void draw_char(int vp, char c, unsigned int row, unsigned int col)
419
{
423
{
420
    viewport_t *vport = &viewports[vp];
424
    viewport_t *vport = &viewports[vp];
421
 
425
 
422
    if (vport->cursor_active && (vport->cur_col != col || vport->cur_row != row))
426
    if (vport->cursor_active && (vport->cur_col != col || vport->cur_row != row))
423
        invert_char(vp, vport->cur_col,vport->cur_row);
427
        invert_char(vp, vport->cur_row, vport->cur_col);
424
   
-
 
425
    draw_glyph(vp, c, col, row);
-
 
426
   
428
   
-
 
429
    draw_glyph(vp, c, row, col);
-
 
430
 
-
 
431
    vport->cur_col = col;
427
    if (vport->cursor_active) {
432
    vport->cur_row = row;
-
 
433
 
428
        vport->cur_col++;
434
    vport->cur_col++;
429
        if (vport->cur_col>= vport->cols) {
435
    if (vport->cur_col>= vport->cols) {
430
            vport->cur_col = 0;
436
        vport->cur_col = 0;
431
            vport->cur_row++;
437
        vport->cur_row++;
432
            if (vport->cur_row >= vport->rows)
438
        if (vport->cur_row >= vport->rows)
433
                vport->cur_row--;
439
            vport->cur_row--;
434
        }
-
 
435
        invert_char(vp, vport->cur_col,vport->cur_row);
-
 
436
    }
440
    }
-
 
441
    if (vport->cursor_active)
-
 
442
        invert_char(vp, vport->cur_row, vport->cur_col);
437
}
443
}
438
 
444
 
439
void client_connection(ipc_callid_t iid, ipc_call_t *icall)
445
void client_connection(ipc_callid_t iid, ipc_call_t *icall)
440
{
446
{
441
    ipc_callid_t callid;
447
    ipc_callid_t callid;
Line 478... Line 484...
478
            draw_char(vp, c, row, col);
484
            draw_char(vp, c, row, col);
479
            continue; /* msg already answered */
485
            continue; /* msg already answered */
480
        case FB_CLEAR:
486
        case FB_CLEAR:
481
            clear_port(vp);
487
            clear_port(vp);
482
            if (vport->cursor_active)
488
            if (vport->cursor_active)
483
                invert_char(vp, vport->cur_col,vport->cur_row);
489
                invert_char(vp, vport->cur_row, vport->cur_col);
484
            retval = 0;
490
            retval = 0;
485
            break;
491
            break;
486
        case FB_CURSOR_GOTO:
492
        case FB_CURSOR_GOTO:
487
            row = IPC_GET_ARG1(call);
493
            row = IPC_GET_ARG1(call);
488
            col = IPC_GET_ARG2(call);
494
            col = IPC_GET_ARG2(call);
Line 490... Line 496...
490
                retval = EINVAL;
496
                retval = EINVAL;
491
                break;
497
                break;
492
            }
498
            }
493
            retval = 0;
499
            retval = 0;
494
            if (viewports[vp].cursor_active) {
500
            if (viewports[vp].cursor_active) {
495
                invert_char(vp, vport->cur_col,vport->cur_row);
501
                invert_char(vp, vport->cur_row, vport->cur_col);
496
                invert_char(vp, col, row);
502
                invert_char(vp, row, col);
497
            }
503
            }
498
            vport->cur_col = col;
504
            vport->cur_col = col;
499
            vport->cur_row = row;
505
            vport->cur_row = row;
500
            break;
506
            break;
501
        case FB_CURSOR_VISIBILITY:
507
        case FB_CURSOR_VISIBILITY:
Line 503... Line 509...
503
            retval = 0;
509
            retval = 0;
504
            if ((i && vport->cursor_active) || (!i && !vport->cursor_active))
510
            if ((i && vport->cursor_active) || (!i && !vport->cursor_active))
505
                break;
511
                break;
506
 
512
 
507
            vport->cursor_active = i;
513
            vport->cursor_active = i;
508
            invert_char(vp, vport->cur_col,vport->cur_row);
514
            invert_char(vp, vport->cur_row, vport->cur_col);
509
            break;
515
            break;
510
        case FB_GET_CSIZE:
516
        case FB_GET_CSIZE:
511
            ipc_answer_fast(callid, 0, vport->rows, vport->cols);
517
            ipc_answer_fast(callid, 0, vport->rows, vport->cols);
512
            continue;
518
            continue;
513
        case FB_SCROLL:
519
        case FB_SCROLL:
Line 515... Line 521...
515
            if (i > vport->rows || i < (- (int)vport->rows)) {
521
            if (i > vport->rows || i < (- (int)vport->rows)) {
516
                retval = EINVAL;
522
                retval = EINVAL;
517
                break;
523
                break;
518
            }
524
            }
519
            if (vport->cursor_active)
525
            if (vport->cursor_active)
520
                invert_char(vp, vport->cur_col,vport->cur_row);
526
                invert_char(vp, vport->cur_row, vport->cur_col);
521
            scroll_port(vp, i);
527
            scroll_port(vp, i);
522
            if (vport->cursor_active)
528
            if (vport->cursor_active)
523
                invert_char(vp, vport->cur_col,vport->cur_row);
529
                invert_char(vp, vport->cur_row, vport->cur_col);
524
            retval = 0;
530
            retval = 0;
525
            break;
531
            break;
526
        case FB_VIEWPORT_SWITCH:
532
        case FB_VIEWPORT_SWITCH:
527
            i = IPC_GET_ARG1(call);
533
            i = IPC_GET_ARG1(call);
528
            if (i < 0 || i >= MAX_VIEWPORTS) {
534
            if (i < 0 || i >= MAX_VIEWPORTS) {