Merge pull request #3376 from Bruno-Alumn/fix/search-box-edges-drag-window-2807

LR-BEHAV-TITLEBAR: pressing at the search box's edge no longer moves the window (#2807)
This commit is contained in:
FredApps authored and GitHub committed 2026-11-27 23:18:18 +01:00
commit 03e910f002
4 files changed
+51 -1

No files matched your search

+10
View File
@@ -99,6 +99,12 @@ fn search_field(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, sr: Rect
if std::mem::take(&mut app.ui.focus_search) {
ui.memory_mut(|m| m.request_focus(id));
}
// The whole painted box is the field's, not the title bar's: the text field below fills only
// its middle, so without this a press on its padding (where a selection often starts) landed
// on the empty bar and, on macOS, moved the window (#2807). A click there focuses the field.
// `Sense::CLICK` and not `Sense::click()`: not focusable, so Tab still stops once, on the field,
// and screen readers get no second node beside it.
let bx = ui.interact(sr, id.with("box"), Sense::CLICK).on_hover_cursor(egui::CursorIcon::Text);
let focused = ui.memory(|m| m.has_focus(id));
ui.painter().rect(
sr,
@@ -125,6 +131,10 @@ fn search_field(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, sr: Rect
.text_color(t.text)
.show(&mut child)
.response;
// after the field: it gives up the focus on a click outside its own rect
if bx.clicked() {
ui.memory_mut(|m| m.request_focus(id));
}
if resp.changed() {
let q = app.ui.search.clone();
let _ = app.run("library.filter", json!({"text": q}));
+33
View File
@@ -357,3 +357,36 @@ fn the_title_bar_handle_stays_below_a_dropdown_open_in_the_dialog() {
assert!(h.app.ui.dialog.is_some(), "and leaves the dialog");
assert!(handle_at(&mut h), "the handle is back");
}
// Scenario: the search box's padding, around the text, is the field's too: pressing there (where
// a selection often starts) never moves the window, and a click there puts the cursor in the
// field (#2807)
#[test]
fn the_search_box_edges_keep_the_window_from_moving() {
let mut h = integrated();
let r = widget(&h, "field:search");
let hover = |h: &mut Headless, p: egui::Pos2| {
h.events.push(egui::Event::PointerMoved(p));
play(h);
craft_window::title_bar::window_movable(&h.view.ctx)
};
// the painted box is 28 high, centred on the field, and 10 wider on each side
let left_edge = egui::pos2(r.left() - 5.0, r.center().y);
let top_edge = egui::pos2(r.center().x, r.center().y - 12.0);
assert!(r.top() > top_edge.y, "the top edge point is outside the text field: {r:?}");
assert!(!hover(&mut h, left_edge), "the box's left padding");
assert!(!hover(&mut h, top_edge), "the box's top padding");
assert!(!hover(&mut h, r.center()), "the text field");
// above the box, the bar is empty again
assert!(hover(&mut h, egui::pos2(r.center().x, r.center().y - 18.0)), "the empty bar above the box moves the window");
h.request("ui.click", json!({"x": left_edge.x, "y": left_edge.y}), T);
play(&mut h);
let field = crate::text_field::id("field:search");
assert!(h.view.ctx.memory(|m| m.has_focus(field)), "a click on the box's edge focuses the field");
assert!(h.window_commands.is_empty(), "{:?}", h.window_commands);
// the box takes no keyboard focus: Shift+Tab from the field goes past it
h.request("ui.key", json!({"key": "Tab", "shift": true}), T);
play(&mut h);
let focused = h.view.ctx.memory(|m| m.focused());
assert!(focused.is_some_and(|f| f != field && f != field.with("box")), "{focused:?}");
}
+2 -1
View File
@@ -492,7 +492,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts).
| LR-BEHAV-LEARN | Tutorials | OOS | 🚫 | | |
| LR-BEHAV-WHATSNEW | What's new | P2 | ✅ | `cmd:app.whatsNew`, `docs/whats-new.md` | Help ▸ What's New: release highlights |
| LR-BEHAV-AI-EA | Early-access badges | P2 | ⬜ | | |
| LR-BEHAV-TITLEBAR | Title bar drag and double-click zoom (macOS) | P2 | 🟡 | `crates/ui-egui/src/panels/topbar.rs`, `crates/ui-egui/src/tests/titlebar.rs` | the native title bar is hidden on macOS, so the top bar's empty space (including the traffic-light margin) moves the window and a double-click does what System Settings › “Double-click a window's title bar to” says (zoom or restore, minimize, nothing; craft-window's `title_bar`); buttons and the search field keep their clicks; ignored in full screen, where the traffic lights are gone and the bar's left buttons move into their space (#1763). A press that starts on a button, the search field or a panel floating over the bar never moves the window (AppKit's `movable` is off while the pointer is there). While a dialog is open the bar is not dimmed, so it stays level with the window buttons AppKit draws over it (as under a macOS sheet): its controls are inactive, a click on it does not close the dialog, and its empty space still moves the window; not on a window with its native title bar, nor in full screen. Known gap: egui-winit reads the zoomed state only at start-up and after our own `Maximized` command, so a window zoomed another way (green button, Window ▸ Zoom, snapping) makes the first double-click a no-op before the toggle catches up. Checked by hand on a real macOS window (drag, zoom, restore) |
| LR-BEHAV-TITLEBAR | Title bar drag and double-click zoom (macOS) | P2 | 🟡 | `crates/ui-egui/src/panels/topbar.rs`, `crates/ui-egui/src/tests/titlebar.rs` | the native title bar is hidden on macOS, so the top bar's empty space (including the traffic-light margin) moves the window and a double-click does what System Settings › “Double-click a window's title bar to” says (zoom or restore, minimize, nothing; craft-window's `title_bar`); buttons and the search field keep their clicks; ignored in full screen, where the traffic lights are gone and the bar's left buttons move into their space (#1763). A press that starts on a button, the search field or a panel floating over the bar never moves the window (AppKit's `movable` is off while the pointer is there). The search field is its whole painted box, the padding around the text included: a click there puts the cursor in the field (#2807). While a dialog is open the bar is not dimmed, so it stays level with the window buttons AppKit draws over it (as under a macOS sheet): its controls are inactive, a click on it does not close the dialog, and its empty space still moves the window; not on a window with its native title bar, nor in full screen. Known gap: egui-winit reads the zoomed state only at start-up and after our own `Maximized` command, so a window zoomed another way (green button, Window ▸ Zoom, snapping) makes the first double-click a no-op before the toggle catches up. Checked by hand on a real macOS window (drag, zoom, restore) |
| LR-BEHAV-WINDOW | Window size and maximized state remembered | P2 | 🟡 | `crates/ui-egui/src/window_place.rs`, `apps/lightcraft/src/prefs.rs`, `apps/lightcraft/src/main.rs` | the window opens at the size it was left at, zoomed / maximized if it was; full screen and the place on the desktop are not remembered; Windows: a maximized window is built at its size and maximized once it shows (built maximized it could cover half the screen while Windows took it for maximized), and restored and maximized again once if it only says so; a window remembered larger than its screen is fitted to it. Not verified on several monitors with different scales on hardware |
## Y. Menus
@@ -816,6 +816,7 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove
| 2026-11-05 | patch | LRC-LIB-CATALOG-LOCK: a library is written only to the folder it was opened from (on Unix, where the system gives a folder an identity, it is checked before every write of the catalog, settings, lock note and thumbnails; a share mounted over it, or a replaced folder, is refused and nothing is written; a folder that holds this session's lock note counts as the opened one, so a drive mounted again keeps saving; on Windows only that the path is still a folder is checked, so a replaced folder or a share mounted at the same path is not caught), a Move import removes its originals only once the catalog log is on disk, and dropping the lock removes only the owner note it wrote itself (#3240); status unchanged |
| 2026-11-05 | minor | LR-EDIT-LENSBLUR: ⬜ → 🟡 (Lens Blur section: Apply, Blur Amount, Boost, focus on the subject or a mask; no depth map yet); LR-MASK-SLIDERS: a Lens Blur block in every mask (selection or outside, Amount, Boost, Transition); KEY-SECTIONS: ⌘6 opens Lens Blur |
| 2026-11-04 | minor | Compressed ORF support was introduced in #3775; subsequently withdrawn pending provenance review. Earlier clean-room and verification claims are withdrawn; compressed files use embedded previews when available. See [ORF status](orf-compression.md). |
| 2026-10-30 | patch | LR-BEHAV-TITLEBAR: the search box's padding around its text is the field's, not the title bar's: pressing there no longer moves the window on macOS, and a click there focuses the field (#2807); status counts unchanged |
| 2026-10-28 | minor | KEY-HIDEPINS ✅ → 🟡: in the Masking panel an unmodified H toggles the mask pins (`view.maskPins`, the View ▸ Show Mask Pins switch) instead of opening Remove; the toggle yields only to an explicit assignment of H itself, a Remove key reassigned to anything else still opens Remove there, and outside Masking — and the full-screen preview, where no panel shows — H keeps its own binding (Remove, by default). Remove's spot pins keep ⇧H as their only hide toggle (`tests/keymap` `h_toggles_the_mask_pins_while_masking`, `a_remapped_remove_key_still_opens_remove_while_masking`, `h_still_toggles_the_pins_when_remove_moves_to_another_key`) |
| 2026-11-07 | minor | LR-EDIT-EFFECTS-GRAIN, LRC-DEV-PROCESS: process V7 takes film grain to crystal layers ([grain.md](grain.md)); V1 to V6 keep value noise |
| 2026-11-06 | minor | LR-EDIT-DETAIL-CNR, LRC-DEV-PROCESS: process V6 takes colour noise reduction to the joint method on linear R−Y / B−Y (issue #815); status unchanged |
+6
View File
@@ -9,6 +9,12 @@
## Unreleased
### Pressing at the search box's edge no longer moves the window
- On macOS the top bar is the window's title bar, and the search box's padding around its text still belonged to
it: a press there, where a text selection often starts, dragged the whole window instead. The whole box is now
the search field's. A click anywhere in it puts the cursor in the field, and only the bar's empty space moves the
window (#2807).
### Export subfolder variables
- The Export dialog's Subfolder field now supports `{album}` (active album name sanitized for filesystem safety, empty outside an album view), `{date}` (batch export date in `YYYYMMDD`, local time), and `{hour}` (batch export time in `HHMM`, local time). An **Insert…** dropdown next to the field inserts tokens at the cursor. Tokens are stored in presets and expanded at export time, so the same preset produces dated subfolders on every use.
### Heal meets its surroundings (process 14)