#include <assert.h>
#include <string.h>
+#include <libweston/config-parser.h>
#include <libweston/libweston.h>
-#include <libweston-desktop/libweston-desktop.h>
+#include <libweston/desktop.h>
#include "agl-shell-desktop-server-protocol.h"
[IVI_SURFACE_ROLE_SPLIT_V] = "SPLIT_V",
[IVI_SURFACE_ROLE_FULLSCREEN] = "FULLSCREEN",
[IVI_SURFACE_ROLE_REMOTE] = "REMOTE",
+ [IVI_SURFACE_ROLE_TILE] = "SPLIT",
};
bool
ivi_layout_init(struct ivi_compositor *ivi, struct ivi_output *output)
{
bool use_default_area = true;
+ struct weston_config_section *section = output->config;
+ char *t;
+
+ weston_config_section_get_string(section, "activation-area", &t, NULL);
+ if (t) {
+ if (output->area_activation.width == 0 &&
+ output->area_activation.height == 0 &&
+ output->area_activation.x == 0 &&
+ output->area_activation.y == 0) {
+ weston_log("WARNING: activation-area set in "
+ "configuration file, but yet applied!\n");
+ if (parse_activation_area(t, output) < 0)
+ weston_log("Invalid activation-area \"%s\" for output %s\n",
+ t, output->name);
+ } else {
+ weston_log("WARNING: activation-area detected in ini file, "
+ "but agl_shell override detected!\n");
+ if (parse_activation_area(t, output) < 0)
+ weston_log("Invalid activation-area \"%s\" for output %s\n",
+ t, output->name);
+ }
+ }
+ free(t);
ivi_background_init(ivi, output);
woutput->x + output->area.x,
woutput->y + output->area.y);
+ /* reset any previous orientation */
+ if (surf->orientation != AGL_SHELL_TILE_ORIENTATION_NONE &&
+ !surf->sticky) {
+ weston_log("%s() resetting itself to none orientation\n", __func__);
+ surf->orientation = AGL_SHELL_TILE_ORIENTATION_NONE;
+ weston_desktop_surface_set_orientation(surf->dsurface,
+ surf->orientation);
+ }
view->is_mapped = true;
surf->mapped = true;
view->surface->is_mapped = true;
if (output->active) {
/* keep the background surface mapped at all times */
- if (output->active->role != IVI_SURFACE_ROLE_BACKGROUND) {
+ if (output->active->role != IVI_SURFACE_ROLE_BACKGROUND &&
+ !output->active->sticky) {
+
output->active->view->is_mapped = false;
output->active->view->surface->is_mapped = false;
* we're trying to complete activation with means we're
* operating on the same app_id so do update previous_active as
* it will overwrite it with the same value */
- if (!strcmp(c_app_id, app_id)) {
+ if (app_id && !strcmp(c_app_id, app_id)) {
update_previous = false;
}
}
return;
}
- if (!surf->ivi->activate_by_default) {
- weston_log("Refusing to activate surface role %d, app_id %s\n",
- surf->role, app_id);
+ if (!surf->ivi->activate_by_default &&
+ (!surf->xwayland.is_set && !is_shell_surface_xwayland(surf))) {
+ weston_log("Refusing to activate surface role %d, app_id %s, type %s\n",
+ surf->role, app_id,
+ is_shell_surface_xwayland(surf) ?
+ "xwayland" : "regular");
if (!weston_desktop_surface_get_maximized(dsurf) ||
geom.width != r_output->area.width ||
*/
weston_log("Surface no app_id, role %s activating by default\n",
ivi_layout_get_surface_role_name(surf));
- ivi_layout_activate_by_surf(r_output, surf);
+ if (surf->xwayland.is_set || is_shell_surface_xwayland(surf)) {
+ ivi_layout_activate_by_surf(r_output, surf);
+ ivi_layout_activate_complete(r_output, surf);
+ } else {
+ ivi_layout_activate_by_surf(r_output, surf);
+ }
}
}
ivi_layout_get_surface_role_name(surface),
output->name);
+ weston_compositor_schedule_repaint(ivi->compositor);
}
}
ivi_layout_popup_committed(surface);
}
+static void
+ivi_layout_fullscreen_re_add(struct ivi_surface *surface)
+{
+ assert(surface->role == IVI_SURFACE_ROLE_FULLSCREEN);
+ struct weston_view *view = surface->view;
+
+ if (weston_view_is_mapped(view)) {
+ struct weston_desktop_surface *dsurface = surface->dsurface;
+ struct weston_surface *wsurface =
+ weston_desktop_surface_get_surface(dsurface);
+
+ weston_layer_entry_remove(&view->layer_link);
+
+ wsurface->is_mapped = false;
+ view->is_mapped = false;
+ }
+
+ /* reset the activate by default in order to (still) allow the surface
+ * to be activaved using the request */
+ if (!surface->mapped)
+ surface->mapped = true;
+
+ surface->state = NORMAL;
+ ivi_layout_fullscreen_committed(surface);
+}
+
static bool
ivi_layout_surface_is_split_or_fullscreen(struct ivi_surface *surf)
{
return false;
}
+void
+ivi_layout_reset_split_surfaces(struct ivi_compositor *ivi)
+{
+ struct ivi_surface *ivisurf;
+ struct ivi_surface *found_ivi_surf = NULL;
+ bool found_split_surface = false;
+ struct ivi_output *output = NULL;
+
+ wl_list_for_each(ivisurf, &ivi->surfaces, link) {
+ if (ivisurf->orientation != AGL_SHELL_TILE_ORIENTATION_NONE) {
+ found_ivi_surf = ivisurf;
+ found_split_surface = true;
+ break;
+ }
+ }
+
+ if (!found_split_surface)
+ return;
+
+ output = found_ivi_surf->current_completed_output;
+
+ if (found_ivi_surf->sticky)
+ return;
+
+ if (output->previous_active && output->background != output->previous_active) {
+ struct weston_view *ev = output->previous_active->view;
+ struct weston_output *woutput = output->output;
+
+ if (!weston_view_is_mapped(ev))
+ weston_view_update_transform(ev);
+ else
+ weston_layer_entry_remove(&ev->layer_link);
+
+ ev->is_mapped = true;
+ ev->surface->is_mapped = true;
+ output->previous_active->mapped = true;
+
+ weston_view_set_output(ev, woutput);
+
+ weston_layer_entry_insert(&ivi->normal.view_list, &ev->layer_link);
+
+ _ivi_set_shell_surface_split(output->previous_active, NULL, 0,
+ AGL_SHELL_TILE_ORIENTATION_NONE, false, false);
+
+ if (output->active == ivisurf) {
+ output->active = output->previous_active;
+ }
+ }
+
+ _ivi_set_shell_surface_split(ivisurf, NULL, 0,
+ AGL_SHELL_TILE_ORIENTATION_NONE, false, false);
+}
+
void
ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf)
{
return;
}
+ if (surf->role == IVI_SURFACE_ROLE_FULLSCREEN) {
+ ivi_layout_fullscreen_re_add(surf);
+ return;
+ }
+#if 0
+ /* reset tile to desktop to allow to resize correctly */
+ if (surf->role == IVI_SURFACE_ROLE_TILE && output->active == surf) {
+ weston_log("%s() resetting tile role!\n", __func__);
+ surf->role = IVI_SURFACE_ROLE_DESKTOP;
+ }
+#endif
+
/* do not 're'-activate surfaces that are split or active */
- if (surf == output->active ||
- ivi_layout_surface_is_split_or_fullscreen(surf)) {
+ if (surf == output->active) {
weston_log("Application %s is already active on output %s\n",
app_id, output->output->name);
return;
}
+ if (surf->sticky && surf->role == IVI_SURFACE_ROLE_TILE && output->active == surf) {
+ weston_log("Application %s is already active on output %s (split role)\n",
+ app_id, output->output->name);
+ return;
+ }
+
+ if (ivi_layout_surface_is_split_or_fullscreen(surf)) {
+ weston_log("Application %s is fullscreen or split on output %s\n",
+ app_id, output->output->name);
+ return;
+ }
+
+ // destroy any split types to allow correct re-activation
+ ivi_layout_reset_split_surfaces(surf->ivi);
+
if (surf->role == IVI_SURFACE_ROLE_REMOTE) {
struct ivi_output *remote_output =
ivi_layout_find_with_app_id(app_id, ivi);
/* the background surface is already "maximized" so we don't need to
* add to the hidden layer */
- if (surf->role == IVI_SURFACE_ROLE_BACKGROUND) {
+ if (surf->role == IVI_SURFACE_ROLE_BACKGROUND &&
+ output->active->role != IVI_SURFACE_ROLE_TILE) {
ivi_layout_activate_complete(output, surf);
return;
}
case IVI_SURFACE_ROLE_REMOTE:
ivi_output = surf->remote.output;
break;
+ case IVI_SURFACE_ROLE_TILE:
+ ivi_output = surf->current_completed_output;
+ break;
case IVI_SURFACE_ROLE_NONE:
default:
+ if (surf->view->output)
+ return to_ivi_output(surf->view->output);
break;
}
weston_desktop_surface_get_app_id(dsurface);
ivi_layout_activate(ivi_output, previous_active_app_id);
}
- } else if (surf->role == IVI_SURFACE_ROLE_POPUP) {
+ } else if (surf->role == IVI_SURFACE_ROLE_POPUP ||
+ surf->role == IVI_SURFACE_ROLE_FULLSCREEN) {
struct weston_view *view = surf->view;
weston_view_unmap(view);
weston_surface_damage(view->surface);
}
- shell_send_app_state(ivi, app_id, AGL_SHELL_APP_STATE_DEACTIVATED);
+ shell_send_app_state(ivi, app_id, AGL_SHELL_APP_STATE_DEACTIVATED);
}