MuseScore icon indicating copy to clipboard operation
MuseScore copied to clipboard

[MU4 Issue] Context menus have thick black outline on WMs with disabled translucency

Open BenWiederhake opened this issue 2 years ago • 4 comments

Describe the bug Context menus have a thick black outline. I strongly believe this is due to missing support for window managers without translucency, because I saw similar bugs in some (not all!) other Qt programs.

I personally use xfwm4 on X11, with translucency disabled. I guess that this happens on some other window managers, too.

However, MuseScore's code looks like it tries to detect and handle that: https://github.com/musescore/MuseScore/blob/326d4706593f234e3ec391a67cb5598871e1b4c8/thirdparty/KDDockWidgets/src/private/Utils_p.h#L146-L153 (found via a quick search; the lines around it look right, but I didn't look at it in detail.)

To Reproduce Steps to reproduce the behavior:

  1. Use xfwm. (Probably the easiest way to do it is to run a Virtual Machine using VirtualBox/qemu/whatever, install Debian using an image like this, and select "xfce" during the installation process.)
  2. Disable compositing (run xfwm4-tweaks-settings, in the tab "Compositor" uncheck the box "Enable display compositing")
  3. Open MuseScore (e.g. by downloading it as AppImage)
  4. Right-Click somewhere

Expected behavior A nice context menu appears.

Actual behavior A context menu appears, with very thick, black outline, that doesn't look like it's supposed to be like that.

Screenshots

Here's what it looks like: Bildschirmfoto_2022-12-19_21-44-36

Here's what it could look like (not a Screenshot, but rather edited to look less terrible): fictional

Here's how to configure xfwm4, in case you want to reproduce step 2 exactly: Bildschirmfoto_2022-12-19_21-58-23

Just in case someone thinks my setup is broken and no Qt app can possibly work on my system, here's frescobaldi, which has a Qt UI, showing a context menu: Bildschirmfoto_2022-12-19_22-26-01

Platform information

  • Linux, specifically Debian
  • X11, with xfwm4 as window manager, and translucency disabled (see "To Reproduce, Step 2")

Additional context The code looks like setting KDDW_NO_TRANSLUCENCY might have an influence, but it doesn't change anything. Running it as KDDW_NO_TRANSLUCENCY=1 ./MuseScore-4.0.0-x86_64.AppImage shows the same black thick border. Either I'm doing something wrong (very likely), or perhaps AppImage prevents the envvar from reaching the windowManagerHasTranslucency function. Or I simply misunderstand something, and MuseScore can't handle non-translucent window managers at all.

Also, whenever a context menu is opened, the following line appears in the log:

22:15:12.816 | WARN  | main_thread | Qt         | QQmlComponent: Created graphical object was not placed in the graphics scene.

I'm not sure whether this is related.

BenWiederhake avatar Dec 19 '22 21:12 BenWiederhake

Menus are affected, too: Bildschirmfoto_2022-12-19_22-31-06

BenWiederhake avatar Dec 19 '22 21:12 BenWiederhake

For context: the extra margin for the menus is needed to create our custom drop shadow (and rounded corners).

However, MuseScore's code looks like it tries to detect and handle that:

That's not really MuseScore's code, but belongs to the third-party library that we use for the docking system. However, thanks for pointing it out; we can just reuse that to detect translucency-less circumstances, and in those circumstances preventively give up with our drop shadows and rounded corners 🙂

cbjeukendrup avatar Dec 19 '22 21:12 cbjeukendrup

Also, whenever a context menu is opened, the following line appears in the log:

22:15:12.816 | WARN  | main_thread | Qt         | QQmlComponent: Created graphical object was not placed in the graphics scene.

I'm not sure whether this is related.

Probably not; I also see that cryptic message sometimes on macOS, where there are no translucency limitations.

cbjeukendrup avatar Dec 19 '22 21:12 cbjeukendrup

Same issue with LXDE & Openbox (Openbox does not provide any compositing effects).

arnaudlecam avatar Jan 03 '23 23:01 arnaudlecam