Implement the window::floating event

The window::floating event should be emitted when a window transitions
to or from the floating state.
This commit is contained in:
Tony Crisci
2014-06-20 07:44:08 -04:00
committed by Michael Stapelberg
parent c2b6b06da7
commit babfb779d7
3 changed files with 70 additions and 2 deletions

View File

@ -298,16 +298,22 @@ void floating_enable(Con *con, bool automatic) {
/* Check if we need to re-assign it to a different workspace because of its
* coordinates and exit if that was done successfully. */
if (floating_maybe_reassign_ws(nc))
if (floating_maybe_reassign_ws(nc)) {
ipc_send_window_event("floating", con);
return;
}
/* Sanitize coordinates: Check if they are on any output */
if (get_output_containing(nc->rect.x, nc->rect.y) != NULL)
if (get_output_containing(nc->rect.x, nc->rect.y) != NULL) {
ipc_send_window_event("floating", con);
return;
}
ELOG("No output found at destination coordinates, centering floating window on current ws\n");
nc->rect.x = ws->rect.x + (ws->rect.width / 2) - (nc->rect.width / 2);
nc->rect.y = ws->rect.y + (ws->rect.height / 2) - (nc->rect.height / 2);
ipc_send_window_event("floating", con);
}
void floating_disable(Con *con, bool automatic) {
@ -351,6 +357,8 @@ void floating_disable(Con *con, bool automatic) {
if (set_focus)
con_focus(con);
ipc_send_window_event("floating", con);
}
/*