From 436068cbb7eff1998a4e292ddf78eedc54d160e0 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Sun, 22 Mar 2015 12:31:35 +0100 Subject: [PATCH] =?UTF-8?q?Allow=20closing=20tabs=20on=20=E2=80=9Cother?= =?UTF-8?q?=E2=80=9D=20(middle)=20mouse=20button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/OakAppKit/src/OakTabBarView.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Frameworks/OakAppKit/src/OakTabBarView.mm b/Frameworks/OakAppKit/src/OakTabBarView.mm index 1826fb94..6200c3db 100644 --- a/Frameworks/OakAppKit/src/OakTabBarView.mm +++ b/Frameworks/OakAppKit/src/OakTabBarView.mm @@ -556,6 +556,11 @@ static NSString* const OakTabItemPasteboardType = @"OakTabItemPasteboardType"; [self trySelectTabForView:[self hitTest:mouseCurrentPos]]; } +- (void)otherMouseUp:(NSEvent*)anEvent +{ + [self _performCloseTab:[self hitTest:[[self superview] convertPoint:[anEvent locationInWindow] fromView:nil]]]; +} + - (void)trySelectTabForView:(NSView*)aView { if(OakTabItem* tabItem = [self tabItemForView:aView]) @@ -783,7 +788,7 @@ static NSString* const OakTabItemPasteboardType = @"OakTabItemPasteboardType"; _tag = [_tabItems indexOfObject:tabItem]; // performCloseTab: asks for [sender tag] BOOL closeOther = OakIsAlternateKeyOrMouseEvent(); - if(_isMouseInside && [[NSApp currentEvent] type] == NSLeftMouseUp && !closeOther && tabItem != _overflowTabItem) + if(_isMouseInside && ([[NSApp currentEvent] type] == NSLeftMouseUp || [[NSApp currentEvent] type] == NSOtherMouseUp) && !closeOther && tabItem != _overflowTabItem) { _didCloseTabIndex = _tag; _didCloseTabFrame = tabItem.targetFrame;