Add momentum scroll for macos

Taken from @mathewmariani lite-macos
This commit is contained in:
Francesco Abbate 2021-04-21 09:52:16 +02:00
parent 1f6680b492
commit 12ca5f3d2a
2 changed files with 11 additions and 1 deletions

View File

@ -9,3 +9,11 @@ void set_macos_bundle_resources(lua_State *L)
lua_setglobal(L, "MACOS_RESOURCES"); lua_setglobal(L, "MACOS_RESOURCES");
}} }}
/* Thanks to mathewmariani, taken from his lite-macos github repository. */
void enable_momentum_scroll() {
[[NSUserDefaults standardUserDefaults]
setBool: YES
forKey: @"AppleMomentumScrollSupported"];
}

View File

@ -37,7 +37,7 @@ static double get_scale(void) {
char *resource = XResourceManagerString(info.info.x11.display); char *resource = XResourceManagerString(info.info.x11.display);
if (resource == NULL) if (resource == NULL)
return 1.0; return 1.0;
XrmInitialize(); XrmInitialize();
db = XrmGetStringDatabase(resource); db = XrmGetStringDatabase(resource);
if (XrmGetResource(db, "Xft.dpi", "String", &type, &value) == False if (XrmGetResource(db, "Xft.dpi", "String", &type, &value) == False
@ -97,6 +97,7 @@ static void init_window_icon(void) {
#ifdef __APPLE__ #ifdef __APPLE__
void set_macos_bundle_resources(lua_State *L); void set_macos_bundle_resources(lua_State *L);
void enable_momentum_scroll();
#endif #endif
int main(int argc, char **argv) { int main(int argc, char **argv) {
@ -154,6 +155,7 @@ init_lua:
#ifdef __APPLE__ #ifdef __APPLE__
set_macos_bundle_resources(L); set_macos_bundle_resources(L);
enable_momentum_scroll();
#endif #endif
const char *init_lite_code = \ const char *init_lite_code = \