Move DisplayServer enums and typedefs to DisplayServerEnums

This will allow decoupling `display_server.h` from a number of headers in the
codebase which only require those enums and not all the DisplayServer API.
This commit is contained in:
Rémi Verschelde 2026-02-26 12:36:47 +01:00
parent 778cf54dab
commit a447ac95ec
No known key found for this signature in database
GPG key ID: C3336907360768E1
160 changed files with 4584 additions and 4520 deletions

View file

@ -32,6 +32,7 @@
#include "core/config/project_settings.h"
#include "core/object/callable_method_pointer.h"
#include "servers/display/display_server.h"
#include "servers/text/text_server.h"
TTS_Linux *TTS_Linux::singleton = nullptr;
@ -91,7 +92,7 @@ void TTS_Linux::_speech_index_mark(int p_msg_id, int p_type, const String &p_ind
_THREAD_SAFE_METHOD_
if (ids.has(p_msg_id)) {
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_BOUNDARY, ids[p_msg_id], p_index_mark.to_int());
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_BOUNDARY, ids[p_msg_id], p_index_mark.to_int());
}
}
@ -125,19 +126,19 @@ void TTS_Linux::_speech_event(int p_msg_id, int p_type) {
if (!paused && ids.has(p_msg_id)) {
if ((SPDNotificationType)p_type == SPD_EVENT_END) {
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_ENDED, ids[p_msg_id]);
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_ENDED, ids[p_msg_id]);
ids.erase(p_msg_id);
last_msg_id = -1;
speaking = false;
} else if ((SPDNotificationType)p_type == SPD_EVENT_CANCEL) {
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, ids[p_msg_id]);
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_CANCELED, ids[p_msg_id]);
ids.erase(p_msg_id);
last_msg_id = -1;
speaking = false;
}
}
if (!speaking && queue.size() > 0) {
DisplayServer::TTSUtterance &message = queue.front()->get();
TTSUtterance &message = queue.front()->get();
// Inject index mark after each word.
String text;
@ -175,7 +176,7 @@ void TTS_Linux::_speech_event(int p_msg_id, int p_type) {
spd_set_data_mode(synth, SPD_DATA_SSML);
last_msg_id = spd_say(synth, SPD_TEXT, text.utf8().get_data());
ids[last_msg_id] = message.id;
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_STARTED, message.id);
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_STARTED, message.id);
queue.pop_front();
speaking = true;
@ -217,11 +218,11 @@ void TTS_Linux::speak(const String &p_text, const String &p_voice, int p_volume,
}
if (p_text.is_empty()) {
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, p_utterance_id);
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_CANCELED, p_utterance_id);
return;
}
DisplayServer::TTSUtterance message;
TTSUtterance message;
message.text = p_text;
message.voice = p_voice;
message.volume = CLAMP(p_volume, 0, 100);
@ -258,11 +259,11 @@ void TTS_Linux::stop() {
_THREAD_SAFE_METHOD_
ERR_FAIL_NULL(synth);
for (DisplayServer::TTSUtterance &message : queue) {
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, message.id);
for (TTSUtterance &message : queue) {
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_CANCELED, message.id);
}
if ((last_msg_id != -1) && ids.has(last_msg_id)) {
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, ids[last_msg_id]);
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_CANCELED, ids[last_msg_id]);
}
queue.clear();
ids.clear();