diff --git a/bin/mac/libnst64.dylib b/bin/mac/libnst64.dylib
index 1e31492f9275..be77c80a0ec9 100755
Binary files a/bin/mac/libnst64.dylib and b/bin/mac/libnst64.dylib differ
diff --git a/native/MacTouchBar/src/Button.m b/native/MacTouchBar/src/Button.m
index 5387be067b30..b345fbb291a0 100644
--- a/native/MacTouchBar/src/Button.m
+++ b/native/MacTouchBar/src/Button.m
@@ -9,6 +9,7 @@ const NSSize g_defaultMinSize = {72, 30}; // empiric value
@property (nonatomic) NSButtonType btype;
@property (nonatomic) CGFloat bwidth;
@property (nonatomic) execute jaction;
+@property (nonatomic) NSString * uid; // for debug only
- (id)init;
- (void)doAction;
+ (Class)cellClass;
@@ -29,7 +30,7 @@ const NSSize g_defaultMinSize = {72, 30}; // empiric value
NSCell * cell = [self cell];
[cell setLineBreakMode:NSLineBreakByTruncatingTail];
[self setBezelStyle:NSRoundedBezelStyle];
- [self setMargins:2 border:8];
+ [self setMargins:3 border:8];
// NSLog(@"created button [%@]: cell-class=%@", self, [[self cell] className]);
}
return self;
@@ -58,6 +59,22 @@ const NSSize g_defaultMinSize = {72, 30}; // empiric value
} else
nstrace(@"button [%@]: empty action, nothing to execute", self);
}
+// Uncomment for visual debug
+//
+//- (void) drawRect:(NSRect)dirtyRect {
+// [[NSGraphicsContext currentContext] saveGraphicsState];
+//
+//// NSColor* backgroundColor = [NSColor clearColor];
+//// NSColor* backgroundColor = [NSColor yellowColor];
+//// [backgroundColor setFill];
+//// NSRectFill(dirtyRect);
+//
+// [NSGraphicsContext restoreGraphicsState];
+//
+// NSLog(@"drawRect [%@]: %@", self.uid, NSStringFromRect(dirtyRect));
+// [super drawRect:dirtyRect];
+//}
+
+ (Class)cellClass
{
return [NSButtonCellEx class];
@@ -69,7 +86,7 @@ const NSSize g_defaultMinSize = {72, 30}; // empiric value
//
//-(void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView
//{
-// NSLog(@"drawBezelWithFrame: %@", NSStringFromRect(frame));
+// NSLog(@"\tdrawBezelWithFrame: %@", NSStringFromRect(frame));
// [super drawBezelWithFrame:frame inView:controlView];
//
// [[NSGraphicsContext currentContext] saveGraphicsState];
@@ -112,7 +129,7 @@ const NSSize g_defaultMinSize = {72, 30}; // empiric value
return result;
}
- (void)drawInteriorWithFrame:(NSRect)frame inView:(NSView *)controlView {
-// NSLog(@"drawInteriorWithFrame: %@", NSStringFromRect(frame));
+ // NSLog(@"\tdrawInteriorWithFrame: %@", NSStringFromRect(frame));
if (self.title == nil || self.title.length <= 0) {
[super drawImage:self.image withFrame:frame inView:controlView];
return;
@@ -187,6 +204,7 @@ const int BUTTON_FLAG_DISABLED = 1;
const int BUTTON_FLAG_SELECTED = 1 << 1;
const int BUTTON_FLAG_COLORED = 1 << 2;
const int BUTTON_FLAG_TOGGLE = 1 << 3;
+const int BUTTON_FLAG_TRANSPARENT_BG = 1 << 4;
const unsigned int LAYOUT_WIDTH_MASK = 0x0FFF;
const unsigned int LAYOUT_FLAG_MIN_WIDTH = 1 << 15;
@@ -304,6 +322,9 @@ static void _setButtonData(NSButtonJAction *button, int updateOptions, int layou
if (enabled != button.enabled) {
[button setEnabled:enabled];
}
+
+ if (buttonFlags & BUTTON_FLAG_TRANSPARENT_BG)
+ [button setBordered:NO];
}
if (button.image != nil) {
@@ -330,6 +351,7 @@ id createButton(
NSCustomTouchBarItem *customItemForButton = [[NSCustomTouchBarItem alloc] initWithIdentifier:nsUid]; // create non-autorelease object to be owned by java-wrapper
NSButtonJAction *button = [[[NSButtonJAction alloc] init] autorelease];
+ button.uid = nsUid;
NSImage *img = createImgFrom4ByteRGBA((const unsigned char *) raster4ByteRGBA, w, h);
NSString *nstext = createStringFromUTF8(text);
diff --git a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java
index 13cc1afc6b6e..d361870f41ad 100644
--- a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java
+++ b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java
@@ -132,6 +132,7 @@ public abstract class DiffRequestProcessor implements Disposable {
myToolbarGroup = new DefaultActionGroup();
myPopupActionGroup = new DefaultActionGroup();
myTouchbarActionGroup = new UpdatableDefaultActionGroup();
+ TouchbarDataKeys.putActionDescriptor(myTouchbarActionGroup).setReplaceEsc(false);
// UI
diff --git a/platform/icons/src/mac/touchbar/popoverArrow_dark.svg b/platform/icons/src/mac/touchbar/popoverArrow_dark.svg
new file mode 100644
index 000000000000..86f530776502
--- /dev/null
+++ b/platform/icons/src/mac/touchbar/popoverArrow_dark.svg
@@ -0,0 +1,3 @@
+
diff --git a/platform/icons/src/mac/touchbar/popoverClose_dark.svg b/platform/icons/src/mac/touchbar/popoverClose_dark.svg
new file mode 100644
index 000000000000..b396e1d86645
--- /dev/null
+++ b/platform/icons/src/mac/touchbar/popoverClose_dark.svg
@@ -0,0 +1,3 @@
+
diff --git a/platform/platform-impl/src/com/intellij/ui/mac/touchbar/BuildUtils.java b/platform/platform-impl/src/com/intellij/ui/mac/touchbar/BuildUtils.java
index 9a3b2c1d7d52..ee5e86c8190c 100644
--- a/platform/platform-impl/src/com/intellij/ui/mac/touchbar/BuildUtils.java
+++ b/platform/platform-impl/src/com/intellij/ui/mac/touchbar/BuildUtils.java
@@ -430,8 +430,8 @@ class BuildUtils {
butt.setHiddenWhenDisabled(true);
if (isRunConfigPopover) {
- butt.setWidth(ourRunConfigurationPopoverWidth);
butt.setHasArrowIcon(true);
+ butt.setLayout(ourRunConfigurationPopoverWidth, 0, 5, 8);
} else if (butt.getAnAction() instanceof WelcomePopupAction)
butt.setHasArrowIcon(true);
diff --git a/platform/platform-impl/src/com/intellij/ui/mac/touchbar/NST.java b/platform/platform-impl/src/com/intellij/ui/mac/touchbar/NST.java
index dced930344d1..08a0309e9e53 100644
--- a/platform/platform-impl/src/com/intellij/ui/mac/touchbar/NST.java
+++ b/platform/platform-impl/src/com/intellij/ui/mac/touchbar/NST.java
@@ -260,7 +260,7 @@ public class NST {
// Maximum icon size 44px × 44px (22pt × 22pt @2x)
final Application app = ApplicationManager.getApplication();
- final float fMulX = app != null && UISettings.getInstance().getPresentationMode() ? 40/icon.getIconHeight() : 40/16.f;
+ final float fMulX = app != null && UISettings.getInstance().getPresentationMode() ? 40.f/icon.getIconHeight() : (icon.getIconHeight() < 24 ? 40.f/16 : 44.f/icon.getIconHeight());
return _getImg4ByteRGBA(icon, fMulX);
}
}
diff --git a/platform/platform-impl/src/com/intellij/ui/mac/touchbar/NSTLibrary.java b/platform/platform-impl/src/com/intellij/ui/mac/touchbar/NSTLibrary.java
index e84fb2541857..79684b91420f 100644
--- a/platform/platform-impl/src/com/intellij/ui/mac/touchbar/NSTLibrary.java
+++ b/platform/platform-impl/src/com/intellij/ui/mac/touchbar/NSTLibrary.java
@@ -58,6 +58,7 @@ public interface NSTLibrary extends Library {
int BUTTON_FLAG_SELECTED = 1 << 1;
int BUTTON_FLAG_COLORED = 1 << 2;
int BUTTON_FLAG_TOGGLE = 1 << 3;
+ int BUTTON_FLAG_TRANSPARENT_BG = 1 << 4;
int LAYOUT_WIDTH_MASK = 0x0FFF;
int LAYOUT_FLAG_MIN_WIDTH = 1 << 15;
diff --git a/platform/platform-impl/src/com/intellij/ui/mac/touchbar/TBItemButton.java b/platform/platform-impl/src/com/intellij/ui/mac/touchbar/TBItemButton.java
index 890f7641348e..926efaff962d 100644
--- a/platform/platform-impl/src/com/intellij/ui/mac/touchbar/TBItemButton.java
+++ b/platform/platform-impl/src/com/intellij/ui/mac/touchbar/TBItemButton.java
@@ -1,7 +1,6 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ui.mac.touchbar;
-import com.intellij.icons.AllIcons;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
@@ -157,6 +156,19 @@ class TBItemButton extends TBItem {
return this;
}
+ TBItemButton setTransparentBg(boolean isTransparentBg) {
+ final int flags = _applyFlag(myFlags, isTransparentBg, NSTLibrary.BUTTON_FLAG_TRANSPARENT_BG);
+ if (flags != myFlags) {
+ myFlags = flags;
+ if (myNativePeer != ID.NIL) {
+ myUpdateOptions |= NSTLibrary.BUTTON_UPDATE_FLAGS;
+ _updateNativePeer();
+ }
+ }
+
+ return this;
+ }
+
void update(Icon icon, String text, boolean isSelected, boolean isDisabled) {
if (icon != null) icon = IconLoader.getDarkIcon(icon, true);
@@ -208,8 +220,10 @@ class TBItemButton extends TBItem {
synchronized protected ID _createNativePeer() {
// System.out.printf("_createNativePeer, button [%s]\n", myUid);
final ID result = NST.createButton(myUid, myLayoutBits, _validateFlags(), myText, myIcon, myNativeCallback);
- if (myHasArrowIcon)
- NST.setArrowImage(result, AllIcons.General.ComboArrow);
+ if (myHasArrowIcon) {
+ final Icon ic = IconLoader.getIcon("/mac/touchbar/popoverArrow_dark.svg");
+ NST.setArrowImage(result, ic);
+ }
return result;
}
diff --git a/platform/platform-impl/src/com/intellij/ui/mac/touchbar/TouchBar.java b/platform/platform-impl/src/com/intellij/ui/mac/touchbar/TouchBar.java
index 80cd77b7ca45..309e94a07266 100644
--- a/platform/platform-impl/src/com/intellij/ui/mac/touchbar/TouchBar.java
+++ b/platform/platform-impl/src/com/intellij/ui/mac/touchbar/TouchBar.java
@@ -1,12 +1,12 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ui.mac.touchbar;
-import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.IndexNotReadyException;
+import com.intellij.openapi.util.IconLoader;
import com.intellij.ui.mac.TouchbarDataKeys;
import com.intellij.ui.mac.foundation.ID;
import org.jetbrains.annotations.NotNull;
@@ -52,8 +52,9 @@ class TouchBar implements NSTLibrary.ItemCreator {
myItemListener = null;
myItems = new ItemsContainer(touchbarName, myItemListener);
- if (replaceEsc)
- myCustomEsc = new TBItemButton(touchbarName + "_custom_esc_button", myItemListener).setIcon(AllIcons.Actions.Cancel).setThreadSafeAction(()-> {
+ if (replaceEsc) {
+ final Icon ic = IconLoader.getIcon("/mac/touchbar/popoverClose_dark.svg");
+ myCustomEsc = new TBItemButton(touchbarName + "_custom_esc_button", myItemListener).setIcon(ic).setWidth(64).setTransparentBg(true).setThreadSafeAction(()-> {
_closeSelf();
if (emulateESC) {
try {
@@ -69,7 +70,7 @@ class TouchBar implements NSTLibrary.ItemCreator {
}
}
});
- else
+ } else
myCustomEsc = null;
myNativePeer = NST.createTouchBar(touchbarName, this, myCustomEsc != null ? myCustomEsc.myUid : null);