-
Notifications
You must be signed in to change notification settings - Fork 507
8313424: JavaFX controls in the title bar #1605
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back mstrauss! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
/reviewers 2 reviewers |
@mstr2 has indicated that a compatibility and specification (CSR) request is needed for this pull request. @mstr2 please create a CSR request for issue JDK-8313424 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
Hey, I'm glad to see this PR, but do you have any ideas for continuing to provide |
Very nice. I'll test on Linux and report back. |
The only difference between the two would be whether the default window buttons are provided. I don't see how a window without default window buttons would be more useful. Even heavily stylized apps like Spotify use window buttons that feel at home on the OS, that doesn't take away from a consistent look and feel. |
A few points observed on Linux:
Added later: Nice cleanup on |
I suggest we convert this PR to Draft and first discuss this in the mailing list. There are so many issues with the proposal that need to be ironed first: CSS support, height limitation (what happens when the app or CSS places too large of the component?), user-defined color/accents/transparency on Windows, to name just a few. This change also may add a significant maintenance burden to the platform, for what I feel is a very small payout. What do you think? |
This has already been discussed at various points in time, and was always received positively. The previous implementation is one of the most-upvoted feature proposals since OpenJFX moved to GitHub.
What about these things? I don't understand the question, but let me try to give some answers nontheless:
Popular demand says otherwise. |
Popular demand is good, but I would like to hear from the tech leads and the maintainers. |
To clarify about height: do all the platforms support arbitrary height? What if size set by the app/CSS exceeds the height supported by the platform? About platform preferences: will it support all the attributes of the window decorations provided by the platform? |
@tsayao Thanks for the comments. I'll have a look at the bugs that you found.
I know that dragging on interactive controls is a thing on Linux, but I don't think that we should be doing that. JavaFX applications are multi-platform apps, which means that their behavior should be consistent across platforms. Stealing mouse interactions on interactive controls is not a thing on Windows and macOS, and this has the potential to cause problems for application developers. If you want, you can declare any node in the header bar to be draggable on all platforms with
I'll have to look into that, but in general an
While that sounds useful at first, I don't think it carries its own weight. Many platforms use different styling for windows that are focused vs. windows that are not. This not only includes the header bar, but many other parts of the user interface as well. I don't think that we should be adding what would essentially be ad-hoc pseudo-classes only to HeaderBar. In addition to that, it is extremely easy for an application to do this by adding a listener to We should definitely not do pseudo-classes for light vs. dark mode. The correct way to solve this problem is with media queries (prefers-color-scheme). |
Mailing list message from quizynox at gmail.com on openjfx-dev: Hello, Thank you so much for your effort! I'm really glad this hasn't been Every modern platform supports this feature: Electron, Tauri, Wails, Qt, Unfortunately, the current UNDECORATED stage implementation lacks two That's why the implementation should be handled on the native side, which It's indeed a complex feature. For that reason, I believe the ??, 22 ???. 2024??. ? 03:24, Michael Strau? <mstrauss at openjdk.org>: -------------- next part -------------- |
Continuing on window attributes. I would like to know what is and is not supported by platform, by feature. For example: Windows
Did I miss anything? |
For the HeaderBar, I would like to see the explanation of different layout options, including the cases when all the information does not fit the window width. Which parts are contracted? How is overflow handled? |
May be I am late to the party, but I would suggest to discuss the JEP first. I would like to see the summary by platform by feature, I would like to see details of the layout, and the description if and how the proposed design responds to user preferences changes dynamically. I would also like to see alternatives. Perhaps the app developers has all the tools already (for example, creating an overlay transparent scene on top of the platform title bar?), or maybe this functionality should be rather implemented in a library. Lastly, there is a concern of adding a huge maintenance burden on the platform. Next time the major OS vendor changes the L&F or adds something to the window decorations, we are on the hook for supporting that. I am not even qualified to access the impact of this feature in the Linux world. There are so many frameworks and opinions - how do you propose to handle that? Is it going to be supported on Wayland? |
Gtk does work on Mac and Windows, maybe we can see how it handles it's HeaderBar, for reference. |
Another aspect is whether this should be a conditional feature. |
I'll eagerly invite you to dissect this PR for its merits, its pros and cons. However, your questions lead me to conclude that you haven't really looked at what I'm proposing. Half of your questions are answered just by looking at the documentation for Let me try to explain
Since there is no non-client title bar, all questions regarding the appearance or accessibility of the |
|
I've decided to replace the
This should make your example easier, since you only need to mark the |
Good idea, this looks like the most flexible option without complicating things too much. I can confirm this works well in my tests. Code changes & documentation look good as well. |
@kevinrushforth |
Yes, I'll put it on my review queue for this week. |
An issue whereby the top border was not showing re-size cursors when using EXTENDED + HeaderBar, was fixed in 544d62e However, a similar bug is still present when using EXTENDED with no HeaderBar, these cursors are missing and it's not possible to re-size using the top border/corners. Easy to reproduce in Monkey Tester. It's also impossible to click and drag the window from the header area, in this configuration, which felt like non-native behaviour that could be enabled by default. Maybe it's intentional. |
I don't think |
No use case (that I care about), but I was able to create it (Monkey Tester), and it had the minimise/maximise/quit buttons, so it seemed like a "valid" minimalist setup. |
Another question, can there be some defaults set to prevent this (icons overlapping controls when window is small): E.g., look what happens when I make IntelliJ as small as possible -- the windowing icons are always visible, never overlap: Same with most apps such as Chrome, etc... everything else shrinks (tabs), but not the windowing icons. I'm sure a developer can workaround this (I haven't tinkered yet), but it would be good if they didn't need to worry about it...? |
Would it be feasible to ensure the minium window width is large enough by default, and allowing to turn this off when manual clipping is implemented instead? |
Apologies on my comment on the subject, I had not realised until after, that it was already discussed. I would agree that "naive" clipping is probably more confusing than intuitive. Anyway, note that even Windows Explorer doesn't do a great job. E.g., depending on how fast you re-size the Window (in this case, with two tabs open), you can get this: ...or this if you resize slower (no indication that two tabs are open -- but less "ugly"): I also prefer your suggestion that there should simply be a minimum window size. But I can imagine a lot of people will want a menu in the top header bar; some maybe with too many items to be reasonably fit into a "minimum" size. Look at SceneBuilder (which has no min size), when resized, the menu items all get ellipsed -- not beautiful but at least it's something: Would this behave similarly in HeaderBar, or would it stay fullsize, and the window icons overlay it? (I am unable to test it at the moment) |
It's probably a bit hard with the API around |
|
Ok, that would need to be done elsewhere then. |
The API looks good to me. I want to do a second pass over the javadocs once I have time to try a few things, but I doubt I'll request any significant changes. Go ahead and create the CSR when you are ready. |
I imagine most people will want HeaderBar's leading node to be an app icon with the usual left-click context menu behaviour (i.e., at least restore, minimise, close), much like it is for DECORATED today. Today, you can add a bunch of icons to a stage with stage.getIcons().addAll(myLogoList)), and the window's header will contain a suitable icon; never too big, never too small. The developer doesn't worry about it. I really feel a utility to add an equivalent app icon to the HeaderBar, should be provided out-of-the-box, using the same logic. E.g., let HeaderBar choose the most suitable icon, and choose the correct size for the platform, and any padding, etc. Otherwise, the developer needs to think about it too much. A lot of this logic used by DECORATED, seems to be buried in WindowStage in terms of picking what icons to display in the title bar, etc. |
@credmond
|
Thanks for the detailed reply @mstr2. I can't really argue with any of your points, I also agree. |
I was testing the HeaderBar, and noticed the styles of the windows buttons were sometimes not applied, or were getting stuck in a particular state (i.e., hover state). I thought I tracked this down to a benign issue where my app was applying duplicate stylesheets, in quick succession (i.e., twice) -- it should not matter usually, at all, but for some reason affected the window decoration icons in particular. I fixed that edge-case issue. However, I then quickly noticed the styling will stop being applied after using a common controlsfx notification popup. It can be very easily reproduced:
Run this, click the button and hover over the window icons, and see that no styling is applied anymore. I have not dived into this yet to understand why, but I know from memory that controlsfx does some re-arranging of nodes in scene usually. Either way, the styling of HeaderBar seems quite unreliable/brittle given the various ways it can seemingly break. I don't know why, or what makes it different. But the other styles in my app appear unaffected by application bugs and/or quirks of controlsfx. |
Actually, it can easily be reproduced with plain Java + JavaFX; no libraries. Turns out, the issue is down to doing:
|
An even more concise example. Create c:\empty.css and run this, then hover over the window icons and note no style is applied (or is partially applied):
|
Implementation of
StageStyle.EXTENDED
.Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1605/head:pull/1605
$ git checkout pull/1605
Update a local copy of the PR:
$ git checkout pull/1605
$ git pull https://git.openjdk.org/jfx.git pull/1605/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1605
View PR using the GUI difftool:
$ git pr show -t 1605
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1605.diff
Using Webrev
Link to Webrev Comment