Last active
August 29, 2015 14:01
-
-
Save mantognini/1e3cc79ace4cfa93bd85 to your computer and use it in GitHub Desktop.
Fix OS X request focus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/SFML/Window/OSX/SFViewController.mm b/src/SFML/Window/OSX/SFViewController.mm | |
index 56c1b89..ee7f7eb 100644 | |
--- a/src/SFML/Window/OSX/SFViewController.mm | |
+++ b/src/SFML/Window/OSX/SFViewController.mm | |
@@ -192,6 +192,9 @@ | |
// The user has to make sure events are forwarded to the view | |
// with the usual responder chain. | |
[[m_view window] makeKeyAndOrderFront:nil]; | |
+ | |
+ // In case the app is not active, make it's dock icon bounce for one sec | |
+ [NSApp requestUserAttention:NSInformationalRequest]; | |
} | |
diff --git a/src/SFML/Window/OSX/SFWindowController.mm b/src/SFML/Window/OSX/SFWindowController.mm | |
index 3b8f4b2..a28282b 100644 | |
--- a/src/SFML/Window/OSX/SFWindowController.mm | |
+++ b/src/SFML/Window/OSX/SFWindowController.mm | |
@@ -453,6 +453,9 @@ | |
-(void)requestFocus | |
{ | |
[m_window makeKeyAndOrderFront:nil]; | |
+ | |
+ // In case the app is not active, make it's dock icon bounce for one sec | |
+ [NSApp requestUserAttention:NSInformationalRequest]; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment