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

[Mono] Switching to WindowBorder.Fixed increases window size by 4 pixels #275

Closed
derrickcreamer opened this issue Jun 22, 2015 · 2 comments

Comments

@derrickcreamer
Copy link

Here's another bug that appears on Windows (7) while using Mono, but not while using .NET. (Not yet tested on Linux.)

Setting WindowBorder to Fixed from either Resizable or Hidden increases both the height & width of the window by 4 pixels each, instead of staying the same as expected. (This does not happen while switching between Resizable and Hidden - only Fixed.)

Code to reproduce:

using OpenTK;
namespace TKFixedBugReport{
    public static class BugReportMain{
        public static void Main(){
            GameWindow w = new GameWindow(200,100,OpenTK.Graphics.GraphicsMode.Default,"Testing");
            w.KeyDown += (sender, e) => {
                if(w.WindowBorder == WindowBorder.Fixed){
                    w.WindowBorder = WindowBorder.Resizable;
                }
                else{
                    w.WindowBorder = WindowBorder.Fixed;
                }
            };
            w.Run();
        }
    }
}
@derrickcreamer
Copy link
Author

I'm trying to track this one down myself. Here's what I've learned so far. Most of the relevant code is in WinGLNative.cs in WindowBorder-set.

  • The value of 'rect' is identical on Mono and .NET, before and after the call to Functions.AdjustWindowRectEx. This doesn't seem to be the source of the problem.
  • When the bug happens, ClientSize changes when SetWindowLong and SetWindowPos are called.
  • .NET and Mono report different window styles for the final 'new_style' when setting to WindowBorder.Fixed. The integer value of new_style is identical, however. Under .NET it is "Tiled, MinimizeBox, SystemMenu, Caption, ClipChildren, ClipSiblings", and under Mono it is "MinimizeBox, SystemMenu, Caption, ClipChildren, ClipSiblings" - Tiled is missing. I realize that TILED/OVERLAPPED have a value of zero and might be treated as defaults, but I'll note this here anyway. The fact that the int value of new_style doesn't change between runtimes suggests that there might be nothing to this after all.

That's where I am now. I suppose the next step is to learn just what SetWindowLong is doing with regards to the style, and how that might be different from one runtime to the next.

@varon
Copy link
Member

varon commented Jun 11, 2017

Closing as this is an ancient issue relating to a very old version of mono on windows, which isn't a supported configuration.

@varon varon closed this as completed Jun 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants