jfx
jfx copied to clipboard
8271557: Undecorated interactive stage style
This PR introduces StageStyle.UNDECORATED_INTERACTIVE
. This style is similiar to StageStyle.UNDECORATED
, but adds platform-specific interactions to the window.
For all platforms, this includes move and resize behaviors. On Windows, it also includes Aero behaviors (snap to screen edges, dock at top to maximize, etc.).
Additionally, on Windows this style adds window animations and a drop shadow (both of which StageStyle.UNDECORATED
lacks).
This new style can be used to create custom window decorations without losing window interactions.
Applications that use this stage style need to provide an implementation of WindowRegionClassifier
to let the JavaFX windowing subsystem know which parts of the window should afford window interactions:
stage.initStyle(StageStyle.UNDECORATED_INTERACTIVE);
stage.initRegionClassifier(new WindowRegionClassifier() {
@Override
public WindowRegion classify(double x, double y, Node nodeAtPosition) {
// Regions can be identified by the node under the current cursor position...
if (nodeAtPosition == titleBar) {
return WindowRegion.TITLE;
}
// ...or by window coordinates
if (x < 10) {
return WindowRegion.LEFT;
}
if (x > primaryStage.getWidth() - 10) {
return WindowRegion.RIGHT;
}
return WindowRegion.CLIENT;
}
});
If a window region is not returned from the classifier, no interaction will be available for this region.
Progress
- [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
Warning
⚠️ Patch contains a binary file (apps/samples/3DViewer/src/test/resources/com/javafx/importers/dae/test-data-maya/duke.png)
Issue
- JDK-8271557: Undecorated interactive stage style (Enhancement - P4)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/594/head:pull/594
$ git checkout pull/594
Update a local copy of the PR:
$ git checkout pull/594
$ git pull https://git.openjdk.org/jfx.git pull/594/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 594
View PR using the GUI difftool:
$ git pr show -t 594
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/594.diff
:wave: Welcome back mstrauss! A progress list of the required criteria for merging this PR into master
will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.
This is a great idea!
great please make it happen
Please make this happen
This would be great for creating customized themes with different window decorations if that were to be supported some time down the line with this feature.
Is there anything blocking this from moving forward in the review process?
This would be great for creating customized themes with different window decorations if that were to be supported some time down the line with this feature.
Is there anything blocking this from moving forward in the review process?
This PR is not yet ready for review, as I'm still working on some issues with resize flicker on Windows.
Any updates here?
I think this is a very important PR.
Undecorated windows have become pretty much the standard nowadays for desktop apps, and the current state of affairs on Windows gives an unprofessional experience - as the minimize, maximize & restore animations are not displayed at all. Not to speak of Aero snapping.
Is there a possibility that this could be done for JavaFX 21?
Very useful PR, looking forward to it.
Very much looking forward to
非常期待
Hi @yijunjiechen, thanks for making a comment in an OpenJDK project!
All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please Use "Add GitHub user yijunjiechen for the summary.
If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.
- [ ] I agree to the OpenJDK Terms of Use for all comments I make in a project in the OpenJDK GitHub organization.
Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.
Very useful PR, looking forward to it.
Hi @LIUSHUAI2018, thanks for making a comment in an OpenJDK project!
All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please Use "Add GitHub user LIUSHUAI2018 for the summary.
If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.
- [ ] I agree to the OpenJDK Terms of Use for all comments I make in a project in the OpenJDK GitHub organization.
Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.
wow,A very splendid pr, especially looking forward to incorporating it into the official version
I am very supportive of this pr, it is hard to imagine that this feature has not been proposed until now, it is very important to build a modern application.
nice,this PR Make it easy to customize the window
@bridgekeeper Sorry. I discussed this issue in a javafx community, and many people found this feature very useful, so they replied to this discussion; there may be more people replying at a time; I have caused trouble to you, sorry.
It‘s a userful PR,every time I need to do it myself. I hope the official can accept it.
Would so love to see this happening.
Can we have this by the next version?
To allow a custom decoration control, the part of the TITLE
window region would have to be transparent to allow it to be more customizable, like this:
Notice the rounded borders.
@mstr2 this pull request can not be integrated into master
due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:
git checkout feature/windowregion
git fetch https://git.openjdk.org/jfx master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push
This PR appears to be starting with an undecorated stage and then creating all of the standard decorations including the drop shadows and resize corners and edges. Are JavaFX developers interested in customizing those areas? To provide a more modern experience the high value change is to enable access to the title bar area. On Mac and Windows it would be far easier to introduce a new stage style that is just like DECORATED but with the Scene extended upward all the way to the top of the Stage. I'm assuming this can be done on Linux but haven't tried to write the code.
In any case there are parts of this PR that can't be easily implemented on the Mac. In particular I haven't found a way to ask the OS to initiate a drag on the resize handles and get all of the usual platform behavior like snapping to the edges of other windows. You can invoke the platform's title bar drag (NSWindow performWindowDragWithEvent:).
@mstr2 This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!
@mstr2 When using stage.initStyle(StageStyle.UNDECORATED_INTERACTIVE) in a Win10 system, a white line may appear on the left side of the window, and if a MenuBar is placed at the top of the window, the position of the menus may be incorrect.
@mstr2 This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!
Please keep Active
Please keep active.
Please keep active ^_^