Skip to content

8271557: Undecorated interactive stage style#594

Closed
mstr2 wants to merge 5 commits into
openjdk:masterfrom
mstr2:feature/windowregion
Closed

8271557: Undecorated interactive stage style#594
mstr2 wants to merge 5 commits into
openjdk:masterfrom
mstr2:feature/windowregion

Conversation

@mstr2

@mstr2 mstr2 commented Jul 29, 2021

Copy link
Copy Markdown
Collaborator

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.

ezgif-2-013a29cf85a4

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

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • 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

@bridgekeeper

bridgekeeper Bot commented Jul 29, 2021

Copy link
Copy Markdown

👋 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.

@sproket

sproket commented Jul 30, 2021

Copy link
Copy Markdown

This is a great idea!

@mstr2 mstr2 changed the title Undecorated-interactive stage style 8271557: Undecorated interactive stage style Jul 30, 2021
@chengenzhao

chengenzhao commented Aug 14, 2021

Copy link
Copy Markdown

great
please make it happen

@SDIDSA

SDIDSA commented Oct 5, 2021

Copy link
Copy Markdown

Please make this happen

@Col-E

Col-E commented Dec 13, 2021

Copy link
Copy Markdown

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?

@mstr2

mstr2 commented Dec 16, 2021

Copy link
Copy Markdown
Collaborator Author

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.

@Haven-King

Haven-King commented Nov 16, 2022

Copy link
Copy Markdown

Any updates here?

@TX256

TX256 commented Jan 12, 2023

Copy link
Copy Markdown

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?

@leewyatt

leewyatt commented Jan 13, 2023

Copy link
Copy Markdown

Very useful PR, looking forward to it.

@futurism-xm

futurism-xm commented Jan 13, 2023

Copy link
Copy Markdown

Very much looking forward to

@3563198204qq

3563198204qq commented Jan 13, 2023

Copy link
Copy Markdown

非常期待

@yijunjiechen

yijunjiechen commented Jan 13, 2023

Copy link
Copy Markdown

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.

Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.

@zero-zero-one-one

zero-zero-one-one commented Jan 13, 2023

Copy link
Copy Markdown

Very useful PR, looking forward to it.

@LIUSHUAI2018

LIUSHUAI2018 commented Jan 13, 2023

Copy link
Copy Markdown

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.

Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.

@Mr-ShiHuaYu

Mr-ShiHuaYu commented Jan 13, 2023

Copy link
Copy Markdown

wow,A very splendid pr, especially looking forward to incorporating it into the official version

@Anivie

Anivie commented Jan 13, 2023

Copy link
Copy Markdown

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.

@Xiaobaishushu25

Xiaobaishushu25 commented Jan 13, 2023

Copy link
Copy Markdown

nice,this PR Make it easy to customize the window

@leewyatt

Copy link
Copy Markdown

@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.

@leck995

leck995 commented Jan 13, 2023

Copy link
Copy Markdown

It‘s a userful PR,every time I need to do it myself. I hope the official can accept it.

@dlemmermann

dlemmermann commented Jan 13, 2023

Copy link
Copy Markdown

Would so love to see this happening.

@palexdev

Copy link
Copy Markdown

Can we have this by the next version?

Comment on lines +119 to +121
private void handleMoveWindow(int xAbs, int yAbs) {
window.setPosition(mouseDownWindowX + xAbs - mouseDownX, mouseDownWindowY + yAbs - mouseDownY);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Linux this will be constrained by the window manager, so it's not possible to move the window outside of the desktop bounds, including panels.

This can be done by implementing a beginMoveDrag on glass that will call (on linux):
gdk_window_begin_move_drag

@tsayao

tsayao commented Jan 27, 2023

Copy link
Copy Markdown
Collaborator

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:

image

Notice the rounded borders.

@leewyatt

Copy link
Copy Markdown

Please keep active ^_^

@leck995

leck995 commented Jul 7, 2023

Copy link
Copy Markdown

Please keep active.

1 similar comment
@Anivie

Anivie commented Jul 8, 2023

Copy link
Copy Markdown

Please keep active.

@FlorianKirmaier

Copy link
Copy Markdown
Member

push

@bridgekeeper

bridgekeeper Bot commented Sep 14, 2023

Copy link
Copy Markdown

@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!

@xdsswar

xdsswar commented Oct 23, 2023

Copy link
Copy Markdown

I had to do a lot of jni to archive this https://github.com/xdsswar/fx-jni-demo

It works fine, tested on windows 10 and 11. There is some small fix I got to do, but its usable. For now its only for Windows.

@palexdev

Copy link
Copy Markdown

I had to do a lot of jni to archive this https://github.com/xdsswar/fx-jni-demo

It works fine, tested on windows 10 and 11. There is some small fix I got to do, but its usable. For now its only for Windows.

Great job, qnd you even used it on a modular project, amazing
Is there the src code for the fx-jni library?

@xdsswar

xdsswar commented Oct 23, 2023

Copy link
Copy Markdown

I had to do a lot of jni to archive this https://github.com/xdsswar/fx-jni-demo
It works fine, tested on windows 10 and 11. There is some small fix I got to do, but its usable. For now its only for Windows.

Great job, qnd you even used it on a modular project, amazing Is there the src code for the fx-jni library?

Yes, I have it , need to upload , but I will share later , Im in the hospital right now with my mom. Also you are the MaterialFx guy right? Amazing job there.

@palexdev

Copy link
Copy Markdown

I had to do a lot of jni to archive this https://github.com/xdsswar/fx-jni-demo
It works fine, tested on windows 10 and 11. There is some small fix I got to do, but its usable. For now its only for Windows.

Great job, qnd you even used it on a modular project, amazing Is there the src code for the fx-jni library?

Yes, I have it , need to upload , but I will share later , Im in the hospital right now with my mom. Also you are the MaterialFx guy right? Amazing job there.

Yes, I am, thank you very much! Looking forward to it, I'm very curious on what you came up with

@xdsswar

xdsswar commented Oct 23, 2023

Copy link
Copy Markdown

I had to do a lot of jni to archive this https://github.com/xdsswar/fx-jni-demo
It works fine, tested on windows 10 and 11. There is some small fix I got to do, but its usable. For now its only for Windows.

Great job, qnd you even used it on a modular project, amazing Is there the src code for the fx-jni library?

Yes, I have it , need to upload , but I will share later , Im in the hospital right now with my mom. Also you are the MaterialFx guy right? Amazing job there.

Yes, I am, thank you very much! Looking forward to it, I'm very curious on what you came up with

Here we go https://github.com/xdsswar/shared-fx-jni-src

@bridgekeeper

bridgekeeper Bot commented Dec 19, 2023

Copy link
Copy Markdown

@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!

@leewyatt

Copy link
Copy Markdown

Very useful PR, looking forward to it.~~

@burningtnt

Copy link
Copy Markdown

Please keep active. This feature is so wonderful!.

@SDIDSA

SDIDSA commented Dec 24, 2023

Copy link
Copy Markdown

need this so much, maybe implementing custom windows doesn't have to be so painful anymore

@bridgekeeper

bridgekeeper Bot commented Feb 18, 2024

Copy link
Copy Markdown

@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!

@dlemmermann

Copy link
Copy Markdown

Still want it.

@YansideyuoOo

YansideyuoOo commented Feb 27, 2024

Copy link
Copy Markdown

非常需要这个,也许实现自定义窗口不必再那么痛苦了

@openjdk

openjdk Bot commented Mar 13, 2024

Copy link
Copy Markdown

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@bridgekeeper

bridgekeeper Bot commented May 9, 2024

Copy link
Copy Markdown

@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!

@BelgianDev

BelgianDev commented May 13, 2024

Copy link
Copy Markdown

Hi @Raft08, 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 Raft08" 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.

Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.

@len-ny

len-ny commented Jul 4, 2024

Copy link
Copy Markdown

Hi @len-ny, 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 len-ny" 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.

Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.

1 similar comment
@len-ny

len-ny commented Jul 4, 2024

Copy link
Copy Markdown

Hi @len-ny, 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 len-ny" 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.

Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.

@bridgekeeper

bridgekeeper Bot commented Aug 29, 2024

Copy link
Copy Markdown

@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!

@sproket

sproket commented Aug 30, 2024

Copy link
Copy Markdown

Please keep this!

@leck995

leck995 commented Sep 25, 2024

Copy link
Copy Markdown

We need it!

@mstr2 mstr2 closed this Oct 19, 2024
@mstr2 mstr2 deleted the feature/windowregion branch January 7, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflict Pull request has merge conflict with target branch

Development

Successfully merging this pull request may close these issues.