mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 12:15:33 +00:00
emscripten: Let SDL_GetDisplayUsableBounds return the size of the window
This does not account for scrollbars nor margins. But is much better then returning the full display size when not running fullscreen, but for example in an iframe.
This commit is contained in:
parent
fb3df3a18d
commit
287772f5e9
|
@ -42,6 +42,7 @@
|
|||
static int Emscripten_VideoInit(_THIS);
|
||||
static int Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||
static void Emscripten_VideoQuit(_THIS);
|
||||
static int Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
|
||||
|
||||
static int Emscripten_CreateWindow(_THIS, SDL_Window * window);
|
||||
static void Emscripten_SetWindowSize(_THIS, SDL_Window * window);
|
||||
|
@ -86,6 +87,7 @@ Emscripten_CreateDevice(int devindex)
|
|||
/* Set the function pointers */
|
||||
device->VideoInit = Emscripten_VideoInit;
|
||||
device->VideoQuit = Emscripten_VideoQuit;
|
||||
device->GetDisplayUsableBounds = Emscripten_GetDisplayUsableBounds;
|
||||
device->SetDisplayMode = Emscripten_SetDisplayMode;
|
||||
|
||||
|
||||
|
@ -177,6 +179,22 @@ Emscripten_VideoQuit(_THIS)
|
|||
Emscripten_FiniMouse();
|
||||
}
|
||||
|
||||
static int
|
||||
Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
|
||||
{
|
||||
if (rect) {
|
||||
rect->x = 0;
|
||||
rect->y = 0;
|
||||
rect->w = EM_ASM_INT_V({
|
||||
return window.innerWidth;
|
||||
});
|
||||
rect->h = EM_ASM_INT_V({
|
||||
return window.innerHeight;
|
||||
});
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
Emscripten_PumpEvents(_THIS)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue