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

8271557: Undecorated interactive stage style #594

Closed
wants to merge 5 commits into from

Conversation

mstr2
Copy link
Collaborator

@mstr2 mstr2 commented Jul 29, 2021

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
Copy link

bridgekeeper bot commented Jul 29, 2021

👋 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
Copy link

sproket commented Jul 30, 2021

This is a great idea!

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

chengenzhao commented Aug 14, 2021

great
please make it happen

@SDIDSA
Copy link

SDIDSA commented Oct 5, 2021

Please make this happen

@Col-E
Copy link

Col-E commented Dec 13, 2021

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
Copy link
Collaborator Author

mstr2 commented Dec 16, 2021

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
Copy link

Haven-King commented Nov 16, 2022

Any updates here?

@TX256
Copy link

TX256 commented Jan 12, 2023

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
Copy link

leewyatt commented Jan 13, 2023

Very useful PR, looking forward to it.

@futurism-xm
Copy link

futurism-xm commented Jan 13, 2023

Very much looking forward to

@3563198204qq
Copy link

3563198204qq commented Jan 13, 2023

非常期待

@yijunjiechen
Copy link

yijunjiechen commented Jan 13, 2023

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
Copy link

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

Very useful PR, looking forward to it.

@LIUSHUAI2018
Copy link

LIUSHUAI2018 commented Jan 13, 2023

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
Copy link

Mr-ShiHuaYu commented Jan 13, 2023

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

@Anivie
Copy link

Anivie commented Jan 13, 2023

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
Copy link

Xiaobaishushu25 commented Jan 13, 2023

nice,this PR Make it easy to customize the window

@leewyatt
Copy link

@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
Copy link

leck995 commented Jan 13, 2023

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

@dlemmermann
Copy link

dlemmermann commented Jan 13, 2023

Would so love to see this happening.

@palexdev
Copy link

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
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
Copy link
Collaborator

tsayao commented Jan 27, 2023

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.

@dlemmermann
Copy link

Please keep active.

@leewyatt
Copy link

Please keep active ^_^

@leck995
Copy link

leck995 commented Jul 7, 2023

Please keep active.

1 similar comment
@Anivie
Copy link

Anivie commented Jul 8, 2023

Please keep active.

@FlorianKirmaier
Copy link
Member

push

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 14, 2023

@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
Copy link

xdsswar commented Oct 23, 2023

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

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
Copy link

xdsswar commented Oct 23, 2023

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

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
Copy link

xdsswar commented Oct 23, 2023

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
Copy link

bridgekeeper bot commented Dec 19, 2023

@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

Very useful PR, looking forward to it.~~

@burningtnt
Copy link

Please keep active. This feature is so wonderful!.

@SDIDSA
Copy link

SDIDSA commented Dec 24, 2023

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

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 18, 2024

@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

Still want it.

@YansideyuoOo
Copy link

YansideyuoOo commented Feb 27, 2024

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

@openjdk
Copy link

openjdk bot commented Mar 13, 2024

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

@bridgekeeper
Copy link

bridgekeeper bot commented May 9, 2024

@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
Copy link

BelgianDev commented May 13, 2024

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
Copy link

len-ny commented Jul 4, 2024

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
Copy link

len-ny commented Jul 4, 2024

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
Copy link

bridgekeeper bot commented Aug 29, 2024

@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
Copy link

sproket commented Aug 30, 2024

Please keep this!

@leck995
Copy link

leck995 commented Sep 25, 2024

We need it!

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.