Old 10-16-2018, 07:35 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,752
Default WDL/swell: Window transparency function

Setting window transparency is very easy in Windows, and according to this website, almost as easy in MacOS and Linux too:

Windows:
Code:
SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(hWnd, 0, alpha, LWA_ALPHA);
MacOS:
Code:
CGFloat opacity = alpha / 255.0f;
[window setAlphaValue:opacity];
[window setOpaque:NO];
Linux:
(EDIT: As cfillion pointed out, the gtk function gdk_window_set_opacity would actually be even easier to use.)
Code:
Display* display = XOpenDisplay(NULL);
Atom property = XInternAtom(display, "_NET_WM_WINDOW_OPACITY", false);
if (property != None)
{
    unsigned long opacity = (0xffffffff / 0xff) * alpha;
    XChangeProperty(display, wnd, property, XA_CARDINAL, 32, PropModeReplace, (unsigned char*)&opacity, 1);
    XFlush(display);
}
XCloseDisplay(display);
Could a transparency function be added to swell?

Last edited by juliansader; 10-16-2018 at 10:10 AM.
juliansader is offline   Reply With Quote
Old 10-16-2018, 09:42 AM   #2
TBProAudio
Human being with feelings
 
TBProAudio's Avatar
 
Join Date: May 2014
Location: Germany
Posts: 506
Default

deleted, wrong post
__________________
www.tb-software.com/TBProAudio

Last edited by TBProAudio; 10-17-2018 at 05:36 AM.
TBProAudio is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:50 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.