Skip to content

Commit d311be8

Browse files
committed
Merge branch 'master' of https://github.com/pionere/devilutionX into android
2 parents 7e9e25b + 83b533c commit d311be8

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

Source/utils/display.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@ void SetVideoMode(int width, int height, int bpp, uint32_t flags)
8282
sdl_error(ERR_SDL_DISPLAY_MODE_SET);
8383
}
8484
#if DEBUG_MODE
85-
const SDL_VideoInfo* current = SDL_GetVideoInfo();
86-
DoLog("Video mode is now %dx%d bpp=%d flags=0x%08X",
87-
current->current_w, current->current_h, current->vfmt->BitsPerPixel, SDL_GetVideoSurface()->flags);
85+
const SDL_Surface *surface = SDL_GetVideoSurface();
86+
if (surface == NULL) {
87+
sdl_error(ERR_SDL_DISPLAY_MODE_SET);
88+
}
89+
DoLog("Video surface is now %dx%d bpp=%d flags=0x%08X",
90+
surface->w, surface->h, surface->format->BitsPerPixel, surface->flags);
8891
#endif
8992
}
9093

@@ -266,9 +269,12 @@ void SpawnWindow()
266269
if (grabInput)
267270
SDL_WM_GrabInput(SDL_GRAB_ON);
268271
atexit(SDL_VideoQuit); // Without this video mode is not restored after fullscreen.
269-
const SDL_VideoInfo* current = SDL_GetVideoInfo();
270-
width = current->current_w;
271-
height = current->current_h;
272+
const SDL_Surface *surface = SDL_GetVideoSurface();
273+
if (surface == NULL) {
274+
sdl_error(ERR_SDL_WINDOW_CREATE);
275+
}
276+
width = surface->w;
277+
height = surface->h;
272278
#else
273279
bool integerScalingEnabled = getIniBool("Graphics", "Integer Scaling", false);
274280
bool upscale = getIniBool("Graphics", "Upscale", true);

android-project/app/src/main/java/org/diasurgical/devilutionx/DevilutionXSDLActivity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.view.SurfaceView;
1111
import android.view.ViewTreeObserver;
1212
import android.widget.Toast;
13+
import android.view.WindowManager;
1314

1415
import org.libsdl.app.SDLActivity;
1516

@@ -30,6 +31,10 @@ protected void onCreate(Bundle savedInstanceState) {
3031
if (Build.VERSION.SDK_INT >= 25)
3132
trackVisibleSpace();
3233

34+
// Force app to overlap with the display cutout
35+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
36+
getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
37+
3338
externalDir = chooseExternalFilesDir();
3439

3540
migrateSaveGames();

0 commit comments

Comments
 (0)