Skip to content

Commit 252403c

Browse files
committed
Avoid semi-transparent window on some compositors
1 parent 468c24a commit 252403c

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -939,21 +939,22 @@ bool CIrrDeviceLinux::createWindow()
939939
attributes.event_mask |= PointerMotionMask |
940940
ButtonPressMask | KeyPressMask |
941941
ButtonReleaseMask | KeyReleaseMask;
942+
943+
Atom *list;
944+
Atom type;
945+
int form;
946+
unsigned long remain, len;
947+
948+
Atom WMCheck = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", false);
949+
Status s = XGetWindowProperty(display, DefaultRootWindow(display),
950+
WMCheck, 0L, 1L, False, XA_WINDOW,
951+
&type, &form, &len, &remain,
952+
(unsigned char **)&list);
953+
XFree(list);
954+
bool netWM = (s == Success) && len;
942955

943956
if (!CreationParams.WindowId)
944957
{
945-
Atom *list;
946-
Atom type;
947-
int form;
948-
unsigned long remain, len;
949-
950-
Atom WMCheck = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", false);
951-
Status s = XGetWindowProperty(display, DefaultRootWindow(display),
952-
WMCheck, 0L, 1L, False, XA_WINDOW,
953-
&type, &form, &len, &remain,
954-
(unsigned char **)&list);
955-
XFree(list);
956-
bool netWM = (s == Success) && len;
957958
attributes.override_redirect = !netWM && CreationParams.Fullscreen;
958959

959960
// create new Window
@@ -1139,6 +1140,18 @@ bool CIrrDeviceLinux::createWindow()
11391140
CreationParams.Bits = bits;
11401141
CreationParams.WindowSize.Width = Width;
11411142
CreationParams.WindowSize.Height = Height;
1143+
1144+
if (netWM == true)
1145+
{
1146+
Atom opaque_region = XInternAtom(display, "_NET_WM_OPAQUE_REGION", true);
1147+
1148+
if (opaque_region != None)
1149+
{
1150+
unsigned long window_rect[4] = {0, 0, Width, Height};
1151+
XChangeProperty(display, window, opaque_region, XA_CARDINAL, 32,
1152+
PropModeReplace, (unsigned char*)window_rect, 4);
1153+
}
1154+
}
11421155

11431156
StdHints = XAllocSizeHints();
11441157
long num;

0 commit comments

Comments
 (0)