Skip to content

misterdownloadmanager: The ultimate open-source, clean-room download manager written from scratch in pure Rust for Windows, Mac, and Linux

Linux: menus open under their title on tiling compositors (sway) too (Fixes #267) (#275)

Ahmed Nefzaoui08860c9f6dce
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d35c8206..4781652a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -587,6 +587,12 @@ Each release's notes on GitHub come from its section here (`## [X.Y.Z]`, see
### Fixed
+- **Linux: menus open under their title on tiling compositors**
+ ([#267](https://github.com/anefzaoui/misterdownloadmanager/issues/267)): under sway (through
+ XWayland, MDM's default in a Wayland session), the menu bar's menus, their submenus, the
+ right-click menus and the drop-down lists opened in the middle of the screen, as the compositor
+ placed them like windows. They are now menu windows no window manager places, as X11 menus are,
+ so they open where MDM puts them, on every window manager.
- **Linux: a missing window library is named, with how to install it**
([#265](https://github.com/anefzaoui/misterdownloadmanager/issues/265)): from the tar.gz or the
AppImage, on a system without libxkbcommon-x11 (or another library X11 windows need), MDM
diff --git a/ROADMAP.md b/ROADMAP.md
index 0b55d949..442fc6a2 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -13,6 +13,9 @@ Everything below ships together, in one release, as version 0.3.0.
### Done
+- ✅ Linux: menus and drop-down lists open under what was clicked on tiling compositors (sway)
+ too, through XWayland, as on GNOME and KDE
+ ([#267](https://github.com/anefzaoui/misterdownloadmanager/issues/267))
- ✅ Linux: a library the window needs that the system lacks (libxkbcommon-x11 and the other X11
ones, from the tar.gz and the AppImage) is named at start, on the terminal and in a message box,
with the command that installs it, instead of a crash; in a Wayland session the window opens
diff --git a/crates/app/src/chrome.rs b/crates/app/src/chrome.rs
index f1871663..644dad47 100644
--- a/crates/app/src/chrome.rs
+++ b/crates/app/src/chrome.rs
@@ -1037,6 +1037,15 @@ fn popup_level<C: Clone>(
.with_active(false)
.with_position(screen.min)
.with_inner_size(size);
+ // Linux, X11 and XWayland (MDM's default): a menu window the window manager doesn't manage
+ // (override-redirect), as X11 menus are, so it opens exactly where it's placed. A tiling
+ // compositor (sway) placed a managed one as it likes, centred on the screen (#267). Never
+ // activated either way (the main window keeps the keyboard); its type says it's a menu.
+ // Ignored on Wayland, which has no such window.
+ #[cfg(target_os = "linux")]
+ let builder = builder
+ .with_override_redirect(true)
+ .with_window_type(egui::X11WindowType::PopupMenu);
let open_sub = if depth == 0 {
ctx.data(|d| d.get_temp::<usize>(sub_key))
} else {