[vlc-devel] commit: NSFontManager's setTarget isn't defined in 10.4u, so we need to intercept the firstResponder chain in order to get notified of the font change . ( Felix Paul Kühne )

git version control git at videolan.org
Sun Sep 21 21:55:05 CEST 2008


vlc | branch: 0.9-bugfix | Felix Paul Kühne <fkuehne at videolan.org> | Sun Sep 21 21:58:08 2008 +0200| [17a722aa10d543ab14805eb9e7410b7a139f1504] | committer: Felix Paul Kühne 

NSFontManager's setTarget isn't defined in 10.4u, so we need to intercept the firstResponder chain in order to get notified of the font change.

Yes, better don't ask. and no, NSFontManager doesn't provide changeFont as a delegate facility. That's incorrect documentation if you look at the header..

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=17a722aa10d543ab14805eb9e7410b7a139f1504
---

 .../English.lproj/Preferences.nib/classes.nib      |    5 +++++
 .../English.lproj/Preferences.nib/info.nib         |    8 ++++----
 .../English.lproj/Preferences.nib/keyedobjects.nib |  Bin 93377 -> 93391 bytes
 modules/gui/macosx/simple_prefs.h                  |    5 +++++
 modules/gui/macosx/simple_prefs.m                  |   16 +++++++++++++++-
 5 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/extras/package/macosx/Resources/English.lproj/Preferences.nib/classes.nib b/extras/package/macosx/Resources/English.lproj/Preferences.nib/classes.nib
index 35d4879..8c565d2 100644
--- a/extras/package/macosx/Resources/English.lproj/Preferences.nib/classes.nib
+++ b/extras/package/macosx/Resources/English.lproj/Preferences.nib/classes.nib
@@ -166,6 +166,11 @@
                 "o_video_view" = id;
             };
             SUPERCLASS = NSObject;
+        },
+                {
+            CLASS = VLCSimplePrefsWindow;
+            LANGUAGE = ObjC;
+            SUPERCLASS = NSWindow;
         }
     );
     IBVersion = 1;
diff --git a/extras/package/macosx/Resources/English.lproj/Preferences.nib/info.nib b/extras/package/macosx/Resources/English.lproj/Preferences.nib/info.nib
index a3331bc..d23e99b 100644
--- a/extras/package/macosx/Resources/English.lproj/Preferences.nib/info.nib
+++ b/extras/package/macosx/Resources/English.lproj/Preferences.nib/info.nib
@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
 	<key>IBDocumentLocation</key>
-	<string>69 69 356 240 0 0 1280 778 </string>
+	<string>75 91 356 240 0 0 1280 778 </string>
 	<key>IBEditorPositions</key>
 	<dict>
 		<key>2311</key>
@@ -23,11 +23,11 @@
 	<integer>5</integer>
 	<key>IBOpenObjects</key>
 	<array>
-		<integer>1530</integer>
-		<integer>2668</integer>
-		<integer>2677</integer>
 		<integer>2330</integer>
 		<integer>2265</integer>
+		<integer>2668</integer>
+		<integer>1530</integer>
+		<integer>2677</integer>
 	</array>
 	<key>IBSystem Version</key>
 	<string>9E17</string>
diff --git a/extras/package/macosx/Resources/English.lproj/Preferences.nib/keyedobjects.nib b/extras/package/macosx/Resources/English.lproj/Preferences.nib/keyedobjects.nib
index 0cc806a..e1f504b 100644
Binary files a/extras/package/macosx/Resources/English.lproj/Preferences.nib/keyedobjects.nib and b/extras/package/macosx/Resources/English.lproj/Preferences.nib/keyedobjects.nib differ
diff --git a/modules/gui/macosx/simple_prefs.h b/modules/gui/macosx/simple_prefs.h
index 558b5de..f5a279a 100644
--- a/modules/gui/macosx/simple_prefs.h
+++ b/modules/gui/macosx/simple_prefs.h
@@ -196,6 +196,7 @@
 - (IBAction)osdSettingChanged:(id)sender;
 - (IBAction)showFontPicker:(id)sender;
 - (void)showOSDSettings;
+- (void)changeFont:(id)sender;
 
 /* input & codecs */
 - (IBAction)inputSettingChanged:(id)sender;
@@ -213,3 +214,7 @@
 @interface VLCHotkeyChangeWindow : NSWindow
 
 @end
+
+ at interface VLCSimplePrefsWindow : NSWindow
+
+ at end
diff --git a/modules/gui/macosx/simple_prefs.m b/modules/gui/macosx/simple_prefs.m
index 82b1896..1df3b8c 100644
--- a/modules/gui/macosx/simple_prefs.m
+++ b/modules/gui/macosx/simple_prefs.m
@@ -1132,7 +1132,8 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
         NSFont * font = [NSFont fontWithDescriptor:[fd fontDescriptorWithFamily:fontFamilyName] textTransform:nil];
         [[NSFontManager sharedFontManager] setSelectedFont:font isMultiple:NO];
     }
-    [[NSFontManager sharedFontManager] setTarget:self];
+    [[NSFontManager sharedFontManager] setDelegate: self];
+    [o_sprefs_win makeFirstResponder: o_sprefs_win];
     [[NSFontPanel sharedFontPanel] orderFront:self];
 }
 
@@ -1319,3 +1320,16 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
 }
 
 @end
+
+ at implementation VLCSimplePrefsWindow
+
+- (BOOL)acceptsFirstResponder
+{
+    return YES;
+}
+
+- (void)changeFont:(id)sender
+{
+    [[[VLCMain sharedInstance] getSimplePreferences] changeFont: sender];
+}
+ at end




More information about the vlc-devel mailing list