summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--new/button_darwin.m2
-rw-r--r--new/container_darwin.m2
-rw-r--r--new/init_darwin.m2
-rw-r--r--new/uipriv_darwin.h18
-rw-r--r--new/window_darwin.m4
5 files changed, 27 insertions, 1 deletions
diff --git a/new/button_darwin.m b/new/button_darwin.m
index 7daf209..87c4525 100644
--- a/new/button_darwin.m
+++ b/new/button_darwin.m
@@ -9,6 +9,8 @@
@implementation button
+uiLogObjCClassAllocations
+
- (IBAction)buttonClicked:(id)sender
{
(*(self.onClicked))(self.c, self.onClickedData);
diff --git a/new/container_darwin.m b/new/container_darwin.m
index d23eedf..f869f2c 100644
--- a/new/container_darwin.m
+++ b/new/container_darwin.m
@@ -10,6 +10,8 @@
// thanks to mikeash and JtRip in irc.freenode.net/#macdev
@implementation uiContainer
+uiLogObjCClassAllocations
+
- (void)setFrameSize:(NSSize)s
{
uiSizing d;
diff --git a/new/init_darwin.m b/new/init_darwin.m
index b251b47..d26c3fa 100644
--- a/new/init_darwin.m
+++ b/new/init_darwin.m
@@ -6,6 +6,8 @@
@implementation uiApplication
+uiLogObjCClassAllocations
+
// hey look! we're overriding terminate:!
// we're going to make sure we can go back to main() whether Cocoa likes it or not!
// and just how are we going to do that, hm?
diff --git a/new/uipriv_darwin.h b/new/uipriv_darwin.h
index dd3467a..e1b38af 100644
--- a/new/uipriv_darwin.h
+++ b/new/uipriv_darwin.h
@@ -11,6 +11,24 @@
struct uiSizing {
};
+#ifdef uiLogAllocations
+#import <stdio.h>
+#define uiLogObjCClassAllocations \
+- (id)init \
+{ \
+ self = [super init]; \
+ fprintf(stderr, "%p alloc %s\n", self, [[self className] UTF8String]); \
+ return self; \
+} \
+- (void)dealloc \
+{ \
+ [super dealloc]; \
+ fprintf(stderr, "%p free\n", self); \
+}
+#else
+#define uiLogObjCClassAllocations
+#endif
+
// util_darwin.m
extern void setStandardControlFont(NSControl *);
diff --git a/new/window_darwin.m b/new/window_darwin.m
index 8beb008..795c2e0 100644
--- a/new/window_darwin.m
+++ b/new/window_darwin.m
@@ -12,6 +12,8 @@
@implementation uiWindowDelegate
+uiLogObjCClassAllocations
+
// TODO will this *destroy* the window?
- (BOOL)windowShouldClose:(id)win
{
@@ -39,7 +41,7 @@ uiWindow *uiNewWindow(char *title, int width, int height)
{
uiWindow *w;
- w = (uiWindow *) uiAlloc(sizeof (uiWindow));
+ w = uiNew(uiWindow);
w->w = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, (CGFloat) width, (CGFloat) height)
styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)