From fdb176b9e980e63ac34b74c422580fbd8cc03108 Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 26 Jul 2012 08:24:40 +0100 Subject: [PATCH] Windows drag-and-drop fix. OSX 10.5 build fix. --- modules/juce_core/native/juce_mac_Files.mm | 8 ++++---- .../native/juce_mac_NSViewComponentPeer.mm | 18 ++++++++++-------- .../native/juce_win32_Windowing.cpp | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/modules/juce_core/native/juce_mac_Files.mm b/modules/juce_core/native/juce_mac_Files.mm index c7bb9bbc48..512665a9c7 100644 --- a/modules/juce_core/native/juce_mac_Files.mm +++ b/modules/juce_core/native/juce_mac_Files.mm @@ -274,7 +274,7 @@ String File::getVersion() const //============================================================================== File File::getLinkedTarget() const { - #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) + #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) NSString* dest = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (getFullPathName()) error: nil]; #else @@ -428,12 +428,12 @@ bool Process::openDocument (const String& fileName, const String& parameters) void File::revealToUser() const { - #if ! JUCE_IOS + #if ! JUCE_IOS if (exists()) [[NSWorkspace sharedWorkspace] selectFile: juceStringToNS (getFullPathName()) inFileViewerRootedAtPath: nsEmptyString()]; else if (getParentDirectory().exists()) getParentDirectory().revealToUser(); - #endif + #endif } //============================================================================== @@ -441,7 +441,7 @@ OSType File::getMacOSType() const { JUCE_AUTORELEASEPOOL - #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) + #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (getFullPathName()) error: nil]; #else // (the cast here avoids a deprecation warning) diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index b012254472..b69b2570f2 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -236,7 +236,7 @@ public: { r = [[view superview] convertRect: r toView: nil]; - #if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_7 + #if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 r = [window convertRectToScreen: r]; #else r.origin = [window convertBaseToScreen: r.origin]; @@ -280,7 +280,7 @@ public: } else { - #if defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5 + #if defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 [view setAlphaValue: (CGFloat) newAlpha]; #else if ([view respondsToSelector: @selector (setAlphaValue:)]) @@ -504,16 +504,18 @@ public: void redirectMouseMove (NSEvent* ev) { + #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 if ([NSWindow windowNumberAtPoint: [[ev window] convertBaseToScreen: [ev locationInWindow]] - belowWindowWithWindowNumber: 0] == [window windowNumber]) + belowWindowWithWindowNumber: 0] != [window windowNumber]) { - currentModifiers = currentModifiers.withoutMouseButtons(); - sendMouseEvent (ev); - showArrowCursorIfNeeded(); + [[NSCursor arrowCursor] set]; } else + #endif { - [[NSCursor arrowCursor] set]; + currentModifiers = currentModifiers.withoutMouseButtons(); + sendMouseEvent (ev); + showArrowCursorIfNeeded(); } } @@ -804,7 +806,7 @@ public: Rectangle original (convertToRectInt (current)); const Rectangle screenBounds (Desktop::getInstance().getDisplays().getTotalBounds (true)); - #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_6 + #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 if ([window inLiveResize]) #else if ([window respondsToSelector: @selector (inLiveResize)] diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index 824f10442b..e497e6b413 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -1239,7 +1239,7 @@ private: void createWindow() { - DWORD exstyle = WS_EX_ACCEPTFILES; + DWORD exstyle = 0; DWORD type = WS_CLIPSIBLINGS | WS_CLIPCHILDREN; if (hasTitleBar())