skyjake / lagrange

A Beautiful Gemini Client
https://gmi.skyjake.fi/lagrange/
BSD 2-Clause "Simplified" License
1.19k stars 62 forks source link

Lagrange on Mobile Linux: Does not adapt well to small screens #618

Open huntekye opened 1 year ago

huntekye commented 1 year ago

Hi!

Thanks for making this great client for Gemini (and friends)! I am experiencing some issues with using Lagrange on a device with a very small screen: A pinephone pro running Linux v6.4.1-1-danctnix (a derivative of Arch) with the sway window manager (Wayland based). The screen causing issues is 720x1440 px, 68x136 mm, with a scaling factor of 2.0 configured in sway

Basically, the Lagrange window is cut off. Changing the UI scaling does not fix the problem (actually setting the scaling to 0.5 creates a huge left margin and the text is still cut off), nor does rotating the screen though this gets close to showing all of the text. There appear to be similar problems with other windows that Lagrange creates, e.g., the preferences window.

I think that potentially there are two things going on: 1) The windows Lagrange makes are not designed to be really small in Linux, though I imagine there must already be some kind of solution for this in iOS and Android; 2) I guess that historically there is only sort of so-so support for Wayland/sway in SDL.

For a bit of background on SDL and window size problems in sway see for example https://github.com/libsdl-org/SDL/issues/3448 . On my laptop running sway I can confirm that even though the Lagrange window has some sort of minimum dimensions, sway is not aware of them, and Lagrange is not fully aware of the window that sway wants it to be in. This means that I can try to make the Lagrange window very small and sway will let me and the window's frame can be as small as I want, but eventually the window that Lagrange renders stops shrinking and renders outside of the frame that sway gives it. Similarly, opening the preferences window (on my laptop), it is tiled by default, generally leading to a window that is far too large. This is handled surprisingly well, and the extra space is filled with a background color, but here again sway allows me to change the size of the window but the rendered window does not react and simply renders outside it's frame (or does not fill the larger frame). This demonstrates that SDL is not correctly communicating minimum and maximum sizes of these windows to sway. These are not really practical issues on a laptop, but I think they provide some context for what is likely happening on a phone screen.

If there's any other information that would be useful, just let me know!

skyjake commented 1 year ago

Unfortunately this seems like a shortcoming in SDL, since it is responsible for the low-level window management. The best chance of fixing this is manually compiling the app using the latest release of SDL.

Also, Lagrange needs to be compiled with the -DENABLE_MOBILE_PHONE=YES CMake option, so the correct UI variant is used. However, this only affects UI layout inside the window, not window management.

huntekye commented 1 year ago

Ah yeah, compiling with that option basically fixes the problem! I guess that that would have been apparent if I had tried reading through CMakeLists.txt, but perhaps that option should be added to the table in the README? Ideally it is nice if this sort of thing is detected dynamically, but with how different the UIs are I get that it probably isn't easy to do. Potentially would it be possible to compile both UIs and switch between them with a runtime flag?

One problem I am still seeing is that it seems I can't open the Settings menu: selecting Settings from the hamburger menu closes the hamburger menu and then nothing happens. Also, ever time I try to close a tab it seg faults, but perhaps these would be better addressed in separate issues if you want.