• Home
  • Raw
  • Download

Lines Matching full:theme

138 	struct wl_cursor_theme *theme;  member
158 struct wl_cursor_theme *theme = image->theme; in wl_cursor_image_get_buffer() local
162 wl_shm_pool_create_buffer(theme->pool->pool, in wl_cursor_image_get_buffer()
200 struct wl_cursor_theme *theme) in wl_cursor_create_from_data() argument
223 image->theme = theme; in wl_cursor_create_from_data()
232 image->offset = shm_pool_allocate(theme->pool, size); in wl_cursor_create_from_data()
237 memcpy(theme->pool->data + image->offset, in wl_cursor_create_from_data()
255 load_default_theme(struct wl_cursor_theme *theme) in load_default_theme() argument
259 free(theme->name); in load_default_theme()
260 theme->name = strdup("default"); in load_default_theme()
262 theme->cursor_count = ARRAY_LENGTH(cursor_metadata); in load_default_theme()
263 theme->cursors = malloc(theme->cursor_count * sizeof(*theme->cursors)); in load_default_theme()
265 if (theme->cursors == NULL) { in load_default_theme()
266 theme->cursor_count = 0; in load_default_theme()
270 for (i = 0; i < theme->cursor_count; ++i) { in load_default_theme()
271 theme->cursors[i] = in load_default_theme()
272 wl_cursor_create_from_data(&cursor_metadata[i], theme); in load_default_theme()
274 if (theme->cursors[i] == NULL) in load_default_theme()
277 theme->cursor_count = i; in load_default_theme()
282 struct wl_cursor_theme *theme) in wl_cursor_create_from_xcursor_images() argument
307 image->theme = theme; in wl_cursor_create_from_xcursor_images()
317 image->offset = shm_pool_allocate(theme->pool, size); in wl_cursor_create_from_xcursor_images()
324 memcpy(theme->pool->data + image->offset, in wl_cursor_create_from_xcursor_images()
344 struct wl_cursor_theme *theme = data; in load_callback() local
347 if (wl_cursor_theme_get_cursor(theme, images->name)) { in load_callback()
352 cursor = wl_cursor_create_from_xcursor_images(images, theme); in load_callback()
355 theme->cursor_count++; in load_callback()
356 theme->cursors = in load_callback()
357 realloc(theme->cursors, in load_callback()
358 theme->cursor_count * sizeof theme->cursors[0]); in load_callback()
360 if (theme->cursors == NULL) { in load_callback()
361 theme->cursor_count--; in load_callback()
364 theme->cursors[theme->cursor_count - 1] = cursor; in load_callback()
371 /** Load a cursor theme to memory shared with the compositor
373 * \param name The name of the cursor theme to load. If %NULL, the default
374 * theme will be loaded.
378 * \return An object representing the theme that should be destroyed with
379 * wl_cursor_theme_destroy() or %NULL on error. If no theme with the given
380 * name exists, a default theme will be loaded.
385 struct wl_cursor_theme *theme; in wl_cursor_theme_load() local
387 theme = malloc(sizeof *theme); in wl_cursor_theme_load()
388 if (!theme) in wl_cursor_theme_load()
394 theme->name = strdup(name); in wl_cursor_theme_load()
395 if (!theme->name) in wl_cursor_theme_load()
397 theme->size = size; in wl_cursor_theme_load()
398 theme->cursor_count = 0; in wl_cursor_theme_load()
399 theme->cursors = NULL; in wl_cursor_theme_load()
401 theme->pool = shm_pool_create(shm, size * size * 4); in wl_cursor_theme_load()
402 if (!theme->pool) in wl_cursor_theme_load()
405 xcursor_load_theme(name, size, load_callback, theme); in wl_cursor_theme_load()
407 if (theme->cursor_count == 0) in wl_cursor_theme_load()
408 load_default_theme(theme); in wl_cursor_theme_load()
410 return theme; in wl_cursor_theme_load()
413 free(theme->name); in wl_cursor_theme_load()
415 free(theme); in wl_cursor_theme_load()
419 /** Destroys a cursor theme object
421 * \param theme The cursor theme to be destroyed
424 wl_cursor_theme_destroy(struct wl_cursor_theme *theme) in wl_cursor_theme_destroy() argument
428 for (i = 0; i < theme->cursor_count; i++) in wl_cursor_theme_destroy()
429 wl_cursor_destroy(theme->cursors[i]); in wl_cursor_theme_destroy()
431 shm_pool_destroy(theme->pool); in wl_cursor_theme_destroy()
433 free(theme->name); in wl_cursor_theme_destroy()
434 free(theme->cursors); in wl_cursor_theme_destroy()
435 free(theme); in wl_cursor_theme_destroy()
438 /** Get the cursor for a given name from a cursor theme
440 * \param theme The cursor theme
442 * \return The theme's cursor of the given name or %NULL if there is no
446 wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme, in wl_cursor_theme_get_cursor() argument
451 for (i = 0; i < theme->cursor_count; i++) { in wl_cursor_theme_get_cursor()
452 if (strcmp(name, theme->cursors[i]->name) == 0) in wl_cursor_theme_get_cursor()
453 return theme->cursors[i]; in wl_cursor_theme_get_cursor()