From: Stefan Csomor <csomor@advancedconcepts.ch>
Date: Sat, 5 Jun 2004 16:20:27 +0000 (+0000)
Subject: fixing the carbon cfm
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e996f5094268521b3cfd078790a1ab5f022939d1

fixing the carbon cfm


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27650 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp
index 2bb2a42402..c5c4267f2e 100644
--- a/src/common/filefn.cpp
+++ b/src/common/filefn.cpp
@@ -923,9 +923,28 @@ wxString wxMacFSSpec2MacFilename( const FSSpec *spec )
     Str255    theParentPath = "\p";
     FSSpec      theParentSpec;
     FSRef       theParentRef;
+    FSRef       theRef ;
     char        theFileName[FILENAME_MAX];
     char        thePath[FILENAME_MAX];
 
+    // we loose the long filename by merely copying the spec->name
+    // so try the built-ins, which only work if the file exists, but still...
+    
+    theErr = FSpMakeFSRef(spec, &theRef);
+    if ( theErr == noErr )
+    {
+    	CFURLRef fullURLRef;
+        fullURLRef = ::CFURLCreateFromFSRef(NULL, &theRef);
+#ifdef __UNIX__
+    	CFURLPathStyle pathstyle = kCFURLPOSIXPathStyle;
+#else
+    	CFURLPathStyle pathstyle = kCFURLHFSPathStyle;
+#endif
+    	CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, pathstyle);
+    	::CFRelease( fullURLRef ) ;
+    	return wxMacCFStringHolder(cfString).AsString(wxFont::GetDefaultEncoding());
+    }
+
     strcpy(thePath, "");
 
     // GD: Separate file name from path and make a FSRef to the parent
diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp
index c2f1be7ea1..258c28bcf1 100644
--- a/src/mac/carbon/utils.cpp
+++ b/src/mac/carbon/utils.cpp
@@ -1307,9 +1307,13 @@ OSStatus wxMacControl::SetData(ControlPartCode inPartCode , ResType inTag , Size
 
 OSStatus wxMacControl::SendEvent(  EventRef event , OptionBits inOptions ) 
 {
+#if TARGET_API_MAC_OSX
     return SendEventToEventTargetWithOptions( event, 
-        HIObjectGetEventTarget( (HIObjectRef) m_controlRef ),
-	        inOptions );        
+        HIObjectGetEventTarget(  (HIObjectRef) m_controlRef ), inOptions );        
+#else
+    #pragma unused(inOptions) 
+    return SendEventToEventTarget(event,GetControlEventTarget( m_controlRef ) ) ;
+#endif
 }
 
 OSStatus wxMacControl::SendHICommand( HICommand &command , OptionBits inOptions )