diff options
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -122,6 +122,7 @@ struct Impl_App { | |||
122 | uint32_t lastTickerTime; | 122 | uint32_t lastTickerTime; |
123 | uint32_t elapsedSinceLastTicker; | 123 | uint32_t elapsedSinceLastTicker; |
124 | iBool isRunning; | 124 | iBool isRunning; |
125 | iBool isRunningUnderWindowSystem; | ||
125 | #if defined (LAGRANGE_ENABLE_IDLE_SLEEP) | 126 | #if defined (LAGRANGE_ENABLE_IDLE_SLEEP) |
126 | iBool isIdling; | 127 | iBool isIdling; |
127 | uint32_t lastEventTime; | 128 | uint32_t lastEventTime; |
@@ -626,6 +627,12 @@ static iBool hasCommandLineOpenableScheme_(const iRangecc uri) { | |||
626 | } | 627 | } |
627 | 628 | ||
628 | static void init_App_(iApp *d, int argc, char **argv) { | 629 | static void init_App_(iApp *d, int argc, char **argv) { |
630 | #if defined (iPlatformLinux) | ||
631 | d->isRunningUnderWindowSystem = !iCmpStr(SDL_GetCurrentVideoDriver(), "x11") || | ||
632 | !iCmpStr(SDL_GetCurrentVideoDriver(), "wayland"); | ||
633 | #else | ||
634 | d->isRunningUnderWindowSystem = iTrue; | ||
635 | #endif | ||
629 | init_CommandLine(&d->args, argc, argv); | 636 | init_CommandLine(&d->args, argc, argv); |
630 | /* Where was the app started from? We ask SDL first because the command line alone is | 637 | /* Where was the app started from? We ask SDL first because the command line alone is |
631 | not a reliable source of this information, particularly when it comes to different | 638 | not a reliable source of this information, particularly when it comes to different |
@@ -749,7 +756,8 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
749 | mulfv_I2(&d->initialWindowRect.size, desktopDPI_Win32()); | 756 | mulfv_I2(&d->initialWindowRect.size, desktopDPI_Win32()); |
750 | #endif | 757 | #endif |
751 | #if defined (iPlatformLinux) | 758 | #if defined (iPlatformLinux) |
752 | /* Scale by the primary (?) monitor DPI. */ { | 759 | /* Scale by the primary (?) monitor DPI. */ |
760 | if (isRunningUnderWindowSystem_App()) { | ||
753 | float vdpi; | 761 | float vdpi; |
754 | SDL_GetDisplayDPI(0, NULL, NULL, &vdpi); | 762 | SDL_GetDisplayDPI(0, NULL, NULL, &vdpi); |
755 | const float factor = vdpi / 96.0f; | 763 | const float factor = vdpi / 96.0f; |
@@ -1582,6 +1590,10 @@ enum iAppDeviceType deviceType_App(void) { | |||
1582 | #endif | 1590 | #endif |
1583 | } | 1591 | } |
1584 | 1592 | ||
1593 | iBool isRunningUnderWindowSystem_App(void) { | ||
1594 | return app_.isRunningUnderWindowSystem; | ||
1595 | } | ||
1596 | |||
1585 | iGmCerts *certs_App(void) { | 1597 | iGmCerts *certs_App(void) { |
1586 | return app_.certs; | 1598 | return app_.certs; |
1587 | } | 1599 | } |