JBR-7334 Skip custom title bar reconfiguration if nothing changed

This commit is contained in:
Nikita Gubarkov
2025-08-29 18:08:55 +02:00
parent 7c8f117efe
commit 7b1aac2ec5

View File

@@ -4059,6 +4059,7 @@ public class Window extends Container implements Accessible {
private float getHeight() { return height; }
private void setHeight(float height) {
if (height <= 0.0f) throw new IllegalArgumentException("TitleBar height must be positive");
if (this.height == height) return;
this.height = height;
notifyUpdate();
}
@@ -4067,13 +4068,17 @@ public class Window extends Container implements Accessible {
}
private void putProperties(Map<String, ?> m) {
if (properties == null) properties = new HashMap<>();
properties.putAll(m);
notifyUpdate();
boolean needsUpdate = false;
for (Map.Entry<String, ?> e : m.entrySet()) {
Object old = properties.put(e.getKey(), e.getValue());
if (!needsUpdate && !Objects.equals(old, e.getValue())) needsUpdate = true;
}
if (needsUpdate) notifyUpdate();
}
private void putProperty(String key, Object value) {
if (properties == null) properties = new HashMap<>();
properties.put(key, value);
notifyUpdate();
Object old = properties.put(key, value);
if (!Objects.equals(old, value)) notifyUpdate();
}
private float getLeftInset() { return insets[0]; }
private float getRightInset() { return insets[1]; }