Skip to content

Commit

Permalink
Block some function keys
Browse files Browse the repository at this point in the history
  • Loading branch information
core1024 committed Apr 19, 2024
1 parent a07a139 commit f7df2f0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/stremio_app/stremio_wevbiew/wevbiew.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::thread;
use urlencoding::decode;
use webview2::Controller;
use winapi::shared::windef::HWND;
use winapi::um::winuser::{GetClientRect, WM_SETFOCUS};
use winapi::um::winuser::{GetClientRect, VK_F7, WM_SETFOCUS};

#[derive(Default)]
pub struct WebView {
Expand Down Expand Up @@ -129,6 +129,16 @@ impl PartialUi for WebView {
controller
.move_focus(webview2::MoveFocusReason::Programmatic)
.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
.set(controller)
Expand Down

0 comments on commit f7df2f0

Please sign in to comment.