Skip to content

Commit

Permalink
Fix warnings in egui_webview
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmerlin committed Aug 27, 2024
1 parent e8042c7 commit c366423
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/egui_webview/examples/webview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl WebBrowser {
if text_resp.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter))
|| btn_resp.clicked()
{
self.view.view.load_url(&self.url_bar);
self.view.view.load_url(&self.url_bar).unwrap();
};
});
});
Expand Down
16 changes: 7 additions & 9 deletions crates/egui_webview/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ use std::fmt::Debug;
use std::sync::{Arc, Weak};

use egui::mutex::Mutex;
use egui::{ColorImage, Context, Id, Image, Sense, TextureHandle, Ui, Vec2, Widget};
use egui::{Context, Id, Image, Sense, TextureHandle, Ui, Vec2, Widget};
use egui_inbox::UiInbox;
use serde::{Deserialize, Serialize};
use wry::dpi::Size::Logical;
use wry::dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size};
use wry::http::Request;
use wry::dpi::{LogicalPosition, LogicalSize, Position, Size};
use wry::raw_window_handle::HasWindowHandle;
use wry::{PageLoadEvent, WebView};

Expand Down Expand Up @@ -161,8 +159,8 @@ impl EguiWebView {
}

fn take_screenshot(&mut self) {
let ctx = self.context.clone();
let tx = self.inbox.sender();
// let ctx = self.context.clone();
// let tx = self.inbox.sender();

// // TODO: This requires a screenshot feature in wry, https://github.com/tauri-apps/wry/pull/266
// self.view
Expand Down Expand Up @@ -250,7 +248,7 @@ impl EguiWebView {

if response.gained_focus() {
println!("Gained focus");
self.view.focus();
self.view.focus().ok();
}

if let Some(image) = &self.current_image {
Expand Down Expand Up @@ -348,10 +346,10 @@ pub fn webview_end_frame(ctx: &Context) {
if let Some(view) = view.upgrade() {
if !state.rendered_this_frame.contains(id) {
println!("Set visible false");
view.set_visible(false);
view.set_visible(false).ok();
} else {
println!("Set visible true");
view.set_visible(true);
view.set_visible(true).ok();
}

true
Expand Down
4 changes: 2 additions & 2 deletions crates/egui_webview/src/native_text_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ impl NativeTextField {
}
Ok(Event::FocusOut) => {
println!("Focus out");
self.webview.view.set_visible(false);
self.webview.view.set_visible(true);
self.webview.view.set_visible(false).ok();
self.webview.view.set_visible(true).ok();
//response.egui_response.surrender_focus();
// let shift_key = ui.input(|i| i.modifiers.shift);
//response.egui_response.surrender_focus();
Expand Down

0 comments on commit c366423

Please sign in to comment.