From 101d78d160156625722f582a6604ae4cf5218663 Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Sat, 11 Apr 2015 11:42:40 -0700 Subject: [PATCH] Assure we use only landscape dimensions --- .../org/deadc0de/apple2ix/Apple2Activity.java | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Android/app/src/main/java/org/deadc0de/apple2ix/Apple2Activity.java b/Android/app/src/main/java/org/deadc0de/apple2ix/Apple2Activity.java index 41332d12..8ce8ed39 100644 --- a/Android/app/src/main/java/org/deadc0de/apple2ix/Apple2Activity.java +++ b/Android/app/src/main/java/org/deadc0de/apple2ix/Apple2Activity.java @@ -166,6 +166,13 @@ public class Apple2Activity extends Activity { Rect rect = new Rect(); mView.getWindowVisibleDisplayFrame(rect); int h = rect.height(); + int w = rect.width(); + if (w < h) { + // assure landscape dimensions + final int w_ = w; + w = h; + h = w_; + } if (mView.getHeight() - h > SOFTKEYBOARD_THRESHOLD) { Log.d(TAG, "Soft keyboard appears to be occupying screen real estate ..."); Apple2Activity.this.mSoftKeyboardShowing = true; @@ -173,7 +180,7 @@ public class Apple2Activity extends Activity { Log.d(TAG, "Soft keyboard appears to be gone ..."); Apple2Activity.this.mSoftKeyboardShowing = false; } - nativeGraphicsChanged(rect.width(), h); + nativeGraphicsChanged(w, h); } }); @@ -404,10 +411,18 @@ public class Apple2Activity extends Activity { } } - public void graphicsInitialized(int width, int height) { - mWidth = width; - mHeight = height; - nativeGraphicsInitialized(width, height); + public void graphicsInitialized(int w, int h) { + if (w < h) { + // assure landscape dimensions + final int w_ = w; + w = h; + h = w_; + } + + mWidth = w; + mHeight = h; + + nativeGraphicsInitialized(w, h); } public Apple2View getView() {