Skip to content

Minimized/Maximized bug #52

@dax-leo

Description

@dax-leo

Hi,

there is a bug related to Maximize/Minimize state.
In this case window will cover full screen (even when FullScreen option is disabled).

Steps to replicate:

  • Open (any) application and set to Maximized state
  • Press Minimize
  • Click on taskbar to restore -> bug occurs which will set application to Full Screen instead of restoring it to previous Maximize state.

As a quick fix I did simple bypass in 2 classes :

WinProc:

  • switch statement WindowsMessage.WM_SIZE:
    `

                      var size = (SizeCommand)wParam;
                      
                      if (_lastWindowState == WindowState.Minimized && (size == SizeCommand.Maximized))
                      {
                          var clientSize = new Size(ToInt32(lParam) & 0xffff, (ToInt32(lParam) >> 16));
                          Resize(clientSize, _resizeReason);
                          Resized(clientSize / RenderScaling, _resizeReason);
                      }
                      else if (Resized != null &&
                          (size == SizeCommand.Restored ||
                           size == SizeCommand.Maximized))
                      {
                          var clientSize = new Size(ToInt32(lParam) & 0xffff, ToInt32(lParam) >> 16);
                          Resized(clientSize / RenderScaling, _resizeReason);
                      }
    
                      var windowState = size switch 
                      {
                          SizeCommand.Maximized => WindowState.Maximized,
                          SizeCommand.Minimized => WindowState.Minimized,
                          _ when _isFullScreenActive => WindowState.FullScreen,
                          _ => WindowState.Normal,
                      };
    
                      if (windowState != _lastWindowState)
                      {
                          _lastWindowState = windowState;
    
                          WindowStateChanged?.Invoke(windowState);
    
                          if (_isClientAreaExtended)
                          {
                              UpdateExtendMargins();
    
                              ExtendClientAreaToDecorationsChanged?.Invoke(true);
                          }
                      }
    
                      return IntPtr.Zero;`
    
  • WindowImpl (need to verify for Linux):
    change Resize call by adding the following line of code at the top of the Resize method call:
    if(WindowState == WindowState.Maximized) { MaximizeWithoutCoveringTaskbar(); }

Hopefully this will help someone who experienced similar issue.

Please note this is still not a final solution. There is another bug? related to regular maximize state. Application surface is maximized, but it's still not proper Maximized state (you can confirm that by bringing cursor close to the border, you will notice it can resize the surface).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions