diff --git a/backends/imgui_impl_metal4.mm b/backends/imgui_impl_metal4.mm index 2f9a53bdb..b811e3d19 100644 --- a/backends/imgui_impl_metal4.mm +++ b/backends/imgui_impl_metal4.mm @@ -139,7 +139,7 @@ void ImGui_ImplMetal4_NewFrame(MTL4RenderPassDescriptor* renderPassDescriptor, i { ImGui_ImplMetal4_Data* bd = ImGui_ImplMetal4_GetBackendData(); IM_ASSERT(bd != nil && "Context or backend not initialized! Did you call ImGui_ImplMetal4_Init()?"); - IM_ASSERT(frameInFlightIndex < bd->SharedMetalContext.framesInFlight && "frameInFlightIndex out of range! See framesInFlight passed to ImGui_ImplMetal4_Init()."); + IM_ASSERT(frameInFlightIndex < (int)bd->SharedMetalContext.framesInFlight && "frameInFlightIndex out of range! See framesInFlight passed to ImGui_ImplMetal4_Init()."); #ifdef IMGUI_IMPL_METAL_CPP bd->SharedMetalContext.framebufferDescriptor = [[[FramebufferDescriptor alloc] initWithRenderPassDescriptor:renderPassDescriptor]autorelease]; #else @@ -479,7 +479,7 @@ bool ImGui_ImplMetal4_Init(id device, id commandQue bd->SharedMetalContext.commandQueue = commandQueue; bd->SharedMetalContext.framesInFlight = (NSUInteger)framesInFlight; NSMutableArray*>* bufferCaches = [NSMutableArray array]; - for (NSUInteger i = 0; i < framesInFlight; i++) + for (NSUInteger i = 0; i < (NSUInteger)framesInFlight; i++) [bufferCaches addObject:[NSMutableArray array]]; bd->SharedMetalContext.bufferCaches = bufferCaches; return true; diff --git a/examples/example_apple_metal/main.mm b/examples/example_apple_metal/main.mm index 34811ac4f..cb27f3330 100644 --- a/examples/example_apple_metal/main.mm +++ b/examples/example_apple_metal/main.mm @@ -111,7 +111,6 @@ #if TARGET_OS_OSX ImGui_ImplOSX_Init(self.view); - [NSApp activateIgnoringOtherApps:YES]; #endif } @@ -285,6 +284,8 @@ [appMenuItem setSubmenu:appMenu]; [mainMenuBar addItem:appMenuItem]; [NSApp setMainMenu:mainMenuBar]; + + [NSApp activateIgnoringOtherApps:YES]; } -(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender @@ -349,7 +350,6 @@ int main(int, const char**) AppDelegate *appDelegate = [[AppDelegate alloc] init]; // creates window [NSApp setDelegate:appDelegate]; - [NSApp activateIgnoringOtherApps:YES]; [NSApp run]; } return 0; diff --git a/examples/example_apple_metal4/main.mm b/examples/example_apple_metal4/main.mm index 5e2d4772b..40fbbe764 100644 --- a/examples/example_apple_metal4/main.mm +++ b/examples/example_apple_metal4/main.mm @@ -117,7 +117,6 @@ #if TARGET_OS_OSX ImGui_ImplOSX_Init(self.view); - [NSApp activateIgnoringOtherApps:YES]; #endif } @@ -301,6 +300,8 @@ [appMenuItem setSubmenu:appMenu]; [mainMenuBar addItem:appMenuItem]; [NSApp setMainMenu:mainMenuBar]; + + [NSApp activateIgnoringOtherApps:YES]; } -(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender @@ -365,7 +366,6 @@ int main(int, const char**) AppDelegate *appDelegate = [[AppDelegate alloc] init]; // creates window [NSApp setDelegate:appDelegate]; - [NSApp activateIgnoringOtherApps:YES]; [NSApp run]; } return 0; diff --git a/examples/example_apple_opengl2/main.mm b/examples/example_apple_opengl2/main.mm index e0438d9c9..94e03c6d4 100644 --- a/examples/example_apple_opengl2/main.mm +++ b/examples/example_apple_opengl2/main.mm @@ -209,10 +209,6 @@ -(void)applicationDidFinishLaunching:(NSNotification *)aNotification { - // Make the application a foreground application (else it won't receive keyboard events) - ProcessSerialNumber psn = {0, kCurrentProcess}; - TransformProcessType(&psn, kProcessTransformToForegroundApplication); - // Menu [self setupMenu]; @@ -236,6 +232,8 @@ NSLog(@"No OpenGL Context!"); [view initialize]; + + [NSApp activateIgnoringOtherApps:YES]; } @end @@ -244,14 +242,17 @@ // Application main() function //----------------------------------------------------------------------------------- -int main(int argc, const char* argv[]) +int main(int, const char**) { @autoreleasepool { - NSApp = [NSApplication sharedApplication]; - AppDelegate* delegate = [[AppDelegate alloc] init]; - [[NSApplication sharedApplication] setDelegate:delegate]; + [NSApplication sharedApplication]; + [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; + + AppDelegate* appDelegate = [[AppDelegate alloc] init]; + [NSApp setDelegate:appDelegate]; + [NSApp run]; } - return NSApplicationMain(argc, argv); + return 0; } diff --git a/examples/example_apple_opengl3/main.mm b/examples/example_apple_opengl3/main.mm index ffb344343..77c95a90e 100644 --- a/examples/example_apple_opengl3/main.mm +++ b/examples/example_apple_opengl3/main.mm @@ -209,10 +209,6 @@ -(void)applicationDidFinishLaunching:(NSNotification *)aNotification { - // Make the application a foreground application (else it won't receive keyboard events) - ProcessSerialNumber psn = {0, kCurrentProcess}; - TransformProcessType(&psn, kProcessTransformToForegroundApplication); - // Menu [self setupMenu]; @@ -237,6 +233,8 @@ NSLog(@"No OpenGL Context!"); [view initialize]; + + [NSApp activateIgnoringOtherApps:YES]; } @end @@ -245,14 +243,17 @@ // Application main() function //----------------------------------------------------------------------------------- -int main(int argc, const char* argv[]) +int main(int, const char**) { @autoreleasepool { - NSApp = [NSApplication sharedApplication]; - AppDelegate* delegate = [[AppDelegate alloc] init]; - [[NSApplication sharedApplication] setDelegate:delegate]; + [NSApplication sharedApplication]; + [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; + + AppDelegate* appDelegate = [[AppDelegate alloc] init]; + [NSApp setDelegate:appDelegate]; + [NSApp run]; } - return NSApplicationMain(argc, argv); + return 0; }