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

chore(deps): update rust crate winit to 0.29 #108

Merged
merged 11 commits into from
Oct 24, 2023
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
48 changes: 48 additions & 0 deletions .github/workflows/clippy-fmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2022-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

name: clippy & fmt

on:
push:
branches:
- dev
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
clippy:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v4
- name: install system deps
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev

- uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- run: cargo clippy --all-targets --all-features -- -D warnings

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- run: cargo fmt --all -- --check
4 changes: 1 addition & 3 deletions .github/workflows/covector-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/checkout@v4
- name: covector status
uses: jbolda/covector/packages/action@covector-v0
id: covector
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/covector-version-or-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: version or publish
name: covector version or publish

on:
push:
Expand All @@ -15,16 +15,16 @@ jobs:
successfulPublish: ${{ steps.covector.outputs.successfulPublish }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: rustup update
- uses: actions/checkout@v4

- name: cargo login
run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }}

- name: git config
run: |
git config --global user.name "${{ github.event.pusher.name }}"
git config --global user.email "${{ github.event.pusher.email }}"

- name: covector version or publish (publish when no change files present)
uses: jbolda/covector/packages/action@covector-v0
id: covector
Expand All @@ -34,14 +34,15 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
command: "version-or-publish"
createRelease: true

- name: Create Pull Request With Versions Bumped
id: cpr
uses: tauri-apps/create-pull-request@v3
if: steps.covector.outputs.commandRan == 'version'
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "Publish New Versions"
commit-message: "publish new versions"
labels: "version updates"
branch: "release"
title: Apply Version Updates From Current Changes
commit-message: 'apply version updates'
labels: 'version updates'
branch: 'release'
body: ${{ steps.covector.outputs.change }}
29 changes: 0 additions & 29 deletions .github/workflows/fmt.yml

This file was deleted.

31 changes: 13 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
name: Test
name: test

on:
push:
branches:
- dev
pull_request:
branches:
- dev

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
platform: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v2
runs-on: ${{ matrix.platform }}

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
steps:
- uses: actions/checkout@v4
- name: install system deps
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path ./Cargo.toml --release
- uses: dtolnay/rust-toolchain@stable
- run: cargo test
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ raw-window-handle = "0.5"

[dev-dependencies]
tao = "0.23"
winit = "0.28"
winit = {version = "0.29", default-features = false, features = ["x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita", "rwh_05"] }

[target."cfg(target_os = \"windows\")".dependencies.windows-sys]
version = "0.48.0"
Expand Down
3 changes: 2 additions & 1 deletion examples/tao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fn main() {
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
};
#[cfg(any(target_os = "windows", target_os = "macos"))]
use window_vibrancy::*;

let event_loop = EventLoop::new();
Expand All @@ -29,7 +30,7 @@ fn main() {
.expect("Unsupported platform! 'apply_blur' is only supported on Windows");

#[cfg(target_os = "macos")]
let _ = apply_vibrancy(&window, NSVisualEffectMaterial::HudWindow, None, None)
apply_vibrancy(&window, NSVisualEffectMaterial::HudWindow, None, None)
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");

#[cfg(target_os = "windows")]
Expand Down
8 changes: 4 additions & 4 deletions examples/tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ license = "MIT OR Apache-2.0"
edition = "2021"

[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.1", features = ["api-all"] }
serde_json = "1"
serde = { version = "1", features = ["derive"] }
tauri = { version = "1", features = ["api-all"] }
window-vibrancy = { path = "../../../" }


[build-dependencies]
tauri-build = { version = "1.1" }
tauri-build = { version = "1" }

[features]
default = ["custom-protocol"]
Expand Down
49 changes: 26 additions & 23 deletions examples/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: MIT

fn main() {
#[cfg(any(target_os = "windows", target_os = "macos"))]
use window_vibrancy::*;
#[cfg(target_os = "windows")]
use winit::platform::windows::{WindowBuilderExtWindows, WindowExtWindows};
Expand All @@ -12,7 +13,7 @@ fn main() {
window::WindowBuilder,
};

let event_loop = EventLoop::new();
let event_loop = EventLoop::new().unwrap();

#[allow(unused_mut)]
let mut builder = WindowBuilder::new()
Expand All @@ -29,33 +30,35 @@ fn main() {
.expect("Unsupported platform! 'apply_blur' is only supported on Windows");

#[cfg(target_os = "macos")]
let _ = apply_vibrancy(&window, NSVisualEffectMaterial::HudWindow, None, None)
apply_vibrancy(&window, NSVisualEffectMaterial::HudWindow, None, None)
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");

#[cfg(target_os = "windows")]
window.set_undecorated_shadow(true);
window.set_title("A fantastic window!");

event_loop.run(move |event, _, control_flow| {
*control_flow = ControlFlow::Wait;

match event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => *control_flow = ControlFlow::Exit,
Event::WindowEvent {
event:
WindowEvent::MouseInput {
state: ElementState::Pressed,
button: MouseButton::Left,
..
},
..
} => {
window.drag_window().unwrap();
event_loop
.run(move |event, event_loop| {
event_loop.set_control_flow(ControlFlow::Wait);

match event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => event_loop.exit(),
Event::WindowEvent {
event:
WindowEvent::MouseInput {
state: ElementState::Pressed,
button: MouseButton::Left,
..
},
..
} => {
window.drag_window().unwrap();
}
_ => (),
}
_ => (),
}
});
})
.unwrap();
}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
//! apply_blur(&window, Some((18, 18, 18, 125))).expect("Unsupported platform! 'apply_blur' is only supported on Windows");
//! ```

#![allow(clippy::deprecated_semver)]

mod macos;
mod windows;

Expand Down
7 changes: 4 additions & 3 deletions src/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// with a bit of rewrite by @youngsing to make it more like cocoa::appkit style.

/// <https://developer.apple.com/documentation/appkit/nsvisualeffectview/material>

#[repr(u64)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum NSVisualEffectMaterial {
Expand Down Expand Up @@ -110,9 +111,9 @@ mod internal {
}

let mut m = appearance;
if appearance as u32 > 9 && NSAppKitVersionNumber < NSAppKitVersionNumber10_14 {
m = NSVisualEffectMaterial::AppearanceBased;
} else if appearance as u32 > 4 && NSAppKitVersionNumber < NSAppKitVersionNumber10_11 {
if (appearance as u32 > 9 && NSAppKitVersionNumber < NSAppKitVersionNumber10_14)
|| (appearance as u32 > 4 && NSAppKitVersionNumber < NSAppKitVersionNumber10_11)
{
m = NSVisualEffectMaterial::AppearanceBased;
}

Expand Down
1 change: 1 addition & 0 deletions src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![cfg(target_os = "windows")]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(clippy::upper_case_acronyms)]

use std::ffi::c_void;
pub use windows_sys::Win32::{
Expand Down