You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Effective DisplayServer separation, rename X11 -> LinuxBSD
This commit is contained in:
committed by
Juan Linietsky
parent
4396e98834
commit
f8a79a97c7
@@ -36,12 +36,12 @@
|
||||
#include "core/print_string.h"
|
||||
#include "core/translation.h"
|
||||
#include "label.h"
|
||||
|
||||
#include "servers/display_server.h"
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/editor_scale.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#endif
|
||||
|
||||
#include "scene/main/viewport.h"
|
||||
static bool _is_text_char(CharType c) {
|
||||
|
||||
return !is_symbol(c);
|
||||
@@ -127,8 +127,8 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||
selection.creating = false;
|
||||
selection.doubleclick = false;
|
||||
|
||||
if (OS::get_singleton()->has_virtual_keyboard())
|
||||
OS::get_singleton()->show_virtual_keyboard(text, get_global_rect(), max_length);
|
||||
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_VIRTUAL_KEYBOARD))
|
||||
DisplayServer::get_singleton()->virtual_keyboard_show(text, get_global_rect(), max_length);
|
||||
}
|
||||
|
||||
update();
|
||||
@@ -304,8 +304,8 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||
case KEY_ENTER: {
|
||||
|
||||
emit_signal("text_entered", text);
|
||||
if (OS::get_singleton()->has_virtual_keyboard())
|
||||
OS::get_singleton()->hide_virtual_keyboard();
|
||||
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_VIRTUAL_KEYBOARD))
|
||||
DisplayServer::get_singleton()->virtual_keyboard_hide();
|
||||
|
||||
} break;
|
||||
|
||||
@@ -914,8 +914,8 @@ void LineEdit::_notification(int p_what) {
|
||||
|
||||
if (has_focus()) {
|
||||
|
||||
OS::get_singleton()->set_ime_active(true);
|
||||
OS::get_singleton()->set_ime_position(get_global_position() + Point2(using_placeholder ? 0 : x_ofs, y_ofs + caret_height));
|
||||
DisplayServer::get_singleton()->window_set_ime_active(true, get_viewport()->get_window_id());
|
||||
DisplayServer::get_singleton()->window_set_ime_position(get_global_position() + Point2(using_placeholder ? 0 : x_ofs, y_ofs + caret_height), get_viewport()->get_window_id());
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_FOCUS_ENTER: {
|
||||
@@ -926,12 +926,12 @@ void LineEdit::_notification(int p_what) {
|
||||
draw_caret = true;
|
||||
}
|
||||
|
||||
OS::get_singleton()->set_ime_active(true);
|
||||
DisplayServer::get_singleton()->window_set_ime_active(true, get_viewport()->get_window_id());
|
||||
Point2 cursor_pos = Point2(get_cursor_position(), 1) * get_minimum_size().height;
|
||||
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos);
|
||||
DisplayServer::get_singleton()->window_set_ime_position(get_global_position() + cursor_pos, get_viewport()->get_window_id());
|
||||
|
||||
if (OS::get_singleton()->has_virtual_keyboard())
|
||||
OS::get_singleton()->show_virtual_keyboard(text, get_global_rect(), max_length);
|
||||
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_VIRTUAL_KEYBOARD))
|
||||
DisplayServer::get_singleton()->virtual_keyboard_show(text, get_global_rect(), max_length);
|
||||
|
||||
} break;
|
||||
case NOTIFICATION_FOCUS_EXIT: {
|
||||
@@ -940,20 +940,20 @@ void LineEdit::_notification(int p_what) {
|
||||
caret_blink_timer->stop();
|
||||
}
|
||||
|
||||
OS::get_singleton()->set_ime_position(Point2());
|
||||
OS::get_singleton()->set_ime_active(false);
|
||||
DisplayServer::get_singleton()->window_set_ime_position(Point2(), get_viewport()->get_window_id());
|
||||
DisplayServer::get_singleton()->window_set_ime_active(false, get_viewport()->get_window_id());
|
||||
ime_text = "";
|
||||
ime_selection = Point2();
|
||||
|
||||
if (OS::get_singleton()->has_virtual_keyboard())
|
||||
OS::get_singleton()->hide_virtual_keyboard();
|
||||
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_VIRTUAL_KEYBOARD))
|
||||
DisplayServer::get_singleton()->virtual_keyboard_hide();
|
||||
|
||||
} break;
|
||||
case MainLoop::NOTIFICATION_OS_IME_UPDATE: {
|
||||
|
||||
if (has_focus()) {
|
||||
ime_text = OS::get_singleton()->get_ime_text();
|
||||
ime_selection = OS::get_singleton()->get_ime_selection();
|
||||
ime_text = DisplayServer::get_singleton()->ime_get_text();
|
||||
ime_selection = DisplayServer::get_singleton()->ime_get_selection();
|
||||
update();
|
||||
}
|
||||
} break;
|
||||
@@ -963,14 +963,14 @@ void LineEdit::_notification(int p_what) {
|
||||
void LineEdit::copy_text() {
|
||||
|
||||
if (selection.enabled && !pass) {
|
||||
OS::get_singleton()->set_clipboard(text.substr(selection.begin, selection.end - selection.begin));
|
||||
DisplayServer::get_singleton()->clipboard_set(text.substr(selection.begin, selection.end - selection.begin));
|
||||
}
|
||||
}
|
||||
|
||||
void LineEdit::cut_text() {
|
||||
|
||||
if (selection.enabled && !pass) {
|
||||
OS::get_singleton()->set_clipboard(text.substr(selection.begin, selection.end - selection.begin));
|
||||
DisplayServer::get_singleton()->clipboard_set(text.substr(selection.begin, selection.end - selection.begin));
|
||||
selection_delete();
|
||||
}
|
||||
}
|
||||
@@ -978,7 +978,7 @@ void LineEdit::cut_text() {
|
||||
void LineEdit::paste_text() {
|
||||
|
||||
// Strip escape characters like \n and \t as they can't be displayed on LineEdit.
|
||||
String paste_buffer = OS::get_singleton()->get_clipboard().strip_escapes();
|
||||
String paste_buffer = DisplayServer::get_singleton()->clipboard_get().strip_escapes();
|
||||
|
||||
if (paste_buffer != "") {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user