mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Fixed OSX/ShowMouseCursor
This commit is contained in:
parent
32563cdc6f
commit
6c0535db45
@ -311,7 +311,8 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowImplDelegateRef myDelegate; ///< Implementation in Obj-C.
|
||||
WindowImplDelegateRef myDelegate; ///< Implementation in Obj-C.
|
||||
bool myShowCursor; ///< Is the cursor displayed or hidden ?
|
||||
};
|
||||
|
||||
} // namespace priv
|
||||
|
@ -44,6 +44,7 @@ namespace priv
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowImplCocoa::WindowImplCocoa(WindowHandle handle)
|
||||
: myShowCursor(true)
|
||||
{
|
||||
// Ask for a pool.
|
||||
RetainPool();
|
||||
@ -91,6 +92,7 @@ WindowImplCocoa::WindowImplCocoa(WindowHandle handle)
|
||||
WindowImplCocoa::WindowImplCocoa(VideoMode mode,
|
||||
const std::string& title,
|
||||
unsigned long style)
|
||||
: myShowCursor(true)
|
||||
{
|
||||
// Transform the app process.
|
||||
SetUpProcess();
|
||||
@ -183,6 +185,10 @@ void WindowImplCocoa::WindowResized(unsigned int width, unsigned int height)
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowImplCocoa::WindowLostFocus(void)
|
||||
{
|
||||
if (!myShowCursor) {
|
||||
[myDelegate showMouseCursor]; // Make sur the cursor is visible
|
||||
}
|
||||
|
||||
Event event;
|
||||
event.Type = Event::LostFocus;
|
||||
|
||||
@ -193,6 +199,10 @@ void WindowImplCocoa::WindowLostFocus(void)
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowImplCocoa::WindowGainedFocus(void)
|
||||
{
|
||||
if (!myShowCursor) {
|
||||
[myDelegate hideMouseCursor]; // Restore user's setting
|
||||
}
|
||||
|
||||
Event event;
|
||||
event.Type = Event::GainedFocus;
|
||||
|
||||
@ -255,6 +265,10 @@ void WindowImplCocoa::MouseWheelScrolledAt(float delta, int x, int y)
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowImplCocoa::MouseMovedIn(void)
|
||||
{
|
||||
if (!myShowCursor) {
|
||||
[myDelegate hideMouseCursor]; // Restore user's setting
|
||||
}
|
||||
|
||||
Event event;
|
||||
event.Type = Event::MouseEntered;
|
||||
|
||||
@ -264,6 +278,10 @@ void WindowImplCocoa::MouseMovedIn(void)
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowImplCocoa::MouseMovedOut(void)
|
||||
{
|
||||
if (!myShowCursor) {
|
||||
[myDelegate showMouseCursor]; // Make sur the cursor is visible
|
||||
}
|
||||
|
||||
Event event;
|
||||
event.Type = Event::MouseLeft;
|
||||
|
||||
@ -330,7 +348,9 @@ WindowHandle WindowImplCocoa::GetSystemHandle() const
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowImplCocoa::ShowMouseCursor(bool show)
|
||||
{
|
||||
if (show) {
|
||||
myShowCursor = show;
|
||||
|
||||
if (myShowCursor) {
|
||||
[myDelegate showMouseCursor];
|
||||
} else {
|
||||
[myDelegate hideMouseCursor];
|
||||
|
Loading…
Reference in New Issue
Block a user