Merge pull request #4041 from orestisfl/floating_enable-bool

Only set FLOATING_AUTO_ON when floating_enable succeeds
This commit is contained in:
Ingo Bürk
2020-04-30 09:04:22 +02:00
committed by GitHub
5 changed files with 85 additions and 12 deletions

View File

@ -223,22 +223,22 @@ void floating_check_size(Con *floating_con, bool prefer_height) {
}
}
void floating_enable(Con *con, bool automatic) {
bool floating_enable(Con *con, bool automatic) {
bool set_focus = (con == focused);
if (con_is_docked(con)) {
LOG("Container is a dock window, not enabling floating mode.\n");
return;
return false;
}
if (con_is_floating(con)) {
LOG("Container is already in floating mode, not doing anything.\n");
return;
return false;
}
if (con->type == CT_WORKSPACE) {
LOG("Container is a workspace, not enabling floating mode.\n");
return;
return false;
}
Con *focus_head_placeholder = NULL;
@ -421,6 +421,7 @@ void floating_enable(Con *con, bool automatic) {
floating_set_hint_atom(nc, true);
ipc_send_window_event("floating", con);
return true;
}
void floating_disable(Con *con) {

View File

@ -841,12 +841,13 @@ static void handle_client_message(xcb_client_message_event_t *event) {
* let's float it and make it sticky. */
DLOG("The window was requested to be visible on all workspaces, making it sticky and floating.\n");
floating_enable(con, false);
con->floating = FLOATING_AUTO_ON;
if (floating_enable(con, false)) {
con->floating = FLOATING_AUTO_ON;
con->sticky = true;
ewmh_update_sticky(con->window->id, true);
output_push_sticky_windows(focused);
con->sticky = true;
ewmh_update_sticky(con->window->id, true);
output_push_sticky_windows(focused);
}
} else {
Con *ws = ewmh_get_workspace_by_index(index);
if (ws == NULL) {

View File

@ -533,8 +533,9 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
* was not specified */
bool automatic_border = (motif_border_style == BS_NORMAL);
floating_enable(nc, automatic_border);
nc->floating = FLOATING_AUTO_ON;
if (floating_enable(nc, automatic_border)) {
nc->floating = FLOATING_AUTO_ON;
}
}
/* explicitly set the border width to the default */