woutput->y + output->area.y);
/* reset any previous orientation */
- if (surf->orientation != AGL_SHELL_TILE_ORIENTATION_NONE) {
+ 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,
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;
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 = ivisurf->current_completed_output;
+ 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;
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);
+ 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);
+ AGL_SHELL_TILE_ORIENTATION_NONE, false, false);
}
void
return;
}
+ if (surf->sticky && surf->role == IVI_SURFACE_ROLE_TILE) {
+ 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);
static uint32_t
reverse_orientation(uint32_t orientation);
+const char *
+split_orientation_to_string(uint32_t orientation);
+
void
agl_shell_desktop_advertise_application_id(struct ivi_compositor *ivi,
struct ivi_surface *surface)
}
_ivi_set_shell_surface_split(papp->ioutput->active, NULL,
reverse_orientation(papp_tile->orientation),
- width_prev_app, false);
+ width_prev_app, false, false);
}
surface->role = IVI_SURFACE_ROLE_TILE;
wl_list_insert(&surface->ivi->surfaces, &surface->link);
_ivi_set_shell_surface_split(surface, papp->ioutput,
- papp_tile->orientation, papp_tile->width, true);
+ papp_tile->orientation, papp_tile->width,
+ papp_tile->sticky, true);
/* remove it from pending */
wl_list_remove(&papp->link);
}
+const char *
+split_orientation_to_string(uint32_t orientation)
+{
+ switch (orientation) {
+ case AGL_SHELL_TILE_ORIENTATION_LEFT:
+ return "tile_left";
+ break;
+ case AGL_SHELL_TILE_ORIENTATION_RIGHT:
+ return "tile_right";
+ break;
+ case AGL_SHELL_TILE_ORIENTATION_TOP:
+ return "title_top";
+ break;
+ case AGL_SHELL_TILE_ORIENTATION_BOTTOM:
+ return "tile_bottom";
+ break;
+ default:
+ return "none";
+ }
+}
+
static uint32_t
reverse_orientation(uint32_t orientation)
{
void
_ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *ioutput,
- uint32_t orientation, uint32_t width, bool to_activate)
+ uint32_t orientation, uint32_t width, int32_t sticky,
+ bool to_activate)
{
struct ivi_compositor *ivi = surface->ivi;
struct weston_geometry geom = {};
}
break;
case AGL_SHELL_TILE_ORIENTATION_NONE:
- new_width = output->area.width;
- new_height = output->area.height;
+ /* use the current_completed_output because the sticky window
+ * might have changed the output area */
+ new_width = surface->current_completed_output->area_activation.width;
+ new_height = surface->current_completed_output->area_activation.height;
+
+ if (new_width != output->area.width)
+ output->area.width = new_width;
+
+ if (new_height != output->area.height)
+ output->area.height = new_height;
+
+ weston_log("Adjusting activation area "
+ "to %dX%d\n", output->area.width, output->area.height);
+
+ if (surface->sticky) {
+ surface->sticky = 0;
+ weston_log("Resetting sticky window\n");
+ }
+
+ surface->role = IVI_SURFACE_ROLE_DESKTOP;
+ weston_log("Resetting tile role to desktop\n");
break;
default:
/* nothing */
ivi_shell_activate_surface(surface, ivi_seat, WESTON_ACTIVATE_FLAG_NONE);
}
+
weston_view_set_position(surface->view, x, y);
weston_desktop_surface_set_size(surface->dsurface, new_width, new_height);
weston_desktop_surface_set_orientation(surface->dsurface, orientation);
surface->orientation = orientation;
weston_compositor_schedule_repaint(ivi->compositor);
+
+ if (sticky)
+ surface->sticky = sticky;
+
+ if (orientation != AGL_SHELL_TILE_ORIENTATION_NONE) {
+ surface->role = IVI_SURFACE_ROLE_TILE;
+ weston_log("Found split orientation different that none, "
+ "setting surface role to orientation tile\n");
+ }
+
+ if (surface->sticky) {
+ if (orientation == AGL_SHELL_TILE_ORIENTATION_LEFT ||
+ orientation == AGL_SHELL_TILE_ORIENTATION_RIGHT)
+ output->area.width -= new_width;
+
+ if (orientation == AGL_SHELL_TILE_ORIENTATION_TOP ||
+ orientation == AGL_SHELL_TILE_ORIENTATION_BOTTOM)
+ output->area.height -= new_height;
+
+ weston_log("Found sticky window, adjusting activation area "
+ "to %dX%d\n", output->area.width, output->area.height);
+ }
}
static int
if (output->previous_active && output->background != output->previous_active) {
struct weston_view *ev = output->previous_active->view;
int width_prev_app = 0;
+ const char *prev_app_id =
+ weston_desktop_surface_get_app_id(output->previous_active->dsurface);
if (!weston_view_is_mapped(ev))
weston_view_update_transform(ev);
width_prev_app = output->area.width - width;
}
+ weston_log("Setting previous application '%s' to orientation '%s' width %d, not sticky\n",
+ prev_app_id, split_orientation_to_string(reverse_orientation(orientation)),
+ width_prev_app);
+
_ivi_set_shell_surface_split(output->previous_active, NULL,
reverse_orientation(orientation),
- width_prev_app, false);
+ width_prev_app, false, false);
if (orientation == AGL_SHELL_TILE_ORIENTATION_NONE &&
output->active == surf) {
}
}
- _ivi_set_shell_surface_split(surf, NULL, orientation, width, false);
+ weston_log("Setting application '%s' to orientation '%s' width %d, %s\n",
+ app_id, split_orientation_to_string(orientation),
+ width, sticky == 1 ? "sticky" : "not sticky");
+ _ivi_set_shell_surface_split(surf, NULL, orientation, width, sticky, false);
}
static void