Browse Source

Do not call `accessibility_set_window_rect` on Wayland, fix main windows accessibility context creation.

Pāvels Nadtočajevs 3 months ago
parent
commit
5441a82cfb
2 changed files with 11 additions and 1 deletions
  1. 10 0
      platform/linuxbsd/wayland/display_server_wayland.cpp
  2. 1 1
      scene/main/window.cpp

+ 10 - 0
platform/linuxbsd/wayland/display_server_wayland.cpp

@@ -2074,6 +2074,16 @@ DisplayServerWayland::DisplayServerWayland(const String &p_rendering_driver, Win
 	wd.rect.size = p_resolution;
 	wd.title = "Godot";
 
+#ifdef ACCESSKIT_ENABLED
+	if (accessibility_driver && !accessibility_driver->window_create(wd.id, nullptr)) {
+		if (OS::get_singleton()->is_stdout_verbose()) {
+			ERR_PRINT("Can't create an accessibility adapter for window, accessibility support disabled!");
+		}
+		memdelete(accessibility_driver);
+		accessibility_driver = nullptr;
+	}
+#endif
+
 	show_window(MAIN_WINDOW_ID);
 
 #ifdef RD_ENABLED

+ 1 - 1
scene/main/window.cpp

@@ -761,7 +761,7 @@ void Window::_rect_changed_callback(const Rect2i &p_callback) {
 		size = p_callback.size;
 		_update_viewport_size();
 	}
-	if (window_id != DisplayServer::INVALID_WINDOW_ID) {
+	if (window_id != DisplayServer::INVALID_WINDOW_ID && !DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_SELF_FITTING_WINDOWS)) {
 		Vector2 sz_out = DisplayServer::get_singleton()->window_get_size_with_decorations(window_id);
 		Vector2 pos_out = DisplayServer::get_singleton()->window_get_position_with_decorations(window_id);
 		Vector2 sz_in = DisplayServer::get_singleton()->window_get_size(window_id);