enz / pentobi

Computer opponent for Blokus
https://pentobi.sourceforge.io
GNU General Public License v3.0
59 stars 17 forks source link

"Color theme" set to "System" does not behave as expected #26

Open idoric opened 11 months ago

idoric commented 11 months ago

It has come to my attention that the "Color theme" option does not work as expected when set to "System", so I tested it on my own system and can confirm. I did some tests on my own computer, which allows me to confirm that problems appear on both Ubuntu 22.04 and Fedora 39. On the other hand, I only tested the flatpak version.

Problems appear when the system switches from dark to light style, or vice versa, while Pentobi is running. In windowed mode, Pentobi does not adapt to the new style. In full screen mode, Pentobi crashes.

However, I noticed a difference between Ubuntu and Fedora for windowed mode. In the case of Fedora, only the window title bar and menu follow the dark style preference, while the rest of the interface does not vary once launched. In the case of Ubuntu, the behavior is stranger: if I start in dark style, switch to light style (at the system level), and return to dark style, then Pentobi ends up in light style!

enz commented 11 months ago

I believe that these problems are caused by upstream bugs in either Qt or the particular patches applied to Qt in Ubuntu or Fedora.

Pentobi uses Qt Quick Controls Fusion style, which affects the rendering of the menu and dialogs, and Item.palette, which in Pentobi's system mode affects the window background color and the choice of the game board color. It is a known bug that the adaptation of Fusion style, Item.palette and window decorations (like the window title bar) to the system-level settings do not work on some platforms and Qt versions.

I tested that everything works as expected on Ubuntu 23.10 with Flatpak and with Qt 6.5. On Ubuntu 23.10, without Flatpak and with Qt 6.4, the system-level settings are ignored. I never experienced a crash, are there any error messages after the crash if you run it from a terminal?

For now, I will classify this issue as an upstream Qt bug. The best one can do is to build a simple Qt program to reproduce the bug, check if it hasn't been fixed in the current Qt version and create an upstream bug report. I you have any new information that this is really a bug in Pentobi that I can fix in Pentobi's code, please tell me.

idoric commented 10 months ago

Sorry, I thought I sent my response, and now I see that's not the case.

Concerning the error messages, at the time of the crash I read "qt.qpa.qgnomeplatform: Could not find color scheme"¹, but this message also appears when launching the software, so I don't think that the problem comes from there.

I will monitor from time to time whether the situation has evolved.