Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump tao to 0.4 and fix examples #329

Merged
merged 6 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/tao-new-minor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": minor
---

Bump tao to `0.4`. Please refer to `tao` changelog for more details.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ serde = { version = "1.0", features = [ "derive" ] }
serde_json = "1.0"
thiserror = "1.0"
url = "2.2"
tao = { version = "0.3", default-features = false, features = [ "serde" ] }
tao = { version = "0.4", default-features = false, features = [ "serde" ] }

[dev-dependencies]
anyhow = "1.0.42"
Expand Down
5 changes: 4 additions & 1 deletion examples/custom_titlebar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ fn main() -> wry::Result<()> {
}
}

if let Event::WindowEvent { event, window_id } = event {
if let Event::WindowEvent {
event, window_id, ..
} = event
{
match event {
WindowEvent::CloseRequested => {
webviews.remove(&window_id);
Expand Down
1 change: 1 addition & 0 deletions examples/multi_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ fn main() -> wry::Result<()> {
if let Event::WindowEvent {
window_id,
event: WindowEvent::CloseRequested,
..
} = event
{
webviews.remove(&window_id);
Expand Down
17 changes: 12 additions & 5 deletions examples/system_tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ fn main() -> wry::Result<()> {
use wry::application::platform::macos::{
ActivationPolicy, CustomMenuItemExtMacOS, EventLoopExtMacOS, NativeImage,
};
#[cfg(target_os = "linux")]
use wry::application::platform::unix::WindowBuilderExtUnix;
#[cfg(target_os = "windows")]
use wry::application::platform::windows::SystemTrayExtWindows;
#[cfg(target_os = "windows")]
use wry::application::platform::windows::WindowBuilderExtWindows;
use wry::{
application::{
accelerator::{Accelerator, SysMods},
Expand Down Expand Up @@ -49,7 +53,7 @@ fn main() -> wry::Result<()> {
let event_loop = EventLoop::new();

// launch macos app without menu and without dock icon
// shouold be set at launch
// should be set at launch
#[cfg(target_os = "macos")]
event_loop.set_activation_policy(ActivationPolicy::Accessory);

Expand Down Expand Up @@ -116,10 +120,12 @@ fn main() -> wry::Result<()> {
.unwrap();

// create our new window / webview instance
let window = WindowBuilder::new()
.with_skip_taskbar(true)
.build(event_loop)
.unwrap();
#[cfg(any(target_os = "windows", target_os = "linux"))]
let window_builder = WindowBuilder::new().with_skip_taskbar(true);
#[cfg(target_os = "macos")]
let window_builder = WindowBuilder::new();

let window = window_builder.build(event_loop).unwrap();

let id = window.id();

Expand Down Expand Up @@ -155,6 +161,7 @@ fn main() -> wry::Result<()> {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
window_id,
..
} => {
println!("Window {:?} has received the signal to close", window_id);
let mut open_new_window = open_new_window.clone();
Expand Down
23 changes: 17 additions & 6 deletions examples/system_tray_no_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ fn main() -> wry::Result<()> {
use tao::menu::{ContextMenu, MenuItemAttributes};
#[cfg(target_os = "macos")]
use wry::application::platform::macos::{ActivationPolicy, EventLoopExtMacOS};
#[cfg(target_os = "linux")]
use wry::application::platform::unix::WindowBuilderExtUnix;
#[cfg(target_os = "windows")]
use wry::application::platform::windows::WindowBuilderExtWindows;
use wry::{
application::{
dpi::{LogicalSize, PhysicalPosition},
Expand Down Expand Up @@ -45,7 +49,7 @@ fn main() -> wry::Result<()> {
let event_loop = EventLoop::new();

// launch macos app without menu and without dock icon
// shouold be set at launch
// should be set at launch
#[cfg(target_os = "macos")]
event_loop.set_activation_policy(ActivationPolicy::Accessory);

Expand Down Expand Up @@ -112,13 +116,19 @@ fn main() -> wry::Result<()> {
}
return;
}

// create our new window / webview instance
let window = WindowBuilder::new()
.with_skip_taskbar(true)
let mut window_builder = WindowBuilder::new();
window_builder = window_builder
.with_position(window_position)
.with_inner_size(window_size)
.build(event_loop)
.unwrap();
.with_inner_size(window_size);

#[cfg(any(target_os = "windows", target_os = "linux"))]
{
window_builder = window_builder.with_skip_taskbar(true);
}

let window = window_builder.build(event_loop).unwrap();

let id = window.id();

Expand All @@ -140,6 +150,7 @@ fn main() -> wry::Result<()> {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
window_id,
..
} => {
println!("Window {:?} has received the signal to close", window_id);
// Remove webview from our hashmap
Expand Down