Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return iOS Insets in logical pixels #6225

Merged
merged 1 commit into from Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -551,18 +551,11 @@ protected void updateSafeInsets() {
safeInsetBottom = 0;

if (Foundation.getMajorSystemVersion() >= 11) {
UIView view = UIApplication.getSharedApplication().getKeyWindow().getRootViewController().getView();
UIEdgeInsets edgeInsets = view.getSafeAreaInsets();

double top = edgeInsets.getTop() * view.getContentScaleFactor();
double bottom = edgeInsets.getBottom() * view.getContentScaleFactor();
double left = edgeInsets.getLeft() * view.getContentScaleFactor();
double right = edgeInsets.getRight() * view.getContentScaleFactor();

safeInsetTop = (int) top;
safeInsetLeft = (int) left;
safeInsetRight = (int) right;
safeInsetBottom = (int) bottom;
UIEdgeInsets edgeInsets = viewController.getView().getSafeAreaInsets();
safeInsetTop = (int) edgeInsets.getTop();
safeInsetLeft = (int) edgeInsets.getLeft();
safeInsetRight = (int) edgeInsets.getRight();
safeInsetBottom = (int) edgeInsets.getBottom();
}
}

Expand Down
8 changes: 4 additions & 4 deletions gdx/src/com/badlogic/gdx/Graphics.java
Expand Up @@ -154,22 +154,22 @@ public String toString () {
public int getBackBufferHeight ();

/**
* @return the inset from the left which avoids display cutouts in pixels
* @return the inset from the left which avoids display cutouts in logical pixels
*/
int getSafeInsetLeft();

/**
* @return the inset from the top which avoids display cutouts in pixels
* @return the inset from the top which avoids display cutouts in logical pixels
*/
int getSafeInsetTop();

/**
* @return the inset from the bottom which avoids display cutouts or floating gesture bars, in pixels
* @return the inset from the bottom which avoids display cutouts or floating gesture bars, in logical pixels
*/
int getSafeInsetBottom();

/**
* @return the inset from the right which avoids display cutouts in pixels
* @return the inset from the right which avoids display cutouts in logical pixels
*/
int getSafeInsetRight();

Expand Down