Subversion Repositories HelenOS

Rev

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

Rev 4327 Rev 4581
Line 49... Line 49...
49
#include <ipc/ipc.h>
49
#include <ipc/ipc.h>
50
#include <ipc/ns.h>
50
#include <ipc/ns.h>
51
#include <ipc/services.h>
51
#include <ipc/services.h>
52
#include <kernel/errno.h>
52
#include <kernel/errno.h>
53
#include <kernel/genarch/fb/visuals.h>
53
#include <kernel/genarch/fb/visuals.h>
54
#include <console/color.h>
54
#include <io/color.h>
55
#include <console/style.h>
55
#include <io/style.h>
56
#include <async.h>
56
#include <async.h>
-
 
57
#include <fibril.h>
57
#include <bool.h>
58
#include <bool.h>
58
 
59
 
59
#include "font-8x16.h"
60
#include "font-8x16.h"
60
#include "fb.h"
61
#include "fb.h"
61
#include "main.h"
62
#include "main.h"
Line 373... Line 374...
373
 * @param vport Viewport to redraw
374
 * @param vport Viewport to redraw
374
 *
375
 *
375
 */
376
 */
376
static void vport_redraw(viewport_t *vport)
377
static void vport_redraw(viewport_t *vport)
377
{
378
{
378
    unsigned int row;
-
 
379
    unsigned int col;
379
    unsigned int col;
-
 
380
    unsigned int row;
380
   
381
   
381
    for (row = 0; row < vport->rows; row++) {
382
    for (row = 0; row < vport->rows; row++) {
382
        for (col = 0; col < vport->cols; col++) {
383
        for (col = 0; col < vport->cols; col++) {
383
            draw_vp_glyph(vport, false, col, row);
384
            draw_vp_glyph(vport, false, col, row);
384
        }
385
        }
Line 429... Line 430...
429
 * @param lines Number of lines to scroll
430
 * @param lines Number of lines to scroll
430
 *
431
 *
431
 */
432
 */
432
static void vport_scroll(viewport_t *vport, int lines)
433
static void vport_scroll(viewport_t *vport, int lines)
433
{
434
{
434
    unsigned int row;
-
 
435
    unsigned int col;
435
    unsigned int col;
-
 
436
    unsigned int row;
436
    unsigned int x;
437
    unsigned int x;
437
    unsigned int y;
438
    unsigned int y;
438
    uint32_t glyph;
439
    uint32_t glyph;
439
    uint32_t fg_color;
440
    uint32_t fg_color;
440
    uint32_t bg_color;
441
    uint32_t bg_color;
Line 447... Line 448...
447
   
448
   
448
    y = vport->y;
449
    y = vport->y;
449
    for (row = 0; row < vport->rows; row++) {
450
    for (row = 0; row < vport->rows; row++) {
450
        x = vport->x;
451
        x = vport->x;
451
        for (col = 0; col < vport->cols; col++) {
452
        for (col = 0; col < vport->cols; col++) {
-
 
453
            if (((int) row + lines >= 0) &&
452
            if ((row + lines >= 0) && (row + lines < vport->rows)) {
454
                ((int) row + lines < (int) vport->rows)) {
453
                xbp = &vport->backbuf[BB_POS(vport, col, row + lines)];
455
                xbp = &vport->backbuf[BB_POS(vport, col, row + lines)];
454
                bbp = &vport->backbuf[BB_POS(vport, col, row)];
456
                bbp = &vport->backbuf[BB_POS(vport, col, row)];
455
               
457
               
456
                glyph = xbp->glyph;
458
                glyph = xbp->glyph;
457
                fg_color = xbp->fg_color;
459
                fg_color = xbp->fg_color;
Line 1036... Line 1038...
1036
 * @param call   Current call data
1038
 * @param call   Current call data
1037
 * @param vp     Active viewport
1039
 * @param vp     Active viewport
1038
 *
1040
 *
1039
 * @return false if the call was not handled byt this function, true otherwise
1041
 * @return false if the call was not handled byt this function, true otherwise
1040
 *
1042
 *
1041
 * Note: this function is not threads safe, you would have
1043
 * Note: this function is not thread-safe, you would have
1042
 * to redefine static variables with __thread
1044
 * to redefine static variables with fibril_local.
1043
 *
1045
 *
1044
 */
1046
 */
1045
static bool shm_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
1047
static bool shm_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
1046
{
1048
{
1047
    static keyfield_t *interbuffer = NULL;
1049
    static keyfield_t *interbuffer = NULL;
Line 1562... Line 1564...
1562
        ipc_call_t call;
1564
        ipc_call_t call;
1563
        int retval;
1565
        int retval;
1564
        unsigned int i;
1566
        unsigned int i;
1565
        int scroll;
1567
        int scroll;
1566
        wchar_t ch;
1568
        wchar_t ch;
1567
        unsigned int row, col;
1569
        unsigned int col, row;
1568
       
1570
       
1569
        if ((vport->cursor_active) || (anims_enabled))
1571
        if ((vport->cursor_active) || (anims_enabled))
1570
            callid = async_get_call_timeout(&call, 250000);
1572
            callid = async_get_call_timeout(&call, 250000);
1571
        else
1573
        else
1572
            callid = async_get_call(&call);
1574
            callid = async_get_call(&call);
Line 1599... Line 1601...
1599
            /* Exit thread */
1601
            /* Exit thread */
1600
            return;
1602
            return;
1601
       
1603
       
1602
        case FB_PUTCHAR:
1604
        case FB_PUTCHAR:
1603
            ch = IPC_GET_ARG1(call);
1605
            ch = IPC_GET_ARG1(call);
1604
            row = IPC_GET_ARG2(call);
1606
            col = IPC_GET_ARG2(call);
1605
            col = IPC_GET_ARG3(call);
1607
            row = IPC_GET_ARG3(call);
1606
           
1608
           
1607
            if ((col >= vport->cols) || (row >= vport->rows)) {
1609
            if ((col >= vport->cols) || (row >= vport->rows)) {
1608
                retval = EINVAL;
1610
                retval = EINVAL;
1609
                break;
1611
                break;
1610
            }
1612
            }
Line 1618... Line 1620...
1618
            vport_clear(vport);
1620
            vport_clear(vport);
1619
            cursor_show(vport);
1621
            cursor_show(vport);
1620
            retval = EOK;
1622
            retval = EOK;
1621
            break;
1623
            break;
1622
        case FB_CURSOR_GOTO:
1624
        case FB_CURSOR_GOTO:
1623
            row = IPC_GET_ARG1(call);
1625
            col = IPC_GET_ARG1(call);
1624
            col = IPC_GET_ARG2(call);
1626
            row = IPC_GET_ARG2(call);
1625
           
1627
           
1626
            if ((col >= vport->cols) || (row >= vport->rows)) {
1628
            if ((col >= vport->cols) || (row >= vport->rows)) {
1627
                retval = EINVAL;
1629
                retval = EINVAL;
1628
                break;
1630
                break;
1629
            }
1631
            }
Line 1639... Line 1641...
1639
            vport->cursor_active = IPC_GET_ARG1(call);
1641
            vport->cursor_active = IPC_GET_ARG1(call);
1640
            cursor_show(vport);
1642
            cursor_show(vport);
1641
            retval = EOK;
1643
            retval = EOK;
1642
            break;
1644
            break;
1643
        case FB_GET_CSIZE:
1645
        case FB_GET_CSIZE:
1644
            ipc_answer_2(callid, EOK, vport->rows, vport->cols);
1646
            ipc_answer_2(callid, EOK, vport->cols, vport->rows);
1645
            continue;
1647
            continue;
1646
        case FB_SCROLL:
1648
        case FB_SCROLL:
1647
            scroll = IPC_GET_ARG1(call);
1649
            scroll = IPC_GET_ARG1(call);
1648
            if ((scroll > (int) vport->rows) || (scroll < (-(int) vport->rows))) {
1650
            if ((scroll > (int) vport->rows) || (scroll < (-(int) vport->rows))) {
1649
                retval = EINVAL;
1651
                retval = EINVAL;