fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
24.53k stars 1.36k forks source link

DPI/scaling on external monitor #3537

Open maxsupermanhd opened 1 year ago

maxsupermanhd commented 1 year ago

Checklist

Describe the bug

I have 2 monitors, laptop and a standalone. On a laptop monitor fyne_demo reports scaling of 1.0 but on the external monitor it sets it to 2.2 and whole application becomes very big.

It is also accompanied by following messages in terminal:

2023/01/03 20:04:07 Fyne error:  failed to read theme variant from D-Bus
2023/01/03 20:04:07   Cause: Requested setting not found
2023/01/03 20:04:07   At: /home/max/go/pkg/mod/fyne.io/fyne/v2@v2.3.0/app/app_xdg.go:51
Xlib:  extension "NV-GLX" missing on display ":0.0".

How to reproduce

Launch any Fyne application.

Screenshots

On external monitor image On laptop monitor image

Example code

package main

import (
    "fyne.io/fyne/v2"
    "fyne.io/fyne/v2/app"
    "fyne.io/fyne/v2/widget"
)

var data = []string{"a", "string", "list"}

func main() {
    myApp := app.New()
    myWindow := myApp.NewWindow("List Widget")

    list := widget.NewList(
        func() int {
            return len(data)
        },
        func() fyne.CanvasObject {
            return widget.NewLabel("template")
        },
        func(i widget.ListItemID, o fyne.CanvasObject) {
            o.(*widget.Label).SetText(data[i])
        })

    myWindow.SetContent(list)
    myWindow.ShowAndRun()
}

Fyne version

2.3.0

Go compiler version

1.19.3

Operating system

Linux

Operating system version

Ubuntu 20.04 (Xfce)

Additional Information

Other applications do not have this issue.

andydotxyz commented 1 year ago

The maths we do should ensure the content is the same size on the different monitors. Linux is a pain because there is no standard way to get a user defined scaling. Somehow I think that Xfce, or your X11 config, is multiplying our calculations to unexpected outcome.

Can you please provide the full spec (physical size, pixel dimensions) of each monitor, and any scaling that you are applying to the displays through the window manager.

maxsupermanhd commented 1 year ago

Here is modeset logs from xorg, they should have all the info

[     8.353] (II) modeset(G0): glamor X acceleration enabled on Mesa Intel(R) UHD Graphics 620 (WHL GT2)
[     8.353] (II) modeset(G0): glamor initialized
[     8.355] (II) modeset(G0): Output eDP-1-1 has no monitor section
[     8.394] (II) modeset(G0): Output HDMI-1-1 has no monitor section
[     8.405] (II) modeset(G0): EDID for output eDP-1-1
[     8.405] (II) modeset(G0): Manufacturer: BOE  Model: 7ce  Serial#: 0
[     8.405] (II) modeset(G0): Year: 2018  Week: 1
[     8.405] (II) modeset(G0): EDID Version: 1.4
[     8.405] (II) modeset(G0): Digital Display Input
[     8.405] (II) modeset(G0): 6 bits per channel
[     8.405] (II) modeset(G0): Digital interface is DisplayPort
[     8.405] (II) modeset(G0): Max Image Size [cm]: horiz.: 34  vert.: 19
[     8.405] (II) modeset(G0): Gamma: 2.20
[     8.405] (II) modeset(G0): No DPMS capabilities specified
[     8.405] (II) modeset(G0): Supported color encodings: RGB 4:4:4 
[     8.405] (II) modeset(G0): First detailed timing is preferred mode
[     8.405] (II) modeset(G0): Preferred mode is native pixel format and refresh rate
[     8.405] (II) modeset(G0): redX: 0.579 redY: 0.363   greenX: 0.352 greenY: 0.572
[     8.405] (II) modeset(G0): blueX: 0.162 blueY: 0.123   whiteX: 0.312 whiteY: 0.328
[     8.405] (II) modeset(G0): Manufacturer's mask: 0
[     8.405] (II) modeset(G0): Supported detailed timing:
[     8.405] (II) modeset(G0): clock: 76.2 MHz   Image Size:  344 x 193 mm
[     8.405] (II) modeset(G0): h_active: 1366  h_sync: 1414  h_sync_end 1446 h_blank_end 1592 h_border: 0
[     8.405] (II) modeset(G0): v_active: 768  v_sync: 771  v_sync_end 777 v_blanking: 798 v_border: 0
[     8.405] (II) modeset(G0):  BOE CQ
[     8.405] (II) modeset(G0):  NT156WHM-N44
[     8.405] (II) modeset(G0): EDID (in hex):
[     8.405] (II) modeset(G0):  00ffffffffffff0009e5ce0700000000
[     8.405] (II) modeset(G0):  011c0104952213780242a0945d5a9229
[     8.405] (II) modeset(G0):  1f505400000001010101010101010101
[     8.405] (II) modeset(G0):  010101010101c61d56e250001e303020
[     8.405] (II) modeset(G0):  360058c11000001a0000000000000000
[     8.405] (II) modeset(G0):  00000000000000000000000000fe0042
[     8.405] (II) modeset(G0):  4f452043510a202020202020000000fe
[     8.405] (II) modeset(G0):  004e5431353657484d2d4e34340a0039
[     8.405] (II) modeset(G0): Printing probed modes for output eDP-1-1
[     8.405] (II) modeset(G0): Modeline "1366x768"x60.0   76.22  1366 1414 1446 1592  768 771 777 798 +hsync -vsync (47.9 kHz eP)
[     8.405] (II) modeset(G0): Modeline "1360x768"x59.8   84.75  1360 1432 1568 1776  768 771 781 798 -hsync +vsync (47.7 kHz d)
[     8.405] (II) modeset(G0): Modeline "1360x768"x60.0   72.00  1360 1408 1440 1520  768 771 781 790 +hsync -vsync (47.4 kHz d)
[     8.405] (II) modeset(G0): Modeline "1280x720"x120.0  156.12  1280 1376 1512 1744  720 721 724 746 doublescan -hsync +vsync (89.5 kHz d)
[     8.405] (II) modeset(G0): Modeline "1280x720"x120.0  120.75  1280 1304 1320 1360  720 721 724 740 doublescan +hsync -vsync (88.8 kHz d)
[     8.405] (II) modeset(G0): Modeline "1280x720"x59.9   74.50  1280 1344 1472 1664  720 723 728 748 -hsync +vsync (44.8 kHz d)
[     8.405] (II) modeset(G0): Modeline "1280x720"x59.7   63.75  1280 1328 1360 1440  720 723 728 741 +hsync -vsync (44.3 kHz d)
[     8.405] (II) modeset(G0): Modeline "1024x768"x120.1  133.47  1024 1100 1212 1400  768 768 770 794 doublescan -hsync +vsync (95.3 kHz d)
[     8.405] (II) modeset(G0): Modeline "1024x768"x60.0   65.00  1024 1048 1184 1344  768 771 777 806 -hsync -vsync (48.4 kHz d)
[     8.405] (II) modeset(G0): Modeline "960x720"x120.0  117.00  960 1024 1128 1300  720 720 722 750 doublescan -hsync +vsync (90.0 kHz d)
[     8.405] (II) modeset(G0): Modeline "928x696"x120.1  109.15  928 976 1088 1264  696 696 698 719 doublescan -hsync +vsync (86.4 kHz d)
[     8.405] (II) modeset(G0): Modeline "896x672"x120.0  102.40  896 960 1060 1224  672 672 674 697 doublescan -hsync +vsync (83.7 kHz d)
[     8.405] (II) modeset(G0): Modeline "1024x576"x119.9   98.50  1024 1092 1200 1376  576 577 580 597 doublescan -hsync +vsync (71.6 kHz d)
[     8.405] (II) modeset(G0): Modeline "1024x576"x119.9   78.38  1024 1048 1064 1104  576 577 580 592 doublescan +hsync -vsync (71.0 kHz d)
[     8.405] (II) modeset(G0): Modeline "1024x576"x59.9   46.50  1024 1064 1160 1296  576 579 584 599 -hsync +vsync (35.9 kHz d)
[     8.405] (II) modeset(G0): Modeline "1024x576"x59.8   42.00  1024 1072 1104 1184  576 579 584 593 +hsync -vsync (35.5 kHz d)
[     8.405] (II) modeset(G0): Modeline "960x600"x119.9   96.62  960 1028 1128 1296  600 601 604 622 doublescan -hsync +vsync (74.6 kHz d)
[     8.405] (II) modeset(G0): Modeline "960x600"x120.0   77.00  960 984 1000 1040  600 601 604 617 doublescan +hsync -vsync (74.0 kHz d)
[     8.405] (II) modeset(G0): Modeline "960x540"x119.9   86.50  960 1024 1124 1288  540 541 544 560 doublescan -hsync +vsync (67.2 kHz d)
[     8.405] (II) modeset(G0): Modeline "960x540"x120.0   69.25  960 984 1000 1040  540 541 544 555 doublescan +hsync -vsync (66.6 kHz d)
[     8.405] (II) modeset(G0): Modeline "960x540"x59.6   40.75  960 992 1088 1216  540 543 548 562 -hsync +vsync (33.5 kHz d)
[     8.405] (II) modeset(G0): Modeline "960x540"x59.8   37.25  960 1008 1040 1120  540 543 548 556 +hsync -vsync (33.3 kHz d)
[     8.405] (II) modeset(G0): Modeline "800x600"x120.0   81.00  800 832 928 1080  600 600 602 625 doublescan +hsync +vsync (75.0 kHz d)
[     8.405] (II) modeset(G0): Modeline "800x600"x60.3   40.00  800 840 968 1056  600 601 605 628 +hsync +vsync (37.9 kHz d)
[     8.405] (II) modeset(G0): Modeline "800x600"x56.2   36.00  800 824 896 1024  600 601 603 625 +hsync +vsync (35.2 kHz d)
[     8.405] (II) modeset(G0): Modeline "840x525"x120.0   73.12  840 892 980 1120  525 526 529 544 doublescan -hsync +vsync (65.3 kHz d)
[     8.405] (II) modeset(G0): Modeline "840x525"x119.8   59.50  840 864 880 920  525 526 529 540 doublescan +hsync -vsync (64.7 kHz d)
[     8.405] (II) modeset(G0): Modeline "864x486"x59.9   32.50  864 888 968 1072  486 489 494 506 -hsync +vsync (30.3 kHz d)
[     8.405] (II) modeset(G0): Modeline "864x486"x59.6   30.50  864 912 944 1024  486 489 494 500 +hsync -vsync (29.8 kHz d)
[     8.405] (II) modeset(G0): Modeline "800x512"x120.3   51.56  800 800 828 832  512 512 514 515 doublescan +hsync +vsync (62.0 kHz d)
[     8.405] (II) modeset(G0): Modeline "700x525"x120.0   61.00  700 744 820 940  525 526 532 541 doublescan +hsync +vsync (64.9 kHz d)
[     8.405] (II) modeset(G0): Modeline "800x450"x119.9   59.12  800 848 928 1056  450 451 454 467 doublescan -hsync +vsync (56.0 kHz d)
[     8.405] (II) modeset(G0): Modeline "800x450"x119.6   48.75  800 824 840 880  450 451 454 463 doublescan +hsync -vsync (55.4 kHz d)
[     8.405] (II) modeset(G0): Modeline "640x512"x120.0   54.00  640 664 720 844  512 512 514 533 doublescan +hsync +vsync (64.0 kHz d)
[     8.405] (II) modeset(G0): Modeline "720x450"x119.8   53.25  720 760 836 952  450 451 454 467 doublescan -hsync +vsync (55.9 kHz d)
[     8.405] (II) modeset(G0): Modeline "700x450"x119.9   51.75  700 740 812 924  450 451 456 467 doublescan -hsync +vsync (56.0 kHz d)
[     8.405] (II) modeset(G0): Modeline "700x450"x119.8   43.25  700 724 740 780  450 451 456 463 doublescan +hsync -vsync (55.4 kHz d)
[     8.405] (II) modeset(G0): Modeline "640x480"x120.0   54.00  640 688 744 900  480 480 482 500 doublescan +hsync +vsync (60.0 kHz d)
[     8.405] (II) modeset(G0): Modeline "640x480"x59.9   25.18  640 656 752 800  480 490 492 525 -hsync -vsync (31.5 kHz d)
[     8.405] (II) modeset(G0): Modeline "720x405"x59.5   22.50  720 744 808 896  405 408 413 422 -hsync +vsync (25.1 kHz d)
[     8.405] (II) modeset(G0): Modeline "720x405"x59.0   21.75  720 768 800 880  405 408 413 419 +hsync -vsync (24.7 kHz d)
[     8.405] (II) modeset(G0): Modeline "684x384"x119.8   42.62  684 720 788 892  384 385 390 399 doublescan -hsync +vsync (47.8 kHz d)
[     8.405] (II) modeset(G0): Modeline "684x384"x119.7   36.12  684 708 724 764  384 385 390 395 doublescan +hsync -vsync (47.3 kHz d)
[     8.405] (II) modeset(G0): Modeline "680x384"x119.6   42.38  680 716 784 888  384 385 390 399 doublescan -hsync +vsync (47.7 kHz d)
[     8.405] (II) modeset(G0): Modeline "680x384"x119.9   36.00  680 704 720 760  384 385 390 395 doublescan +hsync -vsync (47.4 kHz d)
[     8.405] (II) modeset(G0): Modeline "640x400"x119.8   41.75  640 676 740 840  400 401 404 415 doublescan -hsync +vsync (49.7 kHz d)
[     8.405] (II) modeset(G0): Modeline "640x400"x120.0   35.50  640 664 680 720  400 401 404 411 doublescan +hsync -vsync (49.3 kHz d)
[     8.406] (II) modeset(G0): Modeline "576x432"x120.1   40.81  576 608 668 760  432 432 434 447 doublescan -hsync +vsync (53.7 kHz d)
[     8.406] (II) modeset(G0): Modeline "640x360"x119.7   37.25  640 672 736 832  360 361 364 374 doublescan -hsync +vsync (44.8 kHz d)
[     8.406] (II) modeset(G0): Modeline "640x360"x119.7   31.88  640 664 680 720  360 361 364 370 doublescan +hsync -vsync (44.3 kHz d)
[     8.406] (II) modeset(G0): Modeline "640x360"x59.8   18.00  640 664 720 800  360 363 368 376 -hsync +vsync (22.5 kHz d)
[     8.406] (II) modeset(G0): Modeline "640x360"x59.3   17.75  640 688 720 800  360 363 368 374 +hsync -vsync (22.2 kHz d)
[     8.406] (II) modeset(G0): Modeline "512x384"x120.0   32.50  512 524 592 672  384 385 388 403 doublescan -hsync -vsync (48.4 kHz d)
[     8.406] (II) modeset(G0): Modeline "512x288"x120.0   23.25  512 532 580 648  288 289 292 299 doublescan -hsync +vsync (35.9 kHz d)
[     8.406] (II) modeset(G0): Modeline "512x288"x119.8   21.00  512 536 552 592  288 289 292 296 doublescan +hsync -vsync (35.5 kHz d)
[     8.406] (II) modeset(G0): Modeline "480x270"x119.3   20.38  480 496 544 608  270 271 274 281 doublescan -hsync +vsync (33.5 kHz d)
[     8.406] (II) modeset(G0): Modeline "480x270"x119.6   18.62  480 504 520 560  270 271 274 278 doublescan +hsync -vsync (33.3 kHz d)
[     8.406] (II) modeset(G0): Modeline "400x300"x120.6   20.00  400 420 484 528  300 300 302 314 doublescan +hsync +vsync (37.9 kHz d)
[     8.406] (II) modeset(G0): Modeline "400x300"x112.7   18.00  400 412 448 512  300 300 301 312 doublescan +hsync +vsync (35.2 kHz d)
[     8.406] (II) modeset(G0): Modeline "432x243"x119.8   16.25  432 444 484 536  243 244 247 253 doublescan -hsync +vsync (30.3 kHz d)
[     8.406] (II) modeset(G0): Modeline "432x243"x119.1   15.25  432 456 472 512  243 244 247 250 doublescan +hsync -vsync (29.8 kHz d)
[     8.406] (II) modeset(G0): Modeline "320x240"x120.1   12.59  320 328 376 400  240 245 246 262 doublescan -hsync -vsync (31.5 kHz d)
[     8.406] (II) modeset(G0): Modeline "360x202"x119.0   11.25  360 372 404 448  202 204 206 211 doublescan -hsync +vsync (25.1 kHz d)
[     8.406] (II) modeset(G0): Modeline "360x202"x118.3   10.88  360 384 400 440  202 204 206 209 doublescan +hsync -vsync (24.7 kHz d)
[     8.406] (II) modeset(G0): Modeline "320x180"x119.7    9.00  320 332 360 400  180 181 184 188 doublescan -hsync +vsync (22.5 kHz d)
[     8.406] (II) modeset(G0): Modeline "320x180"x118.6    8.88  320 344 360 400  180 181 184 187 doublescan +hsync -vsync (22.2 kHz d)
[     8.455] (II) Quirked EDID physical size to 0x0 cm
[     8.455] (II) modeset(G0): EDID for output HDMI-1-1
[     8.455] (II) modeset(G0): Manufacturer: SAM  Model: 3f2  Serial#: 0
[     8.455] (II) modeset(G0): Year: 2008  Week: 4
[     8.455] (II) modeset(G0): EDID Version: 1.3
[     8.455] (II) modeset(G0): Digital Display Input
[     8.455] (II) modeset(G0): Indeterminate output size
[     8.455] (II) modeset(G0): Gamma: 2.20
[     8.455] (II) modeset(G0): No DPMS capabilities specified
[     8.455] (II) modeset(G0): Supported color encodings: RGB 4:4:4 YCrCb 4:4:4 
[     8.455] (II) modeset(G0): First detailed timing is preferred mode
[     8.455] (II) modeset(G0): redX: 0.640 redY: 0.330   greenX: 0.300 greenY: 0.600
[     8.455] (II) modeset(G0): blueX: 0.150 blueY: 0.060   whiteX: 0.312 whiteY: 0.329
[     8.455] (II) modeset(G0): Supported established timings:
[     8.455] (II) modeset(G0): 720x400@70Hz
[     8.455] (II) modeset(G0): 640x480@60Hz
[     8.455] (II) modeset(G0): 640x480@67Hz
[     8.455] (II) modeset(G0): 640x480@72Hz
[     8.455] (II) modeset(G0): 640x480@75Hz
[     8.455] (II) modeset(G0): 800x600@56Hz
[     8.455] (II) modeset(G0): 800x600@60Hz
[     8.455] (II) modeset(G0): 800x600@72Hz
[     8.455] (II) modeset(G0): 800x600@75Hz
[     8.455] (II) modeset(G0): 832x624@75Hz
[     8.455] (II) modeset(G0): 1024x768@60Hz
[     8.455] (II) modeset(G0): 1024x768@70Hz
[     8.455] (II) modeset(G0): 1024x768@75Hz
[     8.455] (II) modeset(G0): 1280x1024@75Hz
[     8.455] (II) modeset(G0): 1152x864@75Hz
[     8.455] (II) modeset(G0): Manufacturer's mask: 0
[     8.455] (II) modeset(G0): Supported standard timings:
[     8.455] (II) modeset(G0): #0: hsize: 1280  vsize 1024  refresh: 60  vid: 32897
[     8.455] (II) modeset(G0): #1: hsize: 1280  vsize 960  refresh: 60  vid: 16513
[     8.455] (II) modeset(G0): #2: hsize: 1152  vsize 864  refresh: 75  vid: 20337
[     8.455] (II) modeset(G0): Supported detailed timing:
[     8.455] (II) modeset(G0): clock: 146.2 MHz   Image Size:  160 x 90 mm
[     8.455] (II) modeset(G0): h_active: 1680  h_sync: 1784  h_sync_end 1960 h_blank_end 2240 h_border: 0
[     8.455] (II) modeset(G0): v_active: 1050  v_sync: 1053  v_sync_end 1059 v_blanking: 1089 v_border: 0
[     8.455] (II) modeset(G0): Supported detailed timing:
[     8.455] (II) modeset(G0): clock: 74.2 MHz   Image Size:  160 x 90 mm
[     8.455] (II) modeset(G0): h_active: 1280  h_sync: 1720  h_sync_end 1760 h_blank_end 1980 h_border: 0
[     8.455] (II) modeset(G0): v_active: 720  v_sync: 725  v_sync_end 730 v_blanking: 750 v_border: 0
[     8.455] (II) modeset(G0): Ranges: V min: 23 V max: 75 Hz, H min: 26 H max: 68 kHz, PixClock max 155 MHz
[     8.455] (II) modeset(G0): Monitor name: SyncMaster
[     8.455] (II) modeset(G0): Supported detailed timing:
[     8.455] (II) modeset(G0): clock: 27.0 MHz   Image Size:  160 x 90 mm
[     8.455] (II) modeset(G0): h_active: 720  h_sync: 736  h_sync_end 798 h_blank_end 858 h_border: 0
[     8.455] (II) modeset(G0): v_active: 480  v_sync: 489  v_sync_end 495 v_blanking: 525 v_border: 0
[     8.455] (II) modeset(G0): Supported detailed timing:
[     8.455] (II) modeset(G0): clock: 74.2 MHz   Image Size:  160 x 90 mm
[     8.455] (II) modeset(G0): h_active: 1280  h_sync: 1390  h_sync_end 1430 h_blank_end 1650 h_border: 0
[     8.455] (II) modeset(G0): v_active: 720  v_sync: 725  v_sync_end 730 v_blanking: 750 v_border: 0
[     8.455] (II) modeset(G0): Supported detailed timing:
[     8.455] (II) modeset(G0): clock: 74.2 MHz   Image Size:  160 x 90 mm
[     8.455] (II) modeset(G0): h_active: 1920  h_sync: 2448  h_sync_end 2492 h_blank_end 2640 h_border: 0
[     8.455] (II) modeset(G0): v_active: 540  v_sync: 542  v_sync_end 547 v_blanking: 562 v_border: 0
[     8.455] (II) modeset(G0): Supported detailed timing:
[     8.455] (II) modeset(G0): clock: 74.2 MHz   Image Size:  160 x 90 mm
[     8.455] (II) modeset(G0): h_active: 1920  h_sync: 2008  h_sync_end 2052 h_blank_end 2200 h_border: 0
[     8.455] (II) modeset(G0): v_active: 540  v_sync: 542  v_sync_end 547 v_blanking: 562 v_border: 0
[     8.455] (II) modeset(G0): Supported detailed timing:
[     8.455] (II) modeset(G0): clock: 27.0 MHz   Image Size:  160 x 90 mm
[     8.455] (II) modeset(G0): h_active: 720  h_sync: 732  h_sync_end 796 h_blank_end 864 h_border: 0
[     8.455] (II) modeset(G0): v_active: 576  v_sync: 581  v_sync_end 586 v_blanking: 625 v_border: 0
[     8.455] (II) modeset(G0): Number of EDID sections to follow: 1
[     8.455] (II) modeset(G0): EDID (in hex):
[     8.455] (II) modeset(G0):  00ffffffffffff004c2df20300000000
[     8.455] (II) modeset(G0):  04120103801009780aee91a3544c9926
[     8.455] (II) modeset(G0):  0f5054bfef8081808140714f01010101
[     8.455] (II) modeset(G0):  01010101010121399030621a274068b0
[     8.455] (II) modeset(G0):  3600a05a0000001c011d00bc52d01e20
[     8.455] (II) modeset(G0):  b8285540a05a0000001e000000fd0017
[     8.455] (II) modeset(G0):  4b1a440f000a202020202020000000fc
[     8.455] (II) modeset(G0):  0053796e634d61737465720a20200167
[     8.455] (II) modeset(G0):  02031ff14b930405140312101f202122
[     8.455] (II) modeset(G0):  230907078301000066030c001000808c
[     8.455] (II) modeset(G0):  0ad08a20e02d10103e9600a05a000000
[     8.455] (II) modeset(G0):  18011d007251d01e206e285500a05a00
[     8.455] (II) modeset(G0):  00001e011d80d0721c1620102c2580a0
[     8.455] (II) modeset(G0):  5a0000009e011d8018711c1620582c25
[     8.455] (II) modeset(G0):  00a05a0000009e8c0ad090204031200c
[     8.455] (II) modeset(G0):  405500a05a00000018000000000000b2
[     8.455] (II) modeset(G0): Printing probed modes for output HDMI-1-1
[     8.455] (II) modeset(G0): Modeline "1680x1050"x60.0  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync (65.3 kHz eP)
[     8.455] (II) modeset(G0): Modeline "1920x1080"x60.0  148.50  1920 2008 2052 2200  1080 1084 1089 1125 +hsync +vsync (67.5 kHz e)
[     8.455] (II) modeset(G0): Modeline "1920x1080"x50.0  148.50  1920 2448 2492 2640  1080 1084 1089 1125 +hsync +vsync (56.2 kHz e)
[     8.455] (II) modeset(G0): Modeline "1920x1080"x59.9  148.35  1920 2008 2052 2200  1080 1084 1089 1125 +hsync +vsync (67.4 kHz e)
[     8.455] (II) modeset(G0): Modeline "1920x1080i"x60.0   74.25  1920 2008 2052 2200  1080 1084 1094 1125 interlace +hsync +vsync (33.8 kHz e)
[     8.455] (II) modeset(G0): Modeline "1920x1080i"x50.0   74.25  1920 2448 2492 2640  1080 1084 1094 1125 interlace +hsync +vsync (28.1 kHz e)
[     8.455] (II) modeset(G0): Modeline "1920x1080"x30.0   74.25  1920 2008 2052 2200  1080 1084 1089 1125 +hsync +vsync (33.8 kHz e)
[     8.455] (II) modeset(G0): Modeline "1920x1080"x25.0   74.25  1920 2448 2492 2640  1080 1084 1089 1125 +hsync +vsync (28.1 kHz e)
[     8.455] (II) modeset(G0): Modeline "1920x1080"x24.0   74.25  1920 2558 2602 2750  1080 1084 1089 1125 +hsync +vsync (27.0 kHz e)
[     8.455] (II) modeset(G0): Modeline "1920x1080i"x59.9   74.18  1920 2008 2052 2200  1080 1084 1094 1125 interlace +hsync +vsync (33.7 kHz e)
[     8.455] (II) modeset(G0): Modeline "1920x1080"x30.0   74.18  1920 2008 2052 2200  1080 1084 1089 1125 +hsync +vsync (33.7 kHz e)
[     8.455] (II) modeset(G0): Modeline "1920x1080"x24.0   74.18  1920 2558 2602 2750  1080 1084 1089 1125 +hsync +vsync (27.0 kHz e)
[     8.455] (II) modeset(G0): Modeline "1280x1024"x75.0  135.00  1280 1296 1440 1688  1024 1025 1028 1066 +hsync +vsync (80.0 kHz e)
[     8.455] (II) modeset(G0): Modeline "1280x1024"x60.0  108.00  1280 1328 1440 1688  1024 1025 1028 1066 +hsync +vsync (64.0 kHz e)
[     8.455] (II) modeset(G0): Modeline "1280x960"x60.0  108.00  1280 1376 1488 1800  960 961 964 1000 +hsync +vsync (60.0 kHz e)
[     8.455] (II) modeset(G0): Modeline "1152x864"x75.0  108.00  1152 1216 1344 1600  864 865 868 900 +hsync +vsync (67.5 kHz e)
[     8.455] (II) modeset(G0): Modeline "1280x720"x60.0   74.25  1280 1390 1430 1650  720 725 730 750 +hsync +vsync (45.0 kHz e)
[     8.455] (II) modeset(G0): Modeline "1280x720"x50.0   74.25  1280 1720 1760 1980  720 725 730 750 +hsync +vsync (37.5 kHz e)
[     8.456] (II) modeset(G0): Modeline "1280x720"x59.9   74.18  1280 1390 1430 1650  720 725 730 750 +hsync +vsync (45.0 kHz e)
[     8.456] (II) modeset(G0): Modeline "1024x768"x75.0   78.75  1024 1040 1136 1312  768 769 772 800 +hsync +vsync (60.0 kHz e)
[     8.456] (II) modeset(G0): Modeline "1024x768"x70.1   75.00  1024 1048 1184 1328  768 771 777 806 -hsync -vsync (56.5 kHz e)
[     8.456] (II) modeset(G0): Modeline "1024x768"x60.0   65.00  1024 1048 1184 1344  768 771 777 806 -hsync -vsync (48.4 kHz e)
[     8.456] (II) modeset(G0): Modeline "832x624"x74.6   57.28  832 864 928 1152  624 625 628 667 -hsync -vsync (49.7 kHz e)
[     8.456] (II) modeset(G0): Modeline "800x600"x72.2   50.00  800 856 976 1040  600 637 643 666 +hsync +vsync (48.1 kHz e)
[     8.456] (II) modeset(G0): Modeline "800x600"x75.0   49.50  800 816 896 1056  600 601 604 625 +hsync +vsync (46.9 kHz e)
[     8.456] (II) modeset(G0): Modeline "800x600"x60.3   40.00  800 840 968 1056  600 601 605 628 +hsync +vsync (37.9 kHz e)
[     8.456] (II) modeset(G0): Modeline "800x600"x56.2   36.00  800 824 896 1024  600 601 603 625 +hsync +vsync (35.2 kHz e)
[     8.456] (II) modeset(G0): Modeline "720x576"x50.0   27.00  720 732 796 864  576 581 586 625 -hsync -vsync (31.2 kHz e)
[     8.456] (II) modeset(G0): Modeline "720x480"x60.0   27.03  720 736 798 858  480 489 495 525 -hsync -vsync (31.5 kHz e)
[     8.456] (II) modeset(G0): Modeline "720x480"x59.9   27.00  720 736 798 858  480 489 495 525 -hsync -vsync (31.5 kHz e)
[     8.456] (II) modeset(G0): Modeline "640x480"x75.0   31.50  640 656 720 840  480 481 484 500 -hsync -vsync (37.5 kHz e)
[     8.456] (II) modeset(G0): Modeline "640x480"x72.8   31.50  640 664 704 832  480 489 492 520 -hsync -vsync (37.9 kHz e)
[     8.456] (II) modeset(G0): Modeline "640x480"x66.7   30.24  640 704 768 864  480 483 486 525 -hsync -vsync (35.0 kHz e)
[     8.456] (II) modeset(G0): Modeline "640x480"x60.0   25.20  640 656 752 800  480 490 492 525 -hsync -vsync (31.5 kHz e)
[     8.456] (II) modeset(G0): Modeline "640x480"x59.9   25.18  640 656 752 800  480 490 492 525 -hsync -vsync (31.5 kHz e)
[     8.456] (II) modeset(G0): Modeline "720x400"x70.1   28.32  720 738 846 900  400 412 414 449 -hsync +vsync (31.5 kHz e)
[     8.456] (==) modeset(G0): Using gamma correction (1.0, 1.0, 1.0)
[     8.456] (==) modeset(G0): DPI set to (96, 96)
dweymouth commented 1 year ago

I've also noticed on my Ubuntu desktop with a LG 27" 4K monitor (3840x2160) that Fyne apps are drawn too big. I have display scaling set to 100% in the display configuration in the Ubuntu settings app. Starting Fyne apps with FYNE_SCALE=0.8 looks about right to me.

Side note - is there a programmatic way to set Fyne scale from within the app? In the app I'm working on I might like to allow the user to set a custom scaling factor in case the default scaling is off for their monitor.

andydotxyz commented 1 year ago

There is the fyne_settings App in the main repo, and you can invoke the settings panel in your own app. We don't expose any programatic overrides because this consistent sizing works on most OS - once the bugs are ironed out it will always be correct ;).

Starting Fyne apps with FYNE_SCALE=0.8 looks about right to me.

I also prefer 0.8 - but what are you comparing it to in saying that it was wrong before?

I have display scaling set to 100% in the display configuration in the Ubuntu settings app

Really you have 1:1 pixel mapping on a 4K display? It seems like for that to be usable there must be another setting somewhere that is scaling it up.

andydotxyz commented 1 year ago

@maxsupermanhd sorry for the delay. I cannot tell from that log which Madeline is selected for each monitor, unless I am missing something?

maxsupermanhd commented 1 year ago

@maxsupermanhd sorry for the delay. I cannot tell from that log which Madeline is selected for each monitor, unless I am missing something?

The top one, "1680x1050"x60.0 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync (65.3 kHz eP)

maxsupermanhd commented 1 year ago

I am right now attached to a different monitor and have no such issue, this one is pure 1080p. "1920x1080"x60.0 148.50 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync (67.5 kHz eP)

dweymouth commented 1 year ago

There is the fyne_settings App in the main repo, and you can invoke the settings panel in your own app. We don't expose any programatic overrides because this consistent sizing works on most OS - once the bugs are ironed out it will always be correct ;).

Starting Fyne apps with FYNE_SCALE=0.8 looks about right to me.

I also prefer 0.8 - but what are you comparing it to in saying that it was wrong before?

I have display scaling set to 100% in the display configuration in the Ubuntu settings app

Really you have 1:1 pixel mapping on a 4K display? It seems like for that to be usable there must be another setting somewhere that is scaling it up.

It is indeed 1:1 and text/UI elements are small in non-Fyne apps but it's a decently large monitor. I'd actually probably prefer 125% scaling but most apps don't scale as well as Fyne does on Linux (look a bit "off" with non-integer scale factors), so I think it looks better 1:1. Maybe there's a way on Gnome/Unity desktops for Fyne to read the desktop environment preference for scale mapping and use that in deriving a default FYNE_SCALE on startup?

andydotxyz commented 1 year ago

Ah I think I have just realised something - the windows have been manually sized by you, not by our scaling. I think this is starting to make more sense.

If your default is to have a 4k display at 1:1 pixel it is highly likely our defaults will not be to your taste, we aim for a consistent font size across all displays - hence it will vary across screens.

Thanks for confirming the displayed resolution - however I think we still don't have the physical display size for each, that way it will be possible to tell if the code is functioning correctly.

andydotxyz commented 1 year ago

Maybe there's a way on Gnome/Unity desktops for Fyne to read the desktop environment preference for scale mapping and use that in deriving a default FYNE_SCALE on startup?

This sounds like a good feature request. To date we have not found a way that works for Gnome / KDE / derivatives - but if you have some hints or have found documentation that would be helpful.

maxsupermanhd commented 1 year ago

the windows have been manually sized by you, not by our scaling.

@andydotxyz can you explain exactly how code that I provided resizes window? I am talking about content inside the window, as you may notice window decorations, window size (in pixels) and other applications (like vscode in the background) behave correctly and have consistent real world elements/fonts sizes.

Unfortunately I can not provide physical size of the external monitor (at least not right now) but size of the laptop monitor is 15.6".

andydotxyz commented 1 year ago

@andydotxyz can you explain exactly how code that I provided resizes window?

It doesn't - I was realising that you had (with the mouse) resized the window, unless that is not correct?

Let me know when you have the physical size, I think it is the only missing info now.

maxsupermanhd commented 1 year ago

you had (with the mouse) resized the window

Nope, it is initial size of a window, and iirc it does contract/expand when I drag it over to different monitors.

maxsupermanhd commented 1 year ago

@andydotxyz after a few minutes of google images narrowdown I found it - 20" Samsung SyncMaster T200G. (I had no hopes of finding that online but I still gave it a shot)

db47h commented 10 months ago

This issue is caused by some monitors reporting an incorrect physical size when queried through RandR (Image Size: 160 x 90 mm in the Xorg log above). This happens to a lot of users, regardless of monitor brand and range. While most of those just say 0mm x 0mm, which is caught by most toolkits, Samsung got sneaky and reports 160x190 when this happens, resulting in a DPI of ~300...

Correcting the issue on the end user's side requires a lot of fiddling with monitor EDIDs, kernel params and/or Xorg config. Even for a power user, it's a real PITA to get it right (and correctly identify the problem in the first place!). That's probably why Gnome, KDE and the like all default to 96 dpi (or what the X server says, which is not necessarily what RandR says...), then offer various knobs to tweak font/UI size. The latter also explains why this issue is not more prominent.

Also using FYNE_SCALE does not fix the problem in multi monitor setups. I believe that the correct way to go about it is to get the scale directly from glfwGetMonitorContentScale or glfwGetWindowContentScale instead of glfwGetMonitorPhysicalSize. Both of these return the correct scale (even with a broken monitor EDID), relying on information provided by the desktop environment by querying Xft.dpi.