Lines Matching refs:cursor
42 #include "cursor.h"
44 struct cursor {
57 static struct cursor cursors[MAX_CURSORS];
65 * the cursor
69 void (*run)(struct cursor *cursor, const struct cursor_step *step);
77 static void set_cursor(struct cursor *cursor, const struct cursor_step *step)
83 handle = cursor->bo_handle;
85 cursor->enabled = enabled;
87 drmModeSetCursor(cursor->fd, cursor->crtc_id, handle, cursor->w, cursor->h);
90 static void move_cursor(struct cursor *cursor, const struct cursor_step *step)
92 int x = cursor->x;
93 int y = cursor->y;
95 if (!cursor->enabled)
96 drmModeSetCursor(cursor->fd, cursor->crtc_id,
97 cursor->bo_handle, cursor->w, cursor->h);
99 /* calculate new cursor position: */
100 x += cursor->dx * step->arg;
101 y += cursor->dy * step->arg;
105 cursor->dx = 1;
106 } else if (x > (int)cursor->crtc_w) {
107 x = cursor->crtc_w - 1;
108 cursor->dx = -1;
113 cursor->dy = 1;
114 } else if (y > (int)cursor->crtc_h) {
115 y = cursor->crtc_h - 1;
116 cursor->dy = -1;
119 cursor->x = x;
120 cursor->y = y;
122 drmModeMoveCursor(cursor->fd, cursor->crtc_id, x, y);
148 struct cursor *cursor = &cursors[i];
149 step->run(cursor, step);
169 struct cursor *cursor = &cursors[ncursors];
173 cursor->fd = fd;
174 cursor->bo_handle = bo_handle;
175 cursor->crtc_id = crtc_id;
176 cursor->crtc_w = crtc_w;
177 cursor->crtc_h = crtc_h;
178 cursor->w = w;
179 cursor->h = h;
181 cursor->enabled = 0;
182 cursor->x = w/2;
183 cursor->y = h/2;
184 cursor->dx = 1;
185 cursor->dy = 1;
196 printf("starting cursor\n");
204 printf("cursor stopped\n");