Changed Window::requestFocus() return type from bool to void
Reasons: * Consistent with other sf::Window methods * User can test whether focus succeeded by subsequent hasFocus() call * Implementation would have to call hasFocus() anyway on some systems Also: minor code style change in Window::hasFocus()
This commit is contained in:
parent
6a24eb5eec
commit
4155b2e449
@ -423,11 +423,10 @@ public:
|
||||
/// is free to deny the request.
|
||||
/// This is not to be confused with setActive().
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
/// \see hasFocus
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool requestFocus();
|
||||
void requestFocus();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check whether the window has the input focus
|
||||
|
@ -188,7 +188,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(BOOL)requestFocus
|
||||
-(void)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
|
||||
@ -197,8 +197,6 @@
|
||||
|
||||
// In case the app is not active, make its dock icon bounce for one sec
|
||||
[NSApp requestUserAttention:NSInformationalRequest];
|
||||
|
||||
return [self hasFocus];
|
||||
}
|
||||
|
||||
|
||||
|
@ -452,14 +452,12 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(BOOL)requestFocus
|
||||
-(void)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];
|
||||
}
|
||||
|
||||
|
||||
|
@ -324,10 +324,8 @@ public:
|
||||
/// \brief Request the current window to be made the active
|
||||
/// foreground window
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool requestFocus();
|
||||
virtual void requestFocus();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check whether the window has the input focus
|
||||
|
@ -553,9 +553,9 @@ void WindowImplCocoa::setKeyRepeatEnabled(bool enabled)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool WindowImplCocoa::requestFocus()
|
||||
void WindowImplCocoa::requestFocus()
|
||||
{
|
||||
return [m_delegate requestFocus];
|
||||
[m_delegate requestFocus];
|
||||
}
|
||||
|
||||
|
||||
|
@ -170,10 +170,8 @@ namespace sf {
|
||||
/// \brief Request the current window to be made the active
|
||||
/// foreground window
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
-(BOOL)requestFocus;
|
||||
-(void)requestFocus;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check whether the window has the input focus
|
||||
|
@ -484,11 +484,10 @@ void WindowImplX11::setKeyRepeatEnabled(bool enabled)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool WindowImplX11::requestFocus()
|
||||
void WindowImplX11::requestFocus()
|
||||
{
|
||||
XRaiseWindow(m_display, m_window);
|
||||
XSetInputFocus(m_display, m_window, RevertToPointerRoot, CurrentTime);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -158,10 +158,8 @@ public:
|
||||
/// \brief Request the current window to be made the active
|
||||
/// foreground window
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool requestFocus();
|
||||
virtual void requestFocus();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check whether the window has the input focus
|
||||
|
@ -367,9 +367,9 @@ void WindowImplWin32::setKeyRepeatEnabled(bool enabled)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool WindowImplWin32::requestFocus()
|
||||
void WindowImplWin32::requestFocus()
|
||||
{
|
||||
return SetForegroundWindow(m_handle);
|
||||
SetForegroundWindow(m_handle);
|
||||
}
|
||||
|
||||
|
||||
|
@ -157,10 +157,8 @@ public:
|
||||
/// \brief Request the current window to be made the active
|
||||
/// foreground window
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool requestFocus();
|
||||
virtual void requestFocus();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check whether the window has the input focus
|
||||
|
@ -337,20 +337,17 @@ bool Window::setActive(bool active) const
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Window::requestFocus()
|
||||
void Window::requestFocus()
|
||||
{
|
||||
if (m_impl)
|
||||
return m_impl->requestFocus();
|
||||
return false;
|
||||
m_impl->requestFocus();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Window::hasFocus() const
|
||||
{
|
||||
if (m_impl)
|
||||
return m_impl->hasFocus();
|
||||
return false;
|
||||
return m_impl && m_impl->hasFocus();
|
||||
}
|
||||
|
||||
|
||||
|
@ -198,10 +198,8 @@ public:
|
||||
/// \brief Request the current window to be made the active
|
||||
/// foreground window
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool requestFocus() = 0;
|
||||
virtual void requestFocus() = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check whether the window has the input focus
|
||||
|
Loading…
Reference in New Issue
Block a user