Lines Matching refs:theme
144 struct wl_cursor_theme *theme; member
164 struct wl_cursor_theme *theme = image->theme; in wl_cursor_image_get_buffer() local
168 wl_shm_pool_create_buffer(theme->pool->pool, in wl_cursor_image_get_buffer()
206 struct wl_cursor_theme *theme) in wl_cursor_create_from_data() argument
229 image->theme = theme; in wl_cursor_create_from_data()
238 image->offset = shm_pool_allocate(theme->pool, size); in wl_cursor_create_from_data()
243 memcpy(theme->pool->data + image->offset, in wl_cursor_create_from_data()
261 load_default_theme(struct wl_cursor_theme *theme) in load_default_theme() argument
265 free(theme->name); in load_default_theme()
266 theme->name = strdup("default"); in load_default_theme()
268 theme->cursor_count = ARRAY_LENGTH(cursor_metadata); in load_default_theme()
269 theme->cursors = malloc(theme->cursor_count * sizeof(*theme->cursors)); in load_default_theme()
271 if (theme->cursors == NULL) { in load_default_theme()
272 theme->cursor_count = 0; in load_default_theme()
276 for (i = 0; i < theme->cursor_count; ++i) { in load_default_theme()
277 theme->cursors[i] = in load_default_theme()
278 wl_cursor_create_from_data(&cursor_metadata[i], theme); in load_default_theme()
280 if (theme->cursors[i] == NULL) in load_default_theme()
283 theme->cursor_count = i; in load_default_theme()
288 struct wl_cursor_theme *theme) in wl_cursor_create_from_xcursor_images() argument
313 image->theme = theme; in wl_cursor_create_from_xcursor_images()
323 image->offset = shm_pool_allocate(theme->pool, size); in wl_cursor_create_from_xcursor_images()
330 memcpy(theme->pool->data + image->offset, in wl_cursor_create_from_xcursor_images()
350 struct wl_cursor_theme *theme = data; in load_callback() local
353 if (wl_cursor_theme_get_cursor(theme, images->name)) { in load_callback()
358 cursor = wl_cursor_create_from_xcursor_images(images, theme); in load_callback()
361 theme->cursor_count++; in load_callback()
362 theme->cursors = in load_callback()
363 realloc(theme->cursors, in load_callback()
364 theme->cursor_count * sizeof theme->cursors[0]); in load_callback()
366 if (theme->cursors == NULL) { in load_callback()
367 theme->cursor_count--; in load_callback()
370 theme->cursors[theme->cursor_count - 1] = cursor; in load_callback()
391 struct wl_cursor_theme *theme; in wl_cursor_theme_load() local
393 theme = malloc(sizeof *theme); in wl_cursor_theme_load()
394 if (!theme) in wl_cursor_theme_load()
400 theme->name = strdup(name); in wl_cursor_theme_load()
401 if (!theme->name) in wl_cursor_theme_load()
403 theme->size = size; in wl_cursor_theme_load()
404 theme->cursor_count = 0; in wl_cursor_theme_load()
405 theme->cursors = NULL; in wl_cursor_theme_load()
407 theme->pool = shm_pool_create(shm, size * size * 4); in wl_cursor_theme_load()
408 if (!theme->pool) in wl_cursor_theme_load()
411 xcursor_load_theme(name, size, load_callback, theme); in wl_cursor_theme_load()
413 if (theme->cursor_count == 0) in wl_cursor_theme_load()
414 load_default_theme(theme); in wl_cursor_theme_load()
416 return theme; in wl_cursor_theme_load()
419 free(theme->name); in wl_cursor_theme_load()
421 free(theme); in wl_cursor_theme_load()
430 wl_cursor_theme_destroy(struct wl_cursor_theme *theme) in wl_cursor_theme_destroy() argument
434 for (i = 0; i < theme->cursor_count; i++) in wl_cursor_theme_destroy()
435 wl_cursor_destroy(theme->cursors[i]); in wl_cursor_theme_destroy()
437 shm_pool_destroy(theme->pool); in wl_cursor_theme_destroy()
439 free(theme->name); in wl_cursor_theme_destroy()
440 free(theme->cursors); in wl_cursor_theme_destroy()
441 free(theme); in wl_cursor_theme_destroy()
452 wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme, in wl_cursor_theme_get_cursor() argument
457 for (i = 0; i < theme->cursor_count; i++) { in wl_cursor_theme_get_cursor()
458 if (strcmp(name, theme->cursors[i]->name) == 0) in wl_cursor_theme_get_cursor()
459 return theme->cursors[i]; in wl_cursor_theme_get_cursor()