diff options
Diffstat (limited to 'platform/linuxbsd/wayland/display_server_wayland.cpp')
-rw-r--r-- | platform/linuxbsd/wayland/display_server_wayland.cpp | 65 |
1 files changed, 27 insertions, 38 deletions
diff --git a/platform/linuxbsd/wayland/display_server_wayland.cpp b/platform/linuxbsd/wayland/display_server_wayland.cpp index 2074d7228d..3fbbc263a0 100644 --- a/platform/linuxbsd/wayland/display_server_wayland.cpp +++ b/platform/linuxbsd/wayland/display_server_wayland.cpp @@ -327,15 +327,7 @@ void DisplayServerWayland::mouse_set_mode(MouseMode p_mode) { bool show_cursor = (p_mode == MOUSE_MODE_VISIBLE || p_mode == MOUSE_MODE_CONFINED); - if (show_cursor) { - if (custom_cursors.has(cursor_shape)) { - wayland_thread.cursor_set_custom_shape(cursor_shape); - } else { - wayland_thread.cursor_set_shape(cursor_shape); - } - } else { - wayland_thread.cursor_hide(); - } + wayland_thread.cursor_set_visible(show_cursor); WaylandThread::PointerConstraint constraint = WaylandThread::PointerConstraint::NONE; @@ -993,11 +985,7 @@ void DisplayServerWayland::cursor_set_shape(CursorShape p_shape) { return; } - if (custom_cursors.has(p_shape)) { - wayland_thread.cursor_set_custom_shape(p_shape); - } else { - wayland_thread.cursor_set_shape(p_shape); - } + wayland_thread.cursor_set_shape(p_shape); } DisplayServerWayland::CursorShape DisplayServerWayland::cursor_get_shape() const { @@ -1009,18 +997,13 @@ DisplayServerWayland::CursorShape DisplayServerWayland::cursor_get_shape() const void DisplayServerWayland::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) { MutexLock mutex_lock(wayland_thread.mutex); - bool visible = (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED); - if (p_cursor.is_valid()) { HashMap<CursorShape, CustomCursor>::Iterator cursor_c = custom_cursors.find(p_shape); if (cursor_c) { if (cursor_c->value.rid == p_cursor->get_rid() && cursor_c->value.hotspot == p_hotspot) { // We have a cached cursor. Nice. - if (visible) { - wayland_thread.cursor_set_custom_shape(p_shape); - } - + wayland_thread.cursor_set_shape(p_shape); return; } @@ -1039,20 +1022,18 @@ void DisplayServerWayland::cursor_set_custom_image(const Ref<Resource> &p_cursor wayland_thread.cursor_shape_set_custom_image(p_shape, image, p_hotspot); - if (visible) { - wayland_thread.cursor_set_custom_shape(p_shape); - } + wayland_thread.cursor_set_shape(p_shape); } else { // Clear cache and reset to default system cursor. - if (cursor_shape == p_shape && visible) { + wayland_thread.cursor_shape_clear_custom_image(p_shape); + + if (cursor_shape == p_shape) { wayland_thread.cursor_set_shape(p_shape); } if (custom_cursors.has(p_shape)) { custom_cursors.erase(p_shape); } - - wayland_thread.cursor_shape_clear_custom_image(p_shape); } } @@ -1363,20 +1344,28 @@ DisplayServerWayland::DisplayServerWayland(const String &p_rendering_driver, Win if (rendering_context->initialize() != OK) { memdelete(rendering_context); rendering_context = nullptr; - r_error = ERR_CANT_CREATE; + bool fallback_to_opengl3 = GLOBAL_GET("rendering/rendering_device/fallback_to_opengl3"); + if (fallback_to_opengl3 && rendering_driver != "opengl3") { + WARN_PRINT("Your video card drivers seem not to support the required Vulkan version, switching to OpenGL 3."); + rendering_driver = "opengl3"; + OS::get_singleton()->set_current_rendering_method("gl_compatibility"); + OS::get_singleton()->set_current_rendering_driver_name(rendering_driver); + } else { + r_error = ERR_CANT_CREATE; - if (p_rendering_driver == "vulkan") { - OS::get_singleton()->alert( - vformat("Your video card drivers seem not to support the required Vulkan version.\n\n" - "If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n" - "You can enable the OpenGL 3 driver by starting the engine from the\n" - "command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n" - "If you recently updated your video card drivers, try rebooting.", - executable_name), - "Unable to initialize Vulkan video driver"); - } + if (p_rendering_driver == "vulkan") { + OS::get_singleton()->alert( + vformat("Your video card drivers seem not to support the required Vulkan version.\n\n" + "If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n" + "You can enable the OpenGL 3 driver by starting the engine from the\n" + "command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n" + "If you recently updated your video card drivers, try rebooting.", + executable_name), + "Unable to initialize Vulkan video driver"); + } - ERR_FAIL_MSG(vformat("Could not initialize %s", rendering_driver)); + ERR_FAIL_MSG(vformat("Could not initialize %s", rendering_driver)); + } } driver_found = true; |