Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion frontend/src/components/window/TitleBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
const tooltip = getContext<TooltipState>("tooltip");

let menuBarLayout: Layout = [];
let lastMouseDown = 0;

$: showFullscreenButton = $appWindow.platform === "Web" || $fullscreen.windowFullscreen || (isDesktop() && $appWindow.fullscreen);
$: isFullscreen = isDesktop() ? $appWindow.fullscreen : $fullscreen.windowFullscreen;
Expand All @@ -41,7 +42,21 @@
{/if}
</LayoutRow>
<!-- Window frame -->
<LayoutRow class="window-frame" on:mousedown={() => !isFullscreen && editor.handle.appWindowDrag()} on:dblclick={() => !isFullscreen && editor.handle.appWindowMaximize()} />
<LayoutRow
class="window-frame"
on:mousedown={() => {
if (isFullscreen) return;

const now = Date.now();
if (now - lastMouseDown < 500) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider extracting the magic number 500 into a constant at the component level, for example const DOUBLE_CLICK_THRESHOLD_MS = 500;. This improves readability and maintainability.

Copy link
Contributor

@0HyperCube 0HyperCube Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear Sir or Madame Gemini Code Assist Bot,

Double click timing can be adjusted by the operating system for accessibility for people with reduced motor function.

The browser will automatically deal with this and report a double click event when appropriate; it can be bound using on:dblclick.

I would expect any fairly competent LLM to take this into account. I hope that will improve your code assistant capabilities as they are currently quite lacking.

Yours faithfully,
Hypercube

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0HyperCube What should I do, I believe the desktop app uses a fixed interval for detecting multi click across the app. This doesn't appear to follow OS settings either. Should I just use this approach only on linux and let other platforms use on:dblclick?

desktop/src/cef/consts.rs

pub(crate) const MULTICLICK_TIMEOUT: Duration = Duration::from_millis(500);

lastMouseDown = 0;
editor.handle.appWindowMaximize();
} else {
lastMouseDown = now;
editor.handle.appWindowDrag();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When the window is maximized, a single click on the title bar shouldn't initiate a drag. This can be prevented by adding a check for $appWindow.maximized before calling appWindowDrag().

if (!$appWindow.maximized) editor.handle.appWindowDrag();

}
}}
/>
<!-- Window buttons -->
<LayoutRow class="window-buttons" classes={{ fullscreen: showFullscreenButton, windows: $appWindow.platform === "Windows", linux: $appWindow.platform === "Linux" }}>
{#if $appWindow.platform !== "Mac"}
Expand Down
Loading