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:
Alex Szpakowski
2015-06-07 19:40:46 -03:00
parent 6ef6f85d0c
commit cf73aa0107
7 changed files with 67 additions and 2 deletions
+5
View File
@@ -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
View File
@@ -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