Fixed following mouse cursor when keyboard is shown

This commit is contained in:
Sergii Pylypenko
2014-12-26 23:24:22 +02:00
parent 934f3981a9
commit 50a6d7e253
7 changed files with 128 additions and 78 deletions

View File

@@ -353,23 +353,21 @@ public class MainActivity extends Activity
DimSystemStatusBar.get().dim(_videoLayout);
DimSystemStatusBar.get().dim(mGLView);
if( Globals.ScreenFollowsMouse )
Rect r = new Rect();
_videoLayout.getWindowVisibleDisplayFrame(r);
mGLView.nativeScreenVisibleRect(r.left, r.top, r.right, r.bottom);
_videoLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
{
Rect r = new Rect();
_videoLayout.getWindowVisibleDisplayFrame(r);
mGLView.nativeScreenVisibleRect(r.left, r.top, r.right, r.bottom);
_videoLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
public void onGlobalLayout()
{
public void onGlobalLayout()
{
Rect r = new Rect();
_videoLayout.getWindowVisibleDisplayFrame(r);
int heightDiff = _videoLayout.getRootView().getHeight() - _videoLayout.getHeight(); // Take system bar into consideration
mGLView.nativeScreenVisibleRect(r.left, r.top + heightDiff, r.width(), r.height());
Log.v("SDL", "Main window visible region changed: " + r.left + ":" + r.top + ":" + r.width() + ":" + r.height() );
}
});
}
Rect r = new Rect();
_videoLayout.getWindowVisibleDisplayFrame(r);
int heightDiff = _videoLayout.getRootView().getHeight() - _videoLayout.getHeight(); // Take system bar into consideration
int widthDiff = _videoLayout.getRootView().getWidth() - _videoLayout.getWidth(); // Nexus 5 has system bar at the right side
mGLView.nativeScreenVisibleRect(r.left + widthDiff, r.top + heightDiff, r.width(), r.height());
Log.v("SDL", "Main window visible region changed: " + r.left + ":" + r.top + ":" + r.width() + ":" + r.height() );
}
});
}
@Override

View File

@@ -527,7 +527,8 @@ class Settings
Globals.RightMouseButtonLongPress ? 1 : 0,
Globals.MoveMouseWithGyroscope ? 1 : 0,
Globals.MoveMouseWithGyroscopeSpeed,
Globals.CompatibilityHacksForceScreenUpdateMouseClick ? 1 : 0 );
Globals.CompatibilityHacksForceScreenUpdateMouseClick ? 1 : 0,
Globals.ScreenFollowsMouse ? 1 : 0 );
}
static void Apply(MainActivity p)
@@ -863,7 +864,7 @@ class Settings
int relativeMovementAccel, int showMouseCursor,
int HoverJitterFilter, int RightMouseButtonLongPress,
int MoveMouseWithGyroscope, int MoveMouseWithGyroscopeSpeed,
int ForceScreenUpdateMouseClick);
int ForceScreenUpdateMouseClick, int ScreenFollowsMouse);
private static native void nativeSetJoystickUsed(int amount);
private static native void nativeSetAccelerometerUsed();
private static native void nativeSetMultitouchUsed();