Lines Matching refs:theme

144 	struct wl_cursor_theme *theme;
164 struct wl_cursor_theme *theme = image->theme;
168 wl_shm_pool_create_buffer(theme->pool->pool,
206 struct wl_cursor_theme *theme)
229 image->theme = theme;
238 image->offset = shm_pool_allocate(theme->pool, size);
243 memcpy(theme->pool->data + image->offset,
261 load_default_theme(struct wl_cursor_theme *theme)
265 free(theme->name);
266 theme->name = strdup("default");
268 theme->cursor_count = ARRAY_LENGTH(cursor_metadata);
269 theme->cursors = malloc(theme->cursor_count * sizeof(*theme->cursors));
271 if (theme->cursors == NULL) {
272 theme->cursor_count = 0;
276 for (i = 0; i < theme->cursor_count; ++i) {
277 theme->cursors[i] =
278 wl_cursor_create_from_data(&cursor_metadata[i], theme);
280 if (theme->cursors[i] == NULL)
283 theme->cursor_count = i;
288 struct wl_cursor_theme *theme)
313 image->theme = theme;
323 image->offset = shm_pool_allocate(theme->pool, size);
330 memcpy(theme->pool->data + image->offset,
350 struct wl_cursor_theme *theme = data;
353 if (wl_cursor_theme_get_cursor(theme, images->name)) {
358 cursor = wl_cursor_create_from_xcursor_images(images, theme);
361 theme->cursor_count++;
362 theme->cursors =
363 realloc(theme->cursors,
364 theme->cursor_count * sizeof theme->cursors[0]);
366 if (theme->cursors == NULL) {
367 theme->cursor_count--;
370 theme->cursors[theme->cursor_count - 1] = cursor;
377 /** Load a cursor theme to memory shared with the compositor
379 * \param name The name of the cursor theme to load. If %NULL, the default
380 * theme will be loaded.
384 * \return An object representing the theme that should be destroyed with
385 * wl_cursor_theme_destroy() or %NULL on error. If no theme with the given
386 * name exists, a default theme will be loaded.
391 struct wl_cursor_theme *theme;
393 theme = malloc(sizeof *theme);
394 if (!theme)
400 theme->name = strdup(name);
401 if (!theme->name)
403 theme->size = size;
404 theme->cursor_count = 0;
405 theme->cursors = NULL;
407 theme->pool = shm_pool_create(shm, size * size * 4);
408 if (!theme->pool)
411 xcursor_load_theme(name, size, load_callback, theme);
413 if (theme->cursor_count == 0)
414 load_default_theme(theme);
416 return theme;
419 free(theme->name);
421 free(theme);
425 /** Destroys a cursor theme object
427 * \param theme The cursor theme to be destroyed
430 wl_cursor_theme_destroy(struct wl_cursor_theme *theme)
434 for (i = 0; i < theme->cursor_count; i++)
435 wl_cursor_destroy(theme->cursors[i]);
437 shm_pool_destroy(theme->pool);
439 free(theme->name);
440 free(theme->cursors);
441 free(theme);
444 /** Get the cursor for a given name from a cursor theme
446 * \param theme The cursor theme
448 * \return The theme's cursor of the given name or %NULL if there is no
452 wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme,
457 for (i = 0; i < theme->cursor_count; i++) {
458 if (strcmp(name, theme->cursors[i]->name) == 0)
459 return theme->cursors[i];