Support JBR-1650 propagate custom decoration title bar height to native

GitOrigin-RevId: 13ca881ea2023fdc5871c382bb23f4a5a3855348
This commit is contained in:
Anton Tarasov
2019-07-08 20:07:55 +03:00
committed by intellij-monorepo-bot
parent 094cc445b1
commit 5dd3e42476
2 changed files with 15 additions and 0 deletions
@@ -71,4 +71,18 @@ public class JdkEx {
}
}
}
public static void setCustomDecorationTitleBarHeight(@NotNull Window window, int height) {
if (SystemInfo.isJetBrainsJvm && SystemInfo.isWindows) {
try {
MethodInvocator invocator =
new MethodInvocator(false, Class.forName("sun.awt.windows.WWindowPeer"), "setCustomDecorationTitleBarHeight", int.class);
if (invocator.isAvailable()) {
invocator.invoke(AWTAccessor.getComponentAccessor().getPeer(window), height);
}
}
catch (ClassNotFoundException ignore) {
}
}
}
}
@@ -159,6 +159,7 @@ abstract class CustomHeader(private val window: Window) : JPanel(), Disposable {
protected fun updateCustomDecorationHitTestSpots() {
val toList = getHitTestSpots().map {it.getRectangleOn(window)}.toList()
JdkEx.setCustomDecorationHitTestSpots(window, toList)
JdkEx.setCustomDecorationTitleBarHeight(window, height)
}
abstract fun getHitTestSpots(): List<RelativeRectangle>