Transparent window

Linux specific questions.
Post Reply
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Transparent window

Post by angros47 »

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/Xlib.bi"
#include once "X11/Xatom.bi"
#include once "X11/Intrinsic.bi"
#include once "X11/extensions/shape.bi"
#include once "X11/Xfuncproto.bi"
#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
sleep
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Transparent window

Post by badidea »

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