Browse Source

Updatesfor OSX 10.7 compatibility.

tags/2021-05-28
jules 14 years ago
parent
commit
fb9af90b61
4 changed files with 42 additions and 11 deletions
  1. +1
    -1
      modules/juce_audio_formats/codecs/flac/libFLAC/md5.c
  2. +8
    -3
      modules/juce_graphics/native/juce_mac_Fonts.mm
  3. +10
    -3
      modules/juce_gui_basics/native/juce_mac_FileChooser.mm
  4. +23
    -4
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm

+ 1
- 1
modules/juce_audio_formats/codecs/flac/libFLAC/md5.c View File

@@ -264,7 +264,7 @@ void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *ctx)
byteSwap(ctx->buf, 4); byteSwap(ctx->buf, 4);
memcpy(digest, ctx->buf, 16); memcpy(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
//memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
if(0 != ctx->internal_buf) { if(0 != ctx->internal_buf) {
free(ctx->internal_buf); free(ctx->internal_buf);
ctx->internal_buf = 0; ctx->internal_buf = 0;


+ 8
- 3
modules/juce_graphics/native/juce_mac_Fonts.mm View File

@@ -121,9 +121,14 @@ namespace CoreTextTypeLayout
CTParagraphStyleSetting settings[] = CTParagraphStyleSetting settings[] =
{ {
{ kCTParagraphStyleSpecifierAlignment, sizeof (CTTextAlignment), &ctTextAlignment },
{ kCTParagraphStyleSpecifierLineBreakMode, sizeof (CTLineBreakMode), &ctLineBreakMode },
{ kCTParagraphStyleSpecifierLineSpacing, sizeof (CGFloat), &ctLineSpacing }
{ kCTParagraphStyleSpecifierAlignment, sizeof (CTTextAlignment), &ctTextAlignment },
{ kCTParagraphStyleSpecifierLineBreakMode, sizeof (CTLineBreakMode), &ctLineBreakMode },
#if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
{ kCTParagraphStyleSpecifierLineSpacingAdjustment, sizeof (CGFloat), &ctLineSpacing }
#else
{ kCTParagraphStyleSpecifierLineSpacing, sizeof (CGFloat), &ctLineSpacing }
#endif
}; };
CTParagraphStyleRef ctParagraphStyleRef = CTParagraphStyleCreate (settings, numElementsInArray (settings)); CTParagraphStyleRef ctParagraphStyleRef = CTParagraphStyleCreate (settings, numElementsInArray (settings));


+ 10
- 3
modules/juce_gui_basics/native/juce_mac_FileChooser.mm View File

@@ -193,20 +193,27 @@ void FileChooser::showPlatformDialog (Array<File>& results,
filename = currentFileOrDirectory.getFileName(); filename = currentFileOrDirectory.getFileName();
} }
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
[panel setDirectoryURL: [NSURL fileURLWithPath: juceStringToNS (directory)]];
[panel setNameFieldStringValue: juceStringToNS (filename)];
if ([panel runModal] == NSOKButton)
#else
if ([panel runModalForDirectory: juceStringToNS (directory) if ([panel runModalForDirectory: juceStringToNS (directory)
file: juceStringToNS (filename)] == NSOKButton) file: juceStringToNS (filename)] == NSOKButton)
#endif
{ {
if (isSaveDialogue) if (isSaveDialogue)
{ {
results.add (File (nsStringToJuce ([panel filename])));
results.add (File (nsStringToJuce ([[panel URL] path])));
} }
else else
{ {
NSOpenPanel* openPanel = (NSOpenPanel*) panel; NSOpenPanel* openPanel = (NSOpenPanel*) panel;
NSArray* urls = [openPanel filenames];
NSArray* urls = [openPanel URLs];
for (unsigned int i = 0; i < [urls count]; ++i) for (unsigned int i = 0; i < [urls count]; ++i)
results.add (File (nsStringToJuce ([urls objectAtIndex: i])));
results.add (File (nsStringToJuce ([[urls objectAtIndex: i] path])));
} }
} }


+ 23
- 4
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -38,8 +38,14 @@ extern CheckEventBlockedByModalComps isEventBlockedByModalComps;
END_JUCE_NAMESPACE END_JUCE_NAMESPACE
@interface NSEvent (JuceDeviceDelta) @interface NSEvent (JuceDeviceDelta)
- (float) deviceDeltaX;
- (float) deviceDeltaY;
- (CGFloat) deviceDeltaX;
- (CGFloat) deviceDeltaY;
#if ! (defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)
- (CGFloat) scrollingDeltaX;
- (CGFloat) scrollingDeltaX;
- (BOOL) hasPreciseScrollingDeltas;
#endif
@end @end
#define JuceNSView MakeObjCClassName(JuceNSView) #define JuceNSView MakeObjCClassName(JuceNSView)
@@ -1560,8 +1566,21 @@ void NSViewComponentPeer::redirectMouseWheel (NSEvent* ev)
@try @try
{ {
x = [ev deviceDeltaX] * 0.5f;
y = [ev deviceDeltaY] * 0.5f;
#if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if ([ev respondsToSelector: @selector (hasPreciseScrollingDeltas)])
{
if ([ev hasPreciseScrollingDeltas])
{
x = [ev scrollingDeltaX] * 0.5f;
y = [ev scrollingDeltaY] * 0.5f;
}
}
else
#endif
{
x = [ev deviceDeltaX] * 0.5f;
y = [ev deviceDeltaY] * 0.5f;
}
} }
@catch (...) @catch (...)
{} {}


Loading…
Cancel
Save