otclient-redemption/modules/corelib/net.lua
Luan Santos 230d1131a4 feat(platform): add native Cocoa/AppKit windowing for macOS
Implement a complete native macOS windowing system using Cocoa/AppKit to replace X11/XQuartz dependency. The implementation uses OpenGL 2.1 Legacy profile for compatibility with shader-based rendering while maintaining clean input handling and window management.

Key features:
- Native NSWindow-based windowing with full AppKit integration
- Comprehensive keyboard mapping using Carbon virtual key codes
- Mouse and cursor management via NSCursor with custom cursor support
- Window state management (maximize, fullscreen, resize, move, minimize)
- Proper event handling through OTOpenGLView and OTWindowDelegate delegates
- UTF-8 text input with proper character processing
- Clipboard support via NSPasteboard
- macOS-specific key modifier mapping (Cmd key to Alt modifier)
- Automatic window centering and display size detection

The change eliminates X11 requirements on macOS and provides a more native user experience with proper HiDPI support and macOS window conventions.

# Conflicts:
#	modules/corelib/const.lua
2026-01-10 10:06:53 -08:00

16 lines
718 B
Lua

function translateNetworkError(errcode, connecting, errdesc)
local text
if errcode == 111 or errcode == 61 then
text = tr('Connection refused, the server might be offline or restarting.\nPlease try again later.')
elseif errcode == 110 then
text = tr('Connection timed out. Either your network is failing or the server is offline.')
elseif errcode == 1 then
text = tr('Connection failed, the server address does not exist.')
elseif connecting then
text = tr('Connection failed.')
else
text = tr('Your connection has been lost.\nEither your network or the server went down.')
end
text = text .. ' ' .. tr('(ERROR %d)', errcode)
return text
end