Compare commits

..

No commits in common. "efcc176c0428a2fd8ce2a3f87ef5bb9ce4feabbf" and "31cc8e5a0d2660503cb1a98f6e0b0714d061f72a" have entirely different histories.

View file

@ -1,7 +1,5 @@
#ifndef USE_COCOA
#define USE_COCOA
#include <Foundation/NSGeometry.h>
#include <Foundation/NSObjCRuntime.h>
#endif
#import <AppKit/AppKit.h>
@ -43,7 +41,6 @@
@interface MilskoCocoa : NSObject {
NSApplication *application;
NSWindow *window;
NSRect rect;
}
+ (MilskoCocoa *)newWithParent:(MwLL)parent
@ -103,20 +100,22 @@
}
c->application = [NSApplication sharedApplication];
c->rect = NSMakeRect(x, y, width, height);
NSRect rect = NSMakeRect(x, y, width, height);
c->window = [[NSWindow alloc]
initWithContentRect:c->rect
c->window = [[[NSWindow alloc]
initWithContentRect:rect
styleMask:parent == NULL
? (NSTitledWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask |
NSResizableWindowMask)
: NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
defer:NO] autorelease];
[c->window makeKeyAndOrderFront:c->application];
if (parent != NULL) {
[c->window setBackgroundColor:[NSColor blueColor]];
MilskoCocoa *p = parent->cocoa.real;
[p->window addChildWindow:c->window ordered:NSWindowAbove];
}
@ -141,16 +140,13 @@
NSPoint p;
p.x = x;
p.y = y;
NSRect frame = [self->window frame];
frame.origin.x = x;
frame.origin.y = y;
[self->window setFrame: frame display: YES animate: true];
[self->window setFrameTopLeftPoint:p];
};
- (void)setW:(int)w H:(int)h {
NSRect frame = [self->window frame];
frame.size.width = w;
frame.size.height = h;
[self->window setFrame: frame display: YES animate: true];
NSSize s;
s.width = w;
s.height = h;
[self->window setFrameSize:s];
};
- (int)pending {
return 1;
@ -193,7 +189,7 @@
MaxY:(int)maxy {
};
- (void)makeBorderless:(int)toggle {
uint32_t mask = [self->window styleMask];
NSWindowStyleMask mask = self->window.styleMask;
if (mask & NSBorderlessWindowMask) {
mask ^= NSBorderlessWindowMask;
mask |= NSTitledWindowMask;
@ -201,10 +197,7 @@
mask |= NSBorderlessWindowMask;
mask ^= NSTitledWindowMask;
}
[self->window initWithContentRect:self->rect
styleMask:mask
backing:NSBackingStoreBuffered
defer:NO];
[self->window setStyleMask:mask];
};
- (void)focus {
[self->window makeMainWindow];
@ -224,12 +217,12 @@
point->x = p.x;
point->y = p.y;
};
- (void)getScreenSize:(MwRect *)_rect {
- (void)getScreenSize:(MwRect *)rect {
NSScreen *screen = [self->window screen];
_rect->x = [screen frame].origin.x;
_rect->y = [screen frame].origin.y;
_rect->width = [screen frame].size.width;
_rect->height = [screen frame].size.height;
rect->x = screen.frame.origin.x;
rect->y = screen.frame.origin.y;
rect->width = screen.frame.size.width;
rect->height = screen.frame.size.height;
};
- (void)destroy {
[self->window dealloc];