Skip to content

Commit

Permalink
implement sdl_get_monitor_dpi
Browse files Browse the repository at this point in the history
  • Loading branch information
allefant authored and SiegeLord committed Apr 24, 2023
1 parent 44ca807 commit 23ad1bf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sdl/sdl_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,13 @@ static void sdl_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor)
ASSERT(sdl_cursor);
SDL_FreeCursor(sdl_cursor->cursor);
al_free(sdl_cursor);

static int sdl_get_monitor_dpi(int adapter)
{
float ddpi, hdpi, vdpi;
if (SDL_GetDisplayDPI(adapter, &ddpi, &hdpi, &vdpi) < 0)
return 72; // we can't indicate "unknown" so return something reasonable
return hdpi;
}

static int sdl_get_num_display_modes(void)
Expand Down Expand Up @@ -411,7 +418,7 @@ ALLEGRO_SYSTEM_INTERFACE *_al_sdl_system_driver(void)
vt->get_num_video_adapters = sdl_get_num_video_adapters;
vt->get_monitor_info = sdl_get_monitor_info;
vt->create_mouse_cursor = sdl_create_mouse_cursor;
vt->destroy_mouse_cursor = sdl_destroy_mouse_cursor;
vt->get_monitor_dpi = sdl_get_monitor_dpi;
/*vt->get_cursor_position = sdl_get_cursor_position;
vt->grab_mouse = sdl_grab_mouse;
vt->ungrab_mouse = sdl_ungrab_mouse;*/
Expand Down

0 comments on commit 23ad1bf

Please sign in to comment.