libnativeapi / libnativeapi/nativeapi

[Bug] Double-click on title bar doesn't work when title bar is hidden on macOS

Aperta
#48 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C++
Stelle
34
Fork
7
Merge medio
3g 1h
PR unite (30g)
1

Descrizione

Description

When a window has its title bar hidden (using TitleBarStyle::Hidden), double-clicking on the title bar area does not trigger the expected system behavior (zoom/maximize or minimize) on macOS. The window appears to ignore double-click events in the title bar region entirely.

Environment

  • Platform: macOS
  • Affected versions: All versions (tested on macOS Ventura and later)
  • Window style: TitleBarStyle::Hidden

Steps to Reproduce

  1. Create a window with TitleBarStyle::Hidden set:
    window_ptr->SetTitleBarStyle(nativeapi::TitleBarStyle::Hidden);
    
  2. Run the application
  3. Double-click on the title bar area of the window (the region where the title bar would normally be)
  4. Observe that nothing happens

Expected Behavior

Double-clicking on the title bar area should trigger the system default action based on the user's "AppleActionOnDoubleClick" system preference:

  • Zoom/Maximize (default behavior)
  • Minimize (if configured in System Settings → Desktop & Dock → Double-click a window's title bar to)

This should match the behavior of standard macOS applications.

Actual Behavior

The double-click event is either:

  • Not being received by the window, or
  • Being received but not processed because the window doesn't recognize clicks in the title bar area when the title bar is hidden

The window remains in its current state without any zoom or minimize action occurring.

Root Cause Analysis

When TitleBarStyle::Hidden is applied, the window's title bar is visually hidden, but more importantly, the window's default double-click handling for the title bar area appears to be disabled. Standard NSWindow behavior relies on the title bar being present and interactive to handle double-click events.

The current implementation does not override mouseUp: or any other mouse event handler to manually detect and handle double-clicks in the title bar region when the title bar is hidden.

Additional Context

  • This issue does not occur when the title bar is visible (default behavior works correctly)
  • The issue affects all windows created with TitleBarStyle::Hidden
  • Users expect consistent behavior regardless of title bar visibility
  • This is a UX regression that makes windows with hidden title bars feel inconsistent with native macOS applications

Impact

  • Users cannot use the standard double-click gesture to zoom/maximize or minimize windows
  • Applications using hidden title bars lose this common macOS interaction pattern
  • May confuse users who expect consistent window management behavior

Related Code

  • File: src/platform/macos/window_macos.mm
  • The current NSWindow implementation does not have custom mouse event handling for double-click detection in the title bar area when the title bar is hidden

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Esamina src/platform/macos/window_macos.mm, concentrandoti sulla gestione di NSWindow per TitleBarStyle::Hidden e sugli eventi del mouse nell'area della barra del titolo. Riproduci il problema su macOS con entrambe le impostazioni di AppleActionOnDoubleClick. Il lavoro è completato quando un doppio clic sulla regione nascosta della barra del titolo ingrandisce o riduce la finestra in base alla preferenza di sistema, mentre le barre del titolo visibili rimangono invariate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, macos, objective-c
Ambito
desktop, operating-systems
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
68/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.