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
Created a profile to run mac sample #2
Created a profile to run mac sample #2
Conversation
A general minor comment... |
Great work @carldea !! Well done! Excited to have Mac support! 👏👏👌 After this PR, what will we need to package and publish this as a jar so this library can be used by developers (and app users) on Mac environments like any other library (or close to that experience)? |
Yes I noticed that. |
Agreed. |
@dukke The native macos and xcode project has been moved. I'm am surprised when I tested my code in running the sample application and noticed JNA might already copying the native library automatically. I didn't have to pass in the following JVM options: -Djava.library.path=FXThemes/target/classes |
That's great carl!! 👍👍 What do you think about the other comments I made on the PR? |
FXThemes-samples/src/main/java/com/pixelduke/samples/window/DarkThemeSampleMac.java
Outdated
Show resolved
Hide resolved
FXThemes/src/main/java/com/pixelduke/window/ThemeWindowManagerFactory.java
Outdated
Show resolved
Hide resolved
Great work Carl! Thanks for looking into my small remarks in this PR. I think there's only one remark left to address: the comment about why not just use the existing DarkThemeSample on Mac as well as Windows, to test out the feature to change the window frame to a dark color rather than a new sample? Since we've never talked in depth about it, perhaps I can grab this opportunity and write a bit about what is my initial thinking about this library. How I imagine it to fulfill its purpose and see if you agree or have any comments about that. Just to make sure we're on the same page on this. My thinking is that programmer users will use FXThemes by calling the same API across all Oses, as much as possible. That is, they can use the same Java code on all platforms, and internally FXThemes will call on specific native code on each platform without the programmers having to know or care about specificities of each OS. As much as possible I think we could try to have as much of the API be present in ThemeWindowManager. For this we'll need to figure out what features are available across OSes and have a way to present them to the programmer user in a way that's platform agnostic. All other API that is specific to a particular OS and that we couldn't find a way to present it in ThemeWindowManager, we can put on the OS specific implementation classes of this interface. Having said this, I think we have already managed to have one API be present in ThemeWindowManager and that is the API to change the window frame to a dark or light appearance. With this in mind I was thinking that we could present this fact (that this API is cross platform) by having only one sample for changing the window frame appearance that can be run on any OS. This would demonstrate that the same code can be run on either Windows or Mac, without change, and present the same result. Also, if you agree with what I said above but don't agree or want to make changes to the DarkThemeSample code feel free to say so... |
I agree. Same page: I like your thinking🙂👍. If the user/dev wants to use specific platform features, they must use the specific functions. My reasoning & issue I encountered: Next steps:
To achieve the native blur effect on Mac, the Stage and Color must be set a certain way. Thank you! |
…SampleMac has javadoc docs to demonstrate the Mac specific Blur effect
The Windows version doesn't set the background to be transparent either. If you call to change the window frame to dark, the background will be opaque on Windows too. For reference, a video illustrating the demo running on win11: https://twitter.com/P_Duke/status/1701577162015363556 My thinking for the method However, the API is still in its early stages, and I guess it will probably change as we learn along the way. Thanks! :) |
Thanks for the merge! I like your suggestion, however, I want to play around more with what’s available (native styling abilities). Re: boolean Mac Styles: It has most of all the native MacOS-supported NSWindow styles similar to your Windows effects. We could compare to see what’s common for both operating systems. Later, we could see Gnome or Centos. |
That url with the styles is interesting. Looks like there's a considerable amount of ways to style the window on Mac. Yes that's it, we should compare and see what's the common denominator. From that link you shared I see that setting an arbitrary color for the window frame seems to be another common feature, although on Windows you only set the window title bar color whereas on Mac you seem to set the whole window color. |
New support for setting dark and light mode for MacOS.
A maven profile for mac was created to detect OS. Windows is default and will build native code if it detects that it is MacOS.
mvn clean install
mvn -f FXThemes-samples javafx:run