forge
Explore
Log in

Don't you dare go Hollow

overview: Activate window upon dropping from interactive move

Browse files at this commit

78e3daf5f82b5870e998faf0e1efeaa048730976Ivan MolodetskikhParent: a99a0b2
src/layout/mod.rsmodified+9 -9
@@ -3543,6 +3543,7 @@ impl<W: LayoutElement> Layout<W> {
3543 column_idx: None,3543 column_idx: None,
3544 },3544 },
3545 activate,3545 activate,
3546+ true,
3546 removed.width,3547 removed.width,
3547 removed.is_full_width,3548 removed.is_full_width,
3548 removed.is_floating,3549 removed.is_floating,
@@ -4392,11 +4393,7 @@ impl<W: LayoutElement> Layout<W> {
4392 }4393 }
4393 4394
4394 // Dragging in the overview shouldn't switch the workspace and so on.4395 // Dragging in the overview shouldn't switch the workspace and so on.
4395- let activate = if self.overview_open {4396+ let allow_to_activate_workspace = !self.overview_open;
4396- ActivateWindow::No
4397- } else {
4398- ActivateWindow::Yes
4399- };
4400 4397
4401 match &mut self.monitor_set {4398 match &mut self.monitor_set {
4402 MonitorSet::Normal {4399 MonitorSet::Normal {
@@ -4489,7 +4486,8 @@ impl<W: LayoutElement> Layout<W> {
4489 id: ws_id,4486 id: ws_id,
4490 column_idx: Some(column_idx),4487 column_idx: Some(column_idx),
4491 },4488 },
4492- activate,4489+ ActivateWindow::Yes,
4490+ allow_to_activate_workspace,
4493 move_.width,4491 move_.width,
4494 move_.is_full_width,4492 move_.is_full_width,
4495 false,4493 false,
@@ -4501,7 +4499,8 @@ impl<W: LayoutElement> Layout<W> {
4501 column_idx,4499 column_idx,
4502 Some(tile_idx),4500 Some(tile_idx),
4503 move_.tile,4501 move_.tile,
4504- activate == ActivateWindow::Yes,4502+ true,
4503+ allow_to_activate_workspace,
4505 );4504 );
4506 }4505 }
4507 InsertPosition::Floating => {4506 InsertPosition::Floating => {
@@ -4543,7 +4542,8 @@ impl<W: LayoutElement> Layout<W> {
4543 id: ws_id,4542 id: ws_id,
4544 column_idx: None,4543 column_idx: None,
4545 },4544 },
4546- activate,4545+ ActivateWindow::Yes,
4546+ allow_to_activate_workspace,
4547 move_.width,4547 move_.width,
4548 move_.is_full_width,4548 move_.is_full_width,
4549 true,4549 true,
@@ -4578,7 +4578,7 @@ impl<W: LayoutElement> Layout<W> {
4578 ws.add_tile(4578 ws.add_tile(
4579 move_.tile,4579 move_.tile,
4580 WorkspaceAddWindowTarget::Auto,4580 WorkspaceAddWindowTarget::Auto,
4581- activate,4581+ ActivateWindow::Yes,
4582 move_.width,4582 move_.width,
4583 move_.is_full_width,4583 move_.is_full_width,
4584 move_.is_floating,4584 move_.is_floating,
src/layout/monitor.rsmodified+19 -3
@@ -439,7 +439,15 @@ impl<W: LayoutElement> Monitor<W> {
439 // monitor. So we can use any workspace, not necessarily the exact target workspace.439 // monitor. So we can use any workspace, not necessarily the exact target workspace.
440 let tile = self.workspaces[0].make_tile(window);440 let tile = self.workspaces[0].make_tile(window);
441 441
442- self.add_tile(tile, target, activate, width, is_full_width, is_floating);442+ self.add_tile(
443+ tile,
444+ target,
445+ activate,
446+ true,
447+ width,
448+ is_full_width,
449+ is_floating,
450+ );
443 }451 }
444 452
445 pub fn add_column(&mut self, mut workspace_idx: usize, column: Column<W>, activate: bool) {453 pub fn add_column(&mut self, mut workspace_idx: usize, column: Column<W>, activate: bool) {
@@ -465,11 +473,14 @@ impl<W: LayoutElement> Monitor<W> {
465 }473 }
466 }474 }
467 475
476+ #[allow(clippy::too_many_arguments)]
468 pub fn add_tile(477 pub fn add_tile(
469 &mut self,478 &mut self,
470 tile: Tile<W>,479 tile: Tile<W>,
471 target: MonitorAddWindowTarget<W>,480 target: MonitorAddWindowTarget<W>,
472 activate: ActivateWindow,481 activate: ActivateWindow,
482+ // FIXME: Refactor ActivateWindow enum to make this better.
483+ allow_to_activate_workspace: bool,
473 width: ColumnWidth,484 width: ColumnWidth,
474 is_full_width: bool,485 is_full_width: bool,
475 is_floating: bool,486 is_floating: bool,
@@ -516,7 +527,7 @@ impl<W: LayoutElement> Monitor<W> {
516 workspace_idx += 1;527 workspace_idx += 1;
517 }528 }
518 529
519- if activate.map_smart(|| false) {530+ if allow_to_activate_workspace && activate.map_smart(|| false) {
520 self.activate_workspace(workspace_idx);531 self.activate_workspace(workspace_idx);
521 }532 }
522 }533 }
@@ -528,6 +539,8 @@ impl<W: LayoutElement> Monitor<W> {
528 tile_idx: Option<usize>,539 tile_idx: Option<usize>,
529 tile: Tile<W>,540 tile: Tile<W>,
530 activate: bool,541 activate: bool,
542+ // FIXME: Refactor ActivateWindow enum to make this better.
543+ allow_to_activate_workspace: bool,
531 ) {544 ) {
532 let workspace = &mut self.workspaces[workspace_idx];545 let workspace = &mut self.workspaces[workspace_idx];
533 546
@@ -541,7 +554,7 @@ impl<W: LayoutElement> Monitor<W> {
541 // Since we're adding window to an existing column, the workspace isn't empty, and554 // Since we're adding window to an existing column, the workspace isn't empty, and
542 // therefore cannot be the last one, so we never need to insert a new empty workspace.555 // therefore cannot be the last one, so we never need to insert a new empty workspace.
543 556
544- if activate {557+ if allow_to_activate_workspace && activate {
545 self.activate_workspace(workspace_idx);558 self.activate_workspace(workspace_idx);
546 }559 }
547 }560 }
@@ -631,6 +644,7 @@ impl<W: LayoutElement> Monitor<W> {
631 column_idx: None,644 column_idx: None,
632 },645 },
633 ActivateWindow::Yes,646 ActivateWindow::Yes,
647+ true,
634 removed.width,648 removed.width,
635 removed.is_full_width,649 removed.is_full_width,
636 removed.is_floating,650 removed.is_floating,
@@ -658,6 +672,7 @@ impl<W: LayoutElement> Monitor<W> {
658 column_idx: None,672 column_idx: None,
659 },673 },
660 ActivateWindow::Yes,674 ActivateWindow::Yes,
675+ true,
661 removed.width,676 removed.width,
662 removed.is_full_width,677 removed.is_full_width,
663 removed.is_floating,678 removed.is_floating,
@@ -712,6 +727,7 @@ impl<W: LayoutElement> Monitor<W> {
712 } else {727 } else {
713 ActivateWindow::No728 ActivateWindow::No
714 },729 },
730+ true,
715 removed.width,731 removed.width,
716 removed.is_full_width,732 removed.is_full_width,
717 removed.is_floating,733 removed.is_floating,