Make fullscreen windows open on the output which is indicated by their geometry
With this change, multi-monitor presentations (e.g. as implemented by LibreOffice Impress) work out of the box. Previously, one had to move the presentation windows to the right outputs oneself.
This commit is contained in:
committed by
Michael Stapelberg
parent
66d9c983e4
commit
fec1a9511e
13
src/con.c
13
src/con.c
@ -1157,6 +1157,19 @@ void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool
|
||||
_con_move_to_con(con, target, true, fix_coordinates, dont_warp, ignore_focus);
|
||||
}
|
||||
|
||||
/*
|
||||
* Moves the given container to the currently focused container on the
|
||||
* visible workspace on the given output.
|
||||
*
|
||||
*/
|
||||
void con_move_to_output(Con *con, Output *output) {
|
||||
Con *ws = NULL;
|
||||
GREP_FIRST(ws, output_get_content(output->con), workspace_is_visible(child));
|
||||
assert(ws != NULL);
|
||||
DLOG("Moving con %p to output %s\n", con, output->name);
|
||||
con_move_to_workspace(con, ws, false, false, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the orientation of the given container (for stacked containers,
|
||||
* vertical orientation is used regardless of the actual orientation of the
|
||||
|
10
src/manage.c
10
src/manage.c
@ -359,8 +359,16 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
||||
if (xcb_reply_contains_atom(state_reply, A__NET_WM_STATE_FULLSCREEN)) {
|
||||
/* If this window is already fullscreen (after restarting!), skip
|
||||
* toggling fullscreen, that would drop it out of fullscreen mode. */
|
||||
if (fs != nc)
|
||||
if (fs != nc) {
|
||||
Output *output = get_output_with_dimensions((Rect){geom->x, geom->y, geom->width, geom->height});
|
||||
/* If the requested window geometry spans the whole area
|
||||
* of an output, move the window to that output. This is
|
||||
* needed e.g. for LibreOffice Impress multi-monitor
|
||||
* presentations to work out of the box. */
|
||||
if (output != NULL)
|
||||
con_move_to_output(nc, output);
|
||||
con_toggle_fullscreen(nc, CF_OUTPUT);
|
||||
}
|
||||
fs = NULL;
|
||||
}
|
||||
|
||||
|
21
src/randr.c
21
src/randr.c
@ -108,6 +108,27 @@ Output *get_output_containing(unsigned int x, unsigned int y) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the active output which spans exactly the area specified by
|
||||
* rect or NULL if there is no output like this.
|
||||
*
|
||||
*/
|
||||
Output *get_output_with_dimensions(Rect rect) {
|
||||
Output *output;
|
||||
TAILQ_FOREACH(output, &outputs, outputs) {
|
||||
if (!output->active)
|
||||
continue;
|
||||
DLOG("comparing x=%d y=%d %dx%d with x=%d and y=%d %dx%d\n",
|
||||
rect.x, rect.y, rect.width, rect.height,
|
||||
output->rect.x, output->rect.y, output->rect.width, output->rect.height);
|
||||
if (rect.x == output->rect.x && rect.width == output->rect.width &&
|
||||
rect.y == output->rect.y && rect.height == output->rect.height)
|
||||
return output;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* In contained_by_output, we check if any active output contains part of the container.
|
||||
* We do this by checking if the output rect is intersected by the Rect.
|
||||
|
Reference in New Issue
Block a user