rbn
Posts: 163
Joined: Tue Dec 27, 2011 8:32 pm
Location: Near Peterborough
Contact: Website

Qt and window opacity on Raspbian Buster (Pi4) SOLVED

Sat Feb 15, 2020 2:24 pm

I am building Sonic Pi with Qt GUI on a Pi4 running latest Raspbian Buster. Everything works fine apart from being able to vary the opacity of the main window. The same code builds and works on Mac, Windows PI and various Linux eg Ubuntu, but on the Pi4 the slider which control the opacity has no effect, and neither does it generate any errors. Any ideas on why it doesn't work or what I might investigate to get it going. (Qt version is 5.11.3)

Code: Select all

void MainWindow::changeGUITransparency(int val) {
    // scale it linearly from 0 -> 100 to 0.3 -> 1
    setWindowOpacity((0.7 * ((100 - (float)val) / 100.0))  + 0.3);
}
Note from Qt docs:
This feature is available on Embedded Linux, macOS, Windows, and X11 platforms that support the Composite extension.
Note: On X11 you need to have a composite manager running, and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be supported by the window manager you are using.
I have checked in raspi-config (advanced settings) that xcompmgr composition manager is enabled.
Last edited by rbn on Sun Feb 16, 2020 10:27 am, edited 1 time in total.

User avatar
Botspot
Posts: 1799
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Qt and window opacity on Raspbian Buster (Pi4)

Sat Feb 15, 2020 3:11 pm

rbn wrote: I have checked in raspi-config (advanced settings) that xcompmgr composition manager is enabled.
Check to see if xcompmgr is actually running. In the terminal:

Code: Select all

xcompmgr
If it says "Another composite manager is already running (xcompmgr)", then you know that xcompmgr is running. If it does not say that, then you just started xcompmgr. The transparency slider should work now.

Also, what instructions are you following to build Sonic Pi? It somehow broke for me and nobody seemed to know why.
Easily install anything on your Pi using Pi-Apps! Over 1 million users.
150+ apps including image editors, text editors, games, web browsers, appearance themes, and other upgrades to get the most out of your Pi.
More info: https://github.com/Botspot/pi-apps

rbn
Posts: 163
Joined: Tue Dec 27, 2011 8:32 pm
Location: Near Peterborough
Contact: Website

Re: Qt and window opacity on Raspbian Buster (Pi4)

Sat Feb 15, 2020 8:55 pm

I am using the new cmake build currently under development in the sonic pi repro. It builds fine and I have a fully working Sonic Pi 3,2 dev apart from the transparency slider in the prefs window having no effect but not causing any errors either.

rbn
Posts: 163
Joined: Tue Dec 27, 2011 8:32 pm
Location: Near Peterborough
Contact: Website

Re: Qt and window opacity on Raspbian Buster (Pi4)

Sun Feb 16, 2020 8:49 am

Oh what a simple solution! xcompmgr wasn't running. Once I started it the transparency worked perfectly. On other linux this step wasn't needed explicitly in the program, and it seemed to be invoked automatically.

Thank you for the prompt to try this.

SOLVED

User avatar
Botspot
Posts: 1799
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Qt and window opacity on Raspbian Buster (Pi4) SOLVED

Sun Feb 16, 2020 1:31 pm

rbn wrote: xcompmgr wasn't running. Once I started it the transparency worked perfectly.
Yes, I think the compositor option in raspi-config isn't working. It's supposed to start it on boot, but I leave that setting off and just make an entry in /etc/xdg/lxsession/LXDE-pi/autostart.
Easily install anything on your Pi using Pi-Apps! Over 1 million users.
150+ apps including image editors, text editors, games, web browsers, appearance themes, and other upgrades to get the most out of your Pi.
More info: https://github.com/Botspot/pi-apps

rbn
Posts: 163
Joined: Tue Dec 27, 2011 8:32 pm
Location: Near Peterborough
Contact: Website

Re: Qt and window opacity on Raspbian Buster (Pi4) SOLVED

Tue Feb 18, 2020 6:04 pm

It seems a bit weird. xcompmgr is enabled and there is an instance running according to

Code: Select all

ps -ae |grep compmgr
However Qt doesn't seem to pick this up and there is no transparency. I disabled it from running, and instead I found that if I edited /etc/xdg/lxsession/LXDE-pi/autostart and added

Code: Select all

@xcompmgr -C -c -o 0.5 -l -19 -t -10 -r 14 -f -O 0.05 -I 0.05
to it, then Sonic Pi transparency worked fine.

Return to “General programming discussion”