input: Fix stack overflow due to shortcut priorities
This commit is contained in:
parent
ac77ab974a
commit
ea14033d06
2 changed files with 47 additions and 31 deletions
|
|
@ -438,7 +438,7 @@ impl State {
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
loop_handle.insert_source(Timer::from_duration(Duration::from_millis(200)), move |current, _, state| {
|
loop_handle.insert_source(Timer::from_duration(Duration::from_millis(200)), move |current, _, state| {
|
||||||
let duration = current.duration_since(start).as_millis();
|
let duration = current.duration_since(start).as_millis();
|
||||||
state.handle_action(action_clone.clone(), &seat_clone, serial, time.overflowing_add(duration as u32).0, key_pattern_clone.clone(), None);
|
state.handle_action(action_clone.clone(), &seat_clone, serial, time.overflowing_add(duration as u32).0, key_pattern_clone.clone(), None, true);
|
||||||
calloop::timer::TimeoutAction::ToDuration(Duration::from_millis(25))
|
calloop::timer::TimeoutAction::ToDuration(Duration::from_millis(25))
|
||||||
}).ok()
|
}).ok()
|
||||||
} else { None };
|
} else { None };
|
||||||
|
|
@ -549,7 +549,7 @@ impl State {
|
||||||
)
|
)
|
||||||
.flatten()
|
.flatten()
|
||||||
{
|
{
|
||||||
self.handle_action(action, &seat, serial, time, pattern, None)
|
self.handle_action(action, &seat, serial, time, pattern, None, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1157,6 +1157,7 @@ impl State {
|
||||||
time: u32,
|
time: u32,
|
||||||
pattern: KeyPattern,
|
pattern: KeyPattern,
|
||||||
direction: Option<Direction>,
|
direction: Option<Direction>,
|
||||||
|
propagate: bool,
|
||||||
) {
|
) {
|
||||||
// TODO: Detect if started from login manager or tty, and only allow
|
// TODO: Detect if started from login manager or tty, and only allow
|
||||||
// `Terminate` if it will return to login manager.
|
// `Terminate` if it will return to login manager.
|
||||||
|
|
@ -1206,6 +1207,16 @@ impl State {
|
||||||
.shell
|
.shell
|
||||||
.activate(¤t_output, workspace as usize);
|
.activate(¤t_output, workspace as usize);
|
||||||
}
|
}
|
||||||
|
Action::LastWorkspace => {
|
||||||
|
let current_output = seat.active_output();
|
||||||
|
let workspace = self
|
||||||
|
.common
|
||||||
|
.shell
|
||||||
|
.workspaces
|
||||||
|
.len(¤t_output)
|
||||||
|
.saturating_sub(1);
|
||||||
|
let _ = self.common.shell.activate(¤t_output, workspace);
|
||||||
|
}
|
||||||
Action::NextWorkspace => {
|
Action::NextWorkspace => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
let workspace = self
|
let workspace = self
|
||||||
|
|
@ -1220,6 +1231,7 @@ impl State {
|
||||||
.shell
|
.shell
|
||||||
.activate(¤t_output, workspace)
|
.activate(¤t_output, workspace)
|
||||||
.is_err()
|
.is_err()
|
||||||
|
&& propagate
|
||||||
{
|
{
|
||||||
if let Some(inferred) = pattern.inferred_direction() {
|
if let Some(inferred) = pattern.inferred_direction() {
|
||||||
self.handle_action(
|
self.handle_action(
|
||||||
|
|
@ -1229,6 +1241,7 @@ impl State {
|
||||||
time,
|
time,
|
||||||
pattern,
|
pattern,
|
||||||
direction,
|
direction,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1247,6 +1260,7 @@ impl State {
|
||||||
.shell
|
.shell
|
||||||
.activate(¤t_output, workspace)
|
.activate(¤t_output, workspace)
|
||||||
.is_err()
|
.is_err()
|
||||||
|
&& propagate
|
||||||
{
|
{
|
||||||
if let Some(inferred) = pattern.inferred_direction() {
|
if let Some(inferred) = pattern.inferred_direction() {
|
||||||
self.handle_action(
|
self.handle_action(
|
||||||
|
|
@ -1256,20 +1270,11 @@ impl State {
|
||||||
time,
|
time,
|
||||||
pattern,
|
pattern,
|
||||||
direction,
|
direction,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Action::LastWorkspace => {
|
|
||||||
let current_output = seat.active_output();
|
|
||||||
let workspace = self
|
|
||||||
.common
|
|
||||||
.shell
|
|
||||||
.workspaces
|
|
||||||
.len(¤t_output)
|
|
||||||
.saturating_sub(1);
|
|
||||||
let _ = self.common.shell.activate(¤t_output, workspace);
|
|
||||||
}
|
|
||||||
x @ Action::MoveToWorkspace(_) | x @ Action::SendToWorkspace(_) => {
|
x @ Action::MoveToWorkspace(_) | x @ Action::SendToWorkspace(_) => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
let follow = matches!(x, Action::MoveToWorkspace(_));
|
let follow = matches!(x, Action::MoveToWorkspace(_));
|
||||||
|
|
@ -1287,6 +1292,23 @@ impl State {
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
x @ Action::MoveToLastWorkspace | x @ Action::SendToLastWorkspace => {
|
||||||
|
let current_output = seat.active_output();
|
||||||
|
let workspace = self
|
||||||
|
.common
|
||||||
|
.shell
|
||||||
|
.workspaces
|
||||||
|
.len(¤t_output)
|
||||||
|
.saturating_sub(1);
|
||||||
|
let _ = Shell::move_current_window(
|
||||||
|
self,
|
||||||
|
seat,
|
||||||
|
¤t_output,
|
||||||
|
(¤t_output, Some(workspace as usize)),
|
||||||
|
matches!(x, Action::MoveToLastWorkspace),
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
}
|
||||||
x @ Action::MoveToNextWorkspace | x @ Action::SendToNextWorkspace => {
|
x @ Action::MoveToNextWorkspace | x @ Action::SendToNextWorkspace => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
let workspace = self
|
let workspace = self
|
||||||
|
|
@ -1305,6 +1327,7 @@ impl State {
|
||||||
direction,
|
direction,
|
||||||
)
|
)
|
||||||
.is_err()
|
.is_err()
|
||||||
|
&& propagate
|
||||||
{
|
{
|
||||||
if let Some(inferred) = pattern.inferred_direction() {
|
if let Some(inferred) = pattern.inferred_direction() {
|
||||||
self.handle_action(
|
self.handle_action(
|
||||||
|
|
@ -1318,6 +1341,7 @@ impl State {
|
||||||
time,
|
time,
|
||||||
pattern,
|
pattern,
|
||||||
direction,
|
direction,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1341,6 +1365,7 @@ impl State {
|
||||||
direction,
|
direction,
|
||||||
)
|
)
|
||||||
.is_err()
|
.is_err()
|
||||||
|
&& propagate
|
||||||
{
|
{
|
||||||
if let Some(inferred) = pattern.inferred_direction() {
|
if let Some(inferred) = pattern.inferred_direction() {
|
||||||
self.handle_action(
|
self.handle_action(
|
||||||
|
|
@ -1354,27 +1379,11 @@ impl State {
|
||||||
time,
|
time,
|
||||||
pattern,
|
pattern,
|
||||||
direction,
|
direction,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x @ Action::MoveToLastWorkspace | x @ Action::SendToLastWorkspace => {
|
|
||||||
let current_output = seat.active_output();
|
|
||||||
let workspace = self
|
|
||||||
.common
|
|
||||||
.shell
|
|
||||||
.workspaces
|
|
||||||
.len(¤t_output)
|
|
||||||
.saturating_sub(1);
|
|
||||||
let _ = Shell::move_current_window(
|
|
||||||
self,
|
|
||||||
seat,
|
|
||||||
¤t_output,
|
|
||||||
(¤t_output, Some(workspace as usize)),
|
|
||||||
matches!(x, Action::MoveToLastWorkspace),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Action::SwitchOutput(direction) => {
|
Action::SwitchOutput(direction) => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
let next_output = self
|
let next_output = self
|
||||||
|
|
@ -1406,7 +1415,7 @@ impl State {
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
} else {
|
} else if propagate {
|
||||||
match (direction, self.common.config.workspace.workspace_layout) {
|
match (direction, self.common.config.workspace.workspace_layout) {
|
||||||
(Direction::Left, WorkspaceLayout::Horizontal)
|
(Direction::Left, WorkspaceLayout::Horizontal)
|
||||||
| (Direction::Up, WorkspaceLayout::Vertical) => self.handle_action(
|
| (Direction::Up, WorkspaceLayout::Vertical) => self.handle_action(
|
||||||
|
|
@ -1416,6 +1425,7 @@ impl State {
|
||||||
time,
|
time,
|
||||||
pattern,
|
pattern,
|
||||||
Some(direction),
|
Some(direction),
|
||||||
|
false,
|
||||||
),
|
),
|
||||||
(Direction::Right, WorkspaceLayout::Horizontal)
|
(Direction::Right, WorkspaceLayout::Horizontal)
|
||||||
| (Direction::Down, WorkspaceLayout::Vertical) => self.handle_action(
|
| (Direction::Down, WorkspaceLayout::Vertical) => self.handle_action(
|
||||||
|
|
@ -1425,6 +1435,7 @@ impl State {
|
||||||
time,
|
time,
|
||||||
pattern,
|
pattern,
|
||||||
Some(direction),
|
Some(direction),
|
||||||
|
false,
|
||||||
),
|
),
|
||||||
|
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
@ -1539,7 +1550,7 @@ impl State {
|
||||||
ptr.frame(self);
|
ptr.frame(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if propagate {
|
||||||
match (direction, self.common.config.workspace.workspace_layout) {
|
match (direction, self.common.config.workspace.workspace_layout) {
|
||||||
(Direction::Left, WorkspaceLayout::Horizontal)
|
(Direction::Left, WorkspaceLayout::Horizontal)
|
||||||
| (Direction::Up, WorkspaceLayout::Vertical) => self.handle_action(
|
| (Direction::Up, WorkspaceLayout::Vertical) => self.handle_action(
|
||||||
|
|
@ -1549,6 +1560,7 @@ impl State {
|
||||||
time,
|
time,
|
||||||
pattern,
|
pattern,
|
||||||
Some(direction),
|
Some(direction),
|
||||||
|
false,
|
||||||
),
|
),
|
||||||
(Direction::Right, WorkspaceLayout::Horizontal)
|
(Direction::Right, WorkspaceLayout::Horizontal)
|
||||||
| (Direction::Down, WorkspaceLayout::Vertical) => self.handle_action(
|
| (Direction::Down, WorkspaceLayout::Vertical) => self.handle_action(
|
||||||
|
|
@ -1558,6 +1570,7 @@ impl State {
|
||||||
time,
|
time,
|
||||||
pattern,
|
pattern,
|
||||||
Some(direction),
|
Some(direction),
|
||||||
|
false,
|
||||||
),
|
),
|
||||||
|
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
@ -1714,6 +1727,7 @@ impl State {
|
||||||
time,
|
time,
|
||||||
pattern,
|
pattern,
|
||||||
Some(direction),
|
Some(direction),
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1735,6 +1749,7 @@ impl State {
|
||||||
time,
|
time,
|
||||||
pattern,
|
pattern,
|
||||||
Some(direction),
|
Some(direction),
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
MoveResult::ShiftFocus(shift) => {
|
MoveResult::ShiftFocus(shift) => {
|
||||||
Common::set_focus(self, Some(&shift), seat, None);
|
Common::set_focus(self, Some(&shift), seat, None);
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ impl KeyboardGrab<State> for SwapWindowGrab {
|
||||||
key: Some(Keysym::new(keycode)),
|
key: Some(Keysym::new(keycode)),
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue