pepper_surface_t *cursor_surface;
pepper_view_t *cursor_view;
+ struct wl_global *wl_shell_global;
+ struct wl_global *xdg_shell_global;
+
/* input device add/remove listeners */
pepper_event_listener_t *input_device_add_listener;
init_wl_shell(desktop_shell_t *shell)
{
struct wl_display *display = pepper_compositor_get_display(shell->compositor);
- struct wl_global *global;
- global = wl_global_create(display, &wl_shell_interface, 1, shell, bind_shell);
- if (!global)
+ shell->wl_shell_global = wl_global_create(display, &wl_shell_interface, 1, shell, bind_shell);
+ if (!shell->wl_shell_global)
return PEPPER_FALSE;
return PEPPER_TRUE;
void
fini_wl_shell(desktop_shell_t *shell)
{
- /* TODO */
+ if (shell->wl_shell_global) {
+ wl_global_destroy(shell->wl_shell_global);
+ shell->wl_shell_global = NULL;
+ }
}
init_xdg_shell(desktop_shell_t *shell)
{
struct wl_display *display = pepper_compositor_get_display(shell->compositor);
- struct wl_global *global;
- global = wl_global_create(display, &xdg_shell_interface, 1, shell,
+ shell->xdg_shell_global = wl_global_create(display, &xdg_shell_interface, 1, shell,
bind_xdg_shell);
- if (!global)
+ if (!shell->xdg_shell_global)
return PEPPER_FALSE;
return PEPPER_TRUE;
void
fini_xdg_shell(desktop_shell_t *shell)
{
- /* TODO */
+ if (shell->xdg_shell_global) {
+ wl_global_destroy(shell->xdg_shell_global);
+ shell->xdg_shell_global = NULL;
+ }
}
PEPPER_CHECK(event_loop, return PEPPER_FALSE, "Failed to get event_loop from display: %p\n", pepper_devicemgr->display);
pepper_devicemgr->timer = wl_event_loop_add_timer(event_loop, func, pepper_devicemgr);
+ PEPPER_CHECK(pepper_devicemgr->timer, return PEPPER_FALSE, "Failed to timer\n");
wl_event_source_timer_update(pepper_devicemgr->timer, time);
return PEPPER_TRUE;
if (allocator->free_id_count == allocator->free_id_size) {
int i;
uint32_t *ids = malloc((allocator->free_id_size + 64) * sizeof(uint32_t));
+ PEPPER_CHECK(ids, return, "Failed to allocate memory for ids (free id size: %d).\n", allocator->free_id_size);
for (i = 0; i < allocator->free_id_size; i++) {
ids[i] = allocator->free_ids[allocator->free_id_head++];
/* Create wayland resources. */
output->surface = wl_compositor_create_surface(conn->compositor);
+ if (!output->surface) {
+ free(output);
+ return NULL;
+ }
+
output->shell_surface = wl_shell_get_shell_surface(conn->shell,
output->surface);
+ if (!output->shell_surface) {
+ wl_surface_destroy(output->surface);
+ free(output);
+ return NULL;
+ }
+
wl_shell_surface_add_listener(output->shell_surface, &shell_surface_listener,
output);
wl_shell_surface_set_toplevel(output->shell_surface);