Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimized/Maximized bug #52

Open
dax-leo opened this issue May 19, 2023 · 0 comments
Open

Minimized/Maximized bug #52

dax-leo opened this issue May 19, 2023 · 0 comments
Labels
bug Something doesn't function as intended

Comments

@dax-leo
Copy link

dax-leo commented May 19, 2023

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).

@dax-leo dax-leo changed the title Restore minimized form when previous state is Maximized Bug: Restore "minimized form" when previous state is "Maximized" fills the screen. May 19, 2023
@jpobst jpobst added the bug Something doesn't function as intended label May 31, 2023
@dax-leo dax-leo changed the title Bug: Restore "minimized form" when previous state is "Maximized" fills the screen. Minimized/Maximized bug Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something doesn't function as intended
Projects
None yet
Development

No branches or pull requests

2 participants