mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Added love.window.requestAttention. Bounces the dock icon in OS X and flashes the taskbar icon in Windows when called, if the program isn't in focus.
This commit is contained in:
@@ -50,6 +50,11 @@ std::string checkDropEvents();
|
||||
**/
|
||||
std::string getExecutablePath();
|
||||
|
||||
/**
|
||||
* Bounce the dock icon, if the app isn't in the foreground.
|
||||
**/
|
||||
void requestAttention(bool continuous);
|
||||
|
||||
} // osx
|
||||
} // love
|
||||
|
||||
|
||||
+13
-1
@@ -23,6 +23,7 @@
|
||||
#ifdef LOVE_MACOSX
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
@@ -41,7 +42,7 @@ std::string getLoveInResources()
|
||||
NSString *lovepath = [[NSBundle mainBundle] pathForResource:nil ofType:@"love"];
|
||||
|
||||
if (lovepath != nil)
|
||||
path = [lovepath UTF8String];
|
||||
path = lovepath.UTF8String;
|
||||
}
|
||||
|
||||
return path;
|
||||
@@ -77,6 +78,17 @@ std::string getExecutablePath()
|
||||
}
|
||||
}
|
||||
|
||||
void requestAttention(bool continuous)
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
if (continuous)
|
||||
[NSApp requestUserAttention:NSCriticalRequest];
|
||||
else
|
||||
[NSApp requestUserAttention:NSInformationalRequest];
|
||||
}
|
||||
}
|
||||
|
||||
} // osx
|
||||
} // love
|
||||
|
||||
|
||||
Reference in New Issue
Block a user