New issue
Advanced search Search tips

Issue 800430 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

hterm: moving window between displays of different DPIs results in incorrect scaling

Project Member Reported by dnschn...@chromium.org, Jan 9 2018

Issue description

Google Chrome	65.0.3299.0 (Official Build) canary (64-bit)
Revision	0
Platform	10232.0.0 (Official Build) canary-channel eve-kvm

What steps will reproduce the problem?
(1) Attach an external monitor of different DPI
(2) Open an hterm window and fill the terminal with lines of text
(3) Move the window from one monitor to the other
(4) Note that hterm notices the resize (it displays the updated geometry), but the bottom lines may be cut off
(5) Hit ctrl-0, which should be a no-op
(6) Scaling is fixed so that the bottom lines are no longer cut off
(7) Repeat 3-6 back to the original monitor.

What is the expected result?
Step 5 shouldn't be necessary.

What happens instead?
Lines get cut off, and you have to hit ctrl-0 to fix things.
 

Comment 1 by vapier@chromium.org, Jan 16 2018

unfortunately there doesn't appear to be any way of detecting this automatically in JS:
https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio

the suggestion there is to add a timer that just periodically polls for changes which is a bit ridiculous here.  adding a check to any other common code path would similarly be a lot of waste cycles.

adding a hook to the resize event itself shouldn't be necessary as that already should recalculate things correctly.

so it'll probably stay broken until the Web API improves.  if we could find an uncommon, but semi-periodic event location, to insert such a check, we might be able to mitigate that way.

Comment 2 Deleted

Hook on newline, but limit to checking once every n seconds?

Regardless, resize is *not* calculating things correctly, or it's using (or being fed) a stale value of DPI or something.  I can move the window to the other display, and then resize the window and it still has the wrong DPI.  Ctrl-0 is the only way I've found to fix things.
not a fan of any timer based approach

googling around, there might be a way to use the scroll event to detect when the font changes.  i'll have to try it on attached displays to see if it helps.  the algo is covered here:
  https://github.com/marcj/css-element-queries/blob/master/src/ResizeSensor.js

Sign in to add a comment