mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
wayland: Add unscaled resolutions to the display mode list
This commit is contained in:
parent
b0178fe518
commit
d785dab5fd
@ -265,12 +265,32 @@ display_handle_mode(void *data,
|
|||||||
{
|
{
|
||||||
SDL_VideoDisplay *display = data;
|
SDL_VideoDisplay *display = data;
|
||||||
SDL_WaylandOutputData* driverdata = display->driverdata;
|
SDL_WaylandOutputData* driverdata = display->driverdata;
|
||||||
|
SDL_DisplayMode mode;
|
||||||
|
|
||||||
if (flags & WL_OUTPUT_MODE_CURRENT) {
|
if (flags & WL_OUTPUT_MODE_CURRENT) {
|
||||||
driverdata->width = width;
|
driverdata->width = width;
|
||||||
driverdata->height = height;
|
driverdata->height = height;
|
||||||
driverdata->refresh = refresh;
|
driverdata->refresh = refresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Note that the width/height are NOT multiplied by scale_factor!
|
||||||
|
* This is intentional and is designed to get the unscaled modes, which is
|
||||||
|
* important for high-DPI games intending to use the display mode as the
|
||||||
|
* target drawable size. The scaled desktop mode will be added at the end
|
||||||
|
* when display_handle_done is called (see below).
|
||||||
|
*/
|
||||||
|
SDL_zero(mode);
|
||||||
|
mode.format = SDL_PIXELFORMAT_RGB888;
|
||||||
|
if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) {
|
||||||
|
mode.w = height;
|
||||||
|
mode.h = width;
|
||||||
|
} else {
|
||||||
|
mode.w = width;
|
||||||
|
mode.h = height;
|
||||||
|
}
|
||||||
|
mode.refresh_rate = refresh / 1000; /* mHz to Hz */
|
||||||
|
mode.driverdata = driverdata->output;
|
||||||
|
SDL_AddDisplayMode(display, &mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -288,13 +308,14 @@ display_handle_done(void *data,
|
|||||||
|
|
||||||
SDL_zero(mode);
|
SDL_zero(mode);
|
||||||
mode.format = SDL_PIXELFORMAT_RGB888;
|
mode.format = SDL_PIXELFORMAT_RGB888;
|
||||||
mode.w = driverdata->width / driverdata->scale_factor;
|
|
||||||
mode.h = driverdata->height / driverdata->scale_factor;
|
|
||||||
if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) {
|
if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) {
|
||||||
mode.w = driverdata->height / driverdata->scale_factor;
|
mode.w = driverdata->height / driverdata->scale_factor;
|
||||||
mode.h = driverdata->width / driverdata->scale_factor;
|
mode.h = driverdata->width / driverdata->scale_factor;
|
||||||
|
} else {
|
||||||
|
mode.w = driverdata->width / driverdata->scale_factor;
|
||||||
|
mode.h = driverdata->height / driverdata->scale_factor;
|
||||||
}
|
}
|
||||||
mode.refresh_rate = driverdata->refresh / 1000; // mHz to Hz
|
mode.refresh_rate = driverdata->refresh / 1000; /* mHz to Hz */
|
||||||
mode.driverdata = driverdata->output;
|
mode.driverdata = driverdata->output;
|
||||||
SDL_AddDisplayMode(display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
display->current_mode = mode;
|
display->current_mode = mode;
|
||||||
|
Loading…
Reference in New Issue
Block a user