mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Merge pull request #6266 from danielmigueltejedor/fix/gnome-window-decorations
Enable font-free GNOME/Wayland controls for system title bars
This commit is contained in:
10 files changed
+76
-8
No files matched your search
Generated
+12
@@ -6662,6 +6662,17 @@ version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "sctk-adwaita"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec"
|
||||
dependencies = [
|
||||
"log",
|
||||
"smithay-client-toolkit 0.19.2",
|
||||
"tiny-skia",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "3.7.0"
|
||||
@@ -8931,6 +8942,7 @@ dependencies = [
|
||||
"raw-window-handle",
|
||||
"redox_syscall 0.4.1",
|
||||
"rustix 0.38.44",
|
||||
"sctk-adwaita",
|
||||
"smithay-client-toolkit 0.19.2",
|
||||
"smol_str",
|
||||
"tracing",
|
||||
|
||||
@@ -23,6 +23,37 @@ https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.md (today BIZ UDP
|
||||
BIZ UDMincho; not the web build), under the SIL Open Font License 1.1. Their licence texts
|
||||
ship with the package as OFL-<family>.txt.
|
||||
|
||||
Linux Wayland window decorations
|
||||
-------------------------------
|
||||
sctk-adwaita 0.10.1 (https://github.com/PolyMeilex/sctk-adwaita,
|
||||
commit d5f343c45c04d4a026db57f76760819b7325db00) is used by winit on Linux
|
||||
for vector window controls. Its title-font features are disabled: no Cantarell
|
||||
font is embedded by this dependency and no font file is added to this repo.
|
||||
|
||||
sctk-adwaita's MIT licence:
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Bartłomiej Maryńczak
|
||||
|
||||
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.
|
||||
|
||||
The egui-icons font subset is embedded from epaint_default_fonts by crates/ui-egui/build.rs
|
||||
and registered in the native and web fallback stacks by crates/ui-egui/src/egui_fonts.rs.
|
||||
It is a subset of emoji-icon-font by John Slegers; the same upstream MIT license applies.
|
||||
|
||||
@@ -122,6 +122,7 @@ Detail and the next releases: [docs/roadmap.md](docs/roadmap.md).
|
||||
|
||||
| Date | Entry |
|
||||
|---|---|
|
||||
| 2026-10-21 | Linux can use font-free Adwaita controls when System Title Bar is selected, while the integrated CSD title bar remains the default (as in #4439). Saved preferences are respected; startup and preference-dialog regressions cover both choices (#6266). |
|
||||
| 2026-10-17 | Object Finder classifies background by boundary coverage, retaining large enclosed foregrounds and rejecting surrounding backdrop (#6548); learned segmentation remains open (#2788) |
|
||||
| 2026-10-10 | Full re-measure against Photoshop 2026 27.11.0 (installed bundle inspected): breadth ~76%, ready ~45%, alpha. Progress docs reorganized (`parity.md` → `parity-checklist.md`, `parity-estimate.md` merged into `target-app-parity.md`). 0.6.0 released. |
|
||||
| 2026-10-09 | Remove tool, Rotate View, crop rotation; OpenRaster and Paint.NET; 39 Affinity documents in the corpus |
|
||||
|
||||
@@ -100,7 +100,7 @@ futures-lite = "=2.6.1"
|
||||
async-io = "=2.6.0"
|
||||
# Open the window through Xwayland for a pen on Wayland (`tablet.rs`, #639): eframe doesn't
|
||||
# re-export winit's `EventLoopBuilderExtX11`. Already in Cargo.lock (eframe); pinned exactly.
|
||||
winit = { version = "=0.30.13", default-features = false, features = ["x11"] }
|
||||
winit = { version = "=0.30.13", default-features = false, features = ["wayland-csd-adwaita-notitle", "x11"] }
|
||||
|
||||
# Safe Win32 wrappers on Windows: the pointer position for file drops (`cursor.rs`,
|
||||
# GetCursorPos) and the window frame for the custom title bar (`window_frame.rs`, window styles),
|
||||
|
||||
@@ -80,9 +80,9 @@ use photocraft_ui_egui::PhotocraftApp;
|
||||
|
||||
use photocraft_ui_egui::os_window::APP_ID;
|
||||
|
||||
/// Windows and Linux: no OS title bar; the app's top bar is the title bar, with its own caption
|
||||
/// buttons and edge resizing (`photocraft_ui_egui::titlebar`), as Photoshop does on Windows. macOS
|
||||
/// keeps its traffic lights over the integrated title strip.
|
||||
/// Windows and Linux can use the app's title bar, with its own caption buttons and edge resizing
|
||||
/// (`photocraft_ui_egui::titlebar`); the preference below selects the mode. macOS always keeps its
|
||||
/// system traffic lights over the integrated title strip.
|
||||
const CUSTOM_TITLEBAR: bool = !cfg!(target_os = "macos");
|
||||
|
||||
/// Whether this start draws its own title bar: Windows and Linux do, unless Preferences ›
|
||||
@@ -946,9 +946,12 @@ mod tests {
|
||||
let dir = std::env::temp_dir().join(format!("pc-titlebar-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let file = dir.join("prefs.json");
|
||||
assert_eq!(super::custom_titlebar(None), super::CUSTOM_TITLEBAR, "no preferences file: the default");
|
||||
let default_custom = super::CUSTOM_TITLEBAR;
|
||||
assert_eq!(super::custom_titlebar(None), default_custom, "no preferences file: the platform default");
|
||||
std::fs::write(&file, "not json").unwrap();
|
||||
assert_eq!(super::custom_titlebar(Some(&file)), super::CUSTOM_TITLEBAR, "an unreadable file: the default");
|
||||
assert_eq!(super::custom_titlebar(Some(&file)), default_custom, "an unreadable file: the platform default");
|
||||
std::fs::write(&file, r#"{"interface":{}}"#).unwrap();
|
||||
assert_eq!(super::custom_titlebar(Some(&file)), default_custom, "an older preference file: the platform default");
|
||||
std::fs::write(&file, r#"{"interface":{"systemTitleBar":true}}"#).unwrap();
|
||||
assert!(!super::custom_titlebar(Some(&file)));
|
||||
assert_eq!(super::native_options(false).viewport.decorations, Some(true));
|
||||
|
||||
@@ -295,7 +295,8 @@ pub struct Interface {
|
||||
pub show_bounding_box_when_dragging_layer: bool,
|
||||
/// Windows and Linux: use the system's title bar and window buttons instead of PhotoCraft's
|
||||
/// own one-row title bar (tiling window managers, desktops that draw their own decorations;
|
||||
/// #1271, #1316). Read when the app starts. macOS always uses the system's.
|
||||
/// #1271, #1316). The integrated title bar remains the default on Linux and Windows;
|
||||
/// the system frame is opt-in. Read when the app starts. macOS always uses the system's.
|
||||
pub system_title_bar: bool,
|
||||
/// Show the active document's file name in the title bar and the OS window title. The tabs
|
||||
/// already name the file, so this can be turned off for a plain "PhotoCraft" title (#5037).
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn system_title_bar_defaults_to_integrated_and_preserves_saved_choices() {
|
||||
let default = false;
|
||||
assert_eq!(Interface::default().system_title_bar, default);
|
||||
for saved in [json!({}), json!({"interface": {}})] {
|
||||
let prefs: Preferences = serde_json::from_value(saved).unwrap();
|
||||
assert_eq!(prefs.interface.system_title_bar, default);
|
||||
}
|
||||
for saved in [false, true] {
|
||||
let prefs: Preferences = serde_json::from_value(json!({"interface": {"systemTitleBar": saved}})).unwrap();
|
||||
assert_eq!(prefs.interface.system_title_bar, saved);
|
||||
let restored: Preferences = serde_json::from_value(prefs.to_json()).unwrap();
|
||||
assert_eq!(restored.interface.system_title_bar, saved);
|
||||
}
|
||||
}
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width": 32, "height": 32})).unwrap();
|
||||
|
||||
@@ -145,7 +145,7 @@ mod title_tests {
|
||||
|
||||
#[test]
|
||||
fn without_the_preference_the_mark_stays() {
|
||||
// The default (e.g. the web build or the snapshot example): no custom bar, no preference.
|
||||
// The default (e.g. the web build or snapshot example): the integrated title bar.
|
||||
let app = crate::PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||
assert!(!system_title_bar(&app));
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ building locally; the downloaded app is still subject to Windows application-con
|
||||
|
||||
## Build and run
|
||||
|
||||
On Linux, PhotoCraft keeps its integrated client-side decorated title bar by default (#4439), including desktop-matched buttons. Enabling **System Title Bar** in Preferences switches to the system frame at the next launch: on GNOME/Wayland, winit provides font-free Adwaita controls; on X11, the window manager supplies the frame. Explicit saved choices are respected and Windows/macOS defaults are unchanged.
|
||||
|
||||
```sh
|
||||
cargo run --release -p photocraft -- path/to/image.psd # desktop app
|
||||
cargo run --release -p photocraft -- --control 7878 --control-token-file .private/control.token \
|
||||
|
||||
@@ -137,6 +137,8 @@ fi
|
||||
if has appimage; then
|
||||
APPDIR="$WORK/PhotoCraft.AppDir"
|
||||
cp -R "$STAGE" "$APPDIR"
|
||||
# Preserve the sctk-adwaita MIT notice in the packaged AppImage.
|
||||
install -Dm644 "$ROOT/NOTICE" "$APPDIR/usr/share/doc/photocraft/NOTICE"
|
||||
# AppRun is a script, not a symlink: it installs the .desktop entry and icons into
|
||||
# $XDG_DATA_HOME before launching, so Wayland compositors can resolve the window's
|
||||
# app_id to our icon instead of the generic Wayland logo (#593; opt-out env in the
|
||||
|
||||
Reference in new issue
Block a user