New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UNIX display with scaling != 100% is broken #1927
Comments
BTW the fonts and icons are correct but they are way too small, so these should be scaled as well. |
Kees... |
Yeah, I realize this. I don't think a lot of users have high end Linux laptops with 4K screens :-) |
For the people who might land here: a workaround is to install the GTK2 version: just pick the cosmic build and it will run just fine, with OpenGL + screen scaling and everything (focal does provide wx-GTK2 runtime libraries). Still, it would be nice to have a GTK3 fix in the next release (and a lot of Linux users have hidpi displays, the Dell XPS 13 is a very popular Linux laptop....). |
First, thanks for you all working on OpenCPN Got the same problem here. Unfortunately, it makes OpenCPN unusable in my case (along with a few cruising friends of mine). We have just migrated from Windows to Linux and with a power efficient small high-resolution displays that are replacing all those power-hungry low-resolution monitors on desktop and laptops. Indeed, it would be nice to have a fix for this. System Info: |
|
It would, wxWidgets and OpenCPN are always built against GTK+ on Linux, that you use Kubuntu changes nothing on that. |
Unsure about how to proceed to implement stelian42's workaround (GTK2), I posted a question on AsK Kubuntu (https://askubuntu.com/questions/1348038/how-can-i-revert-from-using-gtk2-to-gtk-3-on-kunbuntu-20-04). Got back a clear answer that leaves me to question if it's going to work as a temporary workaround? I would really appreciate more guidance... I am kind of stuck without a working OpenCPN. p.s.: I have considered disabling OpenGL on OpenCPN but then I lose my radar overlay. |
You got some super overcomplicated, but sure correct, answers there. But the workaround is to simply install OpenCPN package built for an older Ubuntu release, which will pull in all the required dependencies. You don't need to compile anything. |
Thank you for your time and suggestion 'noal'. |
The packages are in the PPA at https://launchpad.net/~opencpn/+archive/ubuntu/opencpn/+packages from a quick look the newest "old" enough package currently available there is for Bionic. I don't have any Ubuntu machine to try so can't tell if it is usable on Focal the same way the Cosmic package suggested here was. |
You may also try to start OpenCPN from the terminal using |
Thanks...I am learning alot from our exchange.
I will keep the PPA url in my back pocket for now. |
Update... |
Is this beta also available from flatpak ? Because the flatpak "beta" channel version is right now 5.6.0-1.ws315+777652e which does not seem to have the proposed solution... |
Please update flatpak, beta channel. Current version is "5.6.0-2.wx315+777652e" |
Hi Dave, looks fine here as well (Ubuntu 21.10), but only on the internal hidpy panel (with a display scale of 200%). My laptop (Dell XPS 13) also has a "normal" external HDMI screen (configured with a display scale of 100%), and when I send OpenCPN to this screen, everything in the GUI is too big. It would be nice to make OpenCPN automatically behave as it should given the current display (not the primary display as it seems to do now). There are other gtk3 who behave like this (all the gnome standard apps for example). And there are some apps who do not (Chrome, etc)... |
We are relying on wxWidgets to tell us what display scale is. We use what they tell us, no other choice. |
You want a screenshot of the hidpy panel or external screen ? Or both ? |
Any screenshot(s) that illustrate the problems you see. |
Here are the two screenshots. What is important is the physical size of the two displays (the pixel density is different): internal display is a 13" display (3840x2400 pixels, 29x18cm, display scale set to 200%), the external one is a 27" display (2560x1440 pixels, 60x34 cm, display scale set to 100%). |
After more thinking, this may be related to the fact that opencpn always starts on the primary display, so it gets the display scale from there, and then it does not modify it when the window is beeing dragged to the external display. I didn't find a way to force opencpn to start directly on the external display (but some applications do remember the last display they used, maybe part of the window geometry). If this was possible, it may fix the previous issue. There are also applications which are able to dynamically redraw and change scale when the window is dragged from a display to the other. But maybe this is too difficult to do with OpenCPN and/or wxWidgets.... |
Try a test:
Dave |
Nothing changes visually whether I disable or enable OpenGL... |
Am I understanding correctly that the external display is "clipped" on the left. That is, the screenshot shown is the full screen? |
|
As I said before, I cannot launch O directly on the external display. All I can do is start on the primary screen and then drag the window to the external display. Anyway, starting on the primary screen (the hidpy laptop panel), the auto-detected value is already wrong: 254 mm detected, about 290 real. When I drag the O window to the external display, of course this value does not change. I can change it to the real value (600mm), but this doesn't seem to change the size of any GUI or map object. Even after a restart. |
And what happens if you adjust the scaling sliders in Settings->UI ? |
I updated flatpak beta to the latest version: 5.6.0.wx315+777652e When launched on my panel, the toolbar on the left has a physical width of 7mm, which is perfect. I set up the detected screen size to manual to 600 mm, and dragged the window to the external screen. The width of the toolbar is 20 mm. If I set the GUI scaling slider to -5, the toolbar is still too big: 12mm. And the dialogs / icons (in the options dialog for example) are huge. Moreover, icons in the toolbar, and map object as well are badly rendered: they are sort of blurred, like if they were first reduced in size then enlarged... Finally, a bug with the compass icon (top right), it is too small, both on the panel and the external screen |
Hi Dave, System is : My first impressions is that this works much much better with my 4K displays (3840x2160 and 3840x1100) with a display scale set of 100%. I have set the Desktop FONTS on to 192 dpi...instead of changing the display scale.
Please do let me know if this needs clarification or further testing. Regards, Sergio |
"I have set the Desktop FONTS on to 192 dpi...instead of changing the display scale." |
Stelian42...
|
Hi Dave, I think I found something: in Ubuntu Settings, go to the Screens tab. If I choose the "Primary Screen" to be the internal panel (like before), OpenCPN display is perfect on the internal panel (at 200%), but not on the external monitor (at 100%) If I choose the Iiyama monitor as the primary screen, OpenCPN display will be perfect on the external monitor (at 100%), but not on the internal panel. (including almost correct screen width detection, etc) Another thing I've seen: OpenCPN always starts to the leftmost screen. If I modify the configuration to put the external monitor at the left of the internal panel, OpenCPN will launch on the external monitor. Notice however that this will only affect the initial screen, not the actual display of content (which, as said above, is affected by the "primary screen" setting). |
So, when you can start on the external monitor, and start OCPN on that monitor at 100%, with the settings->UI->Scale factors set to "0", then what is the physical width of the toolbar? |
Ah, I just found out, in the same Ubuntu Settings -> Display screen, that I can set my desktop to "single screen", and I can choose the internal panel or the external one. If I choose the internal panel, with all scale factors set to 0, the detected screen width is 254 mm (instead of real 290 mm), and the toolbar physical width is 7 mm. If I choose the external monitor, the detected screen width is 677 mm (instead of real 696 mm) and the toolbar physical width is 10 mm. |
OK, I did the math, that seems right for default toolbar width on external monitor. Thus, we can say that the monitor detection and scaling logic works for this display adapter. For your information, at default scaling, the toolbar is 44 pixels wide. Back to the dual monitor situation, then.
What I am trying to determine is how (if at all) OCPN is reacting to being "dragged". Logfile should tell me that. |
There seem to be no reaction when OpenCPN is being dragged to the external monitor. See the logfile attached. |
The lack of event may be an internal wxWidgets problem. But I can live without the ability to drag OpenCPN from one monitor to another, as long as I can launch it directly on either one of the displays (without changing my primary screen in the settings, because this obviously affects the entire desktop). Maybe this is just some multi-monitor geometry setting OpenCPN is not following ? |
AFICT, wxWidgets has no notion of multi-monitor support. None. |
Check out the wxDisplay class. There you can learn which monitor a window is on. One way to use that is to make a query within a wxWindow move event handler. But it gets tricky because a window can be on both monitors in many desktop managers. |
This patch will add the number of displays (n_NumDisplays) and the current display (m_CurrentDisplay) to a ChartCanvas object.
|
Nice job @transmitterdan ! However, keep in mind that we need to deal with two different rendering issues here: first, the ChartCanvas and all the other objects rendered by OpenCPN itself (charts, toolbars, compass icon, etc). I'm sure that, based on the patch above, it should be able to make some logic to dynamically resize all those objects based on the current display. But there is also a second part: the items directly rendered by GTK (main window with its menus, probably others), and I think (but I may be wrong) that wxWidgets should directly handle this, but it obviously does not. I'm not sure this part can be fixed from outside wxWidgets, and this is why being able to force the display to start OpenCPN on is important, because on start wxWidgets/GTK behaves correctly. |
This code can be added to any object that derives from wxWindow. It is up to the application to sense a change in the display each window is on and reconfigure so wxWidgets picks all the proper ratios of items. I don't think one can reasonably expect wxWidgets to do this automagically. |
Dan/Stelian42... |
Sure, I understand, although the combination on a hidpy laptop panel with an external monitor should be rather common these days... |
Dave, I have a setup here that can test 2 hi-res displays of different resolution on Arm Pi. I'll do some investigating over the next week or two. |
Dan... |
Overtaken by events. |
On Ubuntu 20.04 at least, with GTK3 and display scaling set != 100% the OpenGL display is incorrectly scaled.
At 200% the OpenGL chart display only takes up the bottom left quarter of the screen.
I had the same issue in the radar plugin, and I've fixed it there: opencpn-radar-pi/radar_pi@97064f4
The nicest way is to change the OpenGL viewport size as well as the glOrtho() size and draw fonts at scale as well so you get smooth fonts. An alternative is to only change the viewport size, but this means you're not using the high resolution of the screen so it will look awful.
This is a known issue in wx: https://trac.wxwidgets.org/ticket/17391
The text was updated successfully, but these errors were encountered: