Don't freak out when can't warp the pointer.
This commit is contained in:
parent
a1708637fc
commit
3ee2086f95
|
@ -276,9 +276,11 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
|
|||
{
|
||||
if( !justWarped )
|
||||
{
|
||||
KIPLATFORM::UI::WarpPointer( m_parentPanel, x + warpX, y + warpY );
|
||||
m_dragStartPoint += VECTOR2D( warpX, warpY );
|
||||
justWarped = true;
|
||||
if( KIPLATFORM::UI::WarpPointer( m_parentPanel, x + warpX, y + warpY ) )
|
||||
{
|
||||
m_dragStartPoint += VECTOR2D( warpX, warpY );
|
||||
justWarped = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
justWarped = false;
|
||||
|
@ -837,9 +839,13 @@ void WX_VIEW_CONTROLS::CenterOnCursor()
|
|||
|
||||
if( GetMousePosition( false ) != screenCenter )
|
||||
{
|
||||
m_view->SetCenter( GetCursorPosition() );
|
||||
m_dragStartPoint = screenCenter;
|
||||
KIPLATFORM::UI::WarpPointer( m_parentPanel, screenCenter.x, screenCenter.y );
|
||||
VECTOR2D newCenter = GetCursorPosition();
|
||||
|
||||
if( KIPLATFORM::UI::WarpPointer( m_parentPanel, screenCenter.x, screenCenter.y ) )
|
||||
{
|
||||
m_view->SetCenter( newCenter );
|
||||
m_dragStartPoint = screenCenter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -250,11 +250,12 @@ wxPoint KIPLATFORM::UI::GetMousePosition()
|
|||
#endif
|
||||
|
||||
|
||||
void KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
|
||||
bool KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
|
||||
{
|
||||
if( !wxGetEnv( wxT( "WAYLAND_DISPLAY" ), nullptr ) )
|
||||
{
|
||||
aWindow->WarpPointer( aX, aY );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -277,7 +278,13 @@ void KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
|
|||
|
||||
wxLogTrace( traceWayland, wxS( "Set warped from %d %d to %d %d" ), s_warped_from.x,
|
||||
s_warped_from.y, s_warped_to.x, s_warped_to.y );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxLogTrace( traceWayland, wxS( "*** Warp to %d %d failed ***" ), aX, aY );
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
|
@ -293,9 +300,13 @@ void KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
|
|||
gdk_window_set_cursor( win, blank_cursor );
|
||||
aWindow->WarpPointer( aX, aY );
|
||||
gdk_window_set_cursor( win, cur_cursor );
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -149,8 +149,9 @@ namespace KIPLATFORM
|
|||
* @param aWindow Window in which to position to mouse cursor
|
||||
* @param aX destination x position
|
||||
* @param aY destination y position
|
||||
* @return true if the warp was successful
|
||||
*/
|
||||
void WarpPointer( wxWindow* aWindow, int aX, int aY );
|
||||
bool WarpPointer( wxWindow* aWindow, int aX, int aY );
|
||||
|
||||
/**
|
||||
* Configures the IME mode of a given control handle
|
||||
|
|
|
@ -164,9 +164,10 @@ wxPoint KIPLATFORM::UI::GetMousePosition()
|
|||
}
|
||||
|
||||
|
||||
void KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
|
||||
bool KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
|
||||
{
|
||||
aWindow->WarpPointer( aX, aY );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -172,9 +172,10 @@ wxPoint KIPLATFORM::UI::GetMousePosition()
|
|||
}
|
||||
|
||||
|
||||
void KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
|
||||
bool KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
|
||||
{
|
||||
aWindow->WarpPointer( aX, aY );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue