From 61d08c8bb1f7af5c199aaef4c19769acb3fc4e11 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 2 May 2013 19:22:25 +0200 Subject: [PATCH] IDEA-104782 (ensure sane spacing in main menu under GTK+) --- .../openapi/actionSystem/impl/ActionMenu.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenu.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenu.java index b9b0903b3a5b..448d260dc36e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenu.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenu.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -121,10 +121,6 @@ public final class ActionMenu extends JMenu { if (UIUtil.isStandardMenuLAF()) { super.updateUI(); - - if (myTopLevel && isAmbiance) { - setForeground(UIUtil.GTK_AMBIANCE_TEXT_COLOR); - } } else { setUI(IdeaMenuUI.createUI(this)); @@ -135,6 +131,24 @@ public final class ActionMenu extends JMenu { popupMenu.updateUI(); } } + + if (myTopLevel && isAmbiance) { + setForeground(UIUtil.GTK_AMBIANCE_TEXT_COLOR); + } + + if (myTopLevel && UIUtil.isUnderGTKLookAndFeel()) { + Insets insets = getInsets(); + Insets newInsets = new Insets(insets.top, insets.left, insets.bottom, insets.right); + if (insets.top + insets.bottom < 6) { + newInsets.top = newInsets.bottom = 3; + } + if (insets.left + insets.right < 12) { + newInsets.left = newInsets.right = 6; + } + if (!newInsets.equals(insets)) { + setBorder(BorderFactory.createEmptyBorder(newInsets.top, newInsets.left, newInsets.bottom, newInsets.right)); + } + } } @Override