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