Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Canvas: say when the desktop takes an Alt-click (#2003)

Gert Pellin - GPE24435de7bb3a
diff --git a/crates/ui-egui/src/alt_click_tests.rs b/crates/ui-egui/src/alt_click_tests.rs
new file mode 100644
index 000000000..6db030220
--- /dev/null
+++ b/crates/ui-egui/src/alt_click_tests.rs
@@ -0,0 +1,230 @@
+//! ⌥-click through the real canvas: the Brush's temporary Eyedropper (#1659) and the Clone
+//! Stamp's source point and painting (#1658).
+
+use egui::{Modifiers, PointerButton, Pos2, vec2};
+use egui_kittest::Harness;
+use serde_json::json;
+
+use crate::PhotocraftApp;
+use crate::canvas::ViewXform;
+use crate::state::Tool;
+
+fn harness(app: PhotocraftApp) -> Harness<'static, PhotocraftApp> {
+ let mut h = Harness::builder().with_size(vec2(900.0, 600.0)).build_ui_state(
+ |ui, app: &mut PhotocraftApp| {
+ let ctx = ui.ctx().clone();
+ if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
+ return;
+ }
+ crate::shortcuts::handle(app, &ctx);
+ egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
+ },
+ app,
+ );
+ PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ALL[0]);
+ h.run_steps(4);
+ let v = &mut h.state_mut().ui.views[0];
+ v.zoom = 1.0;
+ v.center = [100.0, 50.0];
+ v.fit_pending = false;
+ h.run_steps(2);
+ h
+}
+
+fn screen(h: &Harness<'static, PhotocraftApp>, x: f32, y: f32) -> Pos2 {
+ let app = h.state();
+ let v = &app.ui.views[0];
+ let xf = ViewXform {
+ rect: crate::rulers::content_rect(app, app.last_canvas_rect),
+ zoom: v.zoom,
+ center: v.center,
+ flip: app.ui.view.flip_horizontal,
+ rotation: v.rotation,
+ };
+ xf.to_screen(x, y)
+}
+
+fn mods(h: &mut Harness<'static, PhotocraftApp>, m: Modifiers) {
+ h.event(egui::Event::ModifiersChanged(m));
+ h.run_steps(1);
+}
+
+fn button(h: &mut Harness<'static, PhotocraftApp>, p: Pos2, down: bool, m: Modifiers) {
+ h.event(egui::Event::PointerButton { pos: p, button: PointerButton::Primary, pressed: down, modifiers: m });
+ h.run_steps(1);
+}
+
+/// A click at document point (x, y) with `m` held from before the press until after the release.
+fn click(h: &mut Harness<'static, PhotocraftApp>, x: f32, y: f32, m: Modifiers) {
+ let p = screen(h, x, y);
+ mods(h, m);
+ h.event(egui::Event::PointerMoved(p));
+ h.run_steps(1);
+ button(h, p, true, m);
+ button(h, p, false, m);
+ h.run_steps(1);
+ mods(h, Modifiers::NONE);
+}
+
+/// A drag between document points with `m` held throughout.
+fn drag(h: &mut Harness<'static, PhotocraftApp>, from: [f32; 2], to: [f32; 2], m: Modifiers) {
+ let p = screen(h, from[0], from[1]);
+ mods(h, m);
+ h.event(egui::Event::PointerMoved(p));
+ h.run_steps(1);
+ button(h, p, true, m);
+ for i in 1..=8 {
+ let t = i as f32 / 8.0;
+ let q = screen(h, from[0] + (to[0] - from[0]) * t, from[1] + (to[1] - from[1]) * t);
+ h.event(egui::Event::PointerMoved(q));
+ h.run_steps(1);
+ }
+ button(h, screen(h, to[0], to[1]), false, m);
+ h.run_steps(2);
+ mods(h, Modifiers::NONE);
+}
+
+/// Two halves: red on the left, green on the right, on one background layer.
+fn two_colours() -> PhotocraftApp {
+ let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
+ app.run("file.new", json!({"width": 200, "height": 100, "background": "white"})).unwrap();
+ app.run("select.rect", json!({"x": 0, "y": 0, "width": 100, "height": 100})).unwrap();
+ app.run("edit.fill", json!({"color": "#ff0000"})).unwrap();
+ app.run("select.rect", json!({"x": 100, "y": 0, "width": 100, "height": 100})).unwrap();
+ app.run("edit.fill", json!({"color": "#00ff00"})).unwrap();
+ app.run("select.deselect", json!({})).unwrap();
+ app.sync_views();
+ app
+}
+
+#[test]
+fn alt_click_with_the_brush_samples_the_foreground() {
+ let mut h = harness(two_colours());
+ h.state_mut().ui.tool = Tool::Brush;
+ h.state_mut().run("tools.setColors", json!({"foreground": [0.0, 0.0, 1.0, 1.0]})).unwrap();
+ let rev = h.state().session.active().unwrap().revision;
+ click(&mut h, 50.0, 50.0, Modifiers::ALT);
+ assert_eq!(h.state().session.tools.foreground, [1.0, 0.0, 0.0, 1.0], "⌥-click sampled red");
+ assert_eq!(h.state().session.active().unwrap().revision, rev, "nothing was painted");
+ click(&mut h, 150.0, 50.0, Modifiers::ALT);
+ assert_eq!(h.state().session.tools.foreground, [0.0, 1.0, 0.0, 1.0], "⌥-click sampled green");
+}
+
+#[test]
+fn alt_click_sets_the_clone_source_and_a_drag_paints_it() {
+ let mut h = harness(two_colours());
+ h.state_mut().ui.tool = Tool::CloneStamp;
+ h.state_mut().ui.tool_options.clone_sample = "all".into();
+ h.state_mut().run("tools.setBrush", json!({"brush": {"size": 10, "hardness": 1.0}})).unwrap();
+ click(&mut h, 150.0, 50.0, Modifiers::ALT);
+ assert!(h.state().session.presets.clone.active().source.is_some(), "⌥-click set the source");
+ let rev = h.state().session.active().unwrap().revision;
+ drag(&mut h, [30.0, 50.0], [70.0, 50.0], Modifiers::NONE);
+ let st = h.state().session.active().unwrap();
+ assert!(st.revision > rev, "the clone stroke was committed");
+ let px = st.doc.layers[0].surface().unwrap().rgba(50, 50);
+ assert!(px[1] > 0.9 && px[0] < 0.1, "green cloned over red: {px:?}");
+}
+
+#[test]
+fn clone_stamp_paints_an_empty_layer_from_the_layers_below() {
+ // The reported setup: a new empty layer on top, Sample: All Layers (or Current & Below).
+ for sample in ["all", "currentAndBelow"] {
+ for aligned in [true, false] {
+ let mut app = two_colours();
+ app.run("layer.new.layer", json!({})).unwrap();
+ app.sync_views();
+ let mut h = harness(app);
+ h.state_mut().ui.tool = Tool::CloneStamp;
+ h.state_mut().ui.tool_options.clone_sample = sample.into();
+ h.state_mut().ui.tool_options.clone_aligned = aligned;
+ h.state_mut().run("tools.setBrush", json!({"brush": {"size": 10, "hardness": 1.0}})).unwrap();
+ click(&mut h, 150.0, 50.0, Modifiers::ALT);
+ drag(&mut h, [30.0, 50.0], [70.0, 50.0], Modifiers::NONE);
+ drag(&mut h, [30.0, 20.0], [70.0, 20.0], Modifiers::NONE);
+ let st = h.state().session.active().unwrap();
+ let top = st.doc.layers.last().unwrap().surface().unwrap();
+ for y in [50, 20] {
+ let px = top.rgba(50, y);
+ assert!(px[1] > 0.9 && px[0] < 0.1 && px[3] > 0.9, "{sample} aligned={aligned} y={y}: {px:?}");
+ }
+ }
+ }
+}
+
+/// What X11 and Wayland deliver when the window manager grabs an Alt+left press (Cinnamon's
+/// window move): the pointer leaves and the keyboard focus goes (winit clears the modifiers),
+/// and both come back on release. The click itself never arrives.
+fn grabbed_alt_click(h: &mut Harness<'static, PhotocraftApp>, x: f32, y: f32, refocus: bool) {
+ let p = screen(h, x, y);
+ mods(h, Modifiers::ALT);
+ h.event(egui::Event::PointerMoved(p));
+ h.run_steps(2);
+ h.event(egui::Event::PointerGone);
+ h.event(egui::Event::WindowFocused(false));
+ h.input_mut().focused = false;
+ mods(h, Modifiers::NONE);
+ h.run_steps(1);
+ if refocus {
+ h.event(egui::Event::WindowFocused(true));
+ h.input_mut().focused = true;
+ mods(h, Modifiers::ALT);
+ }
+ h.event(egui::Event::PointerMoved(p));
+ h.run_steps(2);
+ mods(h, Modifiers::NONE);
+ h.input_mut().focused = true;
+}
+
+#[test]
+fn an_alt_click_the_window_manager_took_says_so() {
+ for tool in [Tool::Brush, Tool::Pencil, Tool::CloneStamp, Tool::Healing] {
+ let mut h = harness(two_colours());
+ h.state_mut().ui.tool = tool;
+ grabbed_alt_click(&mut h, 50.0, 50.0, true);
+ assert_eq!(h.state().ui.status, crate::alt_grab::message(), "{tool:?}");
+ assert!(h.state().ui.status_error);
+ }
+}
+
+#[test]
+fn leaving_the_window_without_a_grab_says_nothing() {
+ // Alt+Tab to another window: the pointer comes back to an unfocused window.
+ let mut h = harness(two_colours());
+ h.state_mut().ui.tool = Tool::Brush;
+ grabbed_alt_click(&mut h, 50.0, 50.0, false);
+ assert_ne!(h.state().ui.status, crate::alt_grab::message());
+ // No ⌥, or a tool whose ⌥-click does nothing special.
+ for (tool, m) in [(Tool::Brush, Modifiers::NONE), (Tool::Eraser, Modifiers::ALT)] {
+ let mut h = harness(two_colours());
+ h.state_mut().ui.tool = tool;
+ let p = screen(&h, 50.0, 50.0);
+ mods(&mut h, m);
+ h.event(egui::Event::PointerMoved(p));
+ h.run_steps(2);
+ h.event(egui::Event::PointerGone);
+ h.run_steps(1);
+ h.event(egui::Event::PointerMoved(p));
+ h.run_steps(2);
+ assert_ne!(h.state().ui.status, crate::alt_grab::message(), "{tool:?} {m:?}");
+ }
+ // A real ⌥-click arrives: it samples, and no message follows.
+ let mut h = harness(two_colours());
+ h.state_mut().ui.tool = Tool::Brush;
+ click(&mut h, 50.0, 50.0, Modifiers::ALT);
+ assert_eq!(h.state().session.tools.foreground, [1.0, 0.0, 0.0, 1.0]);
+ assert_ne!(h.state().ui.status, crate::alt_grab::message());
+}
+
+#[test]
+fn a_latched_alt_samples_and_sets_the_clone_source_without_the_key() {
+ // The way around a desktop that takes Alt+click: latch ⌥ in Window › Modifier Keys.
+ let mut h = harness(two_colours());
+ h.state_mut().ui.shell.sticky_alt = true;
+ h.state_mut().ui.tool = Tool::Brush;
+ click(&mut h, 150.0, 50.0, Modifiers::NONE);
+ assert_eq!(h.state().session.tools.foreground, [0.0, 1.0, 0.0, 1.0]);
+ h.state_mut().ui.tool = Tool::CloneStamp;
+ click(&mut h, 150.0, 50.0, Modifiers::NONE);
+ assert!(h.state().session.presets.clone.active().source.is_some());
+}
diff --git a/crates/ui-egui/src/alt_grab.rs b/crates/ui-egui/src/alt_grab.rs
new file mode 100644
index 000000000..0ba09bad7
--- /dev/null
+++ b/crates/ui-egui/src/alt_grab.rs
@@ -0,0 +1,62 @@
+//! An ⌥-click the desktop took (#1658, #1659).
+//!
+//! Many Linux desktops move a window with Alt+drag: Cinnamon (Linux Mint's default), MATE, Xfce,
+//! and KDE before Plasma 6. Their window manager grabs every Alt+left press, so the click never
+//! reaches PhotoCraft: the Brush's ⌥ Eyedropper samples nothing and the Clone Stamp gets no source
+//! point, while the ⌥ cursor still shows (the keyboard is not grabbed until the press). Nothing in
+//! the app can win that grab back, but its signature is clear: the pointer "leaves" the window from
+//! well inside the canvas while ⌥ is held with a tool whose ⌥-click matters (X11 and Wayland report
+//! a grab as the pointer leaving), and comes back to a window that still has the keyboard focus
+//! when the button is released. The status bar then says what happened and how to get ⌥-click
+//! back. An Alt+Tab away leaves the window without focus, so it never shows the message.
+
+use egui::{Context, Event, Id, Pos2, Rect};
+
+use crate::PhotocraftApp;
+use crate::state::Tool;
+
+/// How far inside the canvas the pointer must be for a "leave" to count as a grab rather than
+/// the pointer moving off the window.
+const MARGIN: f32 = 8.0;
+
+/// Per canvas view: where ⌥ was last held over it, and whether a grab is waiting for the pointer
+/// to come back.
+#[derive(Clone, Copy, Debug, Default)]
+struct Watch {
+ armed: Option<Pos2>,
+ pending: bool,
+}
+
+/// Tools whose ⌥-click does something: the ⌥ Eyedropper and the clone source point.
+pub(crate) fn alt_click_tool(tool: Tool, mods: egui::Modifiers) -> bool {
+ crate::canvas::alt_samples(tool, mods) || (mods.alt && !mods.ctrl && matches!(tool, Tool::CloneStamp | Tool::Healing))
+}
+
+/// The status-bar message for an ⌥-click the desktop took.
+pub(crate) fn message() -> &'static str {
+ tl!("Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys.")
+}
+
+/// Watch one canvas view's frame for an ⌥-click the window manager grabbed. `rect` is the view's
+/// canvas area, `tool` the tool in effect, `active` false while a dialog owns the canvas.
+pub(crate) fn watch(app: &mut PhotocraftApp, ctx: &Context, id: Id, rect: Rect, tool: Tool, active: bool) {
+ let (gone, hover, mods, down, focused) =
+ ctx.input(|i| (i.events.iter().any(|e| matches!(e, Event::PointerGone)), i.pointer.hover_pos(), i.modifiers, i.pointer.any_down(), i.focused));
+ let mut w = ctx.data(|d| d.get_temp::<Watch>(id)).unwrap_or_default();
+ if gone && w.armed.is_some() {
+ w.pending = true;
+ }
+ if w.pending
+ && let Some(p) = hover
+ && rect.contains(p)
+ {
+ w.pending = false;
+ if focused && active {
+ app.ui.status = message().into();
+ app.ui.status_error = true;
+ }
+ }
+ // Only the physical key: a latched Window › Modifier Keys ⌥ isn't held on the keyboard.
+ w.armed = hover.filter(|p| active && !gone && !down && rect.shrink(MARGIN).contains(*p) && alt_click_tool(tool, mods) && !mods.command);
+ ctx.data_mut(|d| d.insert_temp(id, w));
+}
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index 8c3a0bbde..594d0f427 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -2488,6 +2488,8 @@ pub fn canvas_view(app: &mut PhotocraftApp, ui: &mut egui::Ui, idx: usize, rect:
view.center[1] -= d.y;
} else if primary {
let mods = ui.input(|i| i.modifiers);
+ // An ⌥-click the window manager took never arrives; say so (alt_grab.rs).
+ crate::alt_grab::watch(app, &ctx, egui::Id::new(("pc-alt-grab", idx)), rect, tool, !under_dialog);
// Tools follow the left button; the right one opens the Brush Preset picker or erases
// (Preferences › Tools, `paint_mouse`).
crate::paint_mouse::sync_tool_brush(app);
@@ -3388,7 +3390,7 @@ fn draw_drag_preview(app: &mut PhotocraftApp, painter: &egui::Painter, xf: &View
/// Tools on which holding ⌥ (Alt) switches to the Eyedropper: a click or drag sets the
/// foreground colour, as with the Eyedropper itself (#417).
-fn alt_samples(tool: Tool, mods: egui::Modifiers) -> bool {
+pub(crate) fn alt_samples(tool: Tool, mods: egui::Modifiers) -> bool {
// Control+Alt is the brush-resize drag (`brush_resize`), not sampling.
mods.alt && !mods.ctrl && matches!(tool, Tool::Brush | Tool::Pencil | Tool::Gradient | Tool::PaintBucket)
}
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index 30f7b3d91..afb5ad290 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -2289,3 +2289,4 @@ fontWeight Italic Kurzíva
Cycle Overlay Přepnout překryv
Cycle Orientation Přepnout orientaci
Set the overlay options for the Crop tool Nastavit volby překryvu pro nástroj Oříznutí
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. Alt+klik převzalo pracovní prostředí, které pomocí Alt+tažení přesouvá okna. Nastavte jeho klávesu pro přesun oken na Super, nebo zamkněte Alt v nabídce Okno › Modifikační klávesy.
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index 02da857ec..41eb15f62 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -2327,3 +2327,4 @@ fontWeight Italic Kursiv
Cycle Overlay Überlagerung wechseln
Cycle Orientation Ausrichtung wechseln
Set the overlay options for the Crop tool Überlagerungsoptionen für das Freistellungswerkzeug festlegen
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. Der Alt-Klick ging an die Arbeitsumgebung, die Fenster mit Alt-Ziehen verschiebt. Stelle dort die Taste zum Verschieben von Fenstern auf Super oder raste Alt unter Fenster › Modifikatortasten ein.
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index 21d52448f..f2f503e28 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -3398,3 +3398,4 @@ fontWeight Thin Πολύ λεπτά
Cycle Overlay Εναλλαγή επικάλυψης
Cycle Orientation Εναλλαγή προσανατολισμού
Set the overlay options for the Crop tool Ορισμός επιλογών επικάλυψης για το εργαλείο Περικοπή
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. Το Alt-κλικ πήγε στο περιβάλλον εργασίας, που μετακινεί παράθυρα με Alt-σύρσιμο. Ορίστε το πλήκτρο μετακίνησης παραθύρων του σε Super ή κλειδώστε το Alt στο Παράθυρο › Πλήκτρα τροποποίησης.
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index a15f24d2d..f63060755 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -2357,3 +2357,4 @@ fontWeight Italic Cursiva
Cycle Overlay Alternar superposición
Cycle Orientation Alternar orientación
Set the overlay options for the Crop tool Definir las opciones de superposición de la herramienta Recortar
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. El Alt+clic lo recibió el escritorio, que mueve ventanas con Alt+arrastrar. Cambia su tecla para mover ventanas a Super o bloquea Alt en Ventana › Teclas modificadoras.
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index 06876c76f..b0fc124e1 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -2710,3 +2710,4 @@ fontWeight Italic Italique
Cycle Overlay Changer de superposition
Cycle Orientation Changer d’orientation
Set the overlay options for the Crop tool Définir les options de superposition de l’outil Recadrage
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. L’Alt-clic a été intercepté par le bureau, qui déplace les fenêtres avec Alt-glisser. Réglez sa touche de déplacement des fenêtres sur Super, ou verrouillez Alt dans Fenêtre › Touches de modification.
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 8d3f87f6f..167508373 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -2697,3 +2697,4 @@ fontWeight Italic Miring
Cycle Overlay Ganti Overlay
Cycle Orientation Ganti Orientasi
Set the overlay options for the Crop tool Atur opsi overlay untuk alat Crop
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. Alt-klik diambil oleh desktop, yang memindahkan jendela dengan Alt-seret. Atur tombol pemindah jendelanya ke Super, atau kunci Alt di Jendela › Tombol Pengubah.
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index 5a56a33ad..6449ff604 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -2358,3 +2358,4 @@ fontWeight Italic Corsivo
Cycle Overlay Cambia sovrapposizione
Cycle Orientation Cambia orientamento
Set the overlay options for the Crop tool Imposta le opzioni di sovrapposizione dello strumento Taglierina
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. L’Alt-click è andato al desktop, che sposta le finestre con Alt-trascina. Imposta il suo tasto per spostare le finestre su Super, oppure blocca Alt in Finestra › Tasti modificatori.
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 6c2a6c45a..87ba67677 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -3313,3 +3313,4 @@ fontWeight Italic 斜体
Cycle Overlay オーバーレイを切り替え
Cycle Orientation 方向を切り替え
Set the overlay options for the Crop tool 切り抜きツールのオーバーレイオプションを設定
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. Alt+クリックはデスクトップに取られました(Alt+ドラッグでウィンドウを移動する設定です)。デスクトップのウィンドウ移動キーを Super に変更するか、ウィンドウ › 修飾キーで Alt を固定してください。
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index 019caba47..1beadbc95 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -2867,3 +2867,4 @@ fontWeight Italic 기울임
Cycle Overlay 오버레이 순환
Cycle Orientation 방향 순환
Set the overlay options for the Crop tool 자르기 도구의 오버레이 옵션 설정
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. Alt 클릭이 데스크톱으로 전달되었습니다. 데스크톱이 Alt 드래그로 창을 이동합니다. 창 이동 키를 Super로 바꾸거나 창 › 보조 키에서 Alt를 고정하세요.
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index fc01d9076..71eb46e9d 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -3473,3 +3473,4 @@ cameraRaw Whites Witten
Cycle Overlay Overlay wisselen
Cycle Orientation Oriëntatie wisselen
Set the overlay options for the Crop tool Overlay-opties voor het gereedschap Uitsnijden instellen
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. De Alt-klik ging naar het bureaublad, dat vensters verplaatst met Alt-slepen. Stel daar de toets voor het verplaatsen van vensters in op Super, of vergrendel Alt via Venster › Wijzigingstoetsen.
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index 147f4ca72..feef7ecc9 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -3311,3 +3311,4 @@ cameraRaw Roughness Chropowatość
Cycle Overlay Przełącz nakładkę
Cycle Orientation Przełącz orientację
Set the overlay options for the Crop tool Ustaw opcje nakładki narzędzia Kadrowanie
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. Alt+kliknięcie przejęło środowisko pulpitu, które przesuwa okna przez Alt+przeciąganie. Ustaw w nim klawisz przesuwania okien na Super lub zablokuj Alt w Okno › Klawisze modyfikujące.
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index 01469534b..4aecf1b17 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -2717,3 +2717,4 @@ fontWeight Italic Itálico
Cycle Overlay Alternar sobreposição
Cycle Orientation Alternar orientação
Set the overlay options for the Crop tool Definir as opções de sobreposição da ferramenta Corte demarcado
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. O Alt-clique foi para o desktop, que move janelas com Alt-arrastar. Mude a tecla de mover janelas dele para Super ou trave o Alt em Janela › Teclas modificadoras.
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 6d73e1284..e9347c921 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -2562,3 +2562,4 @@ fontWeight Italic Курсив
Cycle Overlay Сменить перекрытие
Cycle Orientation Сменить ориентацию
Set the overlay options for the Crop tool Задать параметры перекрытия для инструмента «Рамка»
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. Alt+щелчок перехватило окружение рабочего стола: оно перемещает окна через Alt+перетаскивание. Назначьте для перемещения окон клавишу Super или зафиксируйте Alt в меню Окно › Клавиши-модификаторы.
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index 91472e10e..ecabc5b7e 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -3398,3 +3398,4 @@ cameraRaw Masking Маскування
Cycle Overlay Змінити накладання
Cycle Orientation Змінити орієнтацію
Set the overlay options for the Crop tool Задати параметри накладання для інструмента «Рамка»
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. Alt-клік перехопило робоче середовище, яке переміщує вікна через Alt-перетягування. Призначте для переміщення вікон клавішу Super або зафіксуйте Alt у меню Вікно › Клавіші-модифікатори.
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index b6684dba3..1dc946a27 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -2297,3 +2297,4 @@ fontWeight Italic 斜体
Cycle Overlay 循环切换叠加
Cycle Orientation 循环切换取向
Set the overlay options for the Crop tool 设置裁剪工具的叠加选项
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. Alt 单击被桌面环境截获了,它用 Alt 拖动来移动窗口。请把桌面的窗口移动键改为 Super,或在 窗口 › 修饰键 中锁定 Alt。
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index f3e832efa..144675e0b 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -2266,3 +2266,4 @@ fontWeight Italic 斜體
Cycle Overlay 循環切換覆蓋
Cycle Orientation 循環切換方向
Set the overlay options for the Crop tool 設定裁切工具的覆蓋選項
+ Alt-click went to the desktop, which moves windows with Alt-drag. Set its window-move key to Super, or latch Alt in Window › Modifier Keys. Alt 按一下被桌面環境攔截了,它用 Alt 拖曳來移動視窗。請把桌面的視窗移動鍵改為 Super,或在 視窗 › 輔助鍵 中鎖定 Alt。
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index e0097e02f..4657e1c44 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -19,6 +19,7 @@ pub mod adjust_dialog;
pub mod adjust_editors;
pub mod adjust_preview;
pub mod adjust_ui;
+mod alt_grab;
pub mod analysis_ui;
pub mod artboard_ui;
pub(crate) mod blend_preview;
@@ -1736,6 +1737,9 @@ mod marquee_tests;
#[cfg(test)]
mod stamp_tests;
+#[cfg(test)]
+mod alt_click_tests;
+
#[cfg(test)]
mod polygon_lasso_tests;