FLTK logo

Re: [fltk.general] Transparent window

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Transparent window Ian MacArthur Jun 12, 2022  
 
Apologies if this appears twice - I thought I posted before, but my response doesn’t seem to be here... Odd...

On 12 Jun 2022, at 08:37, Håvard wrote:
> 
> I add the following lines to a fltk-program (testing on examples/browser-simple) and expect to see a transparent window. That do however not happen.
> 
>   Display* display;
>   char* connection_string = NULL;
>   display = XOpenDisplay (connection_string);
>   Atom atom = XInternAtom(display, "_NET_WM_WINDOW_OPACITY", False); 
>   uint opacity = 0x80000000; /* 0x0 .. 0xffffffff */
>   XChangeProperty(display, fl_xid(win), atom, XA_CARDINAL, 32,
>             PropModeReplace, (unsigned char*)&opacity, 1L);
> 
> I run under linux/X11. How to get a transparent window ?

As Manolo has said, fltk doesn’t really support transparent colours in a window, so a shaped window might be the best we can do using fltk options (there are examples in the docs and in the test folder of using shaped window.)

The other thing you can do is to alter the translucency of the entire window (not just a region of it, though). 
I have code (attached below) that illustrates this, which worked on X11, OSX and Win32 as of 2015’ish... so probably still OK!

TBH, I thought I had a nice worked example of this, but actually all I can find now is this rather feeble OSK demo, that uses the technique to make the pop-up keyboard widget semi-transparent.

So, not great - but once you have the translucent window created, you can vary its alpha dynamically at runtime, which is quite cool, if not actually all that useful!

Might be informative for your use-case, so the code is here...

-- 
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/9D567F5F-DB0C-4A42-A051-FEC13C45C94B%40gmail.com.






-- 
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/9D567F5F-DB0C-4A42-A051-FEC13C45C94B%40gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.