mirror of
https://github.com/Stremio/stremio-shell-ng.git
synced 2026-05-11 04:10:37 +00:00
Block some function keys
This commit is contained in:
parent
baac009fb5
commit
f76435e745
1 changed files with 11 additions and 1 deletions
|
|
@ -12,7 +12,7 @@ use std::thread;
|
||||||
use urlencoding::decode;
|
use urlencoding::decode;
|
||||||
use webview2::Controller;
|
use webview2::Controller;
|
||||||
use winapi::shared::windef::HWND;
|
use winapi::shared::windef::HWND;
|
||||||
use winapi::um::winuser::{GetClientRect, WM_SETFOCUS};
|
use winapi::um::winuser::{GetClientRect, VK_F7, WM_SETFOCUS};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct WebView {
|
pub struct WebView {
|
||||||
|
|
@ -129,6 +129,16 @@ impl PartialUi for WebView {
|
||||||
controller
|
controller
|
||||||
.move_focus(webview2::MoveFocusReason::Programmatic)
|
.move_focus(webview2::MoveFocusReason::Programmatic)
|
||||||
.ok();
|
.ok();
|
||||||
|
controller.add_accelerator_key_pressed(move |_, e| {
|
||||||
|
// Block F7, Ctrl+F, and Ctrl+G
|
||||||
|
let k = e.get_virtual_key()?;
|
||||||
|
if k == VK_F7 as u32 || k == 70 & 0x7F || k == 71 & 0x7F {
|
||||||
|
e.put_handled(true)
|
||||||
|
} else {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
controller_clone
|
controller_clone
|
||||||
.set(controller)
|
.set(controller)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue