Skip to content

Commit

Permalink
Report XRandR display size for lodpi displays
Browse files Browse the repository at this point in the history
  • Loading branch information
alimirjamali committed Nov 15, 2024
1 parent 32e977b commit 564879c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion qubesadmin/tests/tools/qvm_start_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def test_050_get_monitor_layout1(self, proc_mock):
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
'''.splitlines()
self.assertEqual(qubesadmin.tools.qvm_start_daemon.get_monitor_layout(),
['1920 1200 0 0\n'])
['1920 1200 0 0 508 317\n'])

@unittest.mock.patch('subprocess.Popen')
def test_051_get_monitor_layout_multiple(self, proc_mock):
Expand Down
15 changes: 6 additions & 9 deletions qubesadmin/tools/qvm_start_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ def get_monitor_layout():
continue
output_params = match.groupdict()
if output_params['width']:
phys_size = ""
if output_params['width_mm'] \
and int(output_params['width_mm']):
# don't provide real values for privacy reasons - see
Expand All @@ -416,14 +415,12 @@ def get_monitor_layout():
elif dpi > 150:
dpi = 150
else:
# if lower, don't provide this info to the VM at all
dpi = 0
if dpi:
# now calculate dimensions based on approximate DPI
phys_size = " {} {}".format(
int(output_params['width']) * 254 // dpi // 10,
int(output_params['height']) * 254 // dpi // 10,
)
dpi = 96
# now calculate dimensions based on approximate DPI
phys_size = " {} {}".format(
int(output_params['width']) * 254 // dpi // 10,
int(output_params['height']) * 254 // dpi // 10,
)
outputs.append("%s %s %s %s%s\n" % (
output_params['width'],
output_params['height'],
Expand Down

0 comments on commit 564879c

Please sign in to comment.