mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-05 09:26:25 +00:00
video: wayland: Expose more resolutions for mode emulation
Expose as many emulated display modes as possible. They will currently display stretched to the display's native desktop aspect, but if an application requires a hardcoded resolution, it will work at minimum. Aside from the change in the emulated display mode list, the Wayland event handling code had to be updated to support separate scaling for the x and y axes, as square pixels are no longer guaranteed.
This commit is contained in:
@@ -204,7 +204,8 @@ ConfigureViewport(SDL_Window *window)
|
||||
GetFullScreenDimensions(window, &fs_width, &fs_height, &src_width, &src_height);
|
||||
SetViewport(window, src_width, src_height, output->width, output->height);
|
||||
|
||||
data->pointer_scale = (float)fs_width / (float)output->width;
|
||||
data->pointer_scale_x = (float)fs_width / (float)output->width;
|
||||
data->pointer_scale_y = (float)fs_height / (float)output->height;
|
||||
|
||||
/*
|
||||
* If mouse_rect is not empty, re-create the confinement region with the new scale value.
|
||||
@@ -216,7 +217,8 @@ ConfigureViewport(SDL_Window *window)
|
||||
}
|
||||
} else {
|
||||
UnsetViewport(window);
|
||||
data->pointer_scale = 1.0f;
|
||||
data->pointer_scale_x = 1.0f;
|
||||
data->pointer_scale_y = 1.0f;
|
||||
|
||||
/* Re-scale the pointer confinement region */
|
||||
if (!SDL_RectEmpty(&window->mouse_rect)) {
|
||||
@@ -1485,7 +1487,8 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
|
||||
data->sdlwindow = window;
|
||||
|
||||
data->scale_factor = 1.0f;
|
||||
data->pointer_scale = 1.0f;
|
||||
data->pointer_scale_x = 1.0f;
|
||||
data->pointer_scale_y = 1.0f;
|
||||
|
||||
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
|
||||
int i;
|
||||
|
Reference in New Issue
Block a user