cursor: Refactor out code that loads from XcursorImage
This commit is contained in:
parent
383d4c7e4e
commit
0f810a4e21
1 changed files with 19 additions and 9 deletions
|
@ -181,11 +181,10 @@ load_cursor_on_client (MetaDisplay *display,
|
|||
return image;
|
||||
}
|
||||
|
||||
MetaCursorReference *
|
||||
meta_cursor_reference_from_theme (MetaCursorTracker *tracker,
|
||||
MetaCursor cursor)
|
||||
static MetaCursorReference *
|
||||
meta_cursor_reference_from_xcursor_image (MetaCursorTracker *tracker,
|
||||
XcursorImage *image)
|
||||
{
|
||||
XcursorImage *image;
|
||||
int width, height, rowstride;
|
||||
CoglPixelFormat cogl_format;
|
||||
uint32_t gbm_format;
|
||||
|
@ -193,10 +192,6 @@ meta_cursor_reference_from_theme (MetaCursorTracker *tracker,
|
|||
CoglContext *cogl_context;
|
||||
MetaCursorReference *self;
|
||||
|
||||
image = load_cursor_on_client (tracker->screen->display, cursor);
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
width = image->width;
|
||||
height = image->height;
|
||||
rowstride = width * 4;
|
||||
|
@ -250,8 +245,23 @@ meta_cursor_reference_from_theme (MetaCursorTracker *tracker,
|
|||
}
|
||||
|
||||
out:
|
||||
XcursorImageDestroy (image);
|
||||
return self;
|
||||
}
|
||||
|
||||
MetaCursorReference *
|
||||
meta_cursor_reference_from_theme (MetaCursorTracker *tracker,
|
||||
MetaCursor cursor)
|
||||
{
|
||||
MetaCursorReference *self;
|
||||
XcursorImage *image;
|
||||
|
||||
image = load_cursor_on_client (tracker->screen->display, cursor);
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
self = meta_cursor_reference_from_xcursor_image (tracker, image);
|
||||
|
||||
XcursorImageDestroy (image);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue