3 * Copyright (C) 2007 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include <libx/base.h>
25 #include <libx/object.h>
26 #include <libx/image.h>
27 #include <libx/cursor.h>
33 const unsigned char cursor_bitmap
[] = {
34 0x3f,0x3f,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
35 0x3f,0x3f,0x3f,0x3f,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
36 0xff,0x3f,0x3f,0x3f,0x3f,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
37 0xff,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
38 0xff,0xff,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0xff,0xff,0xff,0xff,0xff,
39 0xff,0xff,0xff,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0xff,0xff,0xff,0xff,
40 0xff,0xff,0xff,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,
41 0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0x3f,0x00,0xff,0xff,0xff,0xff,0xff,0xff,
42 0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0x3f,0x00,0xff,0xff,0xff,0xff,0xff,
43 0xff,0xff,0xff,0xff,0xff,0x3f,0xff,0xff,0xff,0x3f,0x00,0xff,0xff,0xff,0xff,
44 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,0xff,0xff,0xff,
45 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,0xff,0xff,
46 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,0xff,
47 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,
48 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f
51 unsigned cursor_setpos (unsigned x
, unsigned y
)
62 unsigned cursor_getpos (unsigned x
, unsigned y
)
73 unsigned cursor_setstate (unsigned state
)
78 cursor
->state
|= state
;
83 unsigned char cursor_getstate ()
91 unsigned cursor_draw ()
99 int ret
= xcursor_update ();
101 xcursor_getpos (&cursor
->x
, &cursor
->y
);
107 case XCURSOR_STATE_RBUTTON
:
108 cursor
->state
= XCURSOR_STATE_RBUTTON
;
110 case XCURSOR_STATE_LBUTTON
:
111 cursor
->state
= XCURSOR_STATE_LBUTTON
;
113 case XCURSOR_STATE_BBUTTON
:
114 cursor
->state
= XCURSOR_STATE_BBUTTON
;
119 //xpixel (cursor->x, cursor->y, 55);
120 //ximage_draw (cursor_img, cursor->x, cursor->y, 0);
124 for (i
= 0; i
< 15*15; i
++) {
130 if (cursor_bitmap
[i
] != 0xff)
131 xpixel (cursor
->x
+k
, cursor
->y
+j
, cursor_bitmap
[i
]*256);
135 //ximage_draw_spec (cursor_img, cursor->x, cursor->y, 24, 24, 0, 0, 0);
140 unsigned init_cursor ()
142 /*cursor_img = ximage_open ("rocket");
147 cursor
= (wmcursor
*) malloc (sizeof (wmcursor
));
158 switch (cfg
->mouse
) {
160 xcursor_settype (XCURSOR_MOUSE_KB
);
163 xcursor_settype (XCURSOR_MOUSE_SERIAL
);
166 xcursor_settype (XCURSOR_MOUSE_PS2
);
169 xcursor_settype (XCURSOR_MOUSE_USB
);
173 int ret
= xcursor_init ();