mirror of https://github.com/adamdruppe/arsd.git
Implement setOpacity on X11
This commit is contained in:
parent
3c7ad66389
commit
a08a809158
|
@ -1562,13 +1562,15 @@ class SimpleWindow : CapableOfHandlingNativeEvent, CapableOfBeingDrawnUpon {
|
||||||
} else static assert(0);
|
} else static assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the window opacity. On X11 (currently not implemented) this will require a compositor to be running. On windows the WindowFlags.extraComposite must be set at window creation.
|
/// Sets the window opacity. On X11 this requires a compositor to be running. On windows the WindowFlags.extraComposite must be set at window creation.
|
||||||
void opacity(double opacity) @property
|
void opacity(double opacity) @property
|
||||||
in {
|
in {
|
||||||
assert(opacity >= 0 && opacity <= 1);
|
assert(opacity >= 0 && opacity <= 1);
|
||||||
} body {
|
} body {
|
||||||
version (Windows) {
|
version (Windows) {
|
||||||
impl.setOpacity(cast(ubyte)(255 * opacity));
|
impl.setOpacity(cast(ubyte)(255 * opacity));
|
||||||
|
} else version (X11) {
|
||||||
|
impl.setOpacity(cast(uint)(uint.max * opacity));
|
||||||
} else throw new NotYetImplementedException();
|
} else throw new NotYetImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8895,6 +8897,14 @@ version(X11) {
|
||||||
flushGui();
|
flushGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setOpacity (uint opacity) {
|
||||||
|
if (opacity == uint.max)
|
||||||
|
XDeleteProperty(display, window, XInternAtom(display, "_NET_WM_WINDOW_OPACITY".ptr, false));
|
||||||
|
else
|
||||||
|
XChangeProperty(display, window, XInternAtom(display, "_NET_WM_WINDOW_OPACITY".ptr, false),
|
||||||
|
XA_CARDINAL, 32, PropModeReplace, &opacity, 1);
|
||||||
|
}
|
||||||
|
|
||||||
void createWindow(int width, int height, string title, in OpenGlOptions opengl, SimpleWindow parent) {
|
void createWindow(int width, int height, string title, in OpenGlOptions opengl, SimpleWindow parent) {
|
||||||
display = XDisplayConnection.get();
|
display = XDisplayConnection.get();
|
||||||
auto screen = DefaultScreen(display);
|
auto screen = DefaultScreen(display);
|
||||||
|
|
Loading…
Reference in New Issue