天天看點

ida-on-non-os-x-retina-hi-dpi-displays

設定一下

QT_AUTO_SCREEN_SCALE_FACTOR

  = 1 的環境變量就行了。

x64dbg也一樣的問題,不設定的話,在4k高清顯示器下,布局能力會丢失,無法通過拖拽等操作來調整布局。

The problem

Some users running IDA on Windows & Linux X11 platforms with Hi-DPI displays, have reported that IDA looks rather odd: the navigator bar is too narrow, the text under it gets truncated, and there is overall feeling of packing & clumsiness:

  • Windows:
    ida-on-non-os-x-retina-hi-dpi-displays
  • Linux X11:
    ida-on-non-os-x-retina-hi-dpi-displays

Looking closely, one can notice the following issues (probably not an exhaustive list)

ida-on-non-os-x-retina-hi-dpi-displays

Note: this should not happen and shouldn’t apply for OS X users running IDA on Retina displays. Nor should it happen (but we didn’t get a chance to test this) on non-X11 Linux display managers, such as Wayland.

Fix / mitigation:

On Linux X11 & Windows, if you are using Hi-DPI monitors and IDA looks somewhat like it does in the above screenshots, please try setting the environment variable 

QT_AUTO_SCREEN_SCALE_FACTOR

 to 

1

:

E.g., on Linux/X11:

~# export QT_AUTO_SCREEN_SCALE_FACTOR=1 ~# path/to/ida my.idb

IDA should now look more pleasant:

  • ida-on-non-os-x-retina-hi-dpi-displays
  • ida-on-non-os-x-retina-hi-dpi-displays

Some things are still not perfect (e.g., checkboxes might remain small), but IDA definitely looks better.

Please give it a try!

Gory details

When one applies scaling/zooming, either in Windows and Linux X11, that will have the effect of causing the OS to return scaled values for font metrics when queried using point sizes (which is almost always the case.)

For example, when the font metrics for a font of size 

12pt

 are requested by a Qt application, instead of returning 

14 pixels

 as it would on a non-scaled system, the operating system will instead return 

28 pixels

 on a 200% scaled one (in other words, this is essentially a font database-related feature).

That will, in turn, have the net effect of causing Qt to compute layout of the surrounding widgets according to those scaled font metrics, which explains why the text is (for the most part) not truncated.

However, what applying scaling does not do, is tell Qt that it should scale all other pixel measurements by that scale factor.

Consequently, paddings, margins, scrollbars, etc… all have uncomfortably small dimensions, especially when compared to text.

The 

QT_AUTO_SCREEN_SCALE_FACTOR

 environment variable is an opt-in that program users can define, in order to control how the program should look. It will in essence instruct Qt to perform automatic scaling of (non-font-related) graphical operations according to the pixel density of the screen(s).

Why is this not needed under OS X + Retina?