summaryrefslogtreecommitdiff
path: root/src/ios.m
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-20 22:39:00 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-20 22:39:00 +0300
commit982b0250255624e6bdf8782dcd2e7cb512f0bd4d (patch)
tree3540f25f88b3b3a5704bc3a822abfba15eacb085 /src/ios.m
parenteaaecf50a5ec64e9c344d195a3a74c7a46c8797c (diff)
iOS: Fixed momentum scroll timing
The scrolling stutters were being caused by timing and not slow text rendering. Now the momentum scroll is locked to display refresh rate.
Diffstat (limited to 'src/ios.m')
-rw-r--r--src/ios.m17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/ios.m b/src/ios.m
index 9aca5a19..58557ef5 100644
--- a/src/ios.m
+++ b/src/ios.m
@@ -33,11 +33,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
33static iBool isSystemDarkMode_ = iFalse; 33static iBool isSystemDarkMode_ = iFalse;
34static iBool isPhone_ = iFalse; 34static iBool isPhone_ = iFalse;
35 35
36static UIViewController *viewController_(iWindow *window) { 36static UIWindow *uiWindow_(iWindow *window) {
37 SDL_SysWMinfo wm; 37 SDL_SysWMinfo wm;
38 SDL_VERSION(&wm.version); 38 SDL_VERSION(&wm.version);
39 if (SDL_GetWindowWMInfo(window->win, &wm)) { 39 if (SDL_GetWindowWMInfo(window->win, &wm)) {
40 return wm.info.uikit.window.rootViewController; 40 return wm.info.uikit.window;
41 }
42 iAssert(false);
43 return NULL;
44}
45
46static UIViewController *viewController_(iWindow *window) {
47 UIWindow *uiWin = uiWindow_(window);
48 if (uiWin) {
49 return uiWin.rootViewController;
41 } 50 }
42 iAssert(false); 51 iAssert(false);
43 return NULL; 52 return NULL;
@@ -248,6 +257,10 @@ iBool isPhone_iOS(void) {
248 return isPhone_; 257 return isPhone_;
249} 258}
250 259
260int displayRefreshRate_iOS(void) {
261 return uiWindow_(get_Window()).screen.maximumFramesPerSecond;
262}
263
251void setupWindow_iOS(iWindow *window) { 264void setupWindow_iOS(iWindow *window) {
252 UIViewController *ctl = viewController_(window); 265 UIViewController *ctl = viewController_(window);
253 isSystemDarkMode_ = isDarkMode_(window); 266 isSystemDarkMode_ = isDarkMode_(window);