mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Added OS X impl of requestFocus and hasFocus
Signed-off-by: Foaly <foaly.f@web.de> Signed-off-by: Jan Haller <bromeon@gmail.com>
This commit is contained in:
parent
b965ad198b
commit
85291debb4
@ -187,6 +187,28 @@
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(BOOL)requestFocus
|
||||
{
|
||||
// Note: this doesn't imply that the view will get any event.
|
||||
// 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 its dock icon bounce for one sec
|
||||
[NSApp requestUserAttention:NSInformationalRequest];
|
||||
|
||||
return [self hasFocus];
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
-(BOOL)hasFocus
|
||||
{
|
||||
return [NSApp keyWindow] == [m_view window];
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)enableKeyRepeat
|
||||
{
|
||||
|
@ -451,6 +451,25 @@
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(BOOL)requestFocus
|
||||
{
|
||||
[m_window makeKeyAndOrderFront:nil];
|
||||
|
||||
// In case the app is not active, make its dock icon bounce for one sec
|
||||
[NSApp requestUserAttention:NSInformationalRequest];
|
||||
|
||||
return [self hasFocus];
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
-(BOOL)hasFocus
|
||||
{
|
||||
return [NSApp keyWindow] == m_window;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)enableKeyRepeat
|
||||
{
|
||||
|
@ -166,6 +166,23 @@ namespace sf {
|
||||
////////////////////////////////////////////////////////////
|
||||
-(void)closeWindow;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Request the current window to be made the active
|
||||
/// foreground window
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
-(BOOL)requestFocus;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Determine whether the window has the input focus
|
||||
///
|
||||
/// \return True if window has focus, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
-(BOOL)hasFocus;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable key repeat
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user