diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/iphone/app_delegate.mm | 21 | ||||
-rw-r--r-- | platform/javascript/SCsub | 6 | ||||
-rw-r--r-- | platform/javascript/detect.py | 17 | ||||
-rw-r--r-- | platform/javascript/engine.js | 21 | ||||
-rw-r--r-- | platform/javascript/export/export.cpp | 2 | ||||
-rw-r--r-- | platform/javascript/javascript_main.cpp | 2 | ||||
-rw-r--r-- | platform/javascript/os_javascript.cpp | 12 | ||||
-rw-r--r-- | platform/osx/os_osx.h | 1 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 75 | ||||
-rw-r--r-- | platform/server/os_server.cpp | 6 | ||||
-rw-r--r-- | platform/server/os_server.h | 3 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 28 | ||||
-rw-r--r-- | platform/windows/os_windows.h | 1 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 13 |
14 files changed, 140 insertions, 68 deletions
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index 7ed1328b20..dd5ce4ab10 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -709,21 +709,18 @@ static int frame_count = 0; iphone_finish(); }; -- (void)applicationDidEnterBackground:(UIApplication *)application { - ///@TODO maybe add pause motionManager? and where would we unpause it? +// When application goes to background (e.g. user switches to another app or presses Home), +// then applicationWillResignActive -> applicationDidEnterBackground are called. +// When user opens the inactive app again, +// applicationWillEnterForeground -> applicationDidBecomeActive are called. - on_focus_out(view_controller, &is_focus_out); -} - -- (void)applicationWillEnterForeground:(UIApplication *)application { - // OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN); - [view_controller.view startAnimation]; -} +// There are cases when applicationWillResignActive -> applicationDidBecomeActive +// sequence is called without the app going to background. For example, that happens +// if you open the app list without switching to another app or open/close the +// notification panel by swiping from the upper part of the screen. - (void)applicationWillResignActive:(UIApplication *)application { - // OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT); - [view_controller.view - stopAnimation]; // FIXME: pause seems to be recommended elsewhere + on_focus_out(view_controller, &is_focus_out); } - (void)applicationDidBecomeActive:(UIApplication *)application { diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub index 5991075e29..98988d97fd 100644 --- a/platform/javascript/SCsub +++ b/platform/javascript/SCsub @@ -30,8 +30,8 @@ zip_files = env.InstallAs([ zip_dir.File('godot.wasm'), zip_dir.File('godot.html') ], [ - js_wrapped, - wasm, - '#misc/dist/html/default.html' + js_wrapped, + wasm, + '#misc/dist/html/default.html' ]) env.Zip('#bin/godot', zip_files, ZIPROOT=zip_dir, ZIPSUFFIX='${PROGSUFFIX}${ZIPSUFFIX}', ZIPCOMSTR='Archving $SOURCES as $TARGET') diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index a48cb872ee..fc909f6619 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -1,5 +1,4 @@ import os -import string import sys @@ -39,7 +38,7 @@ def configure(env): ## Build type - if env['target'] == 'release' or env['target'] == 'profile': + if env['target'] != 'debug': # Use -Os to prioritize optimizing for reduced file size. This is # particularly valuable for the web platform because it directly # decreases download time. @@ -48,17 +47,11 @@ def configure(env): # run-time performance. env.Append(CCFLAGS=['-Os']) env.Append(LINKFLAGS=['-Os']) - if env['target'] == 'profile': + if env['target'] == 'release_debug': + env.Append(CPPDEFINES=['DEBUG_ENABLED']) + # Retain function names for backtraces at the cost of file size. env.Append(LINKFLAGS=['--profiling-funcs']) - - elif env['target'] == 'release_debug': - env.Append(CPPDEFINES=['DEBUG_ENABLED']) - env.Append(CCFLAGS=['-O2']) - env.Append(LINKFLAGS=['-O2']) - # Retain function names for backtraces at the cost of file size. - env.Append(LINKFLAGS=['--profiling-funcs']) - - elif env['target'] == 'debug': + else: env.Append(CPPDEFINES=['DEBUG_ENABLED']) env.Append(CCFLAGS=['-O1', '-g']) env.Append(LINKFLAGS=['-O1', '-g']) diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js index e4839af433..c3ef5bbbb5 100644 --- a/platform/javascript/engine.js +++ b/platform/javascript/engine.js @@ -10,6 +10,7 @@ var DOWNLOAD_ATTEMPTS_MAX = 4; var basePath = null; + var wasmFilenameExtensionOverride = null; var engineLoadPromise = null; var loadingFiles = {}; @@ -129,13 +130,17 @@ this.startGame = function(mainPack) { executableName = getBaseName(mainPack); + var mainArgs = []; + if (!getPathLeaf(mainPack).endsWith('.pck')) { + mainArgs = ['--main-pack', getPathLeaf(mainPack)]; + } return Promise.all([ // Load from directory, this.init(getBasePath(mainPack)), // ...but write to root where the engine expects it. this.preloadFile(mainPack, getPathLeaf(mainPack)) ]).then( - Function.prototype.apply.bind(synchronousStart, this, []) + Function.prototype.apply.bind(synchronousStart, this, mainArgs) ); }; @@ -161,6 +166,10 @@ actualCanvas.style.padding = 0; actualCanvas.style.borderWidth = 0; actualCanvas.style.borderStyle = 'none'; + // disable right-click context menu + actualCanvas.addEventListener('contextmenu', function(ev) { + ev.preventDefault(); + }, false); // until context restoration is implemented actualCanvas.addEventListener('webglcontextlost', function(ev) { alert("WebGL context lost, please reload the page"); @@ -299,6 +308,14 @@ return !!testContext; }; + Engine.setWebAssemblyFilenameExtension = function(override) { + + if (String(override).length === 0) { + throw new Error('Invalid WebAssembly filename extension override'); + } + wasmFilenameExtensionOverride = String(override); + } + Engine.load = function(newBasePath) { if (newBasePath !== undefined) basePath = getBasePath(newBasePath); @@ -306,7 +323,7 @@ if (typeof WebAssembly !== 'object') return Promise.reject(new Error("Browser doesn't support WebAssembly")); // TODO cache/retrieve module to/from idb - engineLoadPromise = loadPromise(basePath + '.wasm').then(function(xhr) { + engineLoadPromise = loadPromise(basePath + '.' + (wasmFilenameExtensionOverride || 'wasm')).then(function(xhr) { return xhr.response; }); engineLoadPromise = engineLoadPromise.catch(function(err) { diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index d81aa25c32..9591850662 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -117,7 +117,7 @@ void EditorExportPlatformJavaScript::get_export_options(List<ExportOption> *r_op r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), true)); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "html/custom_html_shell", PROPERTY_HINT_GLOBAL_FILE, "html"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "html/custom_html_shell", PROPERTY_HINT_FILE, "html"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "html/head_include", PROPERTY_HINT_MULTILINE_TEXT), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index 54d4755bd7..68a2d72464 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -56,8 +56,6 @@ extern "C" EMSCRIPTEN_KEEPALIVE void main_after_fs_sync(char *p_idbfs_err) { int main(int argc, char *argv[]) { - printf("let it go dude!\n"); - // sync from persistent state into memory and then // run the 'main_after_fs_sync' function /* clang-format off */ diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 1b5463e40d..6c6e4d2d1c 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -167,10 +167,9 @@ static EM_BOOL _mousebutton_callback(int event_type, const EmscriptenMouseEvent int mask = _input->get_mouse_button_mask(); int button_flag = 1 << (ev->get_button_index() - 1); if (ev->is_pressed()) { - // since the event is consumed, focus manually - if (!is_canvas_focused()) { - focus_canvas(); - } + // Since the event is consumed, focus manually. The containing iframe, + // if used, may not have focus yet, so focus even if already focused. + focus_canvas(); mask |= button_flag; } else if (mask & button_flag) { mask &= ~button_flag; @@ -181,7 +180,8 @@ static EM_BOOL _mousebutton_callback(int event_type, const EmscriptenMouseEvent ev->set_button_mask(mask); _input->parse_input_event(ev); - // prevent selection dragging + // Prevent multi-click text selection and wheel-click scrolling anchor. + // Context menu is prevented through contextmenu event. return true; } @@ -204,7 +204,7 @@ static EM_BOOL _mousemove_callback(int event_type, const EmscriptenMouseEvent *m ev->set_position(pos); ev->set_global_position(ev->get_position()); - ev->set_relative(ev->get_position() - _input->get_mouse_position()); + ev->set_relative(Vector2(mouse_event->movementX, mouse_event->movementY)); _input->set_mouse_position(ev->get_position()); ev->set_speed(_input->get_last_mouse_speed()); diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index c1022a1aca..2b2d21553b 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -109,6 +109,7 @@ public: bool minimized; bool maximized; bool zoomed; + bool resizable; Size2 window_size; Rect2 restore_rect; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 80d466f4b6..5589f93a5d 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -541,7 +541,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; } - (void)cursorUpdate:(NSEvent *)event { - //setModeCursor(window, window->cursorMode); + OS::CursorShape p_shape = OS_OSX::singleton->cursor_shape; + OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX; + OS_OSX::singleton->set_cursor_shape(p_shape); } static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) { @@ -656,11 +658,12 @@ static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) { return; if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode != OS::MOUSE_MODE_CAPTURED) OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER); - if (OS_OSX::singleton->input) { + if (OS_OSX::singleton->input) OS_OSX::singleton->input->set_mouse_in_window(true); - OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX; - OS_OSX::singleton->set_cursor_shape(OS::CURSOR_ARROW); - } + + OS::CursorShape p_shape = OS_OSX::singleton->cursor_shape; + OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX; + OS_OSX::singleton->set_cursor_shape(p_shape); } - (void)magnifyWithEvent:(NSEvent *)event { @@ -847,16 +850,16 @@ struct _KeyCodeMap { static const _KeyCodeMap _keycodes[55] = { { '`', KEY_QUOTELEFT }, { '~', KEY_ASCIITILDE }, - { '0', KEY_KP_0 }, - { '1', KEY_KP_1 }, - { '2', KEY_KP_2 }, - { '3', KEY_KP_3 }, - { '4', KEY_KP_4 }, - { '5', KEY_KP_5 }, - { '6', KEY_KP_6 }, - { '7', KEY_KP_7 }, - { '8', KEY_KP_8 }, - { '9', KEY_KP_9 }, + { '0', KEY_0 }, + { '1', KEY_1 }, + { '2', KEY_2 }, + { '3', KEY_3 }, + { '4', KEY_4 }, + { '5', KEY_5 }, + { '6', KEY_6 }, + { '7', KEY_7 }, + { '8', KEY_8 }, + { '9', KEY_9 }, { '-', KEY_MINUS }, { '_', KEY_UNDERSCORE }, { '=', KEY_EQUAL }, @@ -910,7 +913,7 @@ static int remapKey(unsigned int key) { CFDataRef layoutData = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData); if (!layoutData) - return nil; + return 0; const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout *)CFDataGetBytePtr(layoutData); @@ -1181,6 +1184,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a if (p_desired.borderless_window) { styleMask = NSWindowStyleMaskBorderless; } else { + resizable = p_desired.resizable; styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | (p_desired.resizable ? NSWindowStyleMaskResizable : 0); } @@ -1477,7 +1481,7 @@ void OS_OSX::set_cursor_shape(CursorShape p_shape) { if (cursor_shape == p_shape) return; - if (mouse_mode != MOUSE_MODE_VISIBLE) { + if (mouse_mode != MOUSE_MODE_VISIBLE && mouse_mode != MOUSE_MODE_CONFINED) { cursor_shape = p_shape; return; } @@ -1594,6 +1598,11 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c if (p_shape == CURSOR_ARROW) { [cursor set]; } + } else { + // Reset to default system cursor + cursors[p_shape] = NULL; + cursor_shape = CURSOR_MAX; + set_cursor_shape(p_shape); } } @@ -1732,7 +1741,8 @@ String OS_OSX::get_godot_dir_name() const { String OS_OSX::get_system_dir(SystemDir p_dir) const { - NSSearchPathDirectory id = 0; + NSSearchPathDirectory id; + bool found = true; switch (p_dir) { case SYSTEM_DIR_DESKTOP: { @@ -1753,10 +1763,13 @@ String OS_OSX::get_system_dir(SystemDir p_dir) const { case SYSTEM_DIR_PICTURES: { id = NSPicturesDirectory; } break; + default: { + found = false; + } } String ret; - if (id) { + if (found) { NSArray *paths = NSSearchPathForDirectoriesInDomains(id, NSUserDomainMask, YES); if (paths && [paths count] >= 1) { @@ -2102,6 +2115,8 @@ void OS_OSX::set_window_resizable(bool p_enabled) { [window_object setStyleMask:[window_object styleMask] | NSWindowStyleMaskResizable]; else [window_object setStyleMask:[window_object styleMask] & ~NSWindowStyleMaskResizable]; + + resizable = p_enabled; }; bool OS_OSX::is_window_resizable() const { @@ -2211,7 +2226,7 @@ void OS_OSX::set_borderless_window(bool p_borderless) { if (layered_window) set_window_per_pixel_transparency_enabled(false); - [window_object setStyleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable]; + [window_object setStyleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | (resizable ? NSWindowStyleMaskResizable : 0)]; // Force update of the window styles NSRect frameRect = [window_object frame]; @@ -2419,12 +2434,21 @@ void OS_OSX::run() { //int frames=0; //uint64_t frame=0; - while (!force_quit) { + bool quit = false; - process_events(); // get rid of pending events - joypad_osx->process_joypads(); - if (Main::iteration() == true) - break; + while (!force_quit && !quit) { + + @try { + + process_events(); // get rid of pending events + joypad_osx->process_joypads(); + + if (Main::iteration() == true) { + quit = true; + } + } @catch (NSException *exception) { + ERR_PRINTS("NSException: " + String([exception reason].UTF8String)); + } }; main_loop->finish(); @@ -2598,6 +2622,7 @@ OS_OSX::OS_OSX() { minimized = false; window_size = Vector2(1024, 600); zoomed = false; + resizable = false; Vector<Logger *> loggers; loggers.push_back(memnew(OSXTerminalLogger)); diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index a8be4fbc35..3b1be780d4 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -30,6 +30,7 @@ #include "os_server.h" #include "drivers/dummy/audio_driver_dummy.h" #include "drivers/dummy/rasterizer_dummy.h" +#include "drivers/dummy/texture_loader_dummy.h" #include "print_string.h" #include "servers/visual/visual_server_raster.h" #include <stdio.h> @@ -83,6 +84,9 @@ Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int _ensure_user_data_dir(); + resource_loader_dummy = memnew(ResourceFormatDummyTexture); + ResourceLoader::add_resource_format_loader(resource_loader_dummy); + return OK; } @@ -99,6 +103,8 @@ void OS_Server::finalize() { memdelete(power_manager); + memdelete(resource_loader_dummy); + args.clear(); } diff --git a/platform/server/os_server.h b/platform/server/os_server.h index 2cc6f0c47e..f1a880ecc2 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -32,6 +32,7 @@ #include "../x11/crash_handler_x11.h" #include "../x11/power_x11.h" +#include "drivers/dummy/texture_loader_dummy.h" #include "drivers/rtaudio/audio_driver_rtaudio.h" #include "drivers/unix/os_unix.h" #include "main/input_default.h" @@ -65,6 +66,8 @@ class OS_Server : public OS_Unix { CrashHandler crash_handler; + ResourceFormatDummyTexture *resource_loader_dummy; + protected: virtual int get_video_driver_count() const; virtual const char *get_video_driver_name(int p_driver) const; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 2850d38ce4..8d664b5832 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -623,9 +623,12 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_SIZE: { int window_w = LOWORD(lParam); int window_h = HIWORD(lParam); - if (window_w > 0 && window_h > 0) { + if (window_w > 0 && window_h > 0 && !preserve_window_size) { video_mode.width = window_w; video_mode.height = window_h; + } else { + preserve_window_size = false; + set_window_size(Size2(video_mode.width, video_mode.height)); } if (wParam == SIZE_MAXIMIZED) { maximized = true; @@ -777,7 +780,9 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) SetCursor(NULL); } else { if (hCursor != NULL) { - SetCursor(hCursor); + CursorShape c = cursor_shape; + cursor_shape = CURSOR_MAX; + set_cursor_shape(c); hCursor = NULL; } } @@ -1561,6 +1566,15 @@ void OS_Windows::set_window_size(const Size2 p_size) { } MoveWindow(hWnd, rect.left, rect.top, w, h, TRUE); + + // Don't let the mouse leave the window when resizing to a smaller resolution + if (mouse_mode == MOUSE_MODE_CONFINED) { + RECT rect; + GetClientRect(hWnd, &rect); + ClientToScreen(hWnd, (POINT *)&rect.left); + ClientToScreen(hWnd, (POINT *)&rect.right); + ClipCursor(&rect); + } } void OS_Windows::set_window_fullscreen(bool p_enabled) { @@ -1767,6 +1781,7 @@ void OS_Windows::set_borderless_window(bool p_borderless) { video_mode.borderless_window = p_borderless; + preserve_window_size = true; _update_window_style(); } @@ -1785,7 +1800,7 @@ void OS_Windows::_update_window_style(bool repaint) { } } - SetWindowPos(hWnd, video_mode.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(hWnd, video_mode.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE); if (repaint) { RECT rect; @@ -1996,7 +2011,7 @@ void OS_Windows::set_cursor_shape(CursorShape p_shape) { if (cursor_shape == p_shape) return; - if (mouse_mode != MOUSE_MODE_VISIBLE) { + if (mouse_mode != MOUSE_MODE_VISIBLE && mouse_mode != MOUSE_MODE_CONFINED) { cursor_shape = p_shape; return; } @@ -2117,6 +2132,11 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap if (hXorMask != NULL) { DeleteObject(hXorMask); } + } else { + // Reset to default system cursor + cursors[p_shape] = NULL; + cursor_shape = CURSOR_MAX; + set_cursor_shape(p_shape); } } diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 221109318e..81849497ee 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -105,6 +105,7 @@ class OS_Windows : public OS { Size2 window_rect; VideoMode video_mode; + bool preserve_window_size = false; MainLoop *main_loop; diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 117995ea48..7b514d0f90 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1292,6 +1292,9 @@ void OS_X11::set_borderless_window(bool p_borderless) { hints.decorations = current_videomode.borderless_window ? 0 : 1; property = XInternAtom(x11_display, "_MOTIF_WM_HINTS", True); XChangeProperty(x11_display, x11_window, property, property, 32, PropModeReplace, (unsigned char *)&hints, 5); + + // Preserve window size + set_window_size(Size2(current_videomode.width, current_videomode.height)); } bool OS_X11::get_borderless_window() { @@ -2407,7 +2410,7 @@ void OS_X11::set_cursor_shape(CursorShape p_shape) { if (p_shape == current_cursor) return; - if (mouse_mode == MOUSE_MODE_VISIBLE) { + if (mouse_mode == MOUSE_MODE_VISIBLE && mouse_mode != MOUSE_MODE_CONFINED) { if (cursors[p_shape] != None) XDefineCursor(x11_display, x11_window, cursors[p_shape]); else if (cursors[CURSOR_ARROW] != None) @@ -2486,6 +2489,14 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c if (p_shape == CURSOR_ARROW) { XDefineCursor(x11_display, x11_window, cursors[p_shape]); } + } else { + // Reset to default system cursor + if (img[p_shape]) { + cursors[p_shape] = XcursorImageLoadCursor(x11_display, img[p_shape]); + } + + current_cursor = CURSOR_MAX; + set_cursor_shape(p_shape); } } |