Skip to content

Commit

Permalink
Fixed some errors on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
MCJack123 committed Jan 1, 2024
1 parent f2d50b1 commit 268997d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/platform/ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ void iosSetSafeAreaConstraints(SDLTerminal * term) {
window_info.info.uikit.window.rootViewController = rootvc;
sdlView = oldvc.view;
viewController = vc;
[viewController retain];
// Remove the updateKeyboard method in the old view controller, as it glitches out the screen when opening/closing the keyboard
method_setImplementation(class_getInstanceMethod([oldvc class], @selector(updateKeyboard)), [ViewController instanceMethodForSelector:@selector(updateKeyboard)]);
// Set fullscreen mode, but only on devices without a notch
Expand All @@ -781,18 +782,18 @@ void iosSetSafeAreaConstraints(SDLTerminal * term) {
}

void updateCloseButton() {
if (computers->empty()) return;
if (computers->empty() || !viewController) return;
viewController.closeButton.enabled = computers->size() > 1 || (*renderTarget) != computers->front()->term;
viewController.nextButton.enabled = renderTargets.size() > 1;
viewController.previousButton.enabled = renderTargets.size() > 1;
}

void iOS_SetWindowTitle(SDL_Window * win, const char * title) {
viewController.navigationItem.title = [NSString stringWithCString:title encoding:NSASCIIStringEncoding];
if (viewController) viewController.navigationItem.title = [NSString stringWithCString:title encoding:NSASCIIStringEncoding];
}

void mobileResetModifiers() {
[viewController resetModifiers];
if (viewController) [viewController resetModifiers];
}

void handler(int sig) {
Expand Down Expand Up @@ -907,7 +908,9 @@ static int mobile_restorePurchases(lua_State *L) {
};*/

int mobile_luaopen(lua_State *L) {
luaL_register(L, "mobile", mobile_reg);
luaL_newlib(L, mobile_reg);
lua_pushvalue(L, -1);
lua_setglobal(L, "mobile");
/*lua_pushstring(L, "ios");
lua_newtable(L);
for (luaL_Reg* r = ios_reg; r->name && r->func; r++) {
Expand Down
2 changes: 1 addition & 1 deletion src/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ template<> class std::hash<SDL_EventType>: public std::hash<unsigned short> {};

// for old compilers (see C++ LWG 3657)
// NOTE: No idea if this MSVC check is correct - if you have issues, just update to the latest VS2022.
#if (defined(__GLIBCXX__) && __GLIBCXX__ < 20220426) || (defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 17000) || (defined(_MSC_FULL_VER) && _MSC_FULL_VER < 193200000)
#if (defined(__GLIBCXX__) && __GLIBCXX__ < 20220426) || (defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 170000) || (defined(_MSC_FULL_VER) && _MSC_FULL_VER < 193200000)
template<> struct std::hash<path_t> {size_t operator()(const path_t& path) const noexcept {return fs::hash_value(path);}};
#endif

Expand Down

0 comments on commit 268997d

Please sign in to comment.