Skip to content

Commit

Permalink
Support relative mouse for Samsung DeX on Samsung Experience 9.5 or l…
Browse files Browse the repository at this point in the history
…ater (Android 8.1 or later)
  • Loading branch information
slouken committed Sep 24, 2018
1 parent 5febdfc commit e0fe8f3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Expand Up @@ -766,9 +766,14 @@ public static boolean supportsRelativeMouse()
return false;
}

// Samsung DeX mode doesn't support relative mice properly under Android 7 APIs,
// and simply returns no data under Android 8 APIs.
if (isDeXMode()) {
// DeX mode in Samsung Experience 9.0 and earlier doesn't support relative mice properly under
// Android 7 APIs, and simply returns no data under Android 8 APIs.
//
// This is fixed in Samsung Experience 9.5, which corresponds to Android 8.1.0, and
// thus SDK version 27. If we are in DeX mode and not API 27 or higher, as a result,
// we should stick to relative mode.
//
if ((Build.VERSION.SDK_INT < 27) && isDeXMode()) {
return false;
}

Expand Down
Expand Up @@ -764,7 +764,7 @@ public boolean onGenericMotion(View v, MotionEvent event) {

@Override
public boolean supportsRelativeMouse() {
return !SDLActivity.isDeXMode();
return (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27));
}

@Override
Expand All @@ -774,7 +774,7 @@ public boolean inRelativeMode() {

@Override
public boolean setRelativeMouseEnabled(boolean enabled) {
if (!SDLActivity.isDeXMode()) {
if (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27)) {
if (enabled) {
SDLActivity.getContentView().requestPointerCapture();
}
Expand Down

0 comments on commit e0fe8f3

Please sign in to comment.