Skip to content

Commit

Permalink
Remove GPU command line option. Fix minimize
Browse files Browse the repository at this point in the history
  • Loading branch information
core1024 committed Apr 17, 2024
1 parent 4022cbb commit 55cbb36
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
3 changes: 0 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ struct Opt {
start_hidden: bool,
#[clap(long, help = "Enable dev tools when pressing F12")]
dev_tools: bool,
#[clap(long, help = "Use software rendering for the webview")]
disable_gpu: bool,
#[clap(long, help = "Disable the server and load the WebUI from localhost")]
development: bool,
#[clap(long, help = "Shortcut for --webui-url=https://staging.strem.io/")]
Expand Down Expand Up @@ -95,7 +93,6 @@ fn main() {
commands_path: Some(commands_path),
webui_url,
dev_tools: opt.development || opt.dev_tools,
disable_gpu: opt.disable_gpu,
start_hidden: opt.start_hidden,
autoupdater_endpoint: opt.autoupdater_endpoint,
force_update: opt.force_update,
Expand Down
2 changes: 0 additions & 2 deletions src/stremio_app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pub struct MainWindow {
pub commands_path: Option<String>,
pub webui_url: String,
pub dev_tools: bool,
pub disable_gpu: bool,
pub start_hidden: bool,
pub autoupdater_endpoint: Option<Url>,
pub force_update: bool,
Expand Down Expand Up @@ -112,7 +111,6 @@ impl MainWindow {
fn on_init(&self) {
self.webview.endpoint.set(self.webui_url.clone()).ok();
self.webview.dev_tools.set(self.dev_tools).ok();
self.webview.disable_gpu.set(self.disable_gpu).ok();
if let Some(hwnd) = self.window.handle.hwnd() {
if let Ok(mut saved_style) = self.saved_window_style.try_borrow_mut() {
saved_style.center_window(hwnd, WINDOW_MIN_WIDTH, WINDOW_MIN_HEIGHT);
Expand Down
14 changes: 2 additions & 12 deletions src/stremio_app/stremio_wevbiew/wevbiew.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use winapi::um::winuser::{GetClientRect, WM_SETFOCUS};

#[derive(Default)]
pub struct WebView {
pub disable_gpu: Rc<OnceCell<bool>>,
pub endpoint: Rc<OnceCell<String>>,
pub dev_tools: Rc<OnceCell<bool>>,
pub controller: Rc<OnceCell<Controller>>,
Expand Down Expand Up @@ -55,6 +54,7 @@ impl PartialUi for WebView {
data: &mut Self,
parent: Option<W>,
) -> Result<(), nwg::NwgError> {
println!("Building WebView");
let (tx, rx) = flume::unbounded();
let tx_drag_drop = tx.clone();
let (tx_web, rx_web) = flume::unbounded();
Expand All @@ -71,13 +71,8 @@ impl PartialUi for WebView {
let endpoint = data.endpoint.clone();
let dev_tools = data.dev_tools.clone();
let webview_flags = "--disable-web-security --autoplay-policy=no-user-gesture-required --disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection";
let webview_flags = if *data.disable_gpu.get().unwrap() {
format!("{} {}", webview_flags, "--disable-gpu")
} else {
webview_flags.to_string()
};
let result = webview2::EnvironmentBuilder::new()
.with_additional_browser_arguments(&webview_flags)
.with_additional_browser_arguments(webview_flags)
.build(move |env| {
env.expect("Cannot obtain webview environment")
.create_controller(hwnd, move |controller| {
Expand Down Expand Up @@ -184,11 +179,6 @@ impl PartialUi for WebView {
) {
use nwg::Event as E;
match evt {
E::OnWindowMinimize => {
if let Some(controller) = self.controller.get() {
controller.put_is_visible(false).ok();
}
}
E::OnNotice => {
let message_queue = self.message_queue.clone();
if let Some(controller) = self.controller.get() {
Expand Down

0 comments on commit 55cbb36

Please sign in to comment.