mirror of
https://github.com/tauri-apps/window-shadows.git
synced 2026-02-04 02:31:23 +01:00
chore: licenses
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,2 +1,6 @@
|
||||
# Copyright 2020-2022 Tauri Programme within The Commons Conservancy
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
/target
|
||||
Cargo.lock
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
21
LICENSE
21
LICENSE
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Amr Bashir <https://github.com/amrbashir>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020-2021 Ngo Iok Ui & Tauri Apps Contributors
|
||||
Copyright (c) 2020-2022 Tauri Programme within The Commons Conservancy
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
10
LICENSE.spdx
10
LICENSE.spdx
@@ -6,14 +6,14 @@ PackageSupplier: Organization: The Tauri Programme in the Commons Conservancy
|
||||
PackageHomePage: https://tauri.app
|
||||
PackageLicenseDeclared: Apache-2.0
|
||||
PackageLicenseDeclared: MIT
|
||||
PackageCopyrightText: 2019-2021, The Tauri Programme in the Commons Conservancy
|
||||
PackageSummary: <text>Send Windows 10 styled notifications on Windows 7.
|
||||
PackageCopyrightText: 2020-2022, The Tauri Programme in the Commons Conservancy
|
||||
PackageSummary: <text>Add native shadows to your windows.
|
||||
</text>
|
||||
PackageComment: <text>The package includes the following libraries; see
|
||||
Relationship information.
|
||||
</text>
|
||||
Created: 2020-05-20T09:00:00Z
|
||||
PackageDownloadLocation: git://github.com/tauri-apps/win7-notifications
|
||||
PackageDownloadLocation: git+https://github.com/tauri-apps/tauri.git
|
||||
PackageDownloadLocation: git+ssh://github.com/tauri-apps/win7-notifications.git
|
||||
PackageDownloadLocation: git://github.com/tauri-apps/window-shadows
|
||||
PackageDownloadLocation: git+https://github.com/tauri-apps/window-shadows.git
|
||||
PackageDownloadLocation: git+ssh://github.com/tauri-apps/window-shadows.git
|
||||
Creator: Person: Daniel Thompson-Yvetot
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
// Copyright 2021 Tauri Programme within The Commons Conservancy
|
||||
// Copyright 2020-2022 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
use tao::{
|
||||
event::{Event, WindowEvent},
|
||||
event_loop::{ControlFlow, EventLoop},
|
||||
window::WindowBuilder,
|
||||
};
|
||||
use window_shadows::set_shadow;
|
||||
use tao::{
|
||||
event::{Event, WindowEvent},
|
||||
event_loop::{ControlFlow, EventLoop},
|
||||
window::WindowBuilder,
|
||||
};
|
||||
use window_shadows::set_shadow;
|
||||
|
||||
let event_loop = EventLoop::new();
|
||||
let event_loop = EventLoop::new();
|
||||
|
||||
let window = WindowBuilder::new()
|
||||
.with_decorations(false)
|
||||
.build(&event_loop)
|
||||
.unwrap();
|
||||
let window = WindowBuilder::new()
|
||||
.with_decorations(false)
|
||||
.build(&event_loop)
|
||||
.unwrap();
|
||||
|
||||
set_shadow(&window, true).expect("Unsupported platform!");
|
||||
set_shadow(&window, true).expect("Unsupported platform!");
|
||||
|
||||
window.set_title("A fantastic window!");
|
||||
window.set_title("A fantastic window!");
|
||||
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
*control_flow = ControlFlow::Wait;
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
*control_flow = ControlFlow::Wait;
|
||||
|
||||
match event {
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::CloseRequested,
|
||||
..
|
||||
} => *control_flow = ControlFlow::Exit,
|
||||
_ => (),
|
||||
}
|
||||
});
|
||||
match event {
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::CloseRequested,
|
||||
..
|
||||
} => *control_flow = ControlFlow::Exit,
|
||||
_ => (),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
4
examples/tauri/.gitignore
vendored
4
examples/tauri/.gitignore
vendored
@@ -1 +1,5 @@
|
||||
# Copyright 2020-2022 Tauri Programme within The Commons Conservancy
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
node_modules/
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@tauri-apps/cli": "^1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
<!-- Copyright 2020-2022 Tauri Programme within The Commons Conservancy
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
SPDX-License-Identifier: MIT
|
||||
-->
|
||||
<html>
|
||||
|
||||
<body>
|
||||
|
||||
4
examples/tauri/src-tauri/.gitignore
vendored
4
examples/tauri/src-tauri/.gitignore
vendored
@@ -1,3 +1,7 @@
|
||||
# Copyright 2020-2022 Tauri Programme within The Commons Conservancy
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
|
||||
@@ -2,20 +2,19 @@
|
||||
name = "app"
|
||||
version = "0.1.0"
|
||||
description = "A Tauri App"
|
||||
authors = [ "You" ]
|
||||
repository = ""
|
||||
authors = ["Tauri Programme within The Commons Conservancy"]
|
||||
edition = "2021"
|
||||
rust-version = "1.57"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
tauri = { version = "1.0.3", features = [ "api-all" ] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.0.3", features = ["api-all"] }
|
||||
window-shadows = { path = "../../../" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1.0.3" }
|
||||
|
||||
[features]
|
||||
default = [ "custom-protocol" ]
|
||||
custom-protocol = [ "tauri/custom-protocol" ]
|
||||
default = ["custom-protocol"]
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// Copyright 2020-2022 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
tauri_build::build()
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
max_width = 100
|
||||
hard_tabs = false
|
||||
tab_spaces = 2
|
||||
newline_style = "Auto"
|
||||
use_small_heuristics = "Default"
|
||||
reorder_imports = true
|
||||
reorder_modules = true
|
||||
remove_nested_parens = true
|
||||
edition = "2021"
|
||||
merge_derives = true
|
||||
use_try_shorthand = false
|
||||
use_field_init_shorthand = false
|
||||
force_explicit_abi = true
|
||||
imports_granularity = "Crate"
|
||||
@@ -1,18 +1,22 @@
|
||||
// Copyright 2020-2022 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
use tauri::Manager;
|
||||
use window_shadows::set_shadow;
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.setup(|app| {
|
||||
let window = app.get_window("main").unwrap();
|
||||
set_shadow(&window, true).expect("Unsupported platform!");
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
tauri::Builder::default()
|
||||
.setup(|app| {
|
||||
let window = app.get_window("main").unwrap();
|
||||
set_shadow(&window, true).expect("Unsupported platform!");
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
// Copyright 2021 Tauri Programme within The Commons Conservancy
|
||||
// Copyright 2020-2022 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
use window_shadows::set_shadow;
|
||||
use winit::{
|
||||
event::{Event, WindowEvent},
|
||||
event_loop::{ControlFlow, EventLoop},
|
||||
window::WindowBuilder,
|
||||
};
|
||||
use window_shadows::set_shadow;
|
||||
use winit::{
|
||||
event::{Event, WindowEvent},
|
||||
event_loop::{ControlFlow, EventLoop},
|
||||
window::WindowBuilder,
|
||||
};
|
||||
|
||||
let event_loop = EventLoop::new();
|
||||
let event_loop = EventLoop::new();
|
||||
|
||||
let window = WindowBuilder::new()
|
||||
.with_decorations(false)
|
||||
.build(&event_loop)
|
||||
.unwrap();
|
||||
let window = WindowBuilder::new()
|
||||
.with_decorations(false)
|
||||
.build(&event_loop)
|
||||
.unwrap();
|
||||
|
||||
set_shadow(&window, true).expect("Unsupported platform!");
|
||||
set_shadow(&window, true).expect("Unsupported platform!");
|
||||
|
||||
window.set_title("A fantastic window!");
|
||||
window.set_title("A fantastic window!");
|
||||
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
*control_flow = ControlFlow::Wait;
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
*control_flow = ControlFlow::Wait;
|
||||
|
||||
match event {
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::CloseRequested,
|
||||
..
|
||||
} => *control_flow = ControlFlow::Exit,
|
||||
_ => (),
|
||||
}
|
||||
});
|
||||
match event {
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::CloseRequested,
|
||||
..
|
||||
} => *control_flow = ControlFlow::Exit,
|
||||
_ => (),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
17
rustfmt.toml
17
rustfmt.toml
@@ -1,17 +0,0 @@
|
||||
max_width = 100
|
||||
hard_tabs = false
|
||||
tab_spaces = 2
|
||||
newline_style = "Unix"
|
||||
use_small_heuristics = "Default"
|
||||
reorder_imports = true
|
||||
reorder_modules = true
|
||||
remove_nested_parens = true
|
||||
edition = "2021"
|
||||
merge_derives = true
|
||||
use_try_shorthand = false
|
||||
use_field_init_shorthand = false
|
||||
force_explicit_abi = true
|
||||
# normalize_comments = true
|
||||
normalize_doc_attributes = true
|
||||
# wrap_comments = true
|
||||
license_template_path = ".license_template"
|
||||
72
src/lib.rs
72
src/lib.rs
@@ -1,4 +1,4 @@
|
||||
// Copyright 2021 Tauri Programme within The Commons Conservancy
|
||||
// Copyright 2020-2022 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
@@ -27,50 +27,50 @@
|
||||
/// - **macOS**: Shadows are always disabled for transparent windows.
|
||||
/// - **Linux**: Unsupported, Shadows are controlled by the compositor installed on the end-user system.
|
||||
pub fn set_shadow(
|
||||
window: impl raw_window_handle::HasRawWindowHandle,
|
||||
enable: bool,
|
||||
window: impl raw_window_handle::HasRawWindowHandle,
|
||||
enable: bool,
|
||||
) -> Result<(), Error> {
|
||||
match window.raw_window_handle() {
|
||||
#[cfg(target_os = "macos")]
|
||||
raw_window_handle::RawWindowHandle::AppKit(handle) => {
|
||||
use cocoa::{appkit::NSWindow, base::id};
|
||||
use objc::runtime::{NO, YES};
|
||||
match window.raw_window_handle() {
|
||||
#[cfg(target_os = "macos")]
|
||||
raw_window_handle::RawWindowHandle::AppKit(handle) => {
|
||||
use cocoa::{appkit::NSWindow, base::id};
|
||||
use objc::runtime::{NO, YES};
|
||||
|
||||
unsafe {
|
||||
(handle.ns_window as id).setHasShadow_(if enable { YES } else { NO });
|
||||
}
|
||||
unsafe {
|
||||
(handle.ns_window as id).setHasShadow_(if enable { YES } else { NO });
|
||||
}
|
||||
|
||||
Ok(())
|
||||
Ok(())
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
raw_window_handle::RawWindowHandle::Win32(handle) => {
|
||||
use windows_sys::Win32::{
|
||||
Graphics::Dwm::DwmExtendFrameIntoClientArea, UI::Controls::MARGINS,
|
||||
};
|
||||
|
||||
let m = if enable { 1 } else { 0 };
|
||||
let margins = MARGINS {
|
||||
cxLeftWidth: m,
|
||||
cxRightWidth: m,
|
||||
cyTopHeight: m,
|
||||
cyBottomHeight: m,
|
||||
};
|
||||
unsafe {
|
||||
DwmExtendFrameIntoClientArea(handle.hwnd as _, &margins);
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
_ => Err(Error::UnsupportedPlatform),
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
raw_window_handle::RawWindowHandle::Win32(handle) => {
|
||||
use windows_sys::Win32::{
|
||||
Graphics::Dwm::DwmExtendFrameIntoClientArea, UI::Controls::MARGINS,
|
||||
};
|
||||
|
||||
let m = if enable { 1 } else { 0 };
|
||||
let margins = MARGINS {
|
||||
cxLeftWidth: m,
|
||||
cxRightWidth: m,
|
||||
cyTopHeight: m,
|
||||
cyBottomHeight: m,
|
||||
};
|
||||
unsafe {
|
||||
DwmExtendFrameIntoClientArea(handle.hwnd as _, &margins);
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
_ => Err(Error::UnsupportedPlatform),
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
UnsupportedPlatform,
|
||||
UnsupportedPlatform,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "\"set_shadow()\" is only supported on Windows and macOS")
|
||||
}
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "\"set_shadow()\" is only supported on Windows and macOS")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user