|
|
@ -92,7 +92,7 @@ void container_begin_destroy(struct sway_container *con) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// The workspace must have the fullscreen pointer cleared so that the
|
|
|
|
// The workspace must have the fullscreen pointer cleared so that the
|
|
|
|
// seat code can find an appropriate new focus.
|
|
|
|
// seat code can find an appropriate new focus.
|
|
|
|
if (con->is_fullscreen && con->workspace) {
|
|
|
|
if (con->fullscreen_mode == FULLSCREEN_WORKSPACE && con->workspace) {
|
|
|
|
con->workspace->fullscreen = NULL;
|
|
|
|
con->workspace->fullscreen = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wl_signal_emit(&con->node.events.destroy, &con->node);
|
|
|
|
wl_signal_emit(&con->node.events.destroy, &con->node);
|
|
|
@ -106,6 +106,10 @@ void container_begin_destroy(struct sway_container *con) {
|
|
|
|
root_scratchpad_remove_container(con);
|
|
|
|
root_scratchpad_remove_container(con);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (con->fullscreen_mode == FULLSCREEN_GLOBAL) {
|
|
|
|
|
|
|
|
container_fullscreen_disable(con);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (con->parent || con->workspace) {
|
|
|
|
if (con->parent || con->workspace) {
|
|
|
|
container_detach(con);
|
|
|
|
container_detach(con);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -840,15 +844,15 @@ void container_floating_move_to_center(struct sway_container *con) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
struct sway_workspace *ws = con->workspace;
|
|
|
|
struct sway_workspace *ws = con->workspace;
|
|
|
|
bool full = con->is_fullscreen;
|
|
|
|
enum sway_fullscreen_mode fullscreen_mode = con->fullscreen_mode;
|
|
|
|
if (full) {
|
|
|
|
if (fullscreen_mode) {
|
|
|
|
container_set_fullscreen(con, false);
|
|
|
|
container_fullscreen_disable(con);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
double new_lx = ws->x + (ws->width - con->width) / 2;
|
|
|
|
double new_lx = ws->x + (ws->width - con->width) / 2;
|
|
|
|
double new_ly = ws->y + (ws->height - con->height) / 2;
|
|
|
|
double new_ly = ws->y + (ws->height - con->height) / 2;
|
|
|
|
container_floating_translate(con, new_lx - con->x, new_ly - con->y);
|
|
|
|
container_floating_translate(con, new_lx - con->x, new_ly - con->y);
|
|
|
|
if (full) {
|
|
|
|
if (fullscreen_mode) {
|
|
|
|
container_set_fullscreen(con, true);
|
|
|
|
container_set_fullscreen(con, fullscreen_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -877,59 +881,125 @@ static void set_fullscreen_iterator(struct sway_container *con, void *data) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void container_set_fullscreen(struct sway_container *container, bool enable) {
|
|
|
|
static void container_fullscreen_workspace(struct sway_container *con) {
|
|
|
|
if (container->is_fullscreen == enable) {
|
|
|
|
if (!sway_assert(con->fullscreen_mode == FULLSCREEN_NONE,
|
|
|
|
|
|
|
|
"Expected a non-fullscreen container")) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool enable = true;
|
|
|
|
|
|
|
|
set_fullscreen_iterator(con, &enable);
|
|
|
|
|
|
|
|
container_for_each_child(con, set_fullscreen_iterator, &enable);
|
|
|
|
|
|
|
|
|
|
|
|
struct sway_workspace *workspace = container->workspace;
|
|
|
|
con->workspace->fullscreen = con;
|
|
|
|
if (enable && workspace->fullscreen) {
|
|
|
|
con->saved_x = con->x;
|
|
|
|
container_set_fullscreen(workspace->fullscreen, false);
|
|
|
|
con->saved_y = con->y;
|
|
|
|
|
|
|
|
con->saved_width = con->width;
|
|
|
|
|
|
|
|
con->saved_height = con->height;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct sway_seat *seat;
|
|
|
|
|
|
|
|
struct sway_workspace *focus_ws;
|
|
|
|
|
|
|
|
wl_list_for_each(seat, &server.input->seats, link) {
|
|
|
|
|
|
|
|
focus_ws = seat_get_focused_workspace(seat);
|
|
|
|
|
|
|
|
if (focus_ws == con->workspace) {
|
|
|
|
|
|
|
|
seat_set_focus_container(seat, con);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set_fullscreen_iterator(container, &enable);
|
|
|
|
con->fullscreen_mode = FULLSCREEN_WORKSPACE;
|
|
|
|
container_for_each_child(container, set_fullscreen_iterator, &enable);
|
|
|
|
container_end_mouse_operation(con);
|
|
|
|
|
|
|
|
ipc_event_window(con, "fullscreen_mode");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void container_fullscreen_global(struct sway_container *con) {
|
|
|
|
|
|
|
|
if (!sway_assert(con->fullscreen_mode == FULLSCREEN_NONE,
|
|
|
|
|
|
|
|
"Expected a non-fullscreen container")) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool enable = true;
|
|
|
|
|
|
|
|
set_fullscreen_iterator(con, &enable);
|
|
|
|
|
|
|
|
container_for_each_child(con, set_fullscreen_iterator, &enable);
|
|
|
|
|
|
|
|
|
|
|
|
container->is_fullscreen = enable;
|
|
|
|
root->fullscreen_global = con;
|
|
|
|
|
|
|
|
con->saved_x = con->x;
|
|
|
|
|
|
|
|
con->saved_y = con->y;
|
|
|
|
|
|
|
|
con->saved_width = con->width;
|
|
|
|
|
|
|
|
con->saved_height = con->height;
|
|
|
|
|
|
|
|
|
|
|
|
if (enable) {
|
|
|
|
struct sway_seat *seat;
|
|
|
|
workspace->fullscreen = container;
|
|
|
|
wl_list_for_each(seat, &server.input->seats, link) {
|
|
|
|
container->saved_x = container->x;
|
|
|
|
struct sway_container *focus = seat_get_focused_container(seat);
|
|
|
|
container->saved_y = container->y;
|
|
|
|
if (focus && focus != con) {
|
|
|
|
container->saved_width = container->width;
|
|
|
|
seat_set_focus_container(seat, con);
|
|
|
|
container->saved_height = container->height;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct sway_seat *seat;
|
|
|
|
|
|
|
|
struct sway_workspace *focus_ws;
|
|
|
|
|
|
|
|
wl_list_for_each(seat, &server.input->seats, link) {
|
|
|
|
|
|
|
|
focus_ws = seat_get_focused_workspace(seat);
|
|
|
|
|
|
|
|
if (focus_ws) {
|
|
|
|
|
|
|
|
if (focus_ws == workspace) {
|
|
|
|
|
|
|
|
seat_set_focus_container(seat, container);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
workspace->fullscreen = NULL;
|
|
|
|
|
|
|
|
if (container_is_floating(container)) {
|
|
|
|
con->fullscreen_mode = FULLSCREEN_GLOBAL;
|
|
|
|
container->x = container->saved_x;
|
|
|
|
container_end_mouse_operation(con);
|
|
|
|
container->y = container->saved_y;
|
|
|
|
ipc_event_window(con, "fullscreen_mode");
|
|
|
|
container->width = container->saved_width;
|
|
|
|
}
|
|
|
|
container->height = container->saved_height;
|
|
|
|
|
|
|
|
struct sway_output *output =
|
|
|
|
void container_fullscreen_disable(struct sway_container *con) {
|
|
|
|
container_floating_find_output(container);
|
|
|
|
if (!sway_assert(con->fullscreen_mode != FULLSCREEN_NONE,
|
|
|
|
if (workspace->output != output) {
|
|
|
|
"Expected a fullscreen container")) {
|
|
|
|
container_floating_move_to_center(container);
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool enable = false;
|
|
|
|
|
|
|
|
set_fullscreen_iterator(con, &enable);
|
|
|
|
|
|
|
|
container_for_each_child(con, set_fullscreen_iterator, &enable);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (container_is_floating(con)) {
|
|
|
|
|
|
|
|
con->x = con->saved_x;
|
|
|
|
|
|
|
|
con->y = con->saved_y;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
con->width = con->saved_width;
|
|
|
|
|
|
|
|
con->height = con->saved_height;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (con->fullscreen_mode == FULLSCREEN_WORKSPACE) {
|
|
|
|
|
|
|
|
con->workspace->fullscreen = NULL;
|
|
|
|
|
|
|
|
if (container_is_floating(con)) {
|
|
|
|
|
|
|
|
struct sway_output *output = container_floating_find_output(con);
|
|
|
|
|
|
|
|
if (con->workspace->output != output) {
|
|
|
|
|
|
|
|
container_floating_move_to_center(con);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
container->width = container->saved_width;
|
|
|
|
|
|
|
|
container->height = container->saved_height;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
root->fullscreen_global = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
container_end_mouse_operation(container);
|
|
|
|
con->fullscreen_mode = FULLSCREEN_NONE;
|
|
|
|
|
|
|
|
container_end_mouse_operation(con);
|
|
|
|
|
|
|
|
ipc_event_window(con, "fullscreen_mode");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void container_set_fullscreen(struct sway_container *con,
|
|
|
|
|
|
|
|
enum sway_fullscreen_mode mode) {
|
|
|
|
|
|
|
|
if (con->fullscreen_mode == mode) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ipc_event_window(container, "fullscreen_mode");
|
|
|
|
switch (mode) {
|
|
|
|
|
|
|
|
case FULLSCREEN_NONE:
|
|
|
|
|
|
|
|
container_fullscreen_disable(con);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FULLSCREEN_WORKSPACE:
|
|
|
|
|
|
|
|
if (root->fullscreen_global) {
|
|
|
|
|
|
|
|
container_fullscreen_disable(root->fullscreen_global);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (con->workspace->fullscreen) {
|
|
|
|
|
|
|
|
container_fullscreen_disable(con->workspace->fullscreen);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
container_fullscreen_workspace(con);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FULLSCREEN_GLOBAL:
|
|
|
|
|
|
|
|
if (root->fullscreen_global) {
|
|
|
|
|
|
|
|
container_fullscreen_disable(root->fullscreen_global);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (con->fullscreen_mode == FULLSCREEN_WORKSPACE) {
|
|
|
|
|
|
|
|
container_fullscreen_disable(con);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
container_fullscreen_global(con);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool container_is_floating_or_child(struct sway_container *container) {
|
|
|
|
bool container_is_floating_or_child(struct sway_container *container) {
|
|
|
@ -941,7 +1011,7 @@ bool container_is_floating_or_child(struct sway_container *container) {
|
|
|
|
|
|
|
|
|
|
|
|
bool container_is_fullscreen_or_child(struct sway_container *container) {
|
|
|
|
bool container_is_fullscreen_or_child(struct sway_container *container) {
|
|
|
|
do {
|
|
|
|
do {
|
|
|
|
if (container->is_fullscreen) {
|
|
|
|
if (container->fullscreen_mode) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
container = container->parent;
|
|
|
|
container = container->parent;
|
|
|
@ -1111,12 +1181,12 @@ list_t *container_get_current_siblings(struct sway_container *container) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void container_handle_fullscreen_reparent(struct sway_container *con) {
|
|
|
|
void container_handle_fullscreen_reparent(struct sway_container *con) {
|
|
|
|
if (!con->is_fullscreen || !con->workspace ||
|
|
|
|
if (con->fullscreen_mode != FULLSCREEN_WORKSPACE || !con->workspace ||
|
|
|
|
con->workspace->fullscreen == con) {
|
|
|
|
con->workspace->fullscreen == con) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (con->workspace->fullscreen) {
|
|
|
|
if (con->workspace->fullscreen) {
|
|
|
|
container_set_fullscreen(con->workspace->fullscreen, false);
|
|
|
|
container_fullscreen_disable(con->workspace->fullscreen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
con->workspace->fullscreen = con;
|
|
|
|
con->workspace->fullscreen = con;
|
|
|
|
|
|
|
|
|
|
|
@ -1171,9 +1241,12 @@ void container_add_child(struct sway_container *parent,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void container_detach(struct sway_container *child) {
|
|
|
|
void container_detach(struct sway_container *child) {
|
|
|
|
if (child->is_fullscreen) {
|
|
|
|
if (child->fullscreen_mode == FULLSCREEN_WORKSPACE) {
|
|
|
|
child->workspace->fullscreen = NULL;
|
|
|
|
child->workspace->fullscreen = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (child->fullscreen_mode == FULLSCREEN_GLOBAL) {
|
|
|
|
|
|
|
|
root->fullscreen_global = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct sway_container *old_parent = child->parent;
|
|
|
|
struct sway_container *old_parent = child->parent;
|
|
|
|
struct sway_workspace *old_workspace = child->workspace;
|
|
|
|
struct sway_workspace *old_workspace = child->workspace;
|
|
|
@ -1387,4 +1460,3 @@ void container_raise_floating(struct sway_container *con) {
|
|
|
|
node_set_dirty(&floater->workspace->node);
|
|
|
|
node_set_dirty(&floater->workspace->node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|