Merge pull request #3388 from orestisf1993/cmd_rename_workspace

cmd_rename_workspace: correct order of events
This commit is contained in:
Ingo Bürk 2018-09-06 08:38:03 +02:00 committed by GitHub
commit 7257c3b528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 6 deletions

View File

@ -2002,6 +2002,7 @@ void cmd_rename_workspace(I3_CMD, const char *old_name, const char *new_name) {
Con *parent = workspace->parent; Con *parent = workspace->parent;
con_detach(workspace); con_detach(workspace);
con_attach(workspace, parent, false); con_attach(workspace, parent, false);
ipc_send_workspace_event("rename", workspace, NULL);
/* Move the workspace to the correct output if it has an assignment */ /* Move the workspace to the correct output if it has an assignment */
struct Workspace_Assignment *assignment = NULL; struct Workspace_Assignment *assignment = NULL;
@ -2046,7 +2047,6 @@ void cmd_rename_workspace(I3_CMD, const char *old_name, const char *new_name) {
cmd_output->needs_tree_render = true; cmd_output->needs_tree_render = true;
ysuccess(true); ysuccess(true);
ipc_send_workspace_event("rename", workspace, NULL);
ewmh_update_desktop_names(); ewmh_update_desktop_names();
ewmh_update_desktop_viewport(); ewmh_update_desktop_viewport();
ewmh_update_current_desktop(); ewmh_update_current_desktop();

View File

@ -82,16 +82,31 @@ is(get_output_for_workspace('5'), 'fake-0',
'Renaming the workspace to a workspace assigned to a directional output should not move the workspace'); 'Renaming the workspace to a workspace assigned to a directional output should not move the workspace');
########################################################################## ##########################################################################
# Renaming a workspace, so that it becomes assigned to the focused # Renaming an unfocused workspace, triggering an assignment to the output
# output's workspace (and the focused output is empty) should # which holds the currently focused empty workspace should result in the
# result in the original workspace replacing the originally # original workspace replacing the empty one.
# focused workspace. # See issue #3228.
########################################################################## ##########################################################################
cmd 'workspace baz'; cmd 'workspace baz';
cmd 'rename workspace 5 to 2'; cmd 'rename workspace 5 to 2';
is(get_output_for_workspace('2'), 'fake-1', is(get_output_for_workspace('2'), 'fake-1',
'Renaming a workspace so that it moves to the focused output which contains only an empty workspace should replace the empty workspace'); 'Renaming an unfocused workspace, triggering an assignment to the output which holds the currently focused empty workspace should result in the original workspace replacing the empty one');
##########################################################################
# Renaming an unfocused empty workspace, triggering an assignment to the
# output which holds the currently focused non-empty workspace should
# close the empty workspace and not crash i3.
# See issue #3248.
##########################################################################
cmd 'workspace 1';
cmd 'workspace 2';
open_window;
cmd 'rename workspace 1 to baz';
is(get_output_for_workspace('baz'), '',
'Renaming an unfocused empty workspace, triggering an assignment to the output which holds the currently focused non-empty workspace should close the empty workspace and not crash i3');
kill_all_windows;
########################################################################## ##########################################################################
# Renaming a workspace with multiple assignments, where the first output # Renaming a workspace with multiple assignments, where the first output