Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8313424: JavaFX controls in the title bar #1605

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3d19b87
WIP
mstr2 Oct 19, 2024
0ddd63d
doc change
mstr2 Oct 20, 2024
7969622
revert unintended change
mstr2 Oct 20, 2024
a289572
Merge branch 'master' into feature/extended-window
mstr2 Oct 23, 2024
ba02e8f
Improve HeaderBar documentation
mstr2 Oct 24, 2024
f973e8c
improve documentation
mstr2 Oct 25, 2024
f02e7e9
Windows: add system menu
mstr2 Oct 25, 2024
fef8cfc
Windows: custom context menu overrides system menu
mstr2 Oct 26, 2024
778e6c1
GTK: prevent resizing below window button size, fix crash
mstr2 Oct 26, 2024
3b468fe
GTK: add system menu
mstr2 Oct 26, 2024
0526edb
small code changes
mstr2 Oct 28, 2024
95736df
remove unused code
mstr2 Oct 28, 2024
d9c0fe2
Merge branch 'master' into feature/extended-window
mstr2 Oct 28, 2024
c0b588f
set minHeight to native height of title bar
mstr2 Oct 28, 2024
d7f88c3
better documentation
mstr2 Oct 28, 2024
9de4694
macOS: hide window title
mstr2 Oct 28, 2024
cd5d443
improve title text documentation
mstr2 Oct 28, 2024
bc48ae0
fix peer access outside of synchronizer
mstr2 Oct 28, 2024
804d0be
NPE
mstr2 Oct 28, 2024
f5e3121
fix header bar height flicker
mstr2 Oct 28, 2024
1c4ecc1
macOS: dynamically adapt toolbar style to headerbar height
mstr2 Oct 29, 2024
15dc3ff
Merge branch 'master' into feature/extended-window
mstr2 Oct 31, 2024
9b63892
Merge branch 'master' into feature/extended-window
mstr2 Nov 1, 2024
e7febc5
fix mirroring/unmirroring of X coord in win-glass
mstr2 Nov 5, 2024
d1c388b
stylistic changes
mstr2 Nov 5, 2024
8c9fbbd
use CsvSource in HeaderBarTest
mstr2 Nov 5, 2024
3660a29
EMPTY Dimension2D constant
mstr2 Nov 5, 2024
8974c14
HeaderBar changes
mstr2 Nov 5, 2024
ca9b325
refactor performWindowDrag
mstr2 Nov 6, 2024
8e77a22
HeaderBar javadoc change
mstr2 Nov 7, 2024
4336735
WindowControlsOverlay snapping
mstr2 Nov 7, 2024
a9178b7
add system menu documentation
mstr2 Nov 7, 2024
6a16536
Merge branch 'master' into feature/extended-window
mstr2 Nov 7, 2024
65f095e
Merge branch 'master' into feature/extended-window
mstr2 Nov 9, 2024
d5afc7d
Merge branch 'master' into feature/extended-window
mstr2 Nov 14, 2024
26b81b8
remove unneeded dll
mstr2 Nov 14, 2024
003e9d5
macOS: double-click action + fullscreen toolbar
mstr2 Nov 14, 2024
485a9d9
Merge branch 'master' into feature/extended-window
mstr2 Nov 14, 2024
743626f
Merge branch 'master' into feature/extended-window
mstr2 Dec 6, 2024
d9b82c8
Add HeaderBar.overlappingSystemInset property
mstr2 Dec 6, 2024
8649f91
StyleableBooleanProperty -> BooleanProperty
mstr2 Dec 6, 2024
af35dce
Merge branch 'master' into feature/extended-window
mstr2 Dec 10, 2024
6523073
fix system menu for non-resizeable extended window
mstr2 Dec 10, 2024
8d5d7b8
add StageStyle.EXTENDED_UTILITY
mstr2 Dec 10, 2024
eaafd9f
fix resizable states for GTK windows
mstr2 Dec 10, 2024
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
4 changes: 2 additions & 2 deletions buildSrc/win.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,9 @@ WIN.glass.rcFlags = [
WIN.glass.ccFlags = [ccFlags].flatten()
WIN.glass.linker = linker
WIN.glass.linkFlags = (IS_STATIC_BUILD ? [linkFlags] : [linkFlags, "delayimp.lib", "gdi32.lib", "urlmon.lib", "Comdlg32.lib",
"winmm.lib", "imm32.lib", "shell32.lib", "Uiautomationcore.lib", "dwmapi.lib", "uxtheme.lib",
"winmm.lib", "imm32.lib", "shell32.lib", "Uiautomationcore.lib", "dwmapi.lib",
"/DELAYLOAD:user32.dll", "/DELAYLOAD:urlmon.dll", "/DELAYLOAD:winmm.dll", "/DELAYLOAD:shell32.dll",
"/DELAYLOAD:Uiautomationcore.dll", "/DELAYLOAD:dwmapi.dll", "/DELAYLOAD:uxtheme.dll"]).flatten()
"/DELAYLOAD:Uiautomationcore.dll", "/DELAYLOAD:dwmapi.dll"]).flatten()
WIN.glass.lib = "glass"

WIN.decora = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ protected void _releaseInput(long ptr) {

private native void _performWindowDrag(long ptr);

private native void _performTitleBarDoubleClickAction(long ptr);

@Override
public NonClientHandler getNonClientHandler() {
return (type, button, x, y, xAbs, yAbs, clickCount) -> {
Expand All @@ -173,7 +175,7 @@ public NonClientHandler getNonClientHandler() {
View.EventHandler eventHandler = view != null ? view.getEventHandler() : null;
if (eventHandler != null && eventHandler.pickDragAreaNode(wx, wy) != null) {
if (clickCount == 2) {
maximize(!isMaximized());
_performTitleBarDoubleClickAction(getRawHandle());
} else if (clickCount == 1) {
_performWindowDrag(getRawHandle());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1145,9 +1145,7 @@ - (BOOL)suppressMouseEnterExitOnMouseDown

- (void)performWindowDrag
{
if (lastEvent != nil) {
[[nsView window] performWindowDragWithEvent:lastEvent];
}
[[nsView window] performWindowDragWithEvent:[NSApp currentEvent]];
}

static jstring convertNSStringToJString(id aString, int length)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification
NSUInteger mask = [self->nsWindow styleMask];
self->isWindowResizable = ((mask & NSWindowStyleMaskResizable) != 0);
[[self->view delegate] setResizableForFullscreen:YES];

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

- (void)windowDidEnterFullScreen:(NSNotification *)notification
Expand All @@ -222,6 +226,10 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification
{
//NSLog(@"windowDidExitFullScreen");

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

GlassViewDelegate* delegate = (GlassViewDelegate*)[self->view delegate];
[delegate setResizableForFullscreen:self->isWindowResizable];

Expand Down
27 changes: 27 additions & 0 deletions modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,33 @@ static jlong _createWindowCommonDo(JNIEnv *env, jobject jWindow, jlong jOwnerPtr
GLASS_CHECK_EXCEPTION(env);
}

/*
* Class: com_sun_glass_ui_mac_MacWindow
* Method: _performTitleBarDoubleClickAction
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_sun_glass_ui_mac_MacWindow__1performTitleBarDoubleClickAction
(JNIEnv *env, jobject jWindow, jlong jPtr)
{
LOG("Java_com_sun_glass_ui_mac_MacWindow__1performTitleBarDoubleClickAction");
if (!jPtr) return;

GLASS_ASSERT_MAIN_JAVA_THREAD(env);
GLASS_POOL_ENTER;
{
GlassWindow *window = getGlassWindow(env, jPtr);
NSString* action = [NSUserDefaults.standardUserDefaults stringForKey:@"AppleActionOnDoubleClick"];

if ([action isEqualToString:@"Minimize"]) {
[window->nsWindow performMiniaturize:nil];
} else if ([action isEqualToString:@"Maximize"]) {
[window->nsWindow performZoom:nil];
}
}
GLASS_POOL_EXIT;
GLASS_CHECK_EXCEPTION(env);
}

/*
* Class: com_sun_glass_ui_mac_MacWindow
* Method: _setToolbarStyle
Expand Down
1 change: 1 addition & 0 deletions modules/javafx.graphics/src/test/addExports
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
--add-opens javafx.graphics/javafx.scene.layout=ALL-UNNAMED
--add-opens javafx.graphics/javafx.scene.paint=ALL-UNNAMED
--add-opens javafx.graphics/javafx.stage=ALL-UNNAMED
--add-opens java.desktop/javax.imageio=ALL-UNNAMED
mstr2 marked this conversation as resolved.
Show resolved Hide resolved
#
# compile time additions
--add-exports=javafx.base/com.sun.javafx.runtime=ALL-UNNAMED
Expand Down