Revision: 14901
http://sourceforge.net/p/skim-app/code/14901
Author: hofman
Date: 2025-01-29 17:17:24 +0000 (Wed, 29 Jan 2025)
Log Message:
-----------
Use NSColorWell subclass in display pref pane to avoid method swizzling
Modified Paths:
--------------
trunk/Base.lproj/DisplayPreferences.xib
trunk/SKColorSwatch.h
trunk/SKColorSwatch.m
Modified: trunk/Base.lproj/DisplayPreferences.xib
===================================================================
--- trunk/Base.lproj/DisplayPreferences.xib 2025-01-28 17:39:33 UTC (rev
14900)
+++ trunk/Base.lproj/DisplayPreferences.xib 2025-01-29 17:17:24 UTC (rev
14901)
@@ -126,7 +126,7 @@
<color key="backgroundColor" name="controlColor"
catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
- <colorWell toolTip="Color to use for the background of the PDF
view in normal mode" translatesAutoresizingMaskIntoConstraints="NO" id="16">
+ <colorWell toolTip="Color to use for the background of the PDF
view in normal mode" translatesAutoresizingMaskIntoConstraints="NO" id="16"
customClass="SKColorWell">
<rect key="frame" x="88" y="164" width="52" height="24"/>
<constraints>
<constraint firstAttribute="height" constant="24"
id="VDH-vA-OdJ"/>
@@ -144,7 +144,7 @@
<outlet property="nextKeyView" destination="17"
id="51"/>
</connections>
</colorWell>
- <colorWell toolTip="Color to use for the background of the PDF
view in full screen mode" translatesAutoresizingMaskIntoConstraints="NO"
id="17">
+ <colorWell toolTip="Color to use for the background of the PDF
view in full screen mode" translatesAutoresizingMaskIntoConstraints="NO"
id="17" customClass="SKColorWell">
<rect key="frame" x="238" y="164" width="52" height="24"/>
<color key="color" red="0.0" green="0.0" blue="0.0"
alpha="1" colorSpace="calibratedRGB"/>
<connections>
@@ -167,7 +167,7 @@
<color key="backgroundColor" name="controlColor"
catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
- <colorWell toolTip="Color to use for the reading bar"
translatesAutoresizingMaskIntoConstraints="NO" id="23">
+ <colorWell toolTip="Color to use for the reading bar"
translatesAutoresizingMaskIntoConstraints="NO" id="23"
customClass="SKColorWell">
<rect key="frame" x="88" y="91" width="52" height="24"/>
<constraints>
<constraint firstAttribute="height" constant="24"
id="UcR-gG-Sft"/>
Modified: trunk/SKColorSwatch.h
===================================================================
--- trunk/SKColorSwatch.h 2025-01-28 17:39:33 UTC (rev 14900)
+++ trunk/SKColorSwatch.h 2025-01-29 17:17:24 UTC (rev 14901)
@@ -82,4 +82,9 @@
@end
+#pragma mark -
+
+@interface SKColorWell : NSColorWell
+@end
+
NS_ASSUME_NONNULL_END
Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m 2025-01-28 17:39:33 UTC (rev 14900)
+++ trunk/SKColorSwatch.m 2025-01-29 17:17:24 UTC (rev 14901)
@@ -44,7 +44,6 @@
#import "NSView_SKExtensions.h"
#import "NSGraphics_SKExtensions.h"
#import "NSShadow_SKExtensions.h"
-#import "SKRuntime.h"
NSString *SKColorSwatchColorsChangedNotification =
@"SKColorSwatchColorsChangedNotification";
NSString *SKColorSwatchOrWellWillActivateNotification =
@"SKColorSwatchOrWellWillActivateNotification";
@@ -838,20 +837,13 @@
@end
#pragma mark -
+@implementation SKColorWell
-@implementation NSColorWell (SKExtensions)
-
-static void (*original_activate)(id, SEL, BOOL) = NULL;
-
-- (void)replacement_activate:(BOOL)exclusive {
+- (void)activate:(BOOL)exclusive {
[[NSNotificationCenter defaultCenter]
postNotificationName:SKColorSwatchOrWellWillActivateNotification object:self];
- original_activate(self, _cmd, exclusive);
+ [super activate:exclusive];
}
-+ (void)load {
- original_activate = (void (*)(id, SEL,
BOOL))SKReplaceInstanceMethodImplementationFromSelector(self,
@selector(activate:), @selector(replacement_activate:));
-}
-
@end
#pragma mark -
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit