hainproject / hain

An 'alt+space' launcher for Windows, built with Electron
http://hainproject.github.io/hain/
MIT License
3.2k stars 155 forks source link

Bug: Hain window shrinks when two displays have different DPI scaling #285

Open amosharper opened 5 years ago

amosharper commented 5 years ago

Hey, quick bug I've encountered with Hain 0.6.6 on Windows 10 (Enterprise 10.0.17134). I have a main display (1920x1080 at 100% scaling) and a secondary display (3840x2160 at 125% scaling).

When Hain is first opened on either display it shows with the expected window size. However, each susbequent time I open it on the 4K screen and then the laptop screen in turn, the dimensions of the window shrink significantly (but not the scaling), becoming more and more difficult to use until Hain must be restarted.

image

A workaround that maintains QOL is to disable "open window on the currently active display".

haroonrafi commented 5 years ago

I'm also experiencing this problem, except it's worse than just resizing the window.

I have three displays:

Display 1 - 1920x1080 / 100% Scaling Display 2 (Primary) - 1920 x 1080 / 100% Scaling Display 3 - 1920 x 1080 / 150% Scaling

When set to use currently active display:

Steps taken in order:

  1. First launched - defaults to display 1, where nothing shows up.
  2. Tried to use shortcut on display 1 - still nothing.
  3. Opened on display 2 - works fine, correct size and centered.
  4. Then opened on display 3 - works fine, correct size and centered.
  5. Went back to display 2 - incorrect size and off center. It's now stuck this way until Hain is restarted.
  6. Tried again on display 1 - still nothing.

So basically, once it's been opened on the display with different scaling, it gets stuck with the wrong dimensions, and display 1 is completely non-responsive from the start.

When set to open on specific display (Display 2):

In this mode, it's worse:

  1. Initial load - shows correctly on display 2.
  2. Display 1/2/3 - using the shortcut, it now fails to open on all three.

Once it's been closed after the automatic initial load, it's dead unless I restart Hain. So basically, it's completely unusable with this setting.

With Display 3 set to 100% scaling instead of 150%:

When all windows have default scaling, it then works fine, both with the "active display" setting and the "specific display" one.


Incidentally, when Display 3 is at 150% scaling, the "open on specific display" list in the preferences shows it as having a resolution of 1280 x 721, instead of 1920 x 1080. I don't know if this is how the OS is supposed to report it to Electron, but I thought it might be worth noting.

For now I have set the third display to 100% scaling, but it's a pretty inconvenient change to make one piece of software work.