Adapt size of Dialogs based on default size upon zoom change #3464
      
        
          +55
        
        
          −0
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
When moved between monitors of different zoom,
Dialogs may not show their full contents anymore. This is caused by their shell and the used fonts being linearly scaled in size according to the zoom, even though font size and required area for a font of that size are not linearly related. I.e., a font of double the size requires more than double of the width and height.Since there are many ways to customize
Dialogs and their sizes/layouts during and after initialization, it's difficult to solve that problem in general (also see #3212). The problem is, however, most severe forDialogs that use the default calculated size and are not resizable, as thoseDialogs do not have sophisticated layouts that adapt to the limited space in a shell and may easily lead to cut offs the user cannot work around by resizing the dialog. Thus, this change adds according zoom change and resize listeners to identify if exactly suchDialogs that use the default computed size and, in that case, recomputes it upon a zoom change.This is supposed to be a conservative alternative to #3212
How to test
On a Windows system, the behavior can particularly be seen in any dialog in which the number of text lines increases when moving the dialog to a monitor with higher zoom.

For example, a
PlainMessageDialogwith an according message looks like this when moved from 100% monitor to 150% monitor without this change:And it looks like this with the proposed change:
