Skip to content

Commit

Permalink
Merge branch 'dev' into set-theme-windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Legend-Master authored Aug 28, 2024
2 parents 6ebb6a2 + e47d4c4 commit 7e044ea
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .changes/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
},
"tao": {
"path": "./",
"manager": "rust"
"manager": "rust",
"dependencies": ["tao-macros"]
}
}
}
5 changes: 5 additions & 0 deletions .changes/kde-taskbar-progress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": "patch"
---

On Linux, removed internal check for current desktop environment before applying `Window::set_progress_bar` API. This should allow `Window::set_progress_bar` to work on KDE Plasma and similar environments that support `libunity` APIs.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## \[0.29.1]

- [`4cd53415`](https://github.com/tauri-apps/tao/commit/4cd534151a2d7a14ade906f960ec02655a91feae) ([#964](https://github.com/tauri-apps/tao/pull/964) by [@lucasfernog](https://github.com/tauri-apps/tao/../../lucasfernog)) Allow Android domain names to include `_1` as escaped `_` characters - required because `_` is the separator for domain parts.

## \[0.29.0]

- [`e67cf1b2`](https://github.com/tauri-apps/tao/commit/e67cf1b2826d32b8eb58f6d111271a1c42b62978) ([#941](https://github.com/tauri-apps/tao/pull/941) by [@Sanae6](https://github.com/tauri-apps/tao/../../Sanae6)) Prevent duplicate mouse press, release, and motion events from firing on Linux (fixes #939)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tao"
version = "0.29.0"
version = "0.29.1"
description = "Cross-platform window manager library."
authors = [
"Tauri Programme within The Commons Conservancy",
Expand Down
15 changes: 0 additions & 15 deletions src/platform_impl/linux/taskbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub struct TaskbarIndicator {
desktop_filename: Option<String>,
desktop_filename_c_str: Option<CString>,

is_supported: bool,
unity_lib: Option<Container<UnityLib>>,
attempted_load: bool,

Expand All @@ -32,7 +31,6 @@ impl TaskbarIndicator {
desktop_filename: None,
desktop_filename_c_str: None,

is_supported: is_supported(),
unity_lib: None,
attempted_load: false,

Expand Down Expand Up @@ -89,10 +87,6 @@ impl TaskbarIndicator {
self.desktop_filename = Some(uri);
}

if !self.is_supported {
return;
}

self.ensure_lib_load();

if !self.is_unity_running() {
Expand Down Expand Up @@ -127,12 +121,3 @@ impl TaskbarIndicator {
}
}
}

pub fn is_supported() -> bool {
std::env::var("XDG_CURRENT_DESKTOP")
.map(|d| {
let d = d.to_lowercase();
d.contains("unity") || d.contains("gnome")
})
.unwrap_or(false)
}
4 changes: 4 additions & 0 deletions tao-macros/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## \[0.1.3]

- [`4cd53415`](https://github.com/tauri-apps/tao/commit/4cd534151a2d7a14ade906f960ec02655a91feae) ([#964](https://github.com/tauri-apps/tao/pull/964) by [@lucasfernog](https://github.com/tauri-apps/tao/../../lucasfernog)) Allow Android domain names to include `_1` as escaped `_` characters - required because `_` is the separator for domain parts.

## \[0.1.2]

- [`b7758314`](https://github.com/tauri-apps/tao/commit/b7758314abf8c6916c865d9b31eea5bd17b2fe16)([#780](https://github.com/tauri-apps/tao/pull/780)) Added support to lifetime parameters on `android_fn`.
Expand Down
2 changes: 1 addition & 1 deletion tao-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tao-macros"
description = "Proc macros for tao"
version = "0.1.2"
version = "0.1.3"
edition = "2021"
authors = [ "Tauri Programme within The Commons Conservancy" ]
rust-version = "1.56"
Expand Down
20 changes: 16 additions & 4 deletions tao-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl Parse for AndroidFnInput {
/// 5. List of extra types your Rust function expects. Pass empty array if the function doesn't need any arugments.
/// - If your function takes an arguments as reference with a lifetime tied to the [`JNIEnv`], it should use `'local` as the lifetime name as it is the
/// lifetime name generated by the macro.
/// Note that all rust functions should expect the first two parameters to be [`JNIEnv`] and [`JClass`] so make sure they are imported into scope).
/// Note that all rust functions should expect the first two parameters to be [`JNIEnv`] and [`JClass`] so make sure they are imported into scope).
/// 6. (Optional) Return type of your rust function.
/// - If your function returns a reference with a lifetime tied to the [`JNIEnv`], it should use `'local` as the lifetime name as it is the
/// lifetime name generated by the macro.
Expand Down Expand Up @@ -202,7 +202,7 @@ pub fn android_fn(tokens: TokenStream) -> TokenStream {
} = tokens;

let domain = domain.to_string();
let package = package.to_string().replace('_', "_1").replace('-', "_1");
let package = package.to_string().replace('_', "_1");
let class = class.to_string();
let args = args
.into_iter()
Expand Down Expand Up @@ -273,6 +273,11 @@ impl Parse for GeneratePackageNameInput {
/// 1. snake_case representation of the reversed domain of the app.
/// 2. snake_case representation of the package name.
///
/// Note that `_` is the separator for the domain parts.
/// For instance the `com.tauri.app` identifier should be represented as
/// `generate_package_name!(com_tauri, app)`.
/// To escape the `_` character you can use `_1` which aligns with the default NDK implementation.
///
/// ## Example
///
/// ```
Expand All @@ -295,8 +300,15 @@ pub fn generate_package_name(tokens: TokenStream) -> TokenStream {
let tokens = parse_macro_input!(tokens as GeneratePackageNameInput);
let GeneratePackageNameInput { domain, package } = tokens;

let domain = domain.to_string().replace('_', "/");
let package = package.to_string().replace('-', "_");
// note that this character is invalid in an identifier so it's safe to use as replacement
const TEMP_ESCAPE_UNDERSCORE_REPLACEMENT: &str = "<";

let domain = domain
.to_string()
.replace("_1", TEMP_ESCAPE_UNDERSCORE_REPLACEMENT)
.replace('_', "/")
.replace(TEMP_ESCAPE_UNDERSCORE_REPLACEMENT, "_");
let package = package.to_string();

let path = format!("{}/{}", domain, package);
let litstr = LitStr::new(&path, proc_macro2::Span::call_site());
Expand Down

0 comments on commit 7e044ea

Please sign in to comment.