Files
DualFloatingClock/window_helper_macos.mm
T
sebastian d9008479c1 feat: tray-first UX, text outline, start-at-login toggle, font max 200
- All settings move to flat tray menu; right-click on clock disabled
- ClockLabel: custom QPainterPath text rendering with configurable
  glyph outline (BorderColor) — verified pixel-level offscreen
- Fixed glyph positioning bug (baseline math) caught by isolated test
- Window auto-fits content (adjustSize) — no more oversized clock
- Start at Login: checkable tray item, persisted in QSettings,
  LaunchAgent enable/disable (TDD: roundTrip test caught disable()
  returning false when plist already absent)
- Color dialog: hex/HTML input + 'transparent' + native picker fallback;
  opaque colors stored as #RRGGBB
- Border: glyph outline instead of box border; background still painted
  in paintEvent (QSS doesn't render with WA_TranslucentBackground on macOS)
- Removed window shadow (setHasShadow:NO), no bold, SF Pro Rounded
- Font size dialogs allow up to 200 (was 72)
- macOS: icon template 16pt, light/dark auto-adapt; LaunchAgent points
  to /Applications install
2026-08-19 22:41:33 +03:00

40 lines
1.4 KiB
Plaintext

#import "window_helper_macos.h"
#import <QWidget>
#ifdef Q_OS_MAC
#import <AppKit/AppKit.h>
#import <CoreGraphics/CGWindowLevel.h>
void MacOSWindowHelper::setupAlwaysOnTopForFullscreen(QWidget *widget)
{
if (!widget) return;
// Get the native NSView and NSWindow
NSView *nativeView = (NSView *)widget->winId();
NSWindow *nativeWindow = [nativeView window];
if (nativeWindow) {
// Set window level to be above everything, including fullscreen apps
[nativeWindow setLevel:NSScreenSaverWindowLevel - 1];
// Allow window to appear on all spaces (including fullscreen spaces)
[nativeWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces |
NSWindowCollectionBehaviorFullScreenAuxiliary |
NSWindowCollectionBehaviorStationary];
// Make it a floating panel that won't steal focus
[nativeWindow setHidesOnDeactivate:NO];
// Note: setFloatingPanel is deprecated, but we keep it for compatibility
// The key is setting the proper window level and collection behavior
// Ensure it stays above dock and menu bar
[nativeWindow setLevel:CGWindowLevelForKey(kCGFloatingWindowLevelKey)];
// Kill the system window shadow — text must float with no halo.
[nativeWindow setHasShadow:NO];
}
}
#endif // Q_OS_MAC