eirikbakke commented on code in PR #6391:
URL: https://github.com/apache/netbeans/pull/6391#discussion_r1321742064


##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/Installer.java:
##########
@@ -62,4 +67,17 @@ public void validate() throws IllegalStateException {
         System.setProperty( "flatlaf.updateUIOnSystemFontChange", "false" );
     }
 
+    private void uiPropertyChange(PropertyChangeEvent pce) {
+        if ("lookAndFeel".equals(pce.getPropertyName())) { //NOI18N
+            if (UIManager.getLookAndFeel() instanceof FlatLaf
+                    && FlatLafPrefs.isUseWindowDecorations()
+                    && SystemInfo.isLinux) {
+
+                JFrame.setDefaultLookAndFeelDecorated(true);
+                JDialog.setDefaultLookAndFeelDecorated(true);

Review Comment:
   If there is a listener that turns these on, should there not be some code 
turning them off again? Is this code only applicable when the setting or LAF is 
changed while NetBeans is running? Or does it end up running on every startup?



##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLafPrefs.java:
##########
@@ -37,6 +38,8 @@ class FlatLafPrefs {
 
     private static final Preferences prefs = 
NbPreferences.forModule(FlatLafPrefs.class);
 
+    private static final boolean DEF_USE_WINDOW_DECORATIONS = 
SystemInfo.isWindows_10_orLater;

Review Comment:
   @DevCharly Is it more correct to call SystemInfo.isWindows_10_orLater here, 
or FlatLaf.supportsNativeWindowDecorations()? E.g. in case FlatLAF later 
decided to make FlatLaf.supportsNativeWindowDecorations() true for Linux. (I 
suppose we could just change the constant in that case.)



##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLafOptionsPanelController.java:
##########
@@ -75,9 +81,33 @@ public void applyChanges() {
 
             FlatLFCustoms.updateUnifiedBackground();
 
-            if (oldUseWindowDecorations != 
FlatLafPrefs.isUseWindowDecorations()) {
-                
FlatLaf.setUseNativeWindowDecorations(FlatLafPrefs.isUseWindowDecorations());
-            } 
+            boolean isUseWindowDecorations = 
FlatLafPrefs.isUseWindowDecorations();
+            if (oldUseWindowDecorations != isUseWindowDecorations) {
+                if (FlatLaf.supportsNativeWindowDecorations()) {
+                    
FlatLaf.setUseNativeWindowDecorations(isUseWindowDecorations);
+                } else {
+                    
JFrame.setDefaultLookAndFeelDecorated(isUseWindowDecorations);

Review Comment:
   This complicated code runs only if the setting is changed from the Options 
dialog while NetBeans is running, right? So if there are bugs, they will go 
away when NetBeans is restarted?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to