1
/* $Xorg: Cursor.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */
4
Copyright 1993 by Davor Matic
6
Permission to use, copy, modify, distribute, and sell this software
7
and its documentation for any purpose is hereby granted without fee,
8
provided that the above copyright notice appear in all copies and that
9
both that copyright notice and this permission notice appear in
10
supporting documentation. Davor Matic makes no representations about
11
the suitability of this software for any purpose. It is provided "as
12
is" without express or implied warranty.
15
/* $XFree86: xc/programs/Xserver/hw/xnest/Cursor.c,v 1.3 2002/11/23 19:27:50 tsi Exp $ */
17
#ifdef HAVE_XNEST_CONFIG_H
18
#include <xnest-config.h>
22
#include <X11/Xproto.h>
23
#include "screenint.h"
27
#include "cursorstr.h"
28
#include "scrnintstr.h"
41
xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
45
XColor fg_color, bg_color;
46
unsigned long valuemask;
49
valuemask = GCFunction |
55
values.function = GXcopy;
56
values.plane_mask = AllPlanes;
57
values.foreground = 1L;
58
values.background = 0L;
59
values.clip_mask = None;
61
XChangeGC(xnestDisplay, xnestBitmapGC, valuemask, &values);
63
source = XCreatePixmap(xnestDisplay,
64
xnestDefaultWindows[pScreen->myNum],
66
pCursor->bits->height,
69
mask = XCreatePixmap(xnestDisplay,
70
xnestDefaultWindows[pScreen->myNum],
72
pCursor->bits->height,
75
ximage = XCreateImage(xnestDisplay,
76
xnestDefaultVisual(pScreen),
78
(char *)pCursor->bits->source,
80
pCursor->bits->height,
81
BitmapPad(xnestDisplay), 0);
83
XPutImage(xnestDisplay, source, xnestBitmapGC, ximage,
84
0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
88
ximage = XCreateImage(xnestDisplay,
89
xnestDefaultVisual(pScreen),
91
(char *)pCursor->bits->mask,
93
pCursor->bits->height,
94
BitmapPad(xnestDisplay), 0);
96
XPutImage(xnestDisplay, mask, xnestBitmapGC, ximage,
97
0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
101
fg_color.red = pCursor->foreRed;
102
fg_color.green = pCursor->foreGreen;
103
fg_color.blue = pCursor->foreBlue;
105
bg_color.red = pCursor->backRed;
106
bg_color.green = pCursor->backGreen;
107
bg_color.blue = pCursor->backBlue;
109
pCursor->devPriv[pScreen->myNum] = (pointer)xalloc(sizeof(xnestPrivCursor));
110
xnestCursorPriv(pCursor, pScreen)->cursor =
111
XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color,
112
pCursor->bits->xhot, pCursor->bits->yhot);
114
XFreePixmap(xnestDisplay, source);
115
XFreePixmap(xnestDisplay, mask);
121
xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
123
XFreeCursor(xnestDisplay, xnestCursor(pCursor, pScreen));
124
xfree(xnestCursorPriv(pCursor, pScreen));
129
xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed)
131
XColor fg_color, bg_color;
133
fg_color.red = pCursor->foreRed;
134
fg_color.green = pCursor->foreGreen;
135
fg_color.blue = pCursor->foreBlue;
137
bg_color.red = pCursor->backRed;
138
bg_color.green = pCursor->backGreen;
139
bg_color.blue = pCursor->backBlue;
141
XRecolorCursor(xnestDisplay,
142
xnestCursor(pCursor, pScreen),
143
&fg_color, &bg_color);
146
void xnestSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
150
XDefineCursor(xnestDisplay,
151
xnestDefaultWindows[pScreen->myNum],
152
xnestCursor(pCursor, pScreen));
157
xnestMoveCursor (ScreenPtr pScreen, int x, int y)