libnativeapi / libnativeapi/nativeapi

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

Ouverte
#48 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
C++
Étoiles
34
Forks
7
Merge moyen
3 j 1 h
PR mergées (30 j)
1

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Inspectez src/platform/macos/window_macos.mm, en vous concentrant sur la gestion de NSWindow pour TitleBarStyle::Hidden et sur les événements de souris dans la zone de la barre de titre. Reproduisez le problème sur macOS avec les deux réglages de AppleActionOnDoubleClick. Le travail est terminé lorsque le double-clic sur la zone masquée de la barre de titre agrandit ou réduit la fenêtre conformément à la préférence système, tandis que les barres de titre visibles restent inchangées.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
cpp, macos, objective-c
Domaine
desktop, operating-systems
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
68/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.