Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
package com.sun.glass.ui.win;

import com.sun.glass.events.WindowEvent;
import com.sun.glass.ui.Cursor;
import com.sun.glass.ui.HeaderButtonMetrics;
import com.sun.glass.ui.HeaderButtonOverlay;
Expand Down Expand Up @@ -122,8 +123,11 @@ public void setBounds(float x, float y, boolean xSet, boolean ySet,
fxReqHeight = fx_ch;

int maxW = getMaximumWidth(), maxH = getMaximumHeight();
int oldPw = pw;
int oldPh = ph;
pw = Math.max(Math.min(pw, maxW > 0 ? maxW : Integer.MAX_VALUE), getMinimumWidth());
ph = Math.max(Math.min(ph, maxH > 0 ? maxH : Integer.MAX_VALUE), getMinimumHeight());
boolean minMaxEnforced = (oldPw != pw || oldPh != ph);

long anchor = _getAnchor(getRawHandle());
int resizeMode = (anchor == ANCHOR_NO_CAPTURE)
Expand All @@ -150,7 +154,18 @@ public void setBounds(float x, float y, boolean xSet, boolean ySet,
if (!ySet) ySet = (py != this.y);
pfReqWidth = (int) Math.ceil(fxReqWidth * platformScaleX);
pfReqHeight = (int) Math.ceil(fxReqHeight * platformScaleY);
boolean alreadyAtSize = (pw == width && ph == height);
_setBounds(getRawHandle(), px, py, xSet, ySet, pw, ph, 0, 0, xGravity, yGravity);

if (minMaxEnforced && alreadyAtSize) {
var eventType = WindowEvent.RESIZE;
if (isMaximized()) {
eventType = WindowEvent.MAXIMIZE;
} else if (isMinimized()) {
eventType = WindowEvent.MINIMIZE;
}
notifyResize(eventType, pw, ph);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ - (void)_setBounds:(jint)x y:(jint)y xSet:(jboolean)xSet ySet:(jboolean)ySet w:(
// as it is possible that the windowDidMove event is not triggered.
[self _sendJavaWindowMoveEventForFrame:flipFrame];
}
if (newW != flipFrame.size.width || newH != flipFrame.size.height) {
// The frame may not have changed due min/max limits. In that case we
// need to send back the actual size since the windowDidResize
// notification was not triggered.
[self _sendJavaWindowResizeEvent:com_sun_glass_events_WindowEvent_RESIZE forFrame:flipFrame];
}
}

- (void)_restorePreZoomedRect
Expand Down