Skip to content

Commit 62dd4af

Browse files
committed
Make share toolbar item respond to mouse down instead of mouse up
1 parent 855ee24 commit 62dd4af

3 files changed

Lines changed: 44 additions & 5 deletions

File tree

Vienna.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@
250250
F6E01A072C652DEE0082E07B /* RSSFeedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6E01A062C652DEE0082E07B /* RSSFeedTests.swift */; };
251251
F6E01A092C652FA50082E07B /* RSSFeedWithContentElements.rss in Resources */ = {isa = PBXBuildFile; fileRef = F6E01A082C652FA50082E07B /* RSSFeedWithContentElements.rss */; };
252252
F6EB26031E58D37100570B22 /* DirectoryMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6EB26021E58D37100570B22 /* DirectoryMonitor.swift */; };
253+
F6EBC78D2F75F519000B2279 /* ShareButtonToolbarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6EBC78C2F75F519000B2279 /* ShareButtonToolbarItem.swift */; };
253254
F6F12AFD25ABDDE3005B2DCE /* NSFileManager+Paths.m in Sources */ = {isa = PBXBuildFile; fileRef = F6F12AFC25ABDDE3005B2DCE /* NSFileManager+Paths.m */; };
254255
F6F2029F2D19DD3A004BB948 /* SubscribeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F6F2029E2D19DD3A004BB948 /* SubscribeViewController.m */; };
255256
F6F844EA2F0C6EBF00A8D8D6 /* TableHeaderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F6F844E92F0C6EBF00A8D8D6 /* TableHeaderCell.m */; };
@@ -678,6 +679,7 @@
678679
F6E01A062C652DEE0082E07B /* RSSFeedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RSSFeedTests.swift; sourceTree = "<group>"; };
679680
F6E01A082C652FA50082E07B /* RSSFeedWithContentElements.rss */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = RSSFeedWithContentElements.rss; sourceTree = "<group>"; };
680681
F6EB26021E58D37100570B22 /* DirectoryMonitor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DirectoryMonitor.swift; sourceTree = "<group>"; };
682+
F6EBC78C2F75F519000B2279 /* ShareButtonToolbarItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareButtonToolbarItem.swift; sourceTree = "<group>"; };
681683
F6F12AFB25ABDDE3005B2DCE /* NSFileManager+Paths.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = "NSFileManager+Paths.h"; sourceTree = "<group>"; };
682684
F6F12AFC25ABDDE3005B2DCE /* NSFileManager+Paths.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = "NSFileManager+Paths.m"; sourceTree = "<group>"; };
683685
F6F2029D2D19DD3A004BB948 /* SubscribeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SubscribeViewController.h; sourceTree = "<group>"; };
@@ -1087,6 +1089,7 @@
10871089
children = (
10881090
F66BF2BD2F6E85E900496980 /* ToolbarItem.swift */,
10891091
F61CEA651F039E56009C878E /* ButtonToolbarItem.swift */,
1092+
F6EBC78C2F75F519000B2279 /* ShareButtonToolbarItem.swift */,
10901093
F61CEA671F03F277009C878E /* RepresentingToolbarItem.swift */,
10911094
);
10921095
name = Toolbar;
@@ -1884,6 +1887,7 @@
18841887
AA26F4F00604927300FE7994 /* BackTrackArray.m in Sources */,
18851888
AAF3B14306095E7B0025CC7F /* StringExtensions.m in Sources */,
18861889
F65F2314294E4B5200605F06 /* SeparatorPredicateEditorRowTemplate.swift in Sources */,
1890+
F6EBC78D2F75F519000B2279 /* ShareButtonToolbarItem.swift in Sources */,
18871891
2F88B2A62545BB450067EEA6 /* ArticleConverter.m in Sources */,
18881892
AA36CD7C06100692001E33A4 /* Field.m in Sources */,
18891893
F6B059E22961D0A800F6E31B /* JSONFeedItem.swift in Sources */,

Vienna/Interfaces/Base.lproj/MainWindowController.xib

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="24506" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="24765" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
44
<deployment identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="24506"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="24765"/>
66
<capability name="Image references" minToolsVersion="12.0"/>
77
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
88
</dependencies>
@@ -264,12 +264,12 @@
264264
<action selector="getInfo:" target="-1" id="Xvh-S3-PIS"/>
265265
</connections>
266266
</toolbarItem>
267-
<toolbarItem implicitItemIdentifier="2194A0A2-BEF2-4411-AE86-F573CC3E7FFB" explicitItemIdentifier="Share" label="Share" paletteLabel="Share" image="NSShareTemplate" sizingBehavior="auto" id="YVR-Ym-Do7" customClass="VNAButtonToolbarItem">
267+
<toolbarItem implicitItemIdentifier="2194A0A2-BEF2-4411-AE86-F573CC3E7FFB" explicitItemIdentifier="Share" label="Share" paletteLabel="Share" image="NSShareTemplate" sizingBehavior="auto" id="YVR-Ym-Do7" customClass="VNAShareButtonToolbarItem">
268268
<button key="view" verticalHuggingPriority="750" id="XcR-k5-Au0">
269269
<rect key="frame" x="6" y="14" width="27" height="23"/>
270270
<autoresizingMask key="autoresizingMask"/>
271-
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSShareTemplate" imagePosition="only" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="rk1-Vu-d16">
272-
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
271+
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSShareTemplate" imagePosition="only" alignment="center" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="rk1-Vu-d16">
272+
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
273273
<font key="font" metaFont="system"/>
274274
</buttonCell>
275275
</button>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// ShareButtonToolbarItem.swift
3+
// Vienna
4+
//
5+
// Copyright 2026 Eitot
6+
//
7+
// Licensed under the Apache License, Version 2.0 (the "License");
8+
// you may not use this file except in compliance with the License.
9+
// You may obtain a copy of the License at
10+
//
11+
// https://www.apache.org/licenses/LICENSE-2.0
12+
//
13+
// Unless required by applicable law or agreed to in writing, software
14+
// distributed under the License is distributed on an "AS IS" BASIS,
15+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
// See the License for the specific language governing permissions and
17+
// limitations under the License.
18+
//
19+
20+
import Cocoa
21+
22+
@objc(VNAShareButtonToolbarItem)
23+
class ShareButtonToolbarItem: ButtonToolbarItem {
24+
25+
override func awakeFromNib() {
26+
super.awakeFromNib()
27+
28+
// The share sheet should appear when the user presses down the left
29+
// mouse button, not when the user releases the button. This reflects
30+
// the behavior of the share button elsewhere in macOS.
31+
if let button = view as? NSButton {
32+
button.sendAction(on: .leftMouseDown)
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)