Add support for JComponent.titleBarCaption for macOS#1124
Open
ps-porpoise wants to merge 3 commits into
Open
Conversation
Adds JNI hooks setupFullWindowContentTitleBarCaption / removeFullWindowContentTitleBarCaption with a per-window callback (FullWindowContentTitleBarCaptionCallback) that decides whether a left mouse down in the title bar area should start a native window drag instead of being delivered to AWT. Implementation installs a FlatTitleBarDragView as a sibling of the standard window buttons; AppKit's normal hit-testing routes button and contentView clicks unchanged, only background clicks land on us and are either handed off via -[NSWindow performWindowDragWithEvent:] or forwarded to the contentView.
Registers a per-window callback with the native library when apple.awt.fullWindowContent is enabled. The callback runs the same shared isTitleBarCaptionAt traversal used on Windows, returning true for components marked with JComponent.titleBarCaption (or their children, recursively).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for the existing
JComponent.titleBarCaptionclient property when using fullWindowContent in macOS. The motivation is to allow configuration as to what components within the title bar region should drag the window, and which should block window dragging and have the events handled by AWT.The solution requires updates to the native code to support us attaching a callback which gets handled when attempting to drag the window, using a similar approach to that in FlatTitlePane for Windows. The approach also attaches a custom NSView (
FlatTitleBarDragView) to receive the mouse events from AppKit & conditionally forward them on.I've added some buttons to demonstrate & test the functionality within the FlatMacOSTest utility.
I've not rebuilt the .dylibs in these commits.
Please let me know any thoughts! Thanks :)