cursor: Refactor out code that loads from XcursorImage

This commit is contained in:
Jasper St. Pierre 2014-03-31 16:09:32 -04:00
parent 383d4c7e4e
commit 0f810a4e21

View File

@ -181,11 +181,10 @@ load_cursor_on_client (MetaDisplay *display,
return image; return image;
} }
MetaCursorReference * static MetaCursorReference *
meta_cursor_reference_from_theme (MetaCursorTracker *tracker, meta_cursor_reference_from_xcursor_image (MetaCursorTracker *tracker,
MetaCursor cursor) XcursorImage *image)
{ {
XcursorImage *image;
int width, height, rowstride; int width, height, rowstride;
CoglPixelFormat cogl_format; CoglPixelFormat cogl_format;
uint32_t gbm_format; uint32_t gbm_format;
@ -193,10 +192,6 @@ meta_cursor_reference_from_theme (MetaCursorTracker *tracker,
CoglContext *cogl_context; CoglContext *cogl_context;
MetaCursorReference *self; MetaCursorReference *self;
image = load_cursor_on_client (tracker->screen->display, cursor);
if (!image)
return NULL;
width = image->width; width = image->width;
height = image->height; height = image->height;
rowstride = width * 4; rowstride = width * 4;
@ -250,8 +245,23 @@ meta_cursor_reference_from_theme (MetaCursorTracker *tracker,
} }
out: 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; return self;
} }