fix close window notif and unused vars (#10)
It wasn't detecting that the window was closed when I closed it by clicking the red X button. As a result, the window would close, but mfb_update() didn't return -1, so the program kept running. This was fixed by listening to the willClose event and using it to set a flag. I'm not sure if this is the best way to do it, I really know nothing about OSX/Cocoa. Also, I fixed a few unused varible warnings. And warnings related to NSUInteger not matching the expected signature with NSWindowStyleMask.
This commit is contained in:
committed by
Daniel Collin
parent
b0f1590fc5
commit
a5e8dd4e2e
@@ -2,14 +2,14 @@
|
||||
#include "OSXWindow.h"
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <unistd.h>
|
||||
#include <MiniFB.h>
|
||||
#include "MiniFB.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void* g_updateBuffer = 0;
|
||||
int g_width = 0;
|
||||
int g_height = 0;
|
||||
static NSWindow* window_;
|
||||
static OSXWindow* window_;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -83,6 +83,9 @@ static int updateEvents()
|
||||
}
|
||||
[pool release];
|
||||
|
||||
if (window_->closed)
|
||||
state = -1;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user