Browse code
chore: more cleanup, document some objc-level explorations
Ed Langley authored on 21/10/2019 03:56:17
Showing 2 changed files
Showing 2 changed files
... | ... |
@@ -1,12 +1,16 @@ |
1 | 1 |
#include <stdio.h> |
2 | 2 |
|
3 |
-#include <Foundation/NSException.h> |
|
3 |
+// #include <Foundation/NSException.h> |
|
4 | 4 |
#include <Foundation/NSGeometry.h> |
5 | 5 |
#include <AppKit/NSWindow.h> |
6 |
+ |
|
7 |
+#import <Cocoa/Cocoa.h> |
|
8 |
+ |
|
6 | 9 |
#define EXPORT __attribute__((visibility("default"))) |
7 | 10 |
|
8 |
-EXPORT void set_uncaught_exception_handler(NSUncaughtExceptionHandler * _Nullable handler) { |
|
9 |
- NSSetUncaughtExceptionHandler(handler);}; |
|
11 |
+// // misguided attempt to recover from cocoa exceptions |
|
12 |
+// EXPORT void set_uncaught_exception_handler(NSUncaughtExceptionHandler * _Nullable handler) { |
|
13 |
+// NSSetUncaughtExceptionHandler(handler);}; |
|
10 | 14 |
|
11 | 15 |
EXPORT void printRect(NSRect rect) { |
12 | 16 |
printf("Got a rect: (%f %f), (%f %f)\n", |
... | ... |
@@ -24,3 +28,16 @@ EXPORT id initWindow(NSWindow *window, NSRect *rect, char a, char b, Boolean c) |
24 | 28 |
EXPORT id initWithFrame(id thing, NSRect *rect) { |
25 | 29 |
printf("Got a rect: (%f %f), (%f %f)\n", rect->size.width, rect->size.height, rect->origin.x, rect->origin.y); |
26 | 30 |
return [thing initWithFrame: *rect];} |
31 |
+ |
|
32 |
+// one way to make this usable with performSelectorOnMainThread: |
|
33 |
+// @interface NSStackView (FWOARStackView) |
|
34 |
+// - (NSStackView *)addViewLeading:(NSView *)view; |
|
35 |
+// @end |
|
36 |
+ |
|
37 |
+// @implementation NSStackView (FWOARStackView) |
|
38 |
+// - (NSStackView *)addViewLeading:(NSView *)view { |
|
39 |
+// [self addView:view |
|
40 |
+// inGravity:NSStackViewGravityLeading]; |
|
41 |
+// return self; |
|
42 |
+// } |
|
43 |
+// @end |