@@ -129,7 +129,28 @@ internal val platformOperations: PlatformOperations by lazy {
129129}
130130
131131// OSX
132- external private fun osxIsFullscreenNative (component : Component ): Boolean
133- external private fun osxSetFullscreenNative (component : Component , value : Boolean )
134- external private fun osxDisableTitleBar (component : Component , headerHeight : Float )
135- external private fun osxOrderEmojiAndSymbolsPopup ()
132+ private external fun osxIsFullscreenNative (component : Component ): Boolean
133+ private external fun osxSetFullscreenNative (component : Component , value : Boolean )
134+ private external fun osxDisableTitleBar (component : Component , headerHeight : Float )
135+ private external fun osxOrderEmojiAndSymbolsPopup ()
136+
137+ // Transparent window hack
138+ private val TRANSPARENT_COLOR = java.awt.Color (0 , 0 , 0 , 0 )
139+
140+ /* *
141+ * Returns the color that should be set as the [Window.background] for transparent windows.
142+ *
143+ * Note that this is a workaround for an implementation detail of OpenGL and Software
144+ * (and possibly other) renderers on Windows. As such, it may be removed in the future.
145+ */
146+ @DelicateSkikoApi
147+ fun transparentWindowBackgroundHack (renderApi : GraphicsApi ): java.awt.Color ? {
148+ // There is a hack inside OpenGL and Software redrawers for Windows that makes the
149+ // window transparent without setting the `background` of the AWT window. It is done
150+ // by getting the native component parent and calling `DwmEnableBlurBehindWindow`.
151+ //
152+ // FIXME: Make OpenGL work inside transparent window (background == Color(0, 0, 0, 0)) without this hack.
153+ // See `enableTransparentWindow` (skiko/src/awtMain/cpp/windows/window_util.cc)
154+ val skikoTransparentWindowHack = hostOs == OS .Windows && renderApi != GraphicsApi .DIRECT3D
155+ return if (skikoTransparentWindowHack) null else TRANSPARENT_COLOR
156+ }
0 commit comments