diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bc0117e..b2fdb93e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Unreleased +- Created the `Copy`, `Paste` and `Cut` `VirtualKeyCode`s and added support for them on X11 and Wayland - Fix `.with_decorations(false)` in macOS - On Mac, `NSWindow` and supporting objects might be alive long after they were `closed` which resulted in apps consuming more heap then needed. Mainly it was affecting multi window applications. Not expecting any user visible change of behaviour after the fix. - Fix regression of Window platform extensions for macOS where `NSFullSizeContentViewWindowMask` was not being correctly applied to `.fullsize_content_view`. diff --git a/src/events.rs b/src/events.rs index 2dcc3ead..ec034d2e 100644 --- a/src/events.rs +++ b/src/events.rs @@ -431,6 +431,9 @@ pub enum VirtualKeyCode { WebSearch, WebStop, Yen, + Copy, + Paste, + Cut, } /// Represents the current state of the keyboard modifiers diff --git a/src/platform/linux/wayland/keyboard.rs b/src/platform/linux/wayland/keyboard.rs index ce670a42..45fc3802 100644 --- a/src/platform/linux/wayland/keyboard.rs +++ b/src/platform/linux/wayland/keyboard.rs @@ -290,6 +290,9 @@ fn keysym_to_vkey(keysym: u32) -> Option { // => Some(VirtualKeyCode::WebSearch), // => Some(VirtualKeyCode::WebStop), // => Some(VirtualKeyCode::Yen), + keysyms::XKB_KEY_XF86Copy => Some(VirtualKeyCode::Copy), + keysyms::XKB_KEY_XF86Paste => Some(VirtualKeyCode::Paste), + keysyms::XKB_KEY_XF86Cut => Some(VirtualKeyCode::Cut), // fallback _ => None } diff --git a/src/platform/linux/x11/events.rs b/src/platform/linux/x11/events.rs index 77543652..e76fb777 100644 --- a/src/platform/linux/x11/events.rs +++ b/src/platform/linux/x11/events.rs @@ -1000,6 +1000,9 @@ pub fn keysym_to_element(keysym: libc::c_uint) -> Option { //ffi::XK_Hebrew_switch => events::VirtualKeyCode::Hebrew_switch, ffi::XF86XK_Back => VirtualKeyCode::NavigateBackward, ffi::XF86XK_Forward => VirtualKeyCode::NavigateForward, + ffi::XF86XK_Copy => VirtualKeyCode::Copy, + ffi::XF86XK_Paste => VirtualKeyCode::Paste, + ffi::XF86XK_Cut => VirtualKeyCode::Cut, _ => return None }) }