intel-virtual-output: Only store cursor image on reference display
We only need a single copy of the cursor image, from which we can create all the cloned cursors. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
5054e22712
commit
63c43dfa63
|
|
@ -111,7 +111,7 @@ struct display {
|
|||
Cursor invisible_cursor;
|
||||
Cursor visible_cursor;
|
||||
|
||||
XcursorImage cursor_image;
|
||||
XcursorImage cursor_image; /* first only */
|
||||
int cursor_serial;
|
||||
int cursor_x;
|
||||
int cursor_y;
|
||||
|
|
@ -1614,14 +1614,17 @@ static Cursor display_load_invisible_cursor(struct display *display)
|
|||
|
||||
static Cursor display_get_visible_cursor(struct display *display)
|
||||
{
|
||||
if (display->cursor_serial != display->cursor_image.size) {
|
||||
DBG(CURSOR, ("%s updating cursor\n", DisplayString(display->dpy)));
|
||||
struct display *first = display->ctx->display;
|
||||
|
||||
if (display->cursor_serial != first->cursor_serial) {
|
||||
DBG(CURSOR, ("%s updating cursor %dx%d, serial %d\n",
|
||||
DisplayString(display->dpy), first->cursor_image.width, first->cursor_image.height, first->cursor_serial));
|
||||
|
||||
if (display->visible_cursor)
|
||||
XFreeCursor(display->dpy, display->visible_cursor);
|
||||
|
||||
display->visible_cursor = XcursorImageLoadCursor(display->dpy, &display->cursor_image);
|
||||
display->cursor_serial = display->cursor_image.size;
|
||||
display->visible_cursor = XcursorImageLoadCursor(display->dpy, &first->cursor_image);
|
||||
display->cursor_serial = first->cursor_serial;
|
||||
}
|
||||
|
||||
return display->visible_cursor;
|
||||
|
|
@ -1644,20 +1647,13 @@ static void display_load_visible_cursor(struct display *display, XFixesCursorIma
|
|||
display->cursor_image.height = cur->height;
|
||||
display->cursor_image.xhot = cur->xhot;
|
||||
display->cursor_image.yhot = cur->yhot;
|
||||
display->cursor_image.size++;
|
||||
display->cursor_serial++;
|
||||
|
||||
n = cur->width*cur->height;
|
||||
src = cur->pixels;
|
||||
dst = display->cursor_image.pixels;
|
||||
while (n--)
|
||||
*dst++ = *src++;
|
||||
|
||||
DBG(CURSOR, ("%s marking cursor changed\n", DisplayString(display->dpy)));
|
||||
display->cursor_moved++;
|
||||
if (display->cursor != display->invisible_cursor) {
|
||||
display->cursor_visible++;
|
||||
context_enable_timer(display->ctx);
|
||||
}
|
||||
}
|
||||
|
||||
static void display_cursor_move(struct display *display, int x, int y, int visible)
|
||||
|
|
@ -1700,6 +1696,8 @@ static void display_flush_cursor(struct display *display)
|
|||
if (cursor == None)
|
||||
cursor = display->invisible_cursor;
|
||||
if (cursor != display->cursor) {
|
||||
DBG(CURSOR, ("%s setting cursor shape %lx\n",
|
||||
DisplayString(display->dpy), (long)cursor));
|
||||
XDefineCursor(display->dpy, display->root, cursor);
|
||||
display->cursor = cursor;
|
||||
}
|
||||
|
|
@ -3405,8 +3403,17 @@ int main(int argc, char **argv)
|
|||
if (cur == NULL)
|
||||
continue;
|
||||
|
||||
for (i = 1; i < ctx.ndisplay; i++)
|
||||
display_load_visible_cursor(&ctx.display[i], cur);
|
||||
display_load_visible_cursor(&ctx.display[0], cur);
|
||||
for (i = 1; i < ctx.ndisplay; i++) {
|
||||
struct display *display = &ctx.display[i];
|
||||
|
||||
DBG(CURSOR, ("%s marking cursor changed\n", DisplayString(display->dpy)));
|
||||
display->cursor_moved++;
|
||||
if (display->cursor != display->invisible_cursor) {
|
||||
display->cursor_visible++;
|
||||
context_enable_timer(display->ctx);
|
||||
}
|
||||
}
|
||||
|
||||
XFree(cur);
|
||||
} else if (e.type == ctx.display->rr_event + RRScreenChangeNotify) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue