diff options
Diffstat (limited to 'clients/window.c')
-rw-r--r-- | clients/window.c | 84 |
1 files changed, 62 insertions, 22 deletions
diff --git a/clients/window.c b/clients/window.c index 4592ef96..47434dce 100644 --- a/clients/window.c +++ b/clients/window.c @@ -72,6 +72,10 @@ typedef void *EGLContext; #include "window.h" +#include <sys/types.h> +#include "ivi-application-client-protocol.h" +#define IVI_SURFACE_ID 9000 + struct shm_pool; struct global { @@ -133,6 +137,7 @@ struct display { int has_rgb565; int seat_version; + struct ivi_application *ivi_application; }; struct window_output { @@ -245,6 +250,7 @@ struct window { struct xdg_popup *xdg_popup; struct window *transient_for; + struct ivi_surface *ivi_surface; struct window_frame *frame; @@ -1373,6 +1379,20 @@ surface_create_surface(struct surface *surface, uint32_t flags) struct display *display = surface->window->display; struct rectangle allocation = surface->allocation; + if (display->ivi_application) + { + if (!surface->toysurface) { + uint32_t id_ivisurf = IVI_SURFACE_ID + (uint32_t)getpid(); + surface->window->ivi_surface = + ivi_application_surface_create(display->ivi_application, + id_ivisurf, surface->surface); + if (surface->window->ivi_surface == NULL) { + fprintf(stderr, "Failed to create ivi_client_surface\n"); + abort(); + } + } + } + if (!surface->toysurface && display->dpy && surface->buffer_type == WINDOW_BUFFER_TYPE_EGL_WINDOW) { surface->toysurface = @@ -1476,6 +1496,12 @@ surface_destroy(struct surface *surface) if (surface->toysurface) surface->toysurface->destroy(surface->toysurface); + if (surface->window->display->ivi_application) + { + ivi_surface_destroy(surface->window->ivi_surface); + ivi_application_destroy(surface->window->display->ivi_application); + } + wl_list_remove(&surface->link); free(surface); } @@ -1490,7 +1516,7 @@ window_destroy(struct window *window) wl_list_remove(&window->redraw_task.link); - wl_list_for_each(input, &display->input_list, link) { + wl_list_for_each(input, &display->input_list, link) { if (input->touch_focus == window) input->touch_focus = NULL; if (input->pointer_focus == window) @@ -3006,7 +3032,7 @@ touch_handle_down(void *data, struct wl_touch *wl_touch, wl_list_insert(&input->touch_point_list, &tp->link); if (widget->touch_down_handler) - (*widget->touch_down_handler)(widget, input, + (*widget->touch_down_handler)(widget, input, serial, time, id, sx, sy, widget->user_data); @@ -4386,7 +4412,7 @@ window_create_internal(struct display *display, int custom) surface = surface_create(window); window->main_surface = surface; - assert(custom || display->xdg_shell); + assert(custom || display->xdg_shell || display->ivi_application); window->custom = custom; window->preferred_format = WINDOW_PREFERRED_FORMAT_NONE; @@ -4409,14 +4435,17 @@ window_create(struct display *display) window = window_create_internal(display, 0); - window->xdg_surface = - xdg_shell_get_xdg_surface(window->display->xdg_shell, - window->main_surface->surface); - fail_on_null(window->xdg_surface); + if (window->display->xdg_shell) + { + window->xdg_surface = + xdg_shell_get_xdg_surface(window->display->xdg_shell, + window->main_surface->surface); + fail_on_null(window->xdg_surface); - xdg_surface_set_user_data(window->xdg_surface, window); - xdg_surface_add_listener(window->xdg_surface, - &xdg_surface_listener, window); + xdg_surface_set_user_data(window->xdg_surface, window); + xdg_surface_add_listener(window->xdg_surface, + &xdg_surface_listener, window); + } return window; } @@ -4634,19 +4663,22 @@ window_show_menu(struct display *display, frame_interior(menu->frame, &ix, &iy, NULL, NULL); - window->xdg_popup = xdg_shell_get_xdg_popup(display->xdg_shell, - window->main_surface->surface, - parent->main_surface->surface, - input->seat, - display_get_serial(window->display), - window->x - ix, - window->y - iy, - 0); - fail_on_null(window->xdg_popup); + if (display->xdg_shell) + { + window->xdg_popup = xdg_shell_get_xdg_popup(display->xdg_shell, + window->main_surface->surface, + parent->main_surface->surface, + input->seat, + display_get_serial(window->display), + window->x - ix, + window->y - iy, + 0); + fail_on_null(window->xdg_popup); - xdg_popup_set_user_data(window->xdg_popup, window); - xdg_popup_add_listener(window->xdg_popup, - &xdg_popup_listener, window); + xdg_popup_set_user_data(window->xdg_popup, window); + xdg_popup_add_listener(window->xdg_popup, + &xdg_popup_listener, window); + } } void @@ -5091,6 +5123,11 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id, wl_registry_bind(registry, id, &wl_subcompositor_interface, 1); } + else if (strcmp(interface, "ivi_application") == 0) { + d->ivi_application = + wl_registry_bind(registry, id, + &ivi_application_interface, 1); + } if (d->global_handler) d->global_handler(d, id, interface, version, d->user_data); @@ -5400,6 +5437,9 @@ display_destroy(struct display *display) close(display->epoll_fd); + if (display->ivi_application) + wl_display_roundtrip(display->display); + if (!(display->display_fd_events & EPOLLERR) && !(display->display_fd_events & EPOLLHUP)) wl_display_flush(display->display); |