26#include <X11/cursorfont.h>
38 {
"X_cursor", XC_X_cursor, None},
39 {
"arrow", XC_arrow, None},
40 {
"based_arrow_down", XC_based_arrow_down, None},
41 {
"based_arrow_up", XC_based_arrow_up, None},
42 {
"boat", XC_boat, None},
43 {
"bogosity", XC_bogosity, None},
44 {
"bottom_left_corner", XC_bottom_left_corner, None},
45 {
"bottom_right_corner", XC_bottom_right_corner, None},
46 {
"bottom_side", XC_bottom_side, None},
47 {
"bottom_tee", XC_bottom_tee, None},
48 {
"box_spiral", XC_box_spiral, None},
49 {
"center_ptr", XC_center_ptr, None},
50 {
"circle", XC_circle, None},
51 {
"clock", XC_clock, None},
52 {
"coffee_mug", XC_coffee_mug, None},
53 {
"cross", XC_cross, None},
54 {
"cross_reverse", XC_cross_reverse, None},
55 {
"crosshair", XC_crosshair, None},
56 {
"diamond_cross", XC_diamond_cross, None},
57 {
"dot", XC_dot, None},
58 {
"dotbox", XC_dotbox, None},
59 {
"double_arrow", XC_double_arrow, None},
60 {
"draft_large", XC_draft_large, None},
61 {
"draft_small", XC_draft_small, None},
62 {
"draped_box", XC_draped_box, None},
63 {
"exchange", XC_exchange, None},
64 {
"fleur", XC_fleur, None},
65 {
"gobbler", XC_gobbler, None},
66 {
"gumby", XC_gumby, None},
67 {
"hand1", XC_hand1, None},
68 {
"hand2", XC_hand2, None},
69 {
"heart", XC_heart, None},
70 {
"icon", XC_icon, None},
71 {
"iron_cross", XC_iron_cross, None},
72 {
"left_ptr", XC_left_ptr, None},
73 {
"left_side", XC_left_side, None},
74 {
"left_tee", XC_left_tee, None},
75 {
"leftbutton", XC_leftbutton, None},
76 {
"ll_angle", XC_ll_angle, None},
77 {
"lr_angle", XC_lr_angle, None},
78 {
"man", XC_man, None},
79 {
"middlebutton", XC_middlebutton, None},
80 {
"mouse", XC_mouse, None},
81 {
"pencil", XC_pencil, None},
82 {
"pirate", XC_pirate, None},
83 {
"plus", XC_plus, None},
84 {
"question_arrow", XC_question_arrow, None},
85 {
"right_ptr", XC_right_ptr, None},
86 {
"right_side", XC_right_side, None},
87 {
"right_tee", XC_right_tee, None},
88 {
"rightbutton", XC_rightbutton, None},
89 {
"rtl_logo", XC_rtl_logo, None},
90 {
"sailboat", XC_sailboat, None},
91 {
"sb_down_arrow", XC_sb_down_arrow, None},
92 {
"sb_h_double_arrow", XC_sb_h_double_arrow, None},
93 {
"sb_left_arrow", XC_sb_left_arrow, None},
94 {
"sb_right_arrow", XC_sb_right_arrow, None},
95 {
"sb_up_arrow", XC_sb_up_arrow, None},
96 {
"sb_v_double_arrow", XC_sb_v_double_arrow, None},
97 {
"shuttle", XC_shuttle, None},
98 {
"sizing", XC_sizing, None},
99 {
"spider", XC_spider, None},
100 {
"spraycan", XC_spraycan, None},
101 {
"star", XC_star, None},
102 {
"target", XC_target, None},
103 {
"tcross", XC_tcross, None},
104 {
"top_left_arrow", XC_top_left_arrow, None},
105 {
"top_left_corner", XC_top_left_corner, None},
106 {
"top_right_corner", XC_top_right_corner, None},
107 {
"top_side", XC_top_side, None},
108 {
"top_tee", XC_top_tee, None},
109 {
"trek", XC_trek, None},
110 {
"ul_angle", XC_ul_angle, None},
111 {
"umbrella", XC_umbrella, None},
112 {
"ur_angle", XC_ur_angle, None},
113 {
"watch", XC_watch, None},
114 {
"xterm", XC_xterm, None},
120 const Display *ldpy =
dpy;
137 fprintf(stderr,
"%s: unable to find font cursor \"%s\"\n",
146 unsigned int sw, sh, mw, mh;
148 Colormap cmap =
Scr->RootColormaps.cwins[0]->colormap->c;
156 fore.pixel =
Scr->Black;
157 XQueryColor(
dpy, cmap, &fore);
158 back.pixel =
Scr->White;
159 XQueryColor(
dpy, cmap, &back);
162 if((hotx =
HotX) < 0) {
165 if((hoty =
HotY) < 0) {
174 if(sw != mw || sh != mh) {
176 "%s: cursor bitmaps \"%s\" and \"%s\" not the same size\n",
180 *cp = XCreatePixmapCursor(
dpy, spm, mpm, &fore, &back, hotx, hoty);
189 unsigned int width, height, middle;
191 Colormap cmap =
Scr->RootColormaps.cwins[0]->colormap->c;
194 XRectangle logical_rect;
196 black.pixel =
Scr->Black;
197 XQueryColor(
dpy, cmap, &black);
198 white.pixel =
Scr->White;
199 XQueryColor(
dpy, cmap, &white);
201 XmbTextExtents(myfont.
font_set,
string, strlen(
string),
202 &inc_rect, &logical_rect);
203 width = logical_rect.width + 4;
204 height = logical_rect.height + 2;
208 bitmap = XCreatePixmap(
dpy,
Scr->Root, width, height, 1);
209 gc = XCreateGC(
dpy, bitmap, 0L, NULL);
211 XSetForeground(
dpy, gc, 0L);
212 XFillRectangle(
dpy, bitmap, gc, 0, 0, width, height);
213 XSetForeground(
dpy, gc, 1L);
214 XDrawRectangle(
dpy, bitmap, gc, 0, 0, width - 1, height - 1);
217 gc, 2, middle,
string, strlen(
string));
219 cursor = XCreatePixmapCursor(
dpy, bitmap, None, &black, &white, 0, 0);
220 XFreePixmap(
dpy, bitmap);
int NewBitmapCursor(Cursor *cp, char *source, char *mask)
Cursor MakeStringCursor(char *string)
static struct _CursorName cursor_names[]
void NewFontCursor(Cursor *cp, const char *str)
Pixmap GetBitmap(const char *name)