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

Dragging windows is broken since 2.4.0 #566

Closed
ElvenSpellmaker opened this issue Jul 11, 2016 · 28 comments
Closed

Dragging windows is broken since 2.4.0 #566

ElvenSpellmaker opened this issue Jul 11, 2016 · 28 comments

Comments

@ElvenSpellmaker
Copy link

ElvenSpellmaker commented Jul 11, 2016

Since 2.4.0 on Windows 8.1 dragging windows onto my second desktop from the third causes them to jolt around, enlarge the font and the size of the terminal and won't move more than halfway over my second desktop (so I cant drag them to the first desktop of three).

If I use the Windows key to move a window to the first desktop and then try dragging to the third, then the terminal gets larger (and zooms in) with each monitor I pass.

I'd like to say my middle (second) monitor is via USB3.0 --> HDMI if that makes a difference.

Note I am not pressing any keys while moving the window.

@mintty
Copy link
Owner

mintty commented Jul 11, 2016

Please fix the version you mentioned (2.2.4?).
What are the dimensions of your monitors? (Pixels, physical size, configured DPI values/"zooming factors"). Still running Windows 8.1?
Any change with option HandleDPI=false?

@ElvenSpellmaker ElvenSpellmaker changed the title Dragging windows is broken since 1.2.4 Dragging windows is broken since 2.2.4 Jul 12, 2016
@ElvenSpellmaker ElvenSpellmaker changed the title Dragging windows is broken since 2.2.4 Dragging windows is broken since 2.4.0 Jul 12, 2016
@ElvenSpellmaker
Copy link
Author

17.3" Laptop 1920x1080 (1)
2x 23" HP Monitors 1920x1080 (2 and 3)

Therefore monitor 1 is denser (and everything appears smaller because Windows sucks at DPI Scaling).
But this problem happens when dragging from any monitor to any other monitor, even when the DPI is the same.

Yes I'm still running 8.1.

image

Putting the option HandleDPI=false into my config solves the problem, and so it seems that the option as true (the default?) is broken?

@mintty
Copy link
Owner

mintty commented Jul 12, 2016

So do I understand right? If you drag mintty from one external monitor to the other, both window and font size get larger? And if you drag it back to the previous external monitor, it gets larger again?
What are the individual DPI values/zoom factors of both (or all three) monitors?
Which mintty version has the effect?

@ElvenSpellmaker
Copy link
Author

Yes that's right, plus it won't let me move it from 3 to anywhere over the second half of screen 2, it just keeps jumping back. I could perhaps try to get a video?

All monitors are on 100%:
image

The latest mintty started this (2.4.0).

@mintty
Copy link
Owner

mintty commented Jul 12, 2016

Your initial report starts "Since 1.2.4..."; what's 1.2.4?
A video might help debugging with a chance of < 10% :(
No idea how to reproduce this.

@ElvenSpellmaker
Copy link
Author

Sorry it's a mistype, I forgot the real version number! I'll try to get a video soon.

@ElvenSpellmaker
Copy link
Author

I tried to use a screen recorder but it just goes wild on this laptop, and so I resorted to using my tablet's camera (which is pretty bad) as my phone camera is ruined.

https://www.youtube.com/watch?v=JcLElyf6SWA

Hopefully this shows what I mean. =)

@mintty
Copy link
Owner

mintty commented Jul 14, 2016

The snapping effects are discomforting; I have not seen anything like it in my own multi-monitor experiments. Some comments:

  • This does not seem to be a scaling problem as in some other issues. Font size is only slightly affected.
  • Quite at the beginning, the window snaps up considerably; is it resized on that occasion?

@FredDeschenes
Copy link

FredDeschenes commented Jul 14, 2016

I'm seeing the same issue, also running Windows 8.1 and Mintty 2.4.0.

If it helps both my monitors run the same resolution (1680X1050) with the same scaling.

Also the video posted by @ElvenSpellmaker doesn't really show it, but going from monitor 2 (on the right) to monitor 1 (left), I can get the "resize" thing to happen more than once if I keep dragging the window towards the left.

EDIT: I also just realized that moving the window with the keyboard (win+arrows) does NOT produce the issue.

@ElvenSpellmaker
Copy link
Author

@FredDeschenes: You're right, I was moving it slowly for the demonstration, but if you move it quickly the font enlarges once for every jerk back to the previous screen.

And yes, I can move with the Win+Arrows too. =)

@ElvenSpellmaker
Copy link
Author

If it helps, the terminal resizes so that it still has the same number of lines and columns as before the resize of the text.

@mintty
Copy link
Owner

mintty commented Jul 14, 2016

If it helps, the terminal resizes so that it still has the same number of lines and columns as before the resize of the text.

which is a tweak that I introduced on purpose in 2.4.0 to stabilize the terminal size after DPI adaptation.
There are actually 3 related modifications; if you like you could try to disable them to find the culprit:
heuristic attempt to stabilize font size roundtrips, esp. after fulls… · 236ea3a
tweak DPI changes to stabilize roundtrips of font and window size (#470) · 2c3c081

@FredDeschenes
Copy link

@mintty : Reverting 2c3c081 in the 2.4.0 tag seems to have fixed the issue for me, thanks!

@mintty
Copy link
Owner

mintty commented Jul 14, 2016

There are actually two changes in this commit:

-        long width = (r->right - r->left);
-        long height = (r->bottom - r->top);
+        long width = (r->right - r->left) * 20 / 19;
+        long height = (r->bottom - r->top) * 20 / 19;

and

+        int y = term.rows, x = term.cols;
         win_adapt_term_size(false, true);
+        win_set_chars(y, x);  // also clips to desktop size (win_fix_position)

Can you test them separately?

@FredDeschenes
Copy link

By itself, removing both " * 20 / 19"s fixes the issue, but the "mouse weirdness" (for the lack of a better word) is still there (cursor doesn't stay in the same place on the title bar dragging across screens). This is fixed by commenting the call to "win_set_chars".

@mintty
Copy link
Owner

mintty commented Jul 14, 2016

Thanks a lot. I wonder, though, why this happens at all; this code is supposed to be activated on DPI changes, but your monitors are identical...

@FredDeschenes
Copy link

Yeah that's really weird, even if they weren't the same DPI (which they might be now that I think of it), I really don't see how this could stack up for each monitor switch.

@mintty
Copy link
Owner

mintty commented Jul 21, 2016

Please check repository version.

@FredDeschenes
Copy link

Looks good, thanks for the fix!

@ElvenSpellmaker
Copy link
Author

Seems good to me!

@cdjc
Copy link

cdjc commented Jul 21, 2016

This issue has been bothering me for a couple of weeks, but finally looked in to it today, and good to see it already fixed now. Thanks. I've reverted back to 2.3.7 (via Cygwin) for the time being.

@ElvenSpellmaker
Copy link
Author

@cdjc: Did you try the suggestion by @mintty?

HandleDPI=false on 2.4.0?

@cdjc
Copy link

cdjc commented Jul 21, 2016

@ElvenSpellmaker: Just re-upgraded to 2.4.0 and tried it. Yes, it does solve the problem.

@mintty
Copy link
Owner

mintty commented Jul 22, 2016

Fixed in 2.4.1.

@c-sonntag
Copy link

c-sonntag commented Jul 25, 2016

This option HandleDPI=false it's ok for me !
Thank you @mintty !

@mintty
Copy link
Owner

mintty commented Jul 25, 2016

Actually, with 2.4.1, this workaround should not be needed anymore.

@mintty
Copy link
Owner

mintty commented Jun 12, 2018

With support for Windows DPI handling V2 (#774), this should now work without DPI disabling.

@mintty
Copy link
Owner

mintty commented Jul 1, 2018

Released 2.9.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants