Transparent window

Linux specific questions.
Posts: 1885
Joined: Jun 21, 2005 19:04

Transparent window

Postby angros47 » Jul 20, 2021 20:40

I borrowed some code from the utility transset, to be able to set the window transparency. It should work in OpenGL, too

Code: Select all

#include once "X11/"
#include once "X11/"
#include once "X11/"
#include once "X11/extensions/"
#include once "X11/"
#inclib "X11"
#inclib "Xext"

SUB SetWindowOpacity (Level as single)

dim as Display ptr dpy=XOpenDisplay(0)
dim w as integer
screencontrol 2,w

dim as Window  parent, root
dim as Window ptr child_list
dim num_children as unsigned long

XQueryTree (dpy, w, @root, @parent, @child_list, @num_children)

dim target_win as Window=parent

dim opacity as ulong=Level * &hffffffff

XChangeProperty (dpy, target_win, XInternAtom (dpy, "_NET_WM_WINDOW_OPACITY", False),XA_CARDINAL, 32, PropModeReplace, cast (ubyte ptr,@opacity), 1)
XSync (dpy, False)
XCloseDisplay (dpy)
end sub

screenres 640,480

dim w as integer
screencontrol 2,w
?"Hello world"

SetWindowOpacity .8
Posts: 2340
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Transparent window

Postby badidea » Jul 20, 2021 22:19

The example works fine here with 64-bit fbc 1.07.0 (gcc), but no transparency 32-bit fbc 1.07.0 (gas).

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 4 guests