enum shell_surface_type {
SHELL_SURFACE_NONE,
SHELL_SURFACE_TOPLEVEL,
- SHELL_SURFACE_TRANSIENT,
SHELL_SURFACE_POPUP,
SHELL_SURFACE_XWAYLAND
};
struct {
bool maximized;
bool fullscreen;
+ bool relative;
} state, next_state; /* surface states */
bool state_changed;
};
break;
}
- case SHELL_SURFACE_TRANSIENT: {
- /* Move the surface to its parent layer so that surfaces which
- * are transient for fullscreen surfaces don't get hidden by the
- * fullscreen surfaces. However, unlike popups, transient
- * surfaces are stacked in front of their parent but not in
- * front of other surfaces of the same type. */
- struct weston_view *parent;
-
- /* TODO: Handle a parent with multiple views */
- parent = get_default_view(shsurf->parent);
- if (parent)
- return parent->layer_link.prev;
-
- break;
- }
-
case SHELL_SURFACE_TOPLEVEL: {
- if (shsurf->state.fullscreen)
+ if (shsurf->state.fullscreen) {
return &shsurf->shell->fullscreen_layer.view_list;
+ } else if (shsurf->parent) {
+ /* Move the surface to its parent layer so that
+ * surfaces which are transient for fullscreen surfaces
+ * don't get hidden by the fullscreen surfaces.
+ * However, unlike popups, transient surfaces are
+ * stacked in front of their parent but not in front of
+ * other surfaces of the same type. */
+ struct weston_view *parent;
+
+ /* TODO: Handle a parent with multiple views */
+ parent = get_default_view(shsurf->parent);
+ if (parent)
+ return parent->layer_link.prev;
+ }
break;
}
shell_surface_set_parent(shsurf, parent);
- shsurf->next_type = SHELL_SURFACE_TRANSIENT;
+ shsurf->next_state.relative = true;
/* The layer_link is updated in set_surface_type(),
* called from configure. */
switch (shsurf->type) {
case SHELL_SURFACE_TOPLEVEL:
- if (shsurf->state.maximized || shsurf->state.fullscreen)
+ if (shsurf->state.maximized || shsurf->state.fullscreen) {
set_full_output(shsurf);
- break;
- case SHELL_SURFACE_TRANSIENT:
- if (pev)
+ } else if (shsurf->state.relative && pev) {
weston_view_set_position(shsurf->view,
pev->geometry.x + shsurf->transient.x,
pev->geometry.y + shsurf->transient.y);
- break;
+ }
case SHELL_SURFACE_XWAYLAND:
weston_view_set_position(shsurf->view, shsurf->transient.x,
static int
view_for_alt_tab(struct weston_view *view)
{
- if (!get_shell_surface(view->surface))
+ struct shell_surface *shsurf = get_shell_surface(view->surface);
+ if (!shsurf)
return 0;
- if (get_shell_surface_type(view->surface) == SHELL_SURFACE_TRANSIENT)
+ if (shsurf->parent)
return 0;
if (view != get_default_view(view->surface))
/* initial positioning, see also configure() */
switch (shsurf->type) {
+ case SHELL_SURFACE_TOPLEVEL:
if (shsurf->state.fullscreen) {
center_on_output(shsurf->view, shsurf->fullscreen_output);
shell_map_fullscreen(shsurf);
shsurf->output->x - surf_x,
shsurf->output->y +
panel_height - surf_y);
- } else {
+ } else if (!shsurf->state.relative) {
weston_view_set_initial_position(shsurf->view, shell);
}
break;
shsurf->view->geometry.x + sx,
shsurf->view->geometry.y + sy);
break;
- case SHELL_SURFACE_TRANSIENT:
case SHELL_SURFACE_XWAYLAND:
default:
;
}
}
+ if ((shsurf->type == SHELL_SURFACE_XWAYLAND || shsurf->state.relative) &&
+ shsurf->transient.flags == WL_SHELL_SURFACE_TRANSIENT_INACTIVE) {
+ }
+
switch (shsurf->type) {
/* XXX: xwayland's using the same fields for transient type */
case SHELL_SURFACE_XWAYLAND:
- case SHELL_SURFACE_TRANSIENT:
if (shsurf->transient.flags ==
WL_SHELL_SURFACE_TRANSIENT_INACTIVE)
break;
case SHELL_SURFACE_TOPLEVEL:
- if (!shell->locked) {
- wl_list_for_each(seat, &compositor->seat_list, link)
- activate(shell, shsurf->surface, seat);
- }
+ if (shsurf->state.relative &&
+ shsurf->transient.flags == WL_SHELL_SURFACE_TRANSIENT_INACTIVE)
+ break;
+ if (!shell->locked)
+ break;
+ wl_list_for_each(seat, &compositor->seat_list, link)
+ activate(shell, shsurf->surface, seat);
break;
case SHELL_SURFACE_POPUP:
case SHELL_SURFACE_NONE:
struct workspace *ws = get_current_workspace(switcher->shell);
wl_list_for_each(view, &ws->layer.view_list, layer_link) {
- switch (get_shell_surface_type(view->surface)) {
+ shsurf = get_shell_surface(view->surface);
+ switch (shsurf->type) {
case SHELL_SURFACE_TOPLEVEL:
+ if (shsurf->parent)
+ break;
if (first == NULL)
first = view->surface;
if (prev == switcher->current)
weston_view_geometry_dirty(view);
weston_surface_damage(view->surface);
break;
- case SHELL_SURFACE_TRANSIENT:
case SHELL_SURFACE_POPUP:
case SHELL_SURFACE_XWAYLAND:
case SHELL_SURFACE_NONE: