On Sat, 9 Nov 2024 07:45:19 GMT, Michael Strauß <mstra...@openjdk.org> wrote:

>> Implementation of [`EXTENDED` stage 
>> style](https://gist.github.com/mstr2/0befc541ee7297b6db2865cc5e4dbd09).
>
> Michael Strauß has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains 34 commits:
> 
>  - Merge branch 'master' into feature/extended-window
>  - Merge branch 'master' into feature/extended-window
>  - add system menu documentation
>  - WindowControlsOverlay snapping
>  - HeaderBar javadoc change
>  - refactor performWindowDrag
>  - HeaderBar changes
>  - EMPTY Dimension2D constant
>  - use CsvSource in HeaderBarTest
>  - stylistic changes
>  - ... and 24 more: https://git.openjdk.org/jfx/compare/d0011b21...65f095ef

Kudos for tackling this and doing such a thorough job. I'll try to look over 
the Windows code in the next couple of weeks.

modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacWindow.java line 
176:

> 174:                 if (eventHandler != null && 
> eventHandler.pickDragAreaNode(wx, wy) != null) {
> 175:                     if (clickCount == 2) {
> 176:                         maximize(!isMaximized());

The title bar double-click behavior is user-configurable. Unfortunately the 
only way to get this right is to query for an undocumented but widely-known 
preference.


NSString* action = [NSUserDefaults.standardUserDefaults stringForKey: 
@"AppleActionOnDoubleClick"];
if ([action isEqualToString: @"Minimize"]) {
    [window performMiniaturize: nil];
}
else if ([action isEqualToString: @"Maximize"]) {
    [window performZoom: nil];
}

modules/javafx.graphics/src/main/native-glass/mac/GlassViewDelegate.m line 1148:

> 1146: - (void)performWindowDrag
> 1147: {
> 1148:     if (lastEvent != nil) {

This is correct code but it would be more bullet-proof if you used 
`NSApp.currentEvent` rather than `lastEvent`. I'm fine either way.

modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m line 465:

> 463:             [window->nsWindow setTitlebarAppearsTransparent:YES];
> 464:             [window->nsWindow setToolbar:[NSToolbar new]];
> 465:             [window->nsWindow 
> setToolbarStyle:NSWindowToolbarStyleUnifiedCompact];

The presence of an empty toolbar is confusing fullscreen mode. My attempt at a 
fix was to add a few lines in GlassWindow+Overrides.m. In 
`windowWillEnterFullScreen` I added:

if (nsWindow.toolbar != nil) {
    nsWindow.toolbar.visible = NO;
}

I made the toolbar visible again in `windowDidExitFullScreen`. I tried doing 
this in `windowWillExitFullScreen` but it didn't work.

These delegate methods are all you need to tweak. There's still a bunch of code 
strewn about related to non-native fullscreen handling but it's all unused 
cruft.

modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m line 1542:

> 1540:     GLASS_POOL_ENTER;
> 1541:     {
> 1542:         NSString* preferredLanguage = [[NSLocale preferredLanguages] 
> objectAtIndex:0];

Is there some reason you're not using the 
`NSWindow.windowTitlebarLayoutDirection` property?

-------------

PR Review: https://git.openjdk.org/jfx/pull/1605#pullrequestreview-2436362179
PR Review Comment: https://git.openjdk.org/jfx/pull/1605#discussion_r1842448874
PR Review Comment: https://git.openjdk.org/jfx/pull/1605#discussion_r1842389767
PR Review Comment: https://git.openjdk.org/jfx/pull/1605#discussion_r1842416159
PR Review Comment: https://git.openjdk.org/jfx/pull/1605#discussion_r1842465120

Reply via email to