|
@@ -502,7 +502,7 @@ namespace entry
|
|
|
return handle;
|
|
return handle;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
WindowHandle invalid = { UINT16_MAX };
|
|
WindowHandle invalid = { UINT16_MAX };
|
|
|
return invalid;
|
|
return invalid;
|
|
|
}
|
|
}
|
|
@@ -543,7 +543,7 @@ namespace entry
|
|
|
WindowHandle createWindow(int32_t _x, int32_t _y, uint32_t _width, uint32_t _height, uint32_t _flags, const char* _title)
|
|
WindowHandle createWindow(int32_t _x, int32_t _y, uint32_t _width, uint32_t _height, uint32_t _flags, const char* _title)
|
|
|
{
|
|
{
|
|
|
BX_UNUSED(_flags);
|
|
BX_UNUSED(_flags);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
bx::MutexScope scope(s_ctx.m_lock);
|
|
bx::MutexScope scope(s_ctx.m_lock);
|
|
|
WindowHandle handle = { s_ctx.m_windowAlloc.alloc() };
|
|
WindowHandle handle = { s_ctx.m_windowAlloc.alloc() };
|
|
|
|
|
|
|
@@ -562,9 +562,9 @@ namespace entry
|
|
|
[window setAcceptsMouseMovedEvents:YES];
|
|
[window setAcceptsMouseMovedEvents:YES];
|
|
|
[window setBackgroundColor:[NSColor blackColor]];
|
|
[window setBackgroundColor:[NSColor blackColor]];
|
|
|
[[Window sharedDelegate] windowCreated:window];
|
|
[[Window sharedDelegate] windowCreated:window];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
s_ctx.m_window[handle.idx] = window;
|
|
s_ctx.m_window[handle.idx] = window;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
s_ctx.m_eventQueue.postSizeEvent(handle, _width, _height);
|
|
s_ctx.m_eventQueue.postSizeEvent(handle, _width, _height);
|
|
|
s_ctx.m_eventQueue.postWindowEvent(handle, window);
|
|
s_ctx.m_eventQueue.postWindowEvent(handle, window);
|
|
|
};
|
|
};
|
|
@@ -597,7 +597,7 @@ namespace entry
|
|
|
{
|
|
{
|
|
|
[window close];
|
|
[window close];
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (0 == _handle.idx)
|
|
if (0 == _handle.idx)
|
|
|
{
|
|
{
|
|
|
[NSApp terminate:nil];
|
|
[NSApp terminate:nil];
|
|
@@ -609,7 +609,7 @@ namespace entry
|
|
|
s_ctx.m_windowAlloc.free(_handle.idx);
|
|
s_ctx.m_windowAlloc.free(_handle.idx);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
void destroyWindow(WindowHandle _handle)
|
|
void destroyWindow(WindowHandle _handle)
|
|
|
{
|
|
{
|
|
|
destroyWindow(_handle, true);
|
|
destroyWindow(_handle, true);
|
|
@@ -621,12 +621,12 @@ namespace entry
|
|
|
, ^{
|
|
, ^{
|
|
|
NSWindow* window = s_ctx.m_window[_handle.idx];
|
|
NSWindow* window = s_ctx.m_window[_handle.idx];
|
|
|
NSScreen* screen = [window screen];
|
|
NSScreen* screen = [window screen];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
NSRect screenRect = [screen frame];
|
|
NSRect screenRect = [screen frame];
|
|
|
CGFloat menuBarHeight = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
|
|
CGFloat menuBarHeight = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
NSPoint position = { float(_x), screenRect.size.height - menuBarHeight - float(_y) };
|
|
NSPoint position = { float(_x), screenRect.size.height - menuBarHeight - float(_y) };
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
[window setFrameTopLeftPoint: position];
|
|
[window setFrameTopLeftPoint: position];
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -659,16 +659,16 @@ namespace entry
|
|
|
{
|
|
{
|
|
|
dispatch_async(dispatch_get_main_queue()
|
|
dispatch_async(dispatch_get_main_queue()
|
|
|
, ^{
|
|
, ^{
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
NSWindow* window = s_ctx.m_window[_handle.idx];
|
|
NSWindow* window = s_ctx.m_window[_handle.idx];
|
|
|
NSScreen* screen = [window screen];
|
|
NSScreen* screen = [window screen];
|
|
|
NSRect screenRect = [screen frame];
|
|
NSRect screenRect = [screen frame];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (!s_ctx.m_fullscreen)
|
|
if (!s_ctx.m_fullscreen)
|
|
|
{
|
|
{
|
|
|
s_ctx.m_style &= ~NSWindowStyleMaskTitled;
|
|
s_ctx.m_style &= ~NSWindowStyleMaskTitled;
|
|
|
s_ctx.m_fullscreen = true;
|
|
s_ctx.m_fullscreen = true;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
[NSMenu setMenuBarVisible: false];
|
|
[NSMenu setMenuBarVisible: false];
|
|
|
[window setStyleMask: s_ctx.m_style];
|
|
[window setStyleMask: s_ctx.m_style];
|
|
|
[window setFrame:screenRect display:YES];
|
|
[window setFrame:screenRect display:YES];
|
|
@@ -677,7 +677,7 @@ namespace entry
|
|
|
{
|
|
{
|
|
|
s_ctx.m_style |= NSWindowStyleMaskTitled;
|
|
s_ctx.m_style |= NSWindowStyleMaskTitled;
|
|
|
s_ctx.m_fullscreen = false;
|
|
s_ctx.m_fullscreen = false;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
[NSMenu setMenuBarVisible: true];
|
|
[NSMenu setMenuBarVisible: true];
|
|
|
[window setStyleMask: s_ctx.m_style];
|
|
[window setStyleMask: s_ctx.m_style];
|
|
|
[window setFrame:s_ctx.m_windowFrame display:YES];
|
|
[window setFrame:s_ctx.m_windowFrame display:YES];
|
|
@@ -759,13 +759,14 @@ namespace entry
|
|
|
NSWindow *window = [notification object];
|
|
NSWindow *window = [notification object];
|
|
|
|
|
|
|
|
[window setDelegate:nil];
|
|
[window setDelegate:nil];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
destroyWindow(entry::s_ctx.findHandle(window), false);
|
|
destroyWindow(entry::s_ctx.findHandle(window), false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)windowShouldClose:(NSWindow*)window
|
|
- (BOOL)windowShouldClose:(NSWindow*)window
|
|
|
{
|
|
{
|
|
|
assert(window);
|
|
assert(window);
|
|
|
|
|
+ BX_UNUSED(window);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|