alacritty: Incorrect DPR when launched in a second monitor

Hi,

I encountered phenomena similar to #71.

When I launch the app from a second monitor with DPR 1, it displays the half-sized display in a correct size window. When I move the window to the main monitor with DPR 2, then it displays correctly, and when I move it again to the second monitor, it also displays correctly, although the log reports that it changed DPR 1 -> DPR 2 -> DPR 1.

On the other hand, when I launch alacritty from a primary builtin monitor with DPR 2, it works fine.

(It seems that “DPR 1” has already been detected before the display is drawn, but the display does not reflect it. I have checked the code and tried some changes, but cannot figure out how to run something like terminal.resize(size_info) inside the initialization process. What changes shall I try?)

Action Monitor Monitor DPR Logged DPR Expected DPR Actual DPR
Launch secondary 1 1 1 2?
Move primary 2 2 2 2
Move secondary 1 1 1 1
Action Monitor Monitor DPR Logged DPR Expected DPR Actual DPR
Launch primary 2 2 2 2
Move secondary 1 1 1 1
Move primary 2 2 2 2

ss 2020-10-21 23 02 21(2)

System

OS: macOS High Sierra (10.13.6) Version: alacritty 0.6.0-dev (21eb84f) (built from commit 21eb84fc5e0e649f53e3785957fa127ee9a78688)

Logs

secondary (1) -> primary (2) -> secondary (1):

% /Applications/Alacritty.app/Contents/MacOS/alacritty -vv
[2020-10-21 23:02:18.127642000] [DEBUG] [alacritty] Using environment locale: ja_JP.UTF-8
Created log file at "/var/folders/wp/x1kk7wts6v3g_g1fy3zwp5c40000gn/T/Alacritty-13668.log"
[2020-10-21 23:02:18.128555000] [INFO ] [alacritty] Welcome to Alacritty
[2020-10-21 23:02:18.128596000] [INFO ] [alacritty] Configuration files loaded from:
[2020-10-21 23:02:18.128620000] [INFO ] [alacritty]   "/Users/noritada/.alacritty.yml"
[2020-10-21 23:02:18.199640000] [DEBUG] [alacritty] Estimated DPR: 2
[2020-10-21 23:02:18.199720000] [DEBUG] [alacritty] Estimated window size: None
[2020-10-21 23:02:18.199752000] [DEBUG] [alacritty] Estimated cell size: 13 x 29
[2020-10-21 23:02:18.251962000] [INFO ] [alacritty] Device pixel ratio: 1
[2020-10-21 23:02:18.256573000] [INFO ] [alacritty] Initializing glyph cache...
[2020-10-21 23:02:18.276219000] [INFO ] [alacritty] ... finished initializing glyph cache in 0.019514376s
[2020-10-21 23:02:18.276342000] [INFO ] [alacritty] Cell size: 6 x 15
[2020-10-21 23:02:18.276383000] [INFO ] [alacritty] Padding: 0 x 0
[2020-10-21 23:02:18.276835000] [INFO ] [alacritty] PTY dimensions: Line(40) x Column(133)
[2020-10-21 23:02:18.281977000] [INFO ] [alacritty] Initialisation complete
[2020-10-21 23:02:25.912539000] [INFO ] [alacritty] Font size changed to Size(22) with DPR of 2
[2020-10-21 23:02:25.917190000] [INFO ] [alacritty] Cell size: 13 x 29
[2020-10-21 23:02:25.917278000] [DEBUG] [alacritty_terminal] New num_cols is 123 and num_lines is 41
[2020-10-21 23:02:25.923895000] [INFO ] [alacritty] Padding: 0 x 0
[2020-10-21 23:02:25.923976000] [INFO ] [alacritty] Width: 1600, Height: 1200
[2020-10-21 23:02:38.556535000] [INFO ] [alacritty] Font size changed to Size(22) with DPR of 1
[2020-10-21 23:02:38.559250000] [INFO ] [alacritty] Cell size: 6 x 15
[2020-10-21 23:02:38.559313000] [DEBUG] [alacritty_terminal] New num_cols is 133 and num_lines is 40
[2020-10-21 23:02:38.565677000] [INFO ] [alacritty] Padding: 0 x 0
[2020-10-21 23:02:38.565782000] [INFO ] [alacritty] Width: 800, Height: 600
[2020-10-21 23:02:55.432480000] [INFO ] [alacritty] Goodbye
Deleted log file at "/var/folders/wp/x1kk7wts6v3g_g1fy3zwp5c40000gn/T/Alacritty-13668.log"

primary (2) -> secondary (1) -> primary (2):

% /Applications/Alacritty.app/Contents/MacOS/alacritty -vv
[2020-10-21 23:04:11.113045000] [DEBUG] [alacritty] Using environment locale: ja_JP.UTF-8
Created log file at "/var/folders/wp/x1kk7wts6v3g_g1fy3zwp5c40000gn/T/Alacritty-13726.log"
[2020-10-21 23:04:11.113213000] [INFO ] [alacritty] Welcome to Alacritty
[2020-10-21 23:04:11.113239000] [INFO ] [alacritty] Configuration files loaded from:
[2020-10-21 23:04:11.113259000] [INFO ] [alacritty]   "/Users/noritada/.alacritty.yml"
[2020-10-21 23:04:11.156174000] [DEBUG] [alacritty] Estimated DPR: 2
[2020-10-21 23:04:11.156247000] [DEBUG] [alacritty] Estimated window size: None
[2020-10-21 23:04:11.156274000] [DEBUG] [alacritty] Estimated cell size: 13 x 29
[2020-10-21 23:04:11.199306000] [INFO ] [alacritty] Device pixel ratio: 2
[2020-10-21 23:04:11.203885000] [INFO ] [alacritty] Initializing glyph cache...
[2020-10-21 23:04:11.225220000] [INFO ] [alacritty] ... finished initializing glyph cache in 0.0209997s
[2020-10-21 23:04:11.225399000] [INFO ] [alacritty] Cell size: 13 x 29
[2020-10-21 23:04:11.225447000] [INFO ] [alacritty] Padding: 0 x 0
[2020-10-21 23:04:11.225823000] [INFO ] [alacritty] PTY dimensions: Line(41) x Column(123)
[2020-10-21 23:04:11.229156000] [INFO ] [alacritty] Initialisation complete
[2020-10-21 23:04:17.884078000] [INFO ] [alacritty] Font size changed to Size(22) with DPR of 1
[2020-10-21 23:04:17.890079000] [INFO ] [alacritty] Cell size: 6 x 15
[2020-10-21 23:04:17.890158000] [DEBUG] [alacritty_terminal] New num_cols is 133 and num_lines is 40
[2020-10-21 23:04:17.895593000] [INFO ] [alacritty] Padding: 0 x 0
[2020-10-21 23:04:17.895691000] [INFO ] [alacritty] Width: 800, Height: 600
[2020-10-21 23:04:26.658052000] [INFO ] [alacritty] Font size changed to Size(22) with DPR of 2
[2020-10-21 23:04:26.661061000] [INFO ] [alacritty] Cell size: 13 x 29
[2020-10-21 23:04:26.661145000] [DEBUG] [alacritty_terminal] New num_cols is 123 and num_lines is 41
[2020-10-21 23:04:26.673038000] [INFO ] [alacritty] Padding: 0 x 0
[2020-10-21 23:04:26.673162000] [INFO ] [alacritty] Width: 1600, Height: 1200
[2020-10-21 23:04:38.168251000] [INFO ] [alacritty] Goodbye
Deleted log file at "/var/folders/wp/x1kk7wts6v3g_g1fy3zwp5c40000gn/T/Alacritty-13726.log"

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

I have upgraded my macOS from High Sierra (10.13.6) to Mojave (10.14.6) and got a correct display with the same binary as what I used to see incorrect display on 10.13.6. So, confirmed that this is only an issue on 10.13, which is now 3 years old. Sorry for the disturbance. Thanks!

Yes, that is why I want to check other environments. Although security update was provided for 10.13 1 month ago (on Sep. 24), the first release of 10.13 was 3 years ago (on Sep 25, 2017).

I don’t have anything as of now. I’d like to check whether it can be reproduced in environments of macOS users around me.

Could you try this patch:

diff --git a/alacritty/src/display.rs b/alacritty/src/display.rs
index 0c5948f..8a6cd22 100644
--- a/alacritty/src/display.rs
+++ b/alacritty/src/display.rs
@@ -206,9 +206,6 @@ impl Display {
 
         info!("Device pixel ratio: {}", window.dpr);
 
-        // get window properties for initializing the other subsystems.
-        let viewport_size = window.inner_size();
-
         // Create renderer.
         let mut renderer = QuadRenderer::new()?;
 
@@ -226,6 +223,7 @@ impl Display {
         }
 
         let padding = config.ui_config.window.padding(window.dpr);
+        let viewport_size = window.inner_size();
 
         // Create new size with at least one column and row.
         let size_info = SizeInfo::new(
@@ -240,6 +238,7 @@ impl Display {
 
         info!("Cell size: {} x {}", cell_width, cell_height);
         info!("Padding: {} x {}", size_info.padding_x(), size_info.padding_y());
+        info!("Width: {}, Height: {}", size_info.width(), size_info.height());
 
         // Update OpenGL projection.
         renderer.resize(&size_info);

It shouldn’t fix anything, but it will make your alacritty -vv log more useful. I’m curious only about the broken case of 1 -> 2 -> 1.

OK, I checked with 0.5.0 (a6681e3) (both downloaded one and built one) and got the same result. So, this is not a regression after 0.5.0.