downstream: clients: set title for IVI applications
authorJanos Kovacs <jankovac503@gmail.com>
Tue, 15 Jul 2014 20:35:34 +0000 (23:35 +0300)
committerJanos Kovacs <jankovac503@gmail.com>
Wed, 10 Dec 2014 14:28:04 +0000 (16:28 +0200)
Change-Id: I56aa6c1a58faf37c5571ed02373598dfa7cf2993
Signed-off-by: Janos Kovacs <jankovac503@gmail.com>
clients/window.c

index ed850dd..49bb28b 100644 (file)
@@ -138,6 +138,7 @@ struct display {
 
        int has_rgb565;
        int seat_version;
+       struct wl_shell *shell;
 };
 
 struct window_output {
@@ -250,6 +251,7 @@ struct window {
        struct surface *main_surface;
        struct xdg_surface *xdg_surface;
        struct xdg_popup *xdg_popup;
+       struct wl_shell_surface *shell_surface;
 
        struct window *parent;
        struct wl_surface *last_parent_surface;
@@ -1404,6 +1406,31 @@ 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 && strcmp(surface->window->title,"Virtual keyboard")!=0) {
+                       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();
+                       }
+
+                        surface->window->shell_surface =
+                            wl_shell_get_shell_surface(display->shell, surface->surface);
+                        if (surface->window->shell_surface == NULL)
+                            fprintf(stderr, "could not obtain shell_surface\n");
+                        else {
+                            if (surface->window->title)
+                                wl_shell_surface_set_title(surface->window->shell_surface,
+                                                           surface->window->title);
+
+                        }
+               }
+       }
+
        if (!surface->toysurface && display->dpy &&
            surface->buffer_type == WINDOW_BUFFER_TYPE_EGL_WINDOW) {
                surface->toysurface =
@@ -4377,6 +4404,8 @@ window_set_title(struct window *window, const char *title)
        }
        if (window->xdg_surface)
                xdg_surface_set_title(window->xdg_surface, title);
+        if (window->shell_surface)
+                wl_shell_surface_set_title(window->shell_surface, title);
 }
 
 const char *
@@ -5275,6 +5304,11 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
                        wl_registry_bind(registry, id,
                                         &ivi_application_interface, 1);
        }
+       else if (strcmp(interface, "wl_shell") == 0) {
+               d->shell =
+                       wl_registry_bind(registry, id,
+                                        &wl_shell_interface, 1);
+       }
 
        if (d->global_handler)
                d->global_handler(d, id, interface, version, d->user_data);