<entry name="fullscreen" value="1"/>
<entry name="split_vertical" value="2"/>
<entry name="split_horizontal" value="3"/>
+ <entry name="remote" value="4"/>
</enum>
<enum name="app_state">
switch (surface->role) {
case IVI_SURFACE_ROLE_DESKTOP:
+ case IVI_SURFACE_ROLE_REMOTE:
ivi_layout_desktop_committed(surface);
break;
case IVI_SURFACE_ROLE_PANEL:
struct wl_list popup_pending_apps;
struct wl_list fullscreen_pending_apps;
struct wl_list split_pending_apps;
+ struct wl_list remote_pending_apps;
struct weston_layer hidden;
struct weston_layer background;
IVI_SURFACE_ROLE_FS,
IVI_SURFACE_ROLE_SPLIT_V,
IVI_SURFACE_ROLE_SPLIT_H,
+ IVI_SURFACE_ROLE_REMOTE,
};
struct pending_popup {
struct wl_list link; /** ivi_compositor::split_pending_apps */
};
+struct pending_remote {
+ struct ivi_output *ioutput;
+ char *app_id;
+ struct wl_list link; /** ivi_compositor::remote_pending_apps */
+};
+
struct ivi_desktop_surface {
struct ivi_output *pending_output;
struct ivi_output *last_output;
struct ivi_output *output;
};
+struct ivi_remote_surface {
+ struct ivi_output *output;
+};
+
struct ivi_split_surface {
struct ivi_output *output;
uint32_t orientation;
struct ivi_popup_surface popup;
struct ivi_fs_surface fs;
struct ivi_split_surface split;
+ struct ivi_remote_surface remote;
};
};
/* force repaint of the entire output */
weston_output_damage(output->output);
+
surf->desktop.last_output = surf->desktop.pending_output;
surf->desktop.pending_output = NULL;
}
return NULL;
}
+static struct ivi_output *
+ivi_layout_get_output_from_surface(struct ivi_surface *surf)
+{
+ struct ivi_output *ivi_output = NULL;
+
+ switch (surf->role) {
+ case IVI_SURFACE_ROLE_DESKTOP:
+ if (surf->desktop.pending_output)
+ ivi_output = surf->desktop.pending_output;
+ else
+ ivi_output = surf->desktop.last_output;
+ break;
+ case IVI_SURFACE_ROLE_POPUP:
+ ivi_output = surf->popup.output;
+ break;
+ case IVI_SURFACE_ROLE_REMOTE:
+ ivi_output = surf->remote.output;
+ break;
+ default:
+ case IVI_SURFACE_ROLE_BACKGROUND:
+ case IVI_SURFACE_ROLE_PANEL:
+ case IVI_SURFACE_ROLE_NONE:
+ break;
+ }
+
+ return ivi_output;
+}
+
void
ivi_layout_desktop_committed(struct ivi_surface *surf)
{
struct weston_desktop_surface *dsurf = surf->dsurface;
struct weston_geometry geom = weston_desktop_surface_get_geometry(dsurf);
struct ivi_output *output;
+ struct ivi_policy *policy = surf->ivi->policy;
- assert(surf->role == IVI_SURFACE_ROLE_DESKTOP);
+ assert(surf->role == IVI_SURFACE_ROLE_DESKTOP ||
+ surf->role == IVI_SURFACE_ROLE_REMOTE);
- output = surf->desktop.pending_output;
+ output = ivi_layout_get_output_from_surface(surf);
if (!output) {
struct ivi_output *ivi_bg_output;
- struct ivi_policy *policy = surf->ivi->policy;
if (policy && policy->api.surface_activate_by_default)
if (policy->api.surface_activate_by_default(surf, surf->ivi))
return;
}
+ if (surf->role == IVI_SURFACE_ROLE_REMOTE && output) {
+ const char *app_id;
+
+ if (policy && policy->api.surface_activate_by_default &&
+ !policy->api.surface_activate_by_default(surf, surf->ivi))
+ return;
+
+ app_id = weston_desktop_surface_get_app_id(dsurf);
+ if (app_id) {
+ ivi_layout_activate(output, app_id);
+
+ /* we transition to the desktop role from remote one,
+ * as they're basically one and the same, but in order
+ * to keep the same functionality (that is to display
+ * it by default when starting), we need to know the
+ * output before hand, fact that that is not true for,
+ * regular desktop ones.
+ */
+ surf->role = IVI_SURFACE_ROLE_DESKTOP;
+ surf->activated_by_default = true;
+ }
+ return;
+ }
+
if (!weston_desktop_surface_get_maximized(dsurf) ||
geom.width != output->area.width ||
geom.height != output->area.height)
surface->view->is_mapped = true;
}
+
void
ivi_layout_desktop_resize(struct ivi_surface *surface,
struct weston_geometry area)
}
}
-static struct ivi_output *
-ivi_layout_get_output_from_surface(struct ivi_surface *surf)
-{
- struct ivi_output *ivi_output = NULL;
-
- switch (surf->role) {
- case IVI_SURFACE_ROLE_DESKTOP:
- if (surf->desktop.pending_output)
- ivi_output = surf->desktop.pending_output;
- else
- ivi_output = surf->desktop.last_output;
- break;
- case IVI_SURFACE_ROLE_POPUP:
- ivi_output = surf->popup.output;
- break;
- default:
- case IVI_SURFACE_ROLE_BACKGROUND:
- case IVI_SURFACE_ROLE_PANEL:
- case IVI_SURFACE_ROLE_NONE:
- break;
- }
-
- return ivi_output;
-}
-
void
ivi_layout_deactivate(struct ivi_compositor *ivi, const char *app_id)
{
wl_list_init(&ivi.popup_pending_apps);
wl_list_init(&ivi.fullscreen_pending_apps);
wl_list_init(&ivi.split_pending_apps);
+ wl_list_init(&ivi.remote_pending_apps);
wl_list_init(&ivi.desktop_clients);
/* Prevent any clients we spawn getting our stdin */
wl_list_insert(&ivi->surfaces, &surface->link);
}
+static void
+ivi_set_desktop_surface_remote(struct ivi_surface *surface)
+{
+ struct ivi_compositor *ivi = surface->ivi;
+ assert(surface->role == IVI_SURFACE_ROLE_NONE);
+
+ /* remote type are the same as desktop just that client can tell
+ * the compositor to start on another output */
+ surface->role = IVI_SURFACE_ROLE_REMOTE;
+ wl_list_insert(&ivi->surfaces, &surface->link);
+}
+
static void
ivi_set_desktop_surface_split(struct ivi_surface *surface)
{
wl_list_insert(&ivi->split_pending_apps, &split->link);
}
+static void
+ivi_set_pending_desktop_surface_remote(struct ivi_output *ioutput,
+ const char *app_id)
+{
+ struct ivi_compositor *ivi = ioutput->ivi;
+ size_t len_app_id = strlen(app_id);
+
+ struct pending_remote *remote = zalloc(sizeof(*remote));
+
+ remote->app_id = zalloc(sizeof(char) * (len_app_id + 1));
+ memcpy(remote->app_id, app_id, len_app_id);
+
+ remote->ioutput = ioutput;
+
+ wl_list_insert(&ivi->remote_pending_apps, &remote->link);
+}
+
static void
ivi_remove_pending_desktop_surface_split(struct pending_split *split)
{
free(p_popup);
}
+static void
+ivi_remove_pending_desktop_surface_remote(struct pending_remote *remote)
+{
+ free(remote->app_id);
+ wl_list_remove(&remote->link);
+ free(remote);
+}
+
static bool
ivi_check_pending_desktop_surface_popup(struct ivi_surface *surface)
{
return false;
}
+static bool
+ivi_check_pending_desktop_surface_remote(struct ivi_surface *surface)
+{
+ struct pending_remote *remote_surf, *next_remote_surf;
+ struct ivi_compositor *ivi = surface->ivi;
+ const char *_app_id =
+ weston_desktop_surface_get_app_id(surface->dsurface);
+
+ if (wl_list_empty(&ivi->remote_pending_apps))
+ return false;
+
+ wl_list_for_each_safe(remote_surf, next_remote_surf,
+ &ivi->remote_pending_apps, link) {
+ if (!strcmp(_app_id, remote_surf->app_id)) {
+ surface->remote.output = remote_surf->ioutput;
+ ivi_remove_pending_desktop_surface_remote(remote_surf);
+ return true;
+ }
+ }
+
+ return false;
+}
+
void
ivi_check_pending_desktop_surface(struct ivi_surface *surface)
{
return;
}
+ ret = ivi_check_pending_desktop_surface_remote(surface);
+ if (ret) {
+ ivi_set_desktop_surface_remote(surface);
+ return;
+ }
+
/* if we end up here means we have a regular desktop app and
* try to activate it */
ivi_set_desktop_surface(surface);
case AGL_SHELL_DESKTOP_APP_ROLE_SPLIT_HORIZONTAL:
ivi_set_pending_desktop_surface_split(output, app_id, role);
break;
+ case AGL_SHELL_DESKTOP_APP_ROLE_REMOTE:
+ ivi_set_pending_desktop_surface_remote(output, app_id);
+ break;
default:
break;
}