2020 year and transparent form in linux (gtk2/qt/something else). Is posible ? lazarus / 32-Linux ---------------------------------------------------------------------- Anton Shevtsov · 2020-11-06 10:45 I've seen many similar topics over the years, but maybe there is a solution now? I want to create a transparent form, is it possible? p.s. linux, fpc 3.3.1, lazarus 2.0.2 ---------------------------------------------------------------------- MarkMLl · 2020-11-06 11:59 It's 2020, and like most foramina there's a search box. Have you read through the results and is there anything useful in there? I'm not trying to be rude, but it's an ongoing topic of discussion. MarkMLl ---------------------------------------------------------------------- balazsszekely · 2020-11-06 12:01 This works fine on my Linux Mint 19.2 Cinnamon(64 bit) machine: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormCreate(Sender: TObject);begin  Form1.AlphaBlend := True;  Form1.AlphaBlendValue := 155; //0..255end; PS: Lazarus 2.1.0, FPC: 3.3.1, Gtk2 ---------------------------------------------------------------------- Handoko · 2020-11-07 17:16 @Anton Shevtsov If you're looking for non-rectangular form and you're a Windows user, try this: https://forum.lazarus.freepascal.org/index.php/topic,26639.msg164057.h tml#msg164057 @GetMem Your suggestion does not work on Ubuntu Mate, which uses a fork of GNOME 2 desktop environment. Linux Mint Cinnamon uses GNOME 3 desktop environment. I found an interesting C code to make transparent form. Can anyone convert it to work in Lazarus? https://gist.github.com/mertyildiran/7708a3764ebd16ee2a5d4f3801207bfd ---------------------------------------------------------------------- tetrastes · 2020-11-07 19:23 Quote from: Handoko on November 07, 2020, 06:16:32 pm @GetMem Your suggestion does not work on Ubuntu Mate, which uses a fork of GNOME 2 desktop environment. Linux Mint Cinnamon uses GNOME 3 desktop environment. Strange, it works on Debian 10 Xfce 4.12, which is still based on GTK-2. May be Lazarus trunc is the matter? (I also have Lazarus 2.1.0, as GetMem.) ---------------------------------------------------------------------- lucamar · 2020-11-07 23:03 Quote from: tetrastes on November 07, 2020, 08:23:01 pmStrange, it works on Debian 10 Xfce 4.12, which is still based on GTK-2. May be Lazarus trunc is the matter? (I also have Lazarus 2.1.0, as GetMem.) It works also in Xubuntu 18.04 (Xfce 4.12) with Laz/fpc 2.0.10/3.2.0 ... ---------------------------------------------------------------------- Fred vS · 2020-11-07 23:40 Quote from: Anton Shevtsov on November 06, 2020, 11:45:53 amI've seen many similar topics over the years, but maybe there is a solution now? I want to create a transparent form, is it possible? p.s. linux, fpc 3.3.1, lazarus 2.0.2 It is perfectly possible using the MSEgui widgetset. On Linux and FreeBSD (and Windows, of course). ---------------------------------------------------------------------- dbannon · 2020-11-08 05:50 Quote from: Handoko on November 07, 2020, 06:16:32 pm.... Your suggestion does not work on Ubuntu Mate, which uses a fork of GNOME 2 desktop environment. Yep, I can confirm that GetMem's suggestion does not work on Ubuntu Mate U18.04. Strange ... I am not sure its a GTK2/GTK3 thing, compiling for GTK3 fails at transparent too. (Obviously, while Mate is based on GTK2, it has the GTK3 libraries installed too.) EDIT: interestingly enough, the C based demo Handoko found does not display any transparency on U18.04 Mate either. Davo ---------------------------------------------------------------------- Fred vS · 2020-11-08 11:15 Quote from: Fred vS on November 08, 2020, 12:40:24 amQuote from: Anton Shevtsov on November 06, 2020, 11:45:53 amI've seen many similar topics over the years, but maybe there is a solution now? I want to create a transparent form, is it possible? p.s. linux, fpc 3.3.1, lazarus 2.0.2 It is perfectly possible using the MSEgui widgetset. On Linux and FreeBSD (and Windows, of course). Here the binary of the example for Linux 64 bit, maybe you may test it to see if it works on your system. MSEgui deals directly with X11. https://github.com/fredvs/attach/files/5506224/transparentform.zip ---------------------------------------------------------------------- AmatCoder · 2020-11-08 15:11 Note that transparents windows from GTK has effect only on X11 screens with a compositing manager running. If it does not work with MATE must be because you are running Marco (the MATE Window Manager) without compositing effects. ---------------------------------------------------------------------- Handoko · 2020-11-08 16:06 Thanks Fred vS for providing the binary. I tested it, unfortunately still got no transparency. So far, it is not GTK2 vs GTK3 issue, not Linux issue but only happens on Ubuntu Mate. Maybe what AmatCoder said is true. I checked my Ubuntu Mate 20.04, it's really using Marco as its window manager. Is anyone here also a member of Ubuntu Mate forum's user? Hope someone can submit a bug report there. ---------------------------------------------------------------------- Fred vS · 2020-11-08 17:45 Quote from: Handoko on November 08, 2020, 05:06:01 pmThanks Fred vS for providing the binary. I tested it, unfortunately still got no transparency. Ha, then, imho, the verdict is like AmatCoder suspected: you dont have a Compositor installed. You may install Compton, it is a very good Compositor: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i § sudo apt install compton compton-conf There are few things to tune after this, take a look at explanation here: https://www.addictivetips.com/ubuntu-linux-tips/window-compositing- lightweight-linux-desktops-compton/ And take a look at "Enabling Compton On MATE" chapter. Fre;D ---------------------------------------------------------------------- dbannon · 2020-11-09 05:15 Yep, that appears to be the case. By default (my) U18.04 Mate uses, as Windows Manager, Marco (Adaptive compositor).  Changing that to either Marco (Compton GPU compositor) or Compiz (Advanced GPU accelerated desktop effects) does show transparency for Lazarus Apps that have the appropriate AlphaBlend settings. Interesting, that C code example Handoko found still does not work, good thing we use Lazarus :-) On (my) U18.04, you do not need to install or configure anything, just fire up Mate Tweek (from Control Center), click Windows and select one. I may use Marco with Crompton for a bit, Compiz is just a bit too busy for me. Interesting discussion. Davo ---------------------------------------------------------------------- Handoko · 2020-11-09 05:23 Thank you for informing what you found. I cannot test Compiz because my graphics card has problem and I do not wish to install Compton just because of the transparency problem. ---------------------------------------------------------------------- dbannon · 2020-11-09 06:08 Quote from: Handoko on November 09, 2020, 06:23:35 amI cannot test Compiz because my graphics card has problem and I do not wish to install Compton just because of the transparency problem. I suspect (but may be very wrong) that you don't need to install, Compton, its already there, you just need to select it in Mate Tweek. I have not installed any special graphics card drivers (I never do) but the mention of "GPU" in the two fancy compositors did worry me a bit.  I would expect you would not be offered the option in Mate Tweek if your hardware does not support it.  Also worth noting that those fancy tricks compositors do come at a CPU cost. And its generally just eye candy. Davo ---------------------------------------------------------------------- Handoko · 2020-11-09 06:37 I can only see Marco (No compositor) and Marco (Adaptive compositor) in my Mate Tweak. And both of them do not support transparency. ---------------------------------------------------------------------- circular · 2020-11-09 07:59 Quote from: dbannon on November 09, 2020, 07:08:08 amI suspect (but may be very wrong) that you don't need to install, Compton, its already there, you just need to select it in Mate Tweek. I have not installed any special graphics card drivers (I never do) but the mention of "GPU" in the two fancy compositors did worry me a bit.  I would expect you would not be offered the option in Mate Tweek if your hardware does not support it.  Also worth noting that those fancy tricks compositors do come at a CPU cost. And its generally just eye candy.Well it is obvious that using a GPU makes the blending faster. If you don't have a sufficient GPU, then indeed, the CPU will do the blending and that can use a significant processing power. If you have a GPU, then why not enjoy it? ---------------------------------------------------------------------- dbannon · 2020-11-09 08:14 Quote from: Handoko on November 09, 2020, 07:37:06 amI can only see Marco (No compositor) and Marco (Adaptive compositor) in my Mate Tweak. And both of them do not support transparency. Hmm, maybe I manually installed Compton at some stage in the past.  I just looked at one of my VM's running Mate and they were not there either. But maybe thats because VirtualBox does not allow direct VM access to the GPU ?  Sorry, don't know. @circular -  The suggestion is at the moment is that without a GPU, we don't even have an option to allow "the CPU will do the blending". So, someone running MATE cannot see transparency unless they have a functioning GPU.   Will that worries neither me or Handoko, it might worry the OP, he/she may have a need to ensure it. Davo