mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-01 18:54:31 +01:00
Dock panels inside the window on native Wayland (#10341)
This commit is contained in:
1 parent
e5bdd539d0
commit
93286c8deb
2 files changed
+21
-2
No files matched your search
@@ -432,6 +432,12 @@ fn opens_through_xwayland(pref: Option<&str>) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// The docking runtime needs the backend the desktop window is opened on.
|
||||
fn desktop_shell_info(detected: Backend, forced_to_x11: bool) -> ShellInfo {
|
||||
let backend = if forced_to_x11 { Backend::X11 } else { detected };
|
||||
ShellInfo::current().backend(backend)
|
||||
}
|
||||
|
||||
/// The nightly channel this build is, as a string for the log.
|
||||
fn channel_name() -> &'static str {
|
||||
match build_flavor::COMPILED {
|
||||
@@ -718,10 +724,10 @@ fn main() -> std::process::ExitCode {
|
||||
// A window forced onto XWayland runs on X11, whose window manager draws the frame: the
|
||||
// framework decides the frame for that backend, from the platform, `VECTORCRAFT_TITLEBAR` and
|
||||
// Preferences › User Interface › System Title Bar.
|
||||
let shell_info = if forced_to_x11 { ShellInfo::current().backend(Backend::X11) } else { ShellInfo::current() };
|
||||
let shell_info = desktop_shell_info(Backend::from_env(), forced_to_x11);
|
||||
// On Wayland with no cursor theme, the system pointer stays and no tool cursor is painted
|
||||
// beside it (#2450, #5311).
|
||||
let wayland = !forced_to_x11 && Backend::from_env() == Backend::Wayland;
|
||||
let wayland = shell_info.backend == Backend::Wayland;
|
||||
let caps = cursor_theme::shell_caps(shell_info.caps, wayland, cursor_theme::theme_missing);
|
||||
let shell_info = shell_info.caps(caps);
|
||||
let titlebar_pref =
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn desktop_shell_reports_the_backend_selected_for_docking() {
|
||||
let wayland = desktop_shell_info(Backend::Wayland, false);
|
||||
assert_eq!(wayland.backend, Backend::Wayland);
|
||||
assert!(!wayland.window_positions(), "native Wayland keeps palettes inside the window");
|
||||
|
||||
for (detected, force_x11) in [(Backend::Wayland, true), (Backend::X11, false)] {
|
||||
let x11 = desktop_shell_info(detected, force_x11);
|
||||
assert_eq!(x11.backend, Backend::X11);
|
||||
assert!(x11.window_positions(), "X11 and XWayland can place native palettes");
|
||||
}
|
||||
}
|
||||
|
||||
/// The saved UI state of an old `ui.json`, as the legacy import reads it.
|
||||
fn legacy_ui(bytes: &[u8]) -> Option<vectorcraft_ui_egui::UiState> {
|
||||
vectorcraft_ui_egui::parse_legacy(bytes).ok().map(|(settings, _)| settings.ui)
|
||||
|
||||
Reference in new issue
Block a user