summaryrefslogtreecommitdiff
path: root/src/dummy_cursor.c
blob: aa6021f54bf7a2848f4daf995cfa4056df0fe8f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

/* All drivers should typically include these */
#include "xf86.h"
#include "xf86_OSproc.h"

#include "xf86Cursor.h"
#include "cursorstr.h"
/* Driver specific headers */
#include "dummy.h"

static void
dummyShowCursor(ScrnInfoPtr pScrn)
{
    DUMMYPtr dPtr = DUMMYPTR(pScrn);

    /* turn cursor on */
    dPtr->DummyHWCursorShown = TRUE;    
}

static void
dummyHideCursor(ScrnInfoPtr pScrn)
{
    DUMMYPtr dPtr = DUMMYPTR(pScrn);

    /*
     * turn cursor off 
     *
     */
    dPtr->DummyHWCursorShown = FALSE;
}

#define MAX_CURS 64

static void
dummySetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
{
    DUMMYPtr dPtr = DUMMYPTR(pScrn);

/*     unsigned char *_dest = ((unsigned char *)dPtr->FBBase + */
/* 			    pScrn->videoRam * 1024 - 1024); */
    dPtr->cursorX = x;
    dPtr->cursorY = y;
}

static void
dummySetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
{
    DUMMYPtr dPtr = DUMMYPTR(pScrn);
    
    dPtr->cursorFG = fg;
    dPtr->cursorBG = bg;
}

static void
dummyLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
{
}

static Bool
dummyUseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
{
    DUMMYPtr dPtr = DUMMYPTR(xf86Screens[pScr->myNum]);
    return(!dPtr->swCursor);
}

#if 0
static unsigned char*
dummyRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
{
    return NULL;
}
#endif

Bool
DUMMYCursorInit(ScreenPtr pScreen)
{
    DUMMYPtr dPtr = DUMMYPTR(xf86Screens[pScreen->myNum]);

    xf86CursorInfoPtr infoPtr;
    infoPtr = xf86CreateCursorInfoRec();
    if(!infoPtr) return FALSE;

    dPtr->CursorInfo = infoPtr;

    infoPtr->MaxHeight = 64;
    infoPtr->MaxWidth = 64;
    infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP;

    infoPtr->SetCursorColors = dummySetCursorColors;
    infoPtr->SetCursorPosition = dummySetCursorPosition;
    infoPtr->LoadCursorImage = dummyLoadCursorImage;
    infoPtr->HideCursor = dummyHideCursor;
    infoPtr->ShowCursor = dummyShowCursor;
    infoPtr->UseHWCursor = dummyUseHWCursor;
/*     infoPtr->RealizeCursor = dummyRealizeCursor; */
    
    return(xf86InitCursor(pScreen, infoPtr));
}