So I have an rtx 3090 as my display GPU and I have an old, old Dell 1920x1200 vertically rotated as my second monitor, and the Alienware ultrawide 3440x1440 OLED monitor from a couple of years ago.
So about a month to a few weeks ago around or before the release of Electron 38, I was trying to combine two different pieces of code from the internet into one python application with a gui, using tkinter, pyautogui, screeninfo, hid, and pystray packages. The first thing I noticed was scrreeninfo was pulling the wrong resolution for the alienware OLED and that the TKinter window wasn’t really filling the screen width-wise like it was supposed to be. I don’t remember exactly what it said my resolution was, but when I run screeninfo.get_monitors(), I get the following output:
[Monitor(x=0, y=0, width=1200, height=1920, width_mm=518, height_mm=324, name='DP-5', is_primary=False), Monitor(x=1200, y=187, width=3621, height=1516, width_mm=810, height_mm=350, name='DP-6', is_primary=True)]
When I run xrandr, I get the same information:
DP-6 connected primary 3621x1516+1200+187 (normal left inverted right x axis y axis) 810mm x 350mm
So ever since I putzed around with this code, perhaps coincidentally, my apps that run using electron, ex. Microsoft Teams, Vivaldi, Chromium, Microsoft Edge, and more have the Wayland cursor coordinates fail to match what the electron app reads as my cursor coordinates (weirdly, VS Code doesn’t have this problem). The further along I get on the x, y plane from the top left corner, the worse the discrepancy gets (so it basically scales with the size of the window (the bigger the window is and thus greater distance you traverse to get close to the bottom or right edges, the worse the discrepancy is. When I try to maximize these electron apps, they don’t maximize to cover the Alienware monitor. They leave a 4 cm gap on the right edge and 1.5 cm gap on the bottom edge.
When I move these apps to the old Dell Monitor though, I run into no such problems. My cursor location matches the location of gui changes (like highlighting the button my cursor is resting on) and clicks. And I’m able to maximize the window without any scaling discrepancies with regards to the cursor and the clicks. So I’m guessing the issue here is probably that the X11 display server has set my Alienware monitor’s resolution incorrectly.
My questions are
- Did python’s tkinter/gtk cause this? Did the screen info package (see the x11 and xrandr library based source code, where it creates I assume a background X11 window(https://github.com/rr-/screeninfo/blob/master/screeninfo/enumerators/xrandr.py)? This is how I use the screeninfo and tkinter packages together. While I add a few more tkinter textboxes and buttons, those don’t really have a major effect.
screen = screeninfo.get_monitors()[0]
scrn_width = screen.width
scrn_height = screen.height
# Calculate position near the bottom center of the screen
wndw_width = scrn_width
wndw_height = 100
window = tk.Tk()
window.title("")
window.geometry(f"{wndw_width}x{wndw_height}")
- If tkinter or screeninfo did not cause this, what’s causing it?
The EDID (Extended Display Identity Data) from the Info Center (I’m running KDE) displays the right information.
# card2-DP-6 #######################
Block 0, Base EDID:
EDID Structure Version & Revision: 1.4
Vendor & Product Identification:
Manufacturer: DEL
Model: 41444
Serial Number: blahblahblah
Made in: week 28 of 2022
Basic Display Parameters & Features:
Digital display
Bits per primary color channel: 10
DisplayPort interface
Maximum image size: 81 cm x 35 cm
Gamma: 2.20
DPMS levels: Off
Supported color formats: RGB 4:4:4, YCrCb 4:4:4, YCrCb 4:2:2
First detailed timing includes the native pixel format and preferred refresh rate
Display supports continuous frequencies
Color Characteristics:
Red : 0.6894, 0.3037
Green: 0.2402, 0.7158
Blue : 0.1474, 0.0566
White: 0.3125, 0.3291
Established Timings I & II:
DMT 0x04: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175000 MHz
DMT 0x09: 800x600 60.316541 Hz 4:3 37.879 kHz 40.000000 MHz
DMT 0x10: 1024x768 60.003840 Hz 4:3 48.363 kHz 65.000000 MHz
Standard Timings: none
Detailed Timing Descriptors:
DTD 1: 3440x1440 59.972616 Hz 43:18 88.819 kHz 319.750000 MHz (809 mm x 354 mm)
Hfront 48 Hsync 32 Hback 80 Hpol P
Vfront 33 Vsync 5 Vback 3 Vpol N
Display Product Serial Number: 'blahblahblah'
Display Range Limits:
Monitor ranges (Range Limits Only): 1-175 Hz V, 255-255 kHz H, max dotclock 990 MHz
Display Product Name: 'Dell AW3423DW'
Extension blocks: 2
Checksum: 0xb7
----------------
kscreendoctor -o gives me the following:
Output: 2 DP-6 monitor-id
enabled
connected
priority 1
DisplayPort
replication source:0
Modes: 10:3440x1440@60! 11:3440x1440@175* 12:3440x1440@144 13:3440x1440@120 14:3440x1440@100 15:1024x768@60 16:800x600@60 17:640x480@60
Geometry: 1200,187 3622x1516
Scale: 0.95
Rotation: 1
Overscan: 0
Vrr: Automatic
RgbRange: unknown
HDR: enabled
SDR brightness: 253 nits
SDR gamut wideness: 0%
Peak brightness: 427 nits
Max average brightness: 254 nits
Min brightness: 0 nits
Wide Color Gamut: enabled
ICC profile: none
Color profile source: EDID
Color power preference: prefer accuracy
Brightness control: supported, set to 90% and dimming to 100%
DDC/CI: allowed
Color resolution: unknown
Allow EDR: unsupported
So I guess X11 is pulling from the Geometry values rather than the Modes? My Alienware is to the right of the rotated old Dell Monitor, suggesting that its coordinates would start at 1200 if we’re considering display configuration coordinates. And I do have the Alienware situated roughly in the middle or elevated above the mddle in regards to the y coordinates relative to the rotated Dell monitor, so the 187 also makes sense (187 + (>187) + 1440 ~ 1920)
But where is it getting 3622 and 1516?
The Wayland section in the Info Center outputs the following, reaffirming 1200 and 187 values.
interface: 'wl_output', version: 4, name: 66
name: DP-5
description: Dell Inc. DELL U2412M
x: 0, y: 0, scale: 1,
physical_width: 518 mm, physical_height: 324 mm,
make: 'Dell Inc.', model: 'DELL U2412M',
subpixel_orientation: unknown, output_transform: 90°,
mode:
width: 1920 px, height: 1200 px, refresh: 59.950 Hz,
flags: current
interface: 'wl_output', version: 4, name: 67
name: DP-6
description: Dell Inc. Dell AW3423DW
x: 1200, y: 187, scale: 1,
physical_width: 810 mm, physical_height: 350 mm,
make: 'Dell Inc.', model: 'Dell AW3423DW',
subpixel_orientation: unknown, output_transform: normal,
mode:
width: 3440 px, h
The X11 section of the Info Center gives me the following:
Screens
=======
Number of Screens: 2
Screen 0:
---------
Name: DP-5
Enabled: 1
Geometry: 0,0,1200x1920
Physical size: 518x324mm
Scale: 1
Refresh Rate: 59950
Adaptive Sync: incapable
Screen 1:
---------
Name: DP-6
Enabled: 1
Geometry: 1200,187,3621x1516
Physical size: 810x350mm
Scale: 0.95
Refresh Rate: 174963
Adaptive Sync: automatic
Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce RTX 3090/PCIe/SSE2
OpenGL version string: 3.1.0 NVIDIA 580.95.05
OpenGL platform interface: EGL
OpenGL shading language version string: 1.40 NVIDIA via Cg compiler
Driver: NVIDIA
Driver version: 580.95.5
GPU class: Unknown
OpenGL version: 3.1
GLSL version: 1.40
X server version: 1.24.1
Linux kernel version: 6.17.1
Direct rendering: Requires strict binding: no
Virtual Machine: no
OpenGL 2 Shaders are used
Why is it 3621 instead of 3622 and again where is it getting these numbers from?
The X-server section yields
screen #0:
dimensions: 4821x1920 pixels (1276x508 millimeters)
resolution: 96x96 dots per inch
depths (7): 24, 1, 4, 8, 15, 16, 32
root window id: 0x39a
depth of root window: 24 planes
number of colormaps: minimum 1, maximum 1
default colormap: 0x65
default number of colormap cells: 256
preallocated pixels: black 0, white 16777215
options: backing-store WHEN MAPPED, save-unders NO
largest cursor: 4821x1920
current input event mask: 0x7a0030
EnterWindowMask LeaveWindowMask StructureNotifyMask
SubstructureNotifyMask SubstructureRedirectMask FocusChangeMask
PropertyChangeMask
number of visuals: 336
default visual id: 0x66
I guess 4821-1200 = 3621.
Running xrandr gives the following output:
Screen 0: minimum 16 x 16, current 4821 x 1920, maximum 32767 x 32767
DP-5 connected 1200x1920+0+0 left (normal left inverted right x axis y axis) 518mm x 324mm
1920x1200 59.88*+
1600x1200 59.87
1440x1080 59.87
1400x1050 59.86
1280x1024 59.76
1280x960 59.94
1152x864 59.78
1024x768 59.68
800x600 59.86
640x480 59.38
320x240 59.29
1680x1050 59.85
1440x900 59.89
1280x800 59.81
1152x720 59.75
960x600 59.63
928x580 59.88
800x500 59.50
768x480 59.38
720x480 59.71
640x400 59.20
320x200 58.14
1920x1080 59.88
1600x900 59.82
1368x768 59.88
1280x720 59.86
1024x576 59.90
864x486 59.45
720x400 59.27
640x350 59.28
DP-6 connected primary 3621x1516+1200+187 (normal left inverted right x axis y axis) 810mm x 350mm
3621x1516 174.91*+
1920x1440 174.89
1600x1200 174.78
1440x1080 174.83
1400x1050 174.81
1280x1024 174.81
1280x960 174.83
1152x864 174.80
1024x768 174.65
800x600 174.74
640x480 174.69
320x240 174.26
1920x1200 174.84
1680x1050 174.76
1440x900 174.75
1280x800 174.81
1152x720 174.79
960x600 174.57
928x580 174.52
800x500 174.50
768x480 174.34
720x480 174.75
640x400 174.52
320x200 172.22
2560x1440 174.89
2048x1152 174.92
1920x1080 174.80
1600x900 174.80
1368x768 174.62
1280x720 174.89
1024x576 174.79
864x486 174.55
720x400 174.58
640x350 174.17
So my questions are why did I start getting these scaling errors with the electron electron apps recently even though I set up the second monitor before it (and unplugging the second monitor doesn’t fix the problem) and don’t remember having any issues for a few weeks before running the tkinter and screeninfo codes? My other question is how do I elegantly fix this issue? I running xrandr to force the right resolutions the right way to approach it with xwayland? By the way, running Vivaldi and other electron apps with the following flags does not fix the issues I am running into:
/usr/bin/vivaldi --enable-features=UseOzonePlatform --ozone-platform=wayland