summaryrefslogtreecommitdiff
path: root/scene/gui/line_edit.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-07-27 09:01:58 +0200
committerGitHub <noreply@github.com>2018-07-27 09:01:58 +0200
commit7056dc601130ae0aa97b5399db3f66b138e462c9 (patch)
tree9bf708325383ea8f338bb9a27c1f92a569b0f407 /scene/gui/line_edit.cpp
parent4c0ded6dcc81f5c551d18c7d42c34230f07b359d (diff)
parent8d05f89bc1eabfe6d682b850ea22cf32d5d97285 (diff)
Merge pull request #20498 from Calinou/caret-width-hidpi
Make the caret thicker in TextEdit and scale it with the editor scale
Diffstat (limited to 'scene/gui/line_edit.cpp')
-rw-r--r--scene/gui/line_edit.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index b71a4dd133..4d73ee2d56 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -35,7 +35,9 @@
#include "os/os.h"
#include "print_string.h"
#include "translation.h"
+
#ifdef TOOLS_ENABLED
+#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#endif
@@ -716,7 +718,11 @@ void LineEdit::_notification(int p_what) {
if (char_ofs == cursor_pos && draw_caret) {
if (ime_text.length() == 0) {
+#ifdef TOOLS_ENABLED
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(Math::round(EDSCALE), caret_height)), cursor_color);
+#else
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(1, caret_height)), cursor_color);
+#endif
}
}
@@ -755,7 +761,11 @@ void LineEdit::_notification(int p_what) {
if (char_ofs == cursor_pos && draw_caret) { //may be at the end
if (ime_text.length() == 0) {
+#ifdef TOOLS_ENABLED
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(Math::round(EDSCALE), caret_height)), cursor_color);
+#else
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(1, caret_height)), cursor_color);
+#endif
}
}