@@ -202,11 +202,23 @@ private void updateViewport() {
202202
203203 protected void updateViewport (int width , int height ) {
204204 glViewport (0 , 0 , width , height );
205-
206- //If the screen is minimized, resolution change is stopped to avoid the width and height of FBO being set to 0.
205+
206+ // GLFW reports the framebuffer as 0x0 while the window is minimized, and
207+ // DisplayResolutionDependentFbo.propertyChange regenerates every resolution-dependent FBO at
208+ // whatever size the display device reports whenever this event fires - it does not look at
209+ // the old/new values below, only at whether the event fired at all. So an unconditional fire
210+ // here means minimizing regenerates every FBO at 0x0, and restoring the window leaves them
211+ // that way until something else triggers a further resize - the black screen on restore this
212+ // is meant to prevent (#4980, #5081).
213+ //
214+ // PropertyChangeSupport.firePropertyChange skips notifying listeners when old equals new, so
215+ // that is used here as the on/off switch: while minimized, pass (1, 1) so the compare matches
216+ // and nothing fires; otherwise pass (0, 1) so a genuine resize still does. This was previously
217+ // inverted - isMinimized picked the value that differs from newValue, the opposite of what
218+ // "stop the resolution change" requires - so it suppressed real resizes instead of minimizes.
207219 boolean isMinimized = GLFW .glfwGetWindowAttrib (GLFW .glfwGetCurrentContext (), GLFW .GLFW_ICONIFIED ) == GLFW .GLFW_TRUE ;
208- int i = isMinimized ? 0 : 1 ;
209- propertyChangeSupport .firePropertyChange (DISPLAY_RESOLUTION_CHANGE , i , 1 );
220+ int oldValue = isMinimized ? 1 : 0 ;
221+ propertyChangeSupport .firePropertyChange (DISPLAY_RESOLUTION_CHANGE , oldValue , 1 );
210222 }
211223
212224 private GLFWVidMode getFullScreenDisplayMode () {
0 commit comments