Mercurial > dwindows
comparison mac/dw.m @ 1904:2e456850e027
Minor fix for that last commit... code actually works now. ;)
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 01 Oct 2014 05:37:10 +0000 |
parents | b94b4ad26a05 |
children | 0d67f00866b7 |
comparison
equal
deleted
inserted
replaced
1903:b94b4ad26a05 | 1904:2e456850e027 |
---|---|
45 #define DW_LOCAL_POOL_IN NSAutoreleasePool *localpool = nil; \ | 45 #define DW_LOCAL_POOL_IN NSAutoreleasePool *localpool = nil; \ |
46 if(DWThread != (DWTID)-1 && pthread_self() != DWThread) \ | 46 if(DWThread != (DWTID)-1 && pthread_self() != DWThread) \ |
47 localpool = [[NSAutoreleasePool alloc] init]; | 47 localpool = [[NSAutoreleasePool alloc] init]; |
48 #define DW_LOCAL_POOL_OUT if(localpool) [localpool drain]; | 48 #define DW_LOCAL_POOL_OUT if(localpool) [localpool drain]; |
49 | 49 |
50 /* Handle deprecation of several response constants in 10.10... | 50 /* Handle deprecation of several constants in 10.10... |
51 * the replacements are not available in earlier versions. | 51 * the replacements are not available in earlier versions. |
52 */ | 52 */ |
53 #if defined(MAC_OS_X_VERSION_10_9) && ((defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9) || !defined(MAC_OS_X_VERSION_MAX_ALLOWED)) | 53 #if defined(MAC_OS_X_VERSION_10_9) && ((defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9) || !defined(MAC_OS_X_VERSION_MAX_ALLOWED)) |
54 #define DWModalResponseOK NSModalResponseOK | 54 #define DWModalResponseOK NSModalResponseOK |
55 #define DWModalResponseCancel NSModalResponseCancel | 55 #define DWModalResponseCancel NSModalResponseCancel |
8109 } | 8109 } |
8110 | 8110 |
8111 /* Handle deprecation of convertScreenToBase in 10.10 yet still supporting | 8111 /* Handle deprecation of convertScreenToBase in 10.10 yet still supporting |
8112 * 10.6 and earlier since convertRectFromScreen was introduced in 10.7. | 8112 * 10.6 and earlier since convertRectFromScreen was introduced in 10.7. |
8113 */ | 8113 */ |
8114 NSPoint _windowPointFromScreen(NSWindow *window, NSPoint p) | 8114 NSPoint _windowPointFromScreen(id window, NSPoint p) |
8115 { | 8115 { |
8116 SEL crfs = NSSelectorFromString(@"convertRectFromScreen"); | 8116 SEL crfs = NSSelectorFromString(@"convertRectFromScreen:"); |
8117 | 8117 |
8118 if([window respondsToSelector:crfs]) | 8118 if([window respondsToSelector:crfs]) |
8119 { | 8119 { |
8120 NSRect (* icrfs)(id, SEL, NSRect) = (NSRect (*)(id, SEL, NSRect))[window methodForSelector:crfs]; | 8120 NSRect (* icrfs)(id, SEL, NSRect) = (NSRect (*)(id, SEL, NSRect))[window methodForSelector:crfs]; |
8121 NSRect rect = icrfs(window, crfs, NSMakeRect(p.x, p.y, 1, 1)); | 8121 NSRect rect = icrfs(window, crfs, NSMakeRect(p.x, p.y, 1, 1)); |
8122 return rect.origin; | 8122 return rect.origin; |
8123 } | 8123 } |
8124 else | 8124 else |
8125 { | 8125 { |
8126 SEL cstb = NSSelectorFromString(@"convertScreenToBase"); | 8126 SEL cstb = NSSelectorFromString(@"convertScreenToBase:"); |
8127 | 8127 |
8128 if([window respondsToSelector:cstb]) | 8128 if([window respondsToSelector:cstb]) |
8129 { | 8129 { |
8130 NSPoint (* icstb)(id, SEL, NSPoint) = (NSPoint (*)(id, SEL, NSPoint))[window methodForSelector:cstb]; | 8130 NSPoint (* icstb)(id, SEL, NSPoint) = (NSPoint (*)(id, SEL, NSPoint))[window methodForSelector:cstb]; |
8131 return icstb(window, cstb, p); | 8131 return icstb(window, cstb, p); |