Lines Matching full:theme
137 struct wl_cursor_theme *theme; member
157 struct wl_cursor_theme *theme = img->theme; in wl_cursor_image_get_buffer() local
161 wl_shm_pool_create_buffer(theme->pool->pool, in wl_cursor_image_get_buffer()
199 struct wl_cursor_theme *theme) in wl_cursor_create_from_data() argument
222 image->theme = theme; in wl_cursor_create_from_data()
231 image->offset = shm_pool_allocate(theme->pool, size); in wl_cursor_create_from_data()
236 memcpy(theme->pool->data + image->offset, in wl_cursor_create_from_data()
254 load_fallback_theme(struct wl_cursor_theme *theme) in load_fallback_theme() argument
258 theme->cursor_count = ARRAY_LENGTH(cursor_metadata); in load_fallback_theme()
259 theme->cursors = malloc(theme->cursor_count * sizeof(*theme->cursors)); in load_fallback_theme()
261 if (theme->cursors == NULL) { in load_fallback_theme()
262 theme->cursor_count = 0; in load_fallback_theme()
266 for (i = 0; i < theme->cursor_count; ++i) { in load_fallback_theme()
267 theme->cursors[i] = in load_fallback_theme()
268 wl_cursor_create_from_data(&cursor_metadata[i], theme); in load_fallback_theme()
270 if (theme->cursors[i] == NULL) in load_fallback_theme()
273 theme->cursor_count = i; in load_fallback_theme()
278 struct wl_cursor_theme *theme) in wl_cursor_create_from_xcursor_images() argument
303 image->theme = theme; in wl_cursor_create_from_xcursor_images()
313 image->offset = shm_pool_allocate(theme->pool, size); in wl_cursor_create_from_xcursor_images()
320 memcpy(theme->pool->data + image->offset, in wl_cursor_create_from_xcursor_images()
340 struct wl_cursor_theme *theme = data; in load_callback() local
343 if (wl_cursor_theme_get_cursor(theme, images->name)) { in load_callback()
348 cursor = wl_cursor_create_from_xcursor_images(images, theme); in load_callback()
351 theme->cursor_count++; in load_callback()
352 theme->cursors = in load_callback()
353 realloc(theme->cursors, in load_callback()
354 theme->cursor_count * sizeof theme->cursors[0]); in load_callback()
356 if (theme->cursors == NULL) { in load_callback()
357 theme->cursor_count--; in load_callback()
360 theme->cursors[theme->cursor_count - 1] = cursor; in load_callback()
367 /** Load a cursor theme to memory shared with the compositor
369 * \param name The name of the cursor theme to load. If %NULL, the default
370 * theme will be loaded.
374 * \return An object representing the theme that should be destroyed with
375 * wl_cursor_theme_destroy() or %NULL on error. If no theme with the given
376 * name exists, a default theme will be loaded.
381 struct wl_cursor_theme *theme; in wl_cursor_theme_load() local
383 theme = malloc(sizeof *theme); in wl_cursor_theme_load()
384 if (!theme) in wl_cursor_theme_load()
390 theme->size = size; in wl_cursor_theme_load()
391 theme->cursor_count = 0; in wl_cursor_theme_load()
392 theme->cursors = NULL; in wl_cursor_theme_load()
394 theme->pool = shm_pool_create(shm, size * size * 4); in wl_cursor_theme_load()
395 if (!theme->pool) in wl_cursor_theme_load()
398 xcursor_load_theme(name, size, load_callback, theme); in wl_cursor_theme_load()
400 if (theme->cursor_count == 0) in wl_cursor_theme_load()
401 xcursor_load_theme(NULL, size, load_callback, theme); in wl_cursor_theme_load()
403 if (theme->cursor_count == 0) in wl_cursor_theme_load()
404 load_fallback_theme(theme); in wl_cursor_theme_load()
406 return theme; in wl_cursor_theme_load()
409 free(theme); in wl_cursor_theme_load()
413 /** Destroys a cursor theme object
415 * \param theme The cursor theme to be destroyed
418 wl_cursor_theme_destroy(struct wl_cursor_theme *theme) in wl_cursor_theme_destroy() argument
422 for (i = 0; i < theme->cursor_count; i++) in wl_cursor_theme_destroy()
423 wl_cursor_destroy(theme->cursors[i]); in wl_cursor_theme_destroy()
425 shm_pool_destroy(theme->pool); in wl_cursor_theme_destroy()
427 free(theme->cursors); in wl_cursor_theme_destroy()
428 free(theme); in wl_cursor_theme_destroy()
431 /** Get the cursor for a given name from a cursor theme
433 * \param theme The cursor theme
435 * \return The theme's cursor of the given name or %NULL if there is no
439 wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme, in wl_cursor_theme_get_cursor() argument
444 for (i = 0; i < theme->cursor_count; i++) { in wl_cursor_theme_get_cursor()
445 if (strcmp(name, theme->cursors[i]->name) == 0) in wl_cursor_theme_get_cursor()
446 return theme->cursors[i]; in wl_cursor_theme_get_cursor()