mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix code style from recent commits and add misc. optimizations
This commit is contained in:
parent
0a0378fece
commit
7b171ea2be
9 changed files with 186 additions and 185 deletions
|
@ -749,25 +749,23 @@ const char *getVideoDriverFriendlyName(irr::video::E_DRIVER_TYPE type)
|
|||
|
||||
static float calcDisplayDensity()
|
||||
{
|
||||
const char* current_display = getenv("DISPLAY");
|
||||
const char *current_display = getenv("DISPLAY");
|
||||
|
||||
if (current_display != NULL) {
|
||||
Display * x11display = XOpenDisplay(current_display);
|
||||
Display *x11display = XOpenDisplay(current_display);
|
||||
|
||||
if (x11display != NULL) {
|
||||
/* try x direct */
|
||||
float dpi_height =
|
||||
floor(DisplayHeight(x11display, 0) /
|
||||
(DisplayHeightMM(x11display, 0) * 0.039370) + 0.5);
|
||||
float dpi_width =
|
||||
floor(DisplayWidth(x11display, 0) /
|
||||
(DisplayWidthMM(x11display, 0) * 0.039370) +0.5);
|
||||
if (x11display != NULL) {
|
||||
/* try x direct */
|
||||
float dpi_height = floor(DisplayHeight(x11display, 0) /
|
||||
(DisplayHeightMM(x11display, 0) * 0.039370) + 0.5);
|
||||
float dpi_width = floor(DisplayWidth(x11display, 0) /
|
||||
(DisplayWidthMM(x11display, 0) * 0.039370) + 0.5);
|
||||
|
||||
XCloseDisplay(x11display);
|
||||
XCloseDisplay(x11display);
|
||||
|
||||
return std::max(dpi_height,dpi_width) / 96.0;
|
||||
}
|
||||
return std::max(dpi_height,dpi_width) / 96.0;
|
||||
}
|
||||
}
|
||||
|
||||
/* return manually specified dpi */
|
||||
return g_settings->getFloat("screen_dpi")/96.0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue