Added to iOS
not working on X11 & Wayland
This commit is contained in:
@ -248,3 +248,25 @@ mfb_timer_init() {
|
||||
g_timer_resolution = 1.0 / g_timer_frequency;
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
void
|
||||
mfb_get_monitor_dpi(struct mfb_window *window, float *dpi_x, float *dpi_y) {
|
||||
(void) window;
|
||||
float scale = 1.0f;
|
||||
|
||||
scale = [[UIScreen mainScreen] scale];
|
||||
|
||||
if (dpi_x) {
|
||||
*dpi_x = scale;
|
||||
if(*dpi_x == 0) {
|
||||
*dpi_x = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (dpi_y) {
|
||||
*dpi_y = scale;
|
||||
if (*dpi_y == 0) {
|
||||
*dpi_y = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -579,6 +579,5 @@ mfb_get_monitor_dpi(struct mfb_window *window, float *dpi_x, float *dpi_y) {
|
||||
*dpi_y = 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -996,3 +996,30 @@ mfb_set_viewport(struct mfb_window *window, unsigned offset_x, unsigned offset_y
|
||||
return false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
mfb_get_monitor_dpi(struct mfb_window *window, float *dpi_x, float *dpi_y) {
|
||||
float x = 96.0, y = 96.0;
|
||||
|
||||
if(window != 0x0) {
|
||||
//SWindowData *window_data = (SWindowData *) window;
|
||||
//SWindowData_X11 *window_data_x11 = (SWindowData_X11 *) window_data->specific;
|
||||
|
||||
// I cannot find a way to get dpi under VirtualBox
|
||||
}
|
||||
|
||||
if (dpi_x) {
|
||||
*dpi_x = x / 96.0f;
|
||||
if(*dpi_x == 0) {
|
||||
*dpi_x = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (dpi_y) {
|
||||
*dpi_y = y / 96.0f;
|
||||
if (*dpi_y == 0) {
|
||||
*dpi_y = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,11 @@
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/cursorfont.h>
|
||||
|
||||
// I cannot find a way to get dpi under VirtualBox
|
||||
//#include <X11/Xresource.h>
|
||||
//#include <X11/extensions/Xrandr.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -789,3 +794,35 @@ mfb_set_viewport(struct mfb_window *window, unsigned offset_x, unsigned offset_y
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
mfb_get_monitor_dpi(struct mfb_window *window, float *dpi_x, float *dpi_y) {
|
||||
float x = 96.0, y = 96.0;
|
||||
|
||||
if(window != 0x0) {
|
||||
//SWindowData *window_data = (SWindowData *) window;
|
||||
//SWindowData_X11 *window_data_x11 = (SWindowData_X11 *) window_data->specific;
|
||||
|
||||
// I cannot find a way to get dpi under VirtualBox
|
||||
// XrmGetResource "Xft.dpi", "Xft.Dpi"
|
||||
// XRRGetOutputInfo
|
||||
// DisplayWidthMM, DisplayHeightMM
|
||||
// All returning invalid values or 0
|
||||
}
|
||||
|
||||
if (dpi_x) {
|
||||
*dpi_x = x / 96.0f;
|
||||
if(*dpi_x == 0) {
|
||||
*dpi_x = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (dpi_y) {
|
||||
*dpi_y = y / 96.0f;
|
||||
if (*dpi_y == 0) {
|
||||
*dpi_y = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user