Mac fixes

* Removed resizing of window as that isn't supported
* Fixed issue that content view would be too small and top of window wouldn't be visible
* Removed some code that isn't needed

Bump lib version to 0.2.3
This commit is contained in:
Daniel Collin 2016-01-04 21:14:06 +01:00
parent 3f1b8e244a
commit d6cbb705c1
4 changed files with 5 additions and 61 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "minifb"
version = "0.2.2"
version = "0.2.3"
license = "MIT"
authors = ["Daniel Collin <daniel@collin.com>"]
description = "Cross-platform window setup for bitmap rendering"

View file

@ -18,9 +18,9 @@ void* mfb_open(const char* name, int width, int height, int scale)
s_init = true;
}
unsigned int styles = NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask;
unsigned int styles = NSClosableWindowMask | NSTitledWindowMask;
NSRect rectangle = NSMakeRect(0, 0, width * scale, (height * scale));
NSRect rectangle = NSMakeRect(0, 0, width * scale, height * scale);
OSXWindow* window = [[OSXWindow alloc] initWithContentRect:rectangle styleMask:styles backing:NSBackingStoreBuffered defer:NO];
if (!window)

View file

@ -5,38 +5,6 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)windowStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)deferCreation
{
self = [super
initWithContentRect:contentRect
styleMask:windowStyle
backing:bufferingType
defer:deferCreation];
if (self)
{
[self setOpaque:YES];
[self setBackgroundColor:[NSColor clearColor]];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(mainWindowChanged:)
name:NSWindowDidBecomeMainNotification
object:self];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(mainWindowChanged:)
name:NSWindowDidResignMainNotification
object:self];
}
return self;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)dealloc
{
[[NSNotificationCenter defaultCenter]
@ -142,9 +110,7 @@
- (void)setContentView:(NSView *)aView
{
if ([childContentView isEqualTo:aView])
{
return;
}
NSRect bounds = [self frame];
bounds.origin = NSZeroPoint;
@ -163,6 +129,8 @@
if (childContentView)
[childContentView removeFromSuperview];
NSRect t = [self contentRectForFrameRect:bounds];
childContentView = aView;
[childContentView setFrame:[self contentRectForFrameRect:bounds]];
[childContentView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
@ -200,13 +168,6 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ (NSRect)frameRectForContentRect:(NSRect)windowContentRect styleMask:(NSUInteger)windowStyle
{
return NSInsetRect(windowContentRect, 0, 0);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)updateSize
{
OSXWindowFrameView* frameView = [super contentView];

View file

@ -4,23 +4,6 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (NSRect)resizeRect
{
const CGFloat resizeBoxSize = 16.0;
const CGFloat contentViewPadding = 5.5;
NSRect contentViewRect = [[self window] contentRectForFrameRect:[[self window] frame]];
NSRect resizeRect = NSMakeRect(
NSMaxX(contentViewRect) + contentViewPadding,
NSMinY(contentViewRect) - resizeBoxSize - contentViewPadding,
resizeBoxSize,
resizeBoxSize);
return resizeRect;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)drawRect:(NSRect)rect
{
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];