diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-20 22:39:00 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-20 22:39:00 +0300 |
commit | 982b0250255624e6bdf8782dcd2e7cb512f0bd4d (patch) | |
tree | 3540f25f88b3b3a5704bc3a822abfba15eacb085 /src/ios.m | |
parent | eaaecf50a5ec64e9c344d195a3a74c7a46c8797c (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.m | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -33,11 +33,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
33 | static iBool isSystemDarkMode_ = iFalse; | 33 | static iBool isSystemDarkMode_ = iFalse; |
34 | static iBool isPhone_ = iFalse; | 34 | static iBool isPhone_ = iFalse; |
35 | 35 | ||
36 | static UIViewController *viewController_(iWindow *window) { | 36 | static 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 | |||
46 | static 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 | ||
260 | int displayRefreshRate_iOS(void) { | ||
261 | return uiWindow_(get_Window()).screen.maximumFramesPerSecond; | ||
262 | } | ||
263 | |||
251 | void setupWindow_iOS(iWindow *window) { | 264 | void setupWindow_iOS(iWindow *window) { |
252 | UIViewController *ctl = viewController_(window); | 265 | UIViewController *ctl = viewController_(window); |
253 | isSystemDarkMode_ = isDarkMode_(window); | 266 | isSystemDarkMode_ = isDarkMode_(window); |