aboutsummaryrefslogtreecommitdiff
path: root/sway/tree/view.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c62
1 files changed, 41 insertions, 21 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 2c8839f5..c241b2b3 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -197,10 +197,11 @@ static bool gaps_to_edge(struct sway_view *view) {
void view_autoconfigure(struct sway_view *view) {
struct sway_container *con = view->container;
- if (container_is_scratchpad_hidden(con)) {
+ if (container_is_scratchpad_hidden(con) &&
+ con->fullscreen_mode != FULLSCREEN_GLOBAL) {
return;
}
- struct sway_output *output = con->workspace->output;
+ struct sway_output *output = con->workspace ? con->workspace->output : NULL;
if (con->fullscreen_mode == FULLSCREEN_WORKSPACE) {
con->content_x = output->lx;
@@ -226,19 +227,21 @@ void view_autoconfigure(struct sway_view *view) {
con->border_top = con->border_bottom = true;
con->border_left = con->border_right = true;
- if (config->hide_edge_borders == E_BOTH
- || config->hide_edge_borders == E_VERTICAL
- || (smart && !other_views && no_gaps)) {
- con->border_left = con->x - con->current_gaps.left != ws->x;
- int right_x = con->x + con->width + con->current_gaps.right;
- con->border_right = right_x != ws->x + ws->width;
- }
- if (config->hide_edge_borders == E_BOTH
- || config->hide_edge_borders == E_HORIZONTAL
- || (smart && !other_views && no_gaps)) {
- con->border_top = con->y - con->current_gaps.top != ws->y;
- int bottom_y = con->y + con->height + con->current_gaps.bottom;
- con->border_bottom = bottom_y != ws->y + ws->height;
+ if (ws) {
+ if (config->hide_edge_borders == E_BOTH
+ || config->hide_edge_borders == E_VERTICAL
+ || (smart && !other_views && no_gaps)) {
+ con->border_left = con->x - con->current_gaps.left != ws->x;
+ int right_x = con->x + con->width + con->current_gaps.right;
+ con->border_right = right_x != ws->x + ws->width;
+ }
+ if (config->hide_edge_borders == E_BOTH
+ || config->hide_edge_borders == E_HORIZONTAL
+ || (smart && !other_views && no_gaps)) {
+ con->border_top = con->y - con->current_gaps.top != ws->y;
+ int bottom_y = con->y + con->height + con->current_gaps.bottom;
+ con->border_bottom = bottom_y != ws->y + ws->height;
+ }
}
double y_offset = 0;
@@ -247,7 +250,8 @@ void view_autoconfigure(struct sway_view *view) {
// title area. We have to offset the surface y by the height of the title,
// bar, and disable any top border because we'll always have the title bar.
list_t *siblings = container_get_siblings(con);
- bool show_titlebar = siblings->length > 1 || !config->hide_lone_tab;
+ bool show_titlebar = (siblings && siblings->length > 1)
+ || !config->hide_lone_tab;
if (show_titlebar && !container_is_floating(con)) {
enum sway_container_layout layout = container_parent_layout(con);
if (layout == L_TABBED) {
@@ -538,6 +542,10 @@ static bool should_focus(struct sway_view *view) {
struct sway_workspace *prev_ws = seat_get_focused_workspace(seat);
struct sway_workspace *map_ws = view->container->workspace;
+ if (view->container->fullscreen_mode == FULLSCREEN_GLOBAL) {
+ return true;
+ }
+
// Views can only take focus if they are mapped into the active workspace
if (prev_ws != map_ws) {
return false;
@@ -581,7 +589,8 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
}
struct sway_seat *seat = input_manager_current_seat();
- struct sway_node *node = seat_get_focus_inactive(seat, &ws->node);
+ struct sway_node *node = ws ? seat_get_focus_inactive(seat, &ws->node)
+ : seat_get_focus_inactive(seat, &root->node);
struct sway_container *target_sibling = node->type == N_CONTAINER ?
node->sway_container : NULL;
@@ -589,12 +598,13 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
// launch it as a tiled view in the root of the workspace instead.
if (target_sibling && container_is_floating(target_sibling)) {
target_sibling = NULL;
+ ws = seat_get_last_known_workspace(seat);
}
view->container = container_create(view);
if (target_sibling) {
container_add_sibling(target_sibling, view->container, 1);
- } else {
+ } else if (ws) {
workspace_add_tiling(ws, view->container);
}
ipc_event_window(view->container, "new");
@@ -1032,8 +1042,18 @@ bool view_is_visible(struct sway_view *view) {
return false;
}
struct sway_workspace *workspace = view->container->workspace;
- if (!workspace) {
- return false;
+ if (!workspace && view->container->fullscreen_mode != FULLSCREEN_GLOBAL) {
+ bool fs_global_descendant = false;
+ struct sway_container *parent = view->container->parent;
+ while (parent) {
+ if (parent->fullscreen_mode == FULLSCREEN_GLOBAL) {
+ fs_global_descendant = true;
+ }
+ parent = parent->parent;
+ }
+ if (!fs_global_descendant) {
+ return false;
+ }
}
// Determine if view is nested inside a floating container which is sticky
struct sway_container *floater = view->container;
@@ -1041,7 +1061,7 @@ bool view_is_visible(struct sway_view *view) {
floater = floater->parent;
}
bool is_sticky = container_is_floating(floater) && floater->is_sticky;
- if (!is_sticky && !workspace_is_visible(workspace)) {
+ if (!is_sticky && workspace && !workspace_is_visible(workspace)) {
return false;
}
// Check view isn't in a tabbed or stacked container on an inactive tab