#include <limits.h>
#include <assert.h>
+#include <wayland-server.h>
+
#include "ivi-shell.h"
#include "ivi-shell-ext.h"
#include "ivi-application-server-protocol.h"
wl_resource_set_implementation(res, &surface_implementation,
ivisurf, shell_destroy_shell_surface);
+
+ ivi_shell_surface_configure(weston_surface, 0,0);
}
static const struct ivi_application_interface application_implementation = {
}
WL_EXPORT void
-send_wl_shell_info(int32_t pid, const char *window_title)
+send_wl_shell_info(int32_t pid, const char *window_title, struct weston_surface *surface)
{
struct ivi_shell *shell = get_shell_instance();
struct wl_resource *resource;
+ uint32_t id_surface = 0;
+ struct ivi_shell_surface *ivisurf;
+
+ wl_list_for_each(ivisurf, &shell->ivi_surface_list, link) {
+ if (surface == ivisurf->surface) {
+ id_surface = ivisurf->id_surface;
+ break;
+ }
+ }
wl_resource_for_each(resource, &shell->client_list) {
- ivi_application_send_wl_shell_info(resource, pid, window_title);
+ ivi_application_send_wl_shell_info(resource, pid, window_title, id_surface);
}
}
+WL_EXPORT void
+get_wl_shell_info(struct ivi_layout_surface *layout_surface, uint32_t id_surface,
+ int32_t *pid_ret, const char **window_title_ret)
+{
+ struct ivi_shell *shell = get_shell_instance();
+ struct ivi_layout_interface *ivi_layout = shell->ivi_layout;
+ struct weston_surface *surface;
+ struct wl_array shsurflist;
+ struct shell_surface **shsurface;
+ pid_t pid;
+ uid_t uid;
+ gid_t gid;
+
+ *pid_ret = 0;
+ *window_title_ret = "";
+
+ if (layout_surface != NULL && id_surface > 0) {
+ surface = ivi_layout->get_weston_surface(layout_surface);
+
+ if (surface != NULL && surface->resource != NULL && surface->resource->client != NULL) {
+ wl_client_get_credentials(surface->resource->client, &pid, &uid, &gid);
+
+ *pid_ret = pid;
+
+ ivi_shell_get_shell_surfaces(&shsurflist);
+
+ wl_array_for_each(shsurface, &shsurflist) {
+ if (surface == shell_surface_get_surface(*shsurface)) {
+ *window_title_ret = shell_surface_get_title(*shsurface);
+ break;
+ }
+ }
+
+ wl_array_release(&shsurflist);
+ }
+ }
+}
+
+static void
+click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t button,
+ void *data)
+{
+ if (seat->pointer->grab != &seat->pointer->default_grab) {
+ return;
+ }
+ if (seat->pointer->focus == NULL) {
+ return;
+ }
+
+ weston_surface_activate(seat->pointer->focus->surface, seat);
+}
+
/*
* Initialization of ivi-shell.
*/
return -1;
}
+ weston_compositor_add_button_binding(compositor, BTN_LEFT, 0, click_to_activate_binding, shell);
+
free(setting.ivi_module);
/* Initialize ivi-shell-ext. wl_shell is supported here */