Subversion Repositories HelenOS

Rev

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

Rev 4420 Rev 4537
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 1036... Line 1037...
1036
 * @param call   Current call data
1037
 * @param call   Current call data
1037
 * @param vp     Active viewport
1038
 * @param vp     Active viewport
1038
 *
1039
 *
1039
 * @return false if the call was not handled byt this function, true otherwise
1040
 * @return false if the call was not handled byt this function, true otherwise
1040
 *
1041
 *
1041
 * Note: this function is not threads safe, you would have
1042
 * Note: this function is not thread-safe, you would have
1042
 * to redefine static variables with __thread
1043
 * to redefine static variables with fibril_local.
1043
 *
1044
 *
1044
 */
1045
 */
1045
static bool shm_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
1046
static bool shm_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
1046
{
1047
{
1047
    static keyfield_t *interbuffer = NULL;
1048
    static keyfield_t *interbuffer = NULL;
Line 1562... Line 1563...
1562
        ipc_call_t call;
1563
        ipc_call_t call;
1563
        int retval;
1564
        int retval;
1564
        unsigned int i;
1565
        unsigned int i;
1565
        int scroll;
1566
        int scroll;
1566
        wchar_t ch;
1567
        wchar_t ch;
1567
        unsigned int row, col;
1568
        unsigned int col, row;
1568
       
1569
       
1569
        if ((vport->cursor_active) || (anims_enabled))
1570
        if ((vport->cursor_active) || (anims_enabled))
1570
            callid = async_get_call_timeout(&call, 250000);
1571
            callid = async_get_call_timeout(&call, 250000);
1571
        else
1572
        else
1572
            callid = async_get_call(&call);
1573
            callid = async_get_call(&call);
Line 1599... Line 1600...
1599
            /* Exit thread */
1600
            /* Exit thread */
1600
            return;
1601
            return;
1601
       
1602
       
1602
        case FB_PUTCHAR:
1603
        case FB_PUTCHAR:
1603
            ch = IPC_GET_ARG1(call);
1604
            ch = IPC_GET_ARG1(call);
1604
            row = IPC_GET_ARG2(call);
1605
            col = IPC_GET_ARG2(call);
1605
            col = IPC_GET_ARG3(call);
1606
            row = IPC_GET_ARG3(call);
1606
           
1607
           
1607
            if ((col >= vport->cols) || (row >= vport->rows)) {
1608
            if ((col >= vport->cols) || (row >= vport->rows)) {
1608
                retval = EINVAL;
1609
                retval = EINVAL;
1609
                break;
1610
                break;
1610
            }
1611
            }
Line 1618... Line 1619...
1618
            vport_clear(vport);
1619
            vport_clear(vport);
1619
            cursor_show(vport);
1620
            cursor_show(vport);
1620
            retval = EOK;
1621
            retval = EOK;
1621
            break;
1622
            break;
1622
        case FB_CURSOR_GOTO:
1623
        case FB_CURSOR_GOTO:
1623
            row = IPC_GET_ARG1(call);
1624
            col = IPC_GET_ARG1(call);
1624
            col = IPC_GET_ARG2(call);
1625
            row = IPC_GET_ARG2(call);
1625
           
1626
           
1626
            if ((col >= vport->cols) || (row >= vport->rows)) {
1627
            if ((col >= vport->cols) || (row >= vport->rows)) {
1627
                retval = EINVAL;
1628
                retval = EINVAL;
1628
                break;
1629
                break;
1629
            }
1630
            }
Line 1639... Line 1640...
1639
            vport->cursor_active = IPC_GET_ARG1(call);
1640
            vport->cursor_active = IPC_GET_ARG1(call);
1640
            cursor_show(vport);
1641
            cursor_show(vport);
1641
            retval = EOK;
1642
            retval = EOK;
1642
            break;
1643
            break;
1643
        case FB_GET_CSIZE:
1644
        case FB_GET_CSIZE:
1644
            ipc_answer_2(callid, EOK, vport->rows, vport->cols);
1645
            ipc_answer_2(callid, EOK, vport->cols, vport->rows);
1645
            continue;
1646
            continue;
1646
        case FB_SCROLL:
1647
        case FB_SCROLL:
1647
            scroll = IPC_GET_ARG1(call);
1648
            scroll = IPC_GET_ARG1(call);
1648
            if ((scroll > (int) vport->rows) || (scroll < (-(int) vport->rows))) {
1649
            if ((scroll > (int) vport->rows) || (scroll < (-(int) vport->rows))) {
1649
                retval = EINVAL;
1650
                retval = EINVAL;