Only set FLOATING_AUTO_ON when floating_enable succeeds
Fixes #4039 Crash with docking clients where the floating field is set even though floating_enable refuses to make them floating. See issue for example with logs.
This commit is contained in:
@ -221,22 +221,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;
|
||||
@ -419,6 +419,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) {
|
||||
|
@ -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) {
|
||||
|
@ -537,8 +537,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 */
|
||||
|
Reference in New Issue
Block a user