mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Add MENU_DISPLAY_CTL_GET_DPI
This commit is contained in:
parent
26e1ec35cb
commit
8629697afb
@ -561,7 +561,7 @@ static void glui_layout(menu_handle_t *menu, glui_handle_t *glui)
|
||||
resolution, so we should be dpi aware to ensure the entries hitboxes are big
|
||||
enough. On desktops, we just care about readability, with every widget size
|
||||
proportional to the display width. */
|
||||
scale_factor = menu_display_get_dpi();
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_GET_DPI, &scale_factor);
|
||||
|
||||
glui->line_height = scale_factor / 3;
|
||||
glui->margin = scale_factor / 6;
|
||||
|
@ -120,24 +120,6 @@ bool menu_display_init(void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
float menu_display_get_dpi(void)
|
||||
{
|
||||
float dpi = menu_dpi_override_value;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings)
|
||||
return dpi;
|
||||
|
||||
if (settings->menu.dpi.override_enable)
|
||||
dpi = settings->menu.dpi.override_value;
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_GLES)
|
||||
else if (!gfx_ctx_get_metrics(DISPLAY_METRIC_DPI, &dpi))
|
||||
dpi = menu_dpi_override_value;
|
||||
#endif
|
||||
|
||||
return dpi;
|
||||
}
|
||||
|
||||
bool menu_display_font_init_first(const void **font_driver,
|
||||
void **font_handle, void *video_data, const char *font_path,
|
||||
float font_size)
|
||||
@ -263,6 +245,22 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
|
||||
if (frame_buf && frame_buf->data)
|
||||
frame_buf->dirty = false;
|
||||
return true;
|
||||
case MENU_DISPLAY_CTL_GET_DPI:
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
float *dpi = (float*)data;
|
||||
|
||||
*dpi = menu_dpi_override_value;
|
||||
|
||||
if (!settings)
|
||||
return true;
|
||||
|
||||
if (settings->menu.dpi.override_enable)
|
||||
*dpi = settings->menu.dpi.override_value;
|
||||
else if (!gfx_ctx_get_metrics(DISPLAY_METRIC_DPI, dpi))
|
||||
*dpi = menu_dpi_override_value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -34,7 +34,8 @@ enum menu_display_ctl_state
|
||||
MENU_DISPLAY_CTL_SET_VIEWPORT = 0,
|
||||
MENU_DISPLAY_CTL_UNSET_VIEWPORT,
|
||||
MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG,
|
||||
MENU_DISPLAY_CTL_UNSET_FRAMEBUFFER_DIRTY_FLAG
|
||||
MENU_DISPLAY_CTL_UNSET_FRAMEBUFFER_DIRTY_FLAG,
|
||||
MENU_DISPLAY_CTL_GET_DPI
|
||||
};
|
||||
|
||||
typedef struct menu_framebuf
|
||||
@ -79,8 +80,6 @@ bool menu_display_init(void *data);
|
||||
|
||||
bool menu_display_update_pending(void);
|
||||
|
||||
float menu_display_get_dpi(void);
|
||||
|
||||
bool menu_display_font_init_first(const void **font_driver,
|
||||
void **font_handle, void *video_data, const char *font_path,
|
||||
float font_size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user