Skip to content

Commit

Permalink
Add a qt.highdpi setting
Browse files Browse the repository at this point in the history
See #1585
  • Loading branch information
The-Compiler committed Nov 6, 2017
1 parent 4857374 commit 341e8ca
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions qutebrowser/config/configdata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,19 @@ qt.force_platform:
using the XCB plugin when running QtWebEngine on Wayland.
qt.highdpi:
type: Bool
default: false
desc: >-
Turn on Qt HighDPI scaling.
This is equivalent to setting QT_AUTO_SCREEN_SCALE_FACTOR=1 in the
environment.
It's off by default as it can cause issues with some bitmap fonts.
As an alternative to this, it's possible to set font sizes and the
`zoom.default` setting.
## auto_save

auto_save.interval:
Expand Down
3 changes: 3 additions & 0 deletions qutebrowser/config/configinit.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def _init_envvars():
else:
os.environ.pop('QT_WAYLAND_DISABLE_WINDOWDECORATION', None)

if config.val.qt.highdpi:
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'


@config.change_filter('fonts.monospace', function=True)
def _update_monospace_fonts():
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/config/test_configinit.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,15 @@ def test_force_platform(self, monkeypatch, config_stub):
configinit._init_envvars()
assert os.environ[envvar] == 'toaster'

def test_highdpi(self, monkeypatch, config_stub):
envvar = 'QT_AUTO_SCREEN_SCALE_FACTOR'
monkeypatch.delenv(envvar, raising=False)

config_stub.val.qt.highdpi = True

configinit._init_envvars()
assert os.environ[envvar] == '1'

@pytest.mark.parametrize('old', ['1', '0', None])
@pytest.mark.parametrize('configval', [True, False])
def test_hide_wayland_decoration(self, monkeypatch, config_stub,
Expand Down

0 comments on commit 341e8ca

Please sign in to comment.