This adds support for passing by the width argument such that users can
specify the width dimensions of the split window. Given that we might
another previous active window we also need to split that accordingly
depending on the orientation.
Bug-AGL: SPEC-4839
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I39239c1af0358eaa671146d0f36a3a334e945067
struct pending_app_tile {
struct pending_app base;
uint32_t orientation;
struct pending_app_tile {
struct pending_app base;
uint32_t orientation;
};
struct ivi_desktop_surface {
};
struct ivi_desktop_surface {
void
_ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *output,
void
_ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *output,
- uint32_t orientation, bool to_activate);
+ uint32_t orientation, uint32_t width, bool to_activate);
weston_layer_entry_insert(&ivi->normal.view_list, &ev->layer_link);
weston_layer_entry_insert(&ivi->normal.view_list, &ev->layer_link);
- _ivi_set_shell_surface_split(output->previous_active, NULL,
+ _ivi_set_shell_surface_split(output->previous_active, NULL, 0,
AGL_SHELL_TILE_ORIENTATION_NONE, false);
if (output->active == ivisurf) {
AGL_SHELL_TILE_ORIENTATION_NONE, false);
if (output->active == ivisurf) {
- _ivi_set_shell_surface_split(ivisurf, NULL,
+ _ivi_set_shell_surface_split(ivisurf, NULL, 0,
AGL_SHELL_TILE_ORIENTATION_NONE, false);
}
AGL_SHELL_TILE_ORIENTATION_NONE, false);
}
// handle the currently active surface
if (papp->ioutput->active) {
// handle the currently active surface
if (papp->ioutput->active) {
+ int width_prev_app = 0;
+
+ if (papp_tile->width > 0) {
+ if (papp_tile->orientation == AGL_SHELL_TILE_ORIENTATION_TOP ||
+ papp_tile->orientation == AGL_SHELL_TILE_ORIENTATION_BOTTOM)
+ width_prev_app = papp->ioutput->area.height - papp_tile->width;
+ else
+ width_prev_app = papp->ioutput->area.width - papp_tile->width;
+ }
_ivi_set_shell_surface_split(papp->ioutput->active, NULL,
_ivi_set_shell_surface_split(papp->ioutput->active, NULL,
- reverse_orientation(papp_tile->orientation), false);
+ reverse_orientation(papp_tile->orientation),
+ width_prev_app, false);
}
surface->role = IVI_SURFACE_ROLE_TILE;
}
surface->role = IVI_SURFACE_ROLE_TILE;
wl_list_insert(&surface->ivi->surfaces, &surface->link);
_ivi_set_shell_surface_split(surface, papp->ioutput,
wl_list_insert(&surface->ivi->surfaces, &surface->link);
_ivi_set_shell_surface_split(surface, papp->ioutput,
- papp_tile->orientation, true);
+ papp_tile->orientation, papp_tile->width, true);
/* remove it from pending */
wl_list_remove(&papp->link);
/* remove it from pending */
wl_list_remove(&papp->link);
void
_ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *ioutput,
void
_ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *ioutput,
- uint32_t orientation, bool to_activate)
+ uint32_t orientation, uint32_t width, bool to_activate)
{
struct ivi_compositor *ivi = surface->ivi;
struct weston_geometry geom = {};
struct ivi_output *output = NULL;
{
struct ivi_compositor *ivi = surface->ivi;
struct weston_geometry geom = {};
struct ivi_output *output = NULL;
+ int new_width, new_height;
int x, y;
geom = weston_desktop_surface_get_geometry(surface->dsurface);
int x, y;
geom = weston_desktop_surface_get_geometry(surface->dsurface);
if (!output)
output = ioutput;
if (!output)
output = ioutput;
- width = output->area.width;
- height = output->area.height;
-
+ // if we don't supply a width we automatically default to doing a half
+ // split, each window taking half of the current output
switch (orientation) {
case AGL_SHELL_TILE_ORIENTATION_LEFT:
case AGL_SHELL_TILE_ORIENTATION_RIGHT:
switch (orientation) {
case AGL_SHELL_TILE_ORIENTATION_LEFT:
case AGL_SHELL_TILE_ORIENTATION_RIGHT:
+ if (width == 0) {
+ new_width = output->area.width / 2;
+ new_height = output->area.height;
+ } else {
+ new_width = width;
+ new_height = output->area.height;
+ }
break;
case AGL_SHELL_TILE_ORIENTATION_TOP:
case AGL_SHELL_TILE_ORIENTATION_BOTTOM:
break;
case AGL_SHELL_TILE_ORIENTATION_TOP:
case AGL_SHELL_TILE_ORIENTATION_BOTTOM:
+ if (width == 0) {
+ new_width = output->area.width;
+ new_height = output->area.height / 2;
+ } else {
+ new_width = output->area.width;
+ new_height = width;
+ }
break;
case AGL_SHELL_TILE_ORIENTATION_NONE:
break;
case AGL_SHELL_TILE_ORIENTATION_NONE:
+ new_width = output->area.width;
+ new_height = output->area.height;
break;
default:
/* nothing */
break;
default:
/* nothing */
y = output->area.y - geom.y;
if (orientation == AGL_SHELL_TILE_ORIENTATION_RIGHT)
y = output->area.y - geom.y;
if (orientation == AGL_SHELL_TILE_ORIENTATION_RIGHT)
+ x += output->area.width - new_width;
else if (orientation == AGL_SHELL_TILE_ORIENTATION_BOTTOM)
else if (orientation == AGL_SHELL_TILE_ORIENTATION_BOTTOM)
+ y += output->area.height - new_height;
+
if (to_activate) {
struct weston_view *ev = surface->view;
if (to_activate) {
struct weston_view *ev = surface->view;
}
weston_view_set_position(surface->view, x, y);
}
weston_view_set_position(surface->view, x, y);
- weston_desktop_surface_set_size(surface->dsurface, width, height);
+ 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);
weston_desktop_surface_set_orientation(surface->dsurface, orientation);
surface->orientation = orientation;
weston_compositor_schedule_repaint(ivi->compositor);
-
- weston_log("%s() Setting to x=%d, y=%d, width=%d, height=%d, orientation=%d\n",
- __func__, x, y, width, height, orientation);
-
if (output->previous_active && output->background != output->previous_active) {
struct weston_view *ev = output->previous_active->view;
if (output->previous_active && output->background != output->previous_active) {
struct weston_view *ev = output->previous_active->view;
+ int width_prev_app = 0;
if (!weston_view_is_mapped(ev))
weston_view_update_transform(ev);
if (!weston_view_is_mapped(ev))
weston_view_update_transform(ev);
weston_layer_entry_insert(&ivi->normal.view_list, &ev->layer_link);
weston_layer_entry_insert(&ivi->normal.view_list, &ev->layer_link);
+ /* a 0 width means we have no explicit width set-up */
+ if (width > 0) {
+ if (orientation == AGL_SHELL_TILE_ORIENTATION_TOP ||
+ orientation == AGL_SHELL_TILE_ORIENTATION_BOTTOM)
+ width_prev_app = output->area.height - width;
+ else
+ width_prev_app = output->area.width - width;
+ }
+
_ivi_set_shell_surface_split(output->previous_active, NULL,
_ivi_set_shell_surface_split(output->previous_active, NULL,
- reverse_orientation(orientation), false);
+ reverse_orientation(orientation),
+ width_prev_app, false);
if (orientation == AGL_SHELL_TILE_ORIENTATION_NONE &&
output->active == surf) {
if (orientation == AGL_SHELL_TILE_ORIENTATION_NONE &&
output->active == surf) {
- _ivi_set_shell_surface_split(surf, NULL, orientation, false);
+ _ivi_set_shell_surface_split(surf, NULL, orientation, width, false);