Merge pull request #74 from Smithay/fix/example_vt_all

udev example: handle all 12 vt switches
This commit is contained in:
Victor Brekenfeld 2018-02-21 01:43:55 +01:00 committed by GitHub
commit 5b9eeb537a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -113,12 +113,14 @@ impl InputHandler<LibinputInputBackend> for LibinputInputHandler {
info!(log, "Stopping example using Logo+Q"); info!(log, "Stopping example using Logo+Q");
running.store(false, Ordering::SeqCst); running.store(false, Ordering::SeqCst);
false false
} else if modifiers.ctrl && modifiers.alt && keysym == xkb::KEY_XF86Switch_VT_1 } else if modifiers.ctrl && modifiers.alt && keysym >= xkb::KEY_XF86Switch_VT_1
&& keysym <= xkb::KEY_XF86Switch_VT_12
&& state == KeyState::Pressed && state == KeyState::Pressed
{ {
info!(log, "Trying to switch to vt 1"); let vt = (keysym - xkb::KEY_XF86Switch_VT_1 + 1) as i32;
if let Err(err) = session.change_vt(1) { info!(log, "Trying to switch to vt {}", vt);
error!(log, "Error switching to vt 1: {}", err); if let Err(err) = session.change_vt(vt) {
error!(log, "Error switching to vt {}: {}", vt, err);
} }
false false
} else if modifiers.logo && keysym == xkb::KEY_Return && state == KeyState::Pressed { } else if modifiers.logo && keysym == xkb::KEY_Return && state == KeyState::Pressed {