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

Windows 10 gaps #50

Closed
ryanjkelly opened this Issue Feb 13, 2015 · 17 comments

Comments

Projects
None yet
3 participants
@ryanjkelly

ryanjkelly commented Feb 13, 2015

I understand that Windows 10 is not out till the fall, but I was wondering if you could fix/close the gaps (or margins) in between my windows. Will this be fixed by release time?

image

@ryanjkelly ryanjkelly changed the title from Windows 10 to Windows 10 Gaps Feb 13, 2015

@ryanjkelly ryanjkelly changed the title from Windows 10 Gaps to Windows 10 gaps Feb 13, 2015

@vegardlarsen

This comment has been minimized.

Member

vegardlarsen commented Feb 13, 2015

@ryanjkelly2 I am assuming this has to be a bug in Windows 10, but I could be wrong. I haven't yet had a chance to test Windows 10 myself, but I can assure you that I will make sure it is correct in the release version.

@ryanjkelly

This comment has been minimized.

ryanjkelly commented Feb 13, 2015

Thanks for the quick response. Looking forward to the fix!

@vegardlarsen vegardlarsen self-assigned this Mar 8, 2015

@vegardlarsen

This comment has been minimized.

Member

vegardlarsen commented Mar 8, 2015

I have finally gotten a virtual machine with the Windows 10 TP running. This seems like changed behavior in Windows 10, which I will have to address. I am delaying the next release until I have had a look at and fixed this.

@ryanjkelly

This comment has been minimized.

ryanjkelly commented Mar 9, 2015

Ya I noticed that this gap also shows up with other apps, like Skype. I'll drag my Skype window close to the edge of my screen and it will snap, but leave a small gap between the window and the edge of my screen.

@vegardlarsen

This comment has been minimized.

Member

vegardlarsen commented Mar 9, 2015

Good to know. I'll install Skype and check if this is unrelated to MaxTo. Either way, we'll have to work around it somehow. My guess, without having verified it yet, is that they didn't change SM_CYBORDER and SM_CXBORDER when they removed the window borders.

@vegardlarsen

This comment has been minimized.

Member

vegardlarsen commented Mar 10, 2015

OK, so I have looked into this more closely now, and this will be a tough nut to crack. Apparently, the window borders are actually present, but they are invisible. In addition, if you turn on Compatibility mode for a program the window borders are set to 0 size but are still invisible.

The real problem is that these invisible window borders are still the drag targets for resizing the window. That means that if MaxTo simply "overlapped" the invisible parts of the window, only the topmost of the windows would be resizable, and worse, you would have to click and drag inside a different window from the one you wanted to resize.

I will try to contact Microsoft for advice on solving this issue.

cc: @francisrath @ryanjkelly2

@ryanjkelly

This comment has been minimized.

ryanjkelly commented May 2, 2015

Update on this. Good news, I recently updated Windows 10 to Build 10074 and can confirm that the gaps are gone and my windows are now perfectly lining up against each other! 😁

@vegardlarsen

This comment has been minimized.

Member

vegardlarsen commented Jul 22, 2015

@ryanjkelly I have that exact build running in a VM here now, and that is not the case. It works if you use the Windows built-in shortcut keys (Win+Left), but not if MaxTo is doing it. I am trying to get in touch with Microsoft, but even through our recent silver partner status this is proving difficult.

@vegardlarsen

This comment has been minimized.

Member

vegardlarsen commented Jul 23, 2015

OK, I've just had 45 minutes with a Microsoft support tech, trying to figure out if this is a bug or not. From a Win32 API standpoint it is behaving quite rationally. There is a window border around the window, it is on three sides (left, bottom and right), it is 7 pixels wide, and it is invisible. So when I move a window to say 0,0, it is working exactly the same as in previous versions of Windows, except that the border is invisible. This means that those 7 pixels appear as a gap.

I've had a look at what the Windows snap functionality is doing, and it seems it just expands the window rectangle on the three sides. This seems to be the solution for MaxTo as well, but I feel that this is a horrible, horrible solution.

I'm thinking this will have to be the approach I choose until I can find something better.

@vegardlarsen

This comment has been minimized.

Member

vegardlarsen commented Jul 24, 2015

I've made quite a bit of progress on this today. There are still some quirks to work out, but I'm confident I'll get to this over the weekend.

@ryanjkelly

This comment has been minimized.

ryanjkelly commented Jul 27, 2015

@vegardlarsen sorry for the false positive earlier. I don't remember why I thought my windows were lining up. Great to hear you're making progress. Perfect timing as I expect a lot of users will be taking the free upgrade to Windows 10 this week.

@mmikeww

This comment has been minimized.

mmikeww commented May 23, 2016

@vegardlarsen , how did you 'fix' this? I don't see any commits referenced. Are you just overlapping the invisible borders of the other windows, and living with the inability to resize?

@vegardlarsen

This comment has been minimized.

Member

vegardlarsen commented May 24, 2016

@mmikeww MaxTo is not open source, so you can't see the source. Roughly, here is the code I got from Microsoft when I worked with them, but if I recall correctly, I had to modify this quite a bit. Why do you ask?

RECT clientRect;
GetClientRect(hWnd, &clientRect);
ClientToScreen(hWnd, (POINT *)&clientRect);

RECT windowRect;
GetWindowRect(hWnd, &windowRect);

int borderWidth = GetSystemMetrics(SM_CXBORDER);
int leftMargin = windowRect.left - clientRect.left + borderWidth;

SetWindowPos(hWnd, NULL, leftMargin, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
@mmikeww

This comment has been minimized.

mmikeww commented May 24, 2016

@vegardlarsen Ahh its not open source, ok that makes sense. I ask because I am facing the same issue. I guess you could get the borders using the difference between the client and window rect. I thought the consensus was to use DwmGetWindowAttribute() with DWMWA_EXTENDED_FRAME_BOUNDS, but whatever works.

Your example is merely for moving a window to the upper left, but what about when you have to move another window adjacent? Do you then just offset by 2 border margins? Because then like you mentioned earlier in this thread, you will have the problem of not being able to resize one window..

@vegardlarsen

This comment has been minimized.

Member

vegardlarsen commented May 24, 2016

I was a bit quick there. Didn't even read the code I copied from my e-mail thread with MS. Here is the code I meant to copy:

RECT extendedRect;
DwmGetWindowAttribute(hWnd, DWMWA_EXTENDED_FRAME_BOUNDS, &extendedRect, sizeof(extendedRect));

RECT windowRect;
GetWindowRect(hWnd, &windowRect);

int leftMargin = windowRect.left - extendedRect.left;

SetWindowPos(hWnd, NULL, leftMargin, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);

You are right on your approach. This was hashed out between me and MS when Windows 10 was just about to go into RTM, so at the time, there was no consensus, and I haven't seen any discussions of it afterwards.

@mmikeww

This comment has been minimized.

mmikeww commented May 24, 2016

Moving by 2 border margins and disallowing resizing of one window is such a hack though, I'm almost tempted to tell the complainers to install the hidden Aero Lite theme to make the borders visible agian.

@vegardlarsen

This comment has been minimized.

Member

vegardlarsen commented May 24, 2016

I know, but that is the way this works currently. Terrible choice by Microsoft, but we just have to adapt... :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment