File tree Expand file tree Collapse file tree 2 files changed +37
-17
lines changed Expand file tree Collapse file tree 2 files changed +37
-17
lines changed Original file line number Diff line number Diff line change @@ -669,8 +669,41 @@ impl State {
669669 } ;
670670
671671 if let Some ( next_output) = next_output {
672- self . common
673- . migrate_workspace ( & active_output, & next_output, & active) ;
672+ let mut shell = self . common . shell . write ( ) ;
673+ let mut workspace_state = self . common . workspace_state . update ( ) ;
674+ shell. workspaces . migrate_workspace (
675+ & active_output,
676+ & next_output,
677+ & active,
678+ & mut workspace_state,
679+ ) ;
680+ // Activate workspace on new set, and set that output as active
681+ if let Some ( new_idx) = shell
682+ . workspaces
683+ . sets
684+ . get ( & next_output)
685+ . and_then ( |set| set. workspaces . iter ( ) . position ( |w| w. handle == active) )
686+ {
687+ let res = shell. activate (
688+ & next_output,
689+ new_idx,
690+ WorkspaceDelta :: new_shortcut ( ) ,
691+ & mut workspace_state,
692+ ) ;
693+ drop ( workspace_state) ;
694+ drop ( shell) ;
695+ if res. is_ok ( ) {
696+ self . handle_shortcut_action (
697+ Action :: SwitchOutput ( direction) ,
698+ seat,
699+ serial,
700+ time,
701+ pattern,
702+ Some ( direction) ,
703+ true ,
704+ )
705+ }
706+ }
674707 }
675708 }
676709
Original file line number Diff line number Diff line change @@ -878,14 +878,14 @@ impl Workspaces {
878878 }
879879
880880 // Move workspace from one output to another, explicitly by the user
881- fn migrate_workspace (
881+ pub fn migrate_workspace (
882882 & mut self ,
883883 from : & Output ,
884884 to : & Output ,
885885 handle : & WorkspaceHandle ,
886886 workspace_state : & mut WorkspaceUpdateGuard < ' _ , State > ,
887887 ) {
888- if !self . sets . contains_key ( to) {
888+ if !self . sets . contains_key ( to) || from == to {
889889 return ;
890890 }
891891
@@ -1354,19 +1354,6 @@ impl Common {
13541354 self . refresh ( ) ; // cleans up excess of workspaces and empty workspaces
13551355 }
13561356
1357- pub fn migrate_workspace ( & mut self , from : & Output , to : & Output , handle : & WorkspaceHandle ) {
1358- if from == to {
1359- return ;
1360- }
1361-
1362- let mut shell = self . shell . write ( ) ;
1363- shell
1364- . workspaces
1365- . migrate_workspace ( from, to, handle, & mut self . workspace_state . update ( ) ) ;
1366-
1367- std:: mem:: drop ( shell) ;
1368- }
1369-
13701357 pub fn update_config ( & mut self ) {
13711358 let mut shell = self . shell . write ( ) ;
13721359 let shell_ref = & mut * shell;
You can’t perform that action at this time.
0 commit comments