Skip to content

Commit 3adb3cf

Browse files
committed
macaroniOS thing ig ion
1 parent db10749 commit 3adb3cf

2 files changed

Lines changed: 28 additions & 10 deletions

File tree

‎project/lib/sdl/src/video/cocoa/SDL_cocoawindow.m‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,11 @@ - (void)windowDidMiniaturize:(NSNotification *)aNotification
12981298
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
12991299
}
13001300

1301+
- (void)windowWillDeminiaturize:(NSNotification *)aNotification
1302+
{
1303+
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
1304+
}
1305+
13011306
- (void)windowDidDeminiaturize:(NSNotification *)aNotification
13021307
{
13031308
// Always send restored before maximized.
@@ -1307,6 +1312,8 @@ - (void)windowDidDeminiaturize:(NSNotification *)aNotification
13071312
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
13081313
}
13091314

1315+
SDL_SendWindowEvent(_data.window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
1316+
13101317
if ([self windowOperationIsPending:PENDING_OPERATION_ENTER_FULLSCREEN]) {
13111318
SDL_UpdateFullscreenMode(_data.window, true, true);
13121319
}

‎project/src/app/Application.cpp‎

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -949,17 +949,28 @@ namespace lime
949949
#if defined(HX_WINDOWS) || defined(HX_MACOS)
950950
bool Application::HandleEventWatcher(void *userdata, SDL_Event *event)
951951
{
952-
if (!background)
952+
if (!background && event->type == SDL_EVENT_WINDOW_EXPOSED)
953953
{
954-
switch (event->type)
955-
{
956-
case SDL_EVENT_WINDOW_EXPOSED:
957-
case SDL_EVENT_WINDOW_RESIZED:
958-
currentApplication->ProcessWindowEvent(event);
959-
currentApplication->RenderFrame();
960-
currentApplication->FramePacer();
961-
return false;
962-
}
954+
WindowEvent windowResizeEvent;
955+
windowResizeEvent.type = WINDOW_RESIZE;
956+
#ifndef IPHONE
957+
SDL_GetWindowSize(SDL_GetWindowFromID(event->window.windowID), &windowResizeEvent.width, &windowResizeEvent.height);
958+
#else
959+
SDL_GetWindowSizeInPixels(SDL_GetWindowFromID(event->window.windowID), &windowResizeEvent.width, &windowResizeEvent.height);
960+
#endif
961+
windowResizeEvent.windowID = event->window.windowID;
962+
WindowEvent::Dispatch(&windowResizeEvent);
963+
964+
WindowEvent windowExposeEvent;
965+
windowExposeEvent.type = WINDOW_EXPOSE;
966+
windowExposeEvent.windowID = event->window.windowID;
967+
WindowEvent::Dispatch(&windowExposeEvent);
968+
969+
currentApplication->RenderFrame();
970+
971+
currentApplication->FramePacer();
972+
973+
return false;
963974
}
964975

965976
return true;

0 commit comments

Comments
 (0)