summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/base_button.cpp7
-rw-r--r--scene/gui/code_edit.cpp35
-rw-r--r--scene/gui/color_picker.cpp7
-rw-r--r--scene/gui/control.cpp12
-rw-r--r--scene/gui/file_dialog.cpp10
-rw-r--r--scene/gui/popup_menu.cpp11
-rw-r--r--scene/gui/popup_menu.h2
-rw-r--r--scene/gui/rich_text_label.cpp152
-rw-r--r--scene/gui/rich_text_label.h5
-rw-r--r--scene/gui/text_edit.cpp19
-rw-r--r--scene/gui/video_stream_player.cpp4
-rw-r--r--scene/gui/video_stream_player.h4
12 files changed, 196 insertions, 72 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 3d95677dcf..af6a99ca62 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -264,7 +264,7 @@ bool BaseButton::is_hovered() const {
BaseButton::DrawMode BaseButton::get_draw_mode() const {
if (status.disabled) {
return DRAW_DISABLED;
- };
+ }
if (!status.press_attempt && status.hovering) {
if (status.pressed) {
@@ -273,8 +273,7 @@ BaseButton::DrawMode BaseButton::get_draw_mode() const {
return DRAW_HOVER;
} else {
- /* determine if pressed or not */
-
+ // Determine if pressed or not.
bool pressing;
if (status.press_attempt) {
pressing = (status.pressing_inside || keep_pressed_outside);
@@ -291,8 +290,6 @@ BaseButton::DrawMode BaseButton::get_draw_mode() const {
return DRAW_NORMAL;
}
}
-
- return DRAW_NORMAL;
}
void BaseButton::set_toggle_mode(bool p_on) {
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index f6e0e4216d..8069ab465b 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -1216,30 +1216,39 @@ bool CodeEdit::is_drawing_executing_lines_gutter() const {
}
void CodeEdit::_main_gutter_draw_callback(int p_line, int p_gutter, const Rect2 &p_region) {
+ bool shift_pressed = Input::get_singleton()->is_key_pressed(Key::SHIFT);
+
if (draw_breakpoints && breakpoint_icon.is_valid()) {
bool hovering = p_region.has_point(get_local_mouse_pos());
bool breakpointed = is_line_breakpointed(p_line);
- if (breakpointed || (hovering && !is_dragging_cursor())) {
+ if (breakpointed || (hovering && !is_dragging_cursor() && !shift_pressed)) {
int padding = p_region.size.x / 6;
Rect2 icon_region = p_region;
icon_region.position += Point2(padding, padding);
icon_region.size -= Point2(padding, padding) * 2;
- // Darken icon when hovering & not yet breakpointed.
- Color use_color = hovering && !breakpointed ? breakpoint_color.darkened(0.4) : breakpoint_color;
+ // Darken icon when hovering, shift not pressed & not yet breakpointed.
+ Color use_color = hovering && !breakpointed && !shift_pressed ? breakpoint_color.darkened(0.4) : breakpoint_color;
breakpoint_icon->draw_rect(get_canvas_item(), icon_region, false, use_color);
}
}
- if (draw_bookmarks && is_line_bookmarked(p_line) && bookmark_icon.is_valid()) {
- int horizontal_padding = p_region.size.x / 2;
- int vertical_padding = p_region.size.y / 4;
+ if (draw_bookmarks && bookmark_icon.is_valid()) {
+ bool hovering = p_region.has_point(get_local_mouse_pos());
+ bool bookmarked = is_line_bookmarked(p_line);
- Rect2 bookmark_region = p_region;
- bookmark_region.position += Point2(horizontal_padding, 0);
- bookmark_region.size -= Point2(horizontal_padding * 1.1, vertical_padding);
- bookmark_icon->draw_rect(get_canvas_item(), bookmark_region, false, bookmark_color);
+ if (bookmarked || (hovering && !is_dragging_cursor() && shift_pressed)) {
+ int horizontal_padding = p_region.size.x / 2;
+ int vertical_padding = p_region.size.y / 4;
+ Rect2 icon_region = p_region;
+ icon_region.position += Point2(horizontal_padding, 0);
+ icon_region.size -= Point2(horizontal_padding * 1.1, vertical_padding);
+
+ // Darken icon when hovering, shift pressed & not yet bookmarked.
+ Color use_color = hovering && !bookmarked && shift_pressed ? bookmark_color.darkened(0.4) : bookmark_color;
+ bookmark_icon->draw_rect(get_canvas_item(), icon_region, false, use_color);
+ }
}
if (draw_executing_lines && is_line_executing(p_line) && executing_line_icon.is_valid()) {
@@ -2378,9 +2387,13 @@ int CodeEdit::_get_auto_brace_pair_close_at_pos(int p_line, int p_col) {
/* Gutters */
void CodeEdit::_gutter_clicked(int p_line, int p_gutter) {
+ bool shift_pressed = Input::get_singleton()->is_key_pressed(Key::SHIFT);
+
if (p_gutter == main_gutter) {
- if (draw_breakpoints) {
+ if (draw_breakpoints && !shift_pressed) {
set_line_as_breakpoint(p_line, !is_line_breakpointed(p_line));
+ } else if (draw_bookmarks && shift_pressed) {
+ set_line_as_bookmarked(p_line, !is_line_bookmarked(p_line));
}
return;
}
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 4a1f2ab7c6..5751c54877 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -427,12 +427,15 @@ void ColorPicker::_html_submitted(const String &p_html) {
return;
}
- float last_alpha = color.a;
+ Color previous_color = color;
color = Color::html(p_html);
if (!is_editing_alpha()) {
- color.a = last_alpha;
+ color.a = previous_color.a;
}
+ if (color == previous_color) {
+ return;
+ }
if (!is_inside_tree()) {
return;
}
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index ae94be8437..dc9294df6d 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2225,7 +2225,19 @@ void Control::_window_find_focus_neighbor(const Vector2 &p_dir, Node *p_at, cons
void Control::set_default_cursor_shape(CursorShape p_shape) {
ERR_FAIL_INDEX(int(p_shape), CURSOR_MAX);
+ if (data.default_cursor == p_shape) {
+ return;
+ }
data.default_cursor = p_shape;
+
+ if (!is_inside_tree()) {
+ return;
+ }
+ if (!get_global_rect().has_point(get_global_mouse_position())) {
+ return;
+ }
+
+ get_viewport()->get_base_window()->update_mouse_cursor_shape();
}
Control::CursorShape Control::get_default_cursor_shape() const {
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 57f27e299f..cf7f439aef 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -172,18 +172,20 @@ void FileDialog::shortcut_input(const Ref<InputEvent> &p_event) {
void FileDialog::set_enable_multiple_selection(bool p_enable) {
tree->set_select_mode(p_enable ? Tree::SELECT_MULTI : Tree::SELECT_SINGLE);
-};
+}
Vector<String> FileDialog::get_selected_files() const {
Vector<String> list;
TreeItem *item = tree->get_root();
- while ((item = tree->get_next_selected(item))) {
+ item = tree->get_next_selected(item);
+ while (item) {
list.push_back(dir_access->get_current_dir().path_join(item->get_text(0)));
- };
+ item = tree->get_next_selected(item);
+ }
return list;
-};
+}
void FileDialog::update_dir() {
if (root_prefix.is_empty()) {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index d4a4efd578..10e13042a7 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -1762,7 +1762,7 @@ void PopupMenu::clear() {
void PopupMenu::_ref_shortcut(Ref<Shortcut> p_sc) {
if (!shortcut_refcount.has(p_sc)) {
shortcut_refcount[p_sc] = 1;
- p_sc->connect("changed", callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
+ p_sc->connect("changed", callable_mp(this, &PopupMenu::_shortcut_changed));
} else {
shortcut_refcount[p_sc] += 1;
}
@@ -1772,11 +1772,18 @@ void PopupMenu::_unref_shortcut(Ref<Shortcut> p_sc) {
ERR_FAIL_COND(!shortcut_refcount.has(p_sc));
shortcut_refcount[p_sc]--;
if (shortcut_refcount[p_sc] == 0) {
- p_sc->disconnect("changed", callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
+ p_sc->disconnect("changed", callable_mp(this, &PopupMenu::_shortcut_changed));
shortcut_refcount.erase(p_sc);
}
}
+void PopupMenu::_shortcut_changed() {
+ for (int i = 0; i < items.size(); i++) {
+ items.write[i].dirty = true;
+ }
+ control->queue_redraw();
+}
+
// Hide on item selection determines whether or not the popup will close after item selection
void PopupMenu::set_hide_on_item_selection(bool p_enabled) {
hide_on_item_selection = p_enabled;
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index ad7909842e..89d3904456 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -121,6 +121,8 @@ class PopupMenu : public Popup {
void _ref_shortcut(Ref<Shortcut> p_sc);
void _unref_shortcut(Ref<Shortcut> p_sc);
+ void _shortcut_changed();
+
bool allow_search = true;
uint64_t search_time_msec = 0;
String search_string = "";
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 3c45b90612..7ea46a0b4f 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -52,7 +52,7 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) co
} else if (p_item->E->next()) {
return p_item->E->next()->get();
} else {
- //go up until something with a next is found
+ // Go up until something with a next is found.
while (p_item->parent && !p_item->E->next()) {
p_item = p_item->parent;
}
@@ -72,7 +72,7 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) co
} else if (p_item->E->next()) {
return p_item->E->next()->get();
} else {
- //go up until something with a next is found
+ // Go up until something with a next is found.
while (p_item->type != ITEM_FRAME && !p_item->E->next()) {
p_item = p_item->parent;
}
@@ -84,8 +84,6 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) co
}
}
}
-
- return nullptr;
}
RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) const {
@@ -97,7 +95,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) co
} else if (p_item->E->prev()) {
return p_item->E->prev()->get();
} else {
- //go back until something with a prev is found
+ // Go back until something with a prev is found.
while (p_item->parent && !p_item->E->prev()) {
p_item = p_item->parent;
}
@@ -117,7 +115,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) co
} else if (p_item->E->prev()) {
return p_item->E->prev()->get();
} else {
- //go back until something with a prev is found
+ // Go back until something with a prev is found.
while (p_item->type != ITEM_FRAME && !p_item->E->prev()) {
p_item = p_item->parent;
}
@@ -129,8 +127,6 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) co
}
}
}
-
- return nullptr;
}
Rect2 RichTextLabel::_get_text_rect() {
@@ -2196,24 +2192,69 @@ RichTextLabel::ItemFont *RichTextLabel::_find_font(Item *p_item) {
ItemFont *fi = static_cast<ItemFont *>(fontitem);
switch (fi->def_font) {
case NORMAL_FONT: {
- fi->font = theme_cache.normal_font;
- fi->font_size = theme_cache.normal_font_size;
+ if (fi->variation) {
+ Ref<FontVariation> fc = fi->font;
+ if (fc.is_valid()) {
+ fc->set_base_font(theme_cache.normal_font);
+ }
+ } else {
+ fi->font = theme_cache.normal_font;
+ }
+ if (fi->def_size) {
+ fi->font_size = theme_cache.normal_font_size;
+ }
} break;
case BOLD_FONT: {
- fi->font = theme_cache.bold_font;
- fi->font_size = theme_cache.bold_font_size;
+ if (fi->variation) {
+ Ref<FontVariation> fc = fi->font;
+ if (fc.is_valid()) {
+ fc->set_base_font(theme_cache.bold_font);
+ }
+ } else {
+ fi->font = theme_cache.bold_font;
+ }
+ if (fi->def_size) {
+ fi->font_size = theme_cache.bold_font_size;
+ }
} break;
case ITALICS_FONT: {
- fi->font = theme_cache.italics_font;
- fi->font_size = theme_cache.italics_font_size;
+ if (fi->variation) {
+ Ref<FontVariation> fc = fi->font;
+ if (fc.is_valid()) {
+ fc->set_base_font(theme_cache.italics_font);
+ }
+ } else {
+ fi->font = theme_cache.italics_font;
+ }
+ if (fi->def_size) {
+ fi->font_size = theme_cache.italics_font_size;
+ }
} break;
case BOLD_ITALICS_FONT: {
- fi->font = theme_cache.bold_italics_font;
- fi->font_size = theme_cache.bold_italics_font_size;
+ if (fi->variation) {
+ Ref<FontVariation> fc = fi->font;
+ if (fc.is_valid()) {
+ fc->set_base_font(theme_cache.bold_italics_font);
+ }
+ } else {
+ fi->font = theme_cache.bold_italics_font;
+ }
+ if (fi->def_size) {
+ fi->font_size = theme_cache.bold_italics_font_size;
+ }
} break;
case MONO_FONT: {
- fi->font = theme_cache.mono_font;
- fi->font_size = theme_cache.mono_font_size;
+ if (fi->variation) {
+ Ref<FontVariation> fc = fi->font;
+ if (fc.is_valid()) {
+ fc->set_base_font(theme_cache.mono_font);
+ }
+ } else {
+ fi->font = theme_cache.mono_font;
+ }
+ if (fi->def_size) {
+ fi->font_size = theme_cache.mono_font_size;
+ }
} break;
default: {
} break;
@@ -3034,14 +3075,30 @@ void RichTextLabel::push_dropcap(const String &p_string, const Ref<Font> &p_font
_add_item(item, false);
}
-void RichTextLabel::_push_def_font(DefaultFont p_font) {
+void RichTextLabel::_push_def_font_var(DefaultFont p_def_font, const Ref<Font> &p_font, int p_size) {
+ _stop_thread();
+ MutexLock data_lock(data_mutex);
+
+ ERR_FAIL_COND(current->type == ITEM_TABLE);
+ ItemFont *item = memnew(ItemFont);
+
+ item->def_font = p_def_font;
+ item->variation = true;
+ item->font = p_font;
+ item->font_size = p_size;
+ item->def_size = (p_size <= 0);
+ _add_item(item, true);
+}
+
+void RichTextLabel::_push_def_font(DefaultFont p_def_font) {
_stop_thread();
MutexLock data_lock(data_mutex);
ERR_FAIL_COND(current->type == ITEM_TABLE);
ItemFont *item = memnew(ItemFont);
- item->def_font = p_font;
+ item->def_font = p_def_font;
+ item->def_size = true;
_add_item(item, true);
}
@@ -4122,24 +4179,21 @@ void RichTextLabel::append_text(const String &p_bbcode) {
pos = brk_end + 1;
tag_stack.push_front("font_size");
- } else if (tag.begins_with("opentype_features=")) {
- String fnt_ftr = tag.substr(18, tag.length());
+ } else if (tag.begins_with("opentype_features=") || tag.begins_with("otf=")) {
+ int value_pos = tag.find("=");
+ String fnt_ftr = tag.substr(value_pos + 1);
Vector<String> subtag = fnt_ftr.split(",");
if (subtag.size() > 0) {
Ref<Font> font = theme_cache.normal_font;
- int font_size = 0;
+ DefaultFont def_font = NORMAL_FONT;
+
ItemFont *font_it = _find_font(current);
if (font_it) {
if (font_it->font.is_valid()) {
font = font_it->font;
- }
- if (font_it->font_size > 0) {
- font_size = font_it->font_size;
+ def_font = font_it->def_font;
}
}
- Ref<FontVariation> fc;
- fc.instantiate();
- fc->set_base_font(font);
Dictionary features;
for (int i = 0; i < subtag.size(); i++) {
Vector<String> subtag_a = subtag[i].split("=");
@@ -4149,11 +4203,21 @@ void RichTextLabel::append_text(const String &p_bbcode) {
features[TS->name_to_tag(subtag_a[0])] = 1;
}
}
+
+ Ref<FontVariation> fc;
+ fc.instantiate();
+
+ fc->set_base_font(font);
fc->set_opentype_features(features);
- push_font(fc, font_size);
+
+ if (def_font != CUSTOM_FONT) {
+ _push_def_font_var(def_font, fc);
+ } else {
+ push_font(fc);
+ }
}
pos = brk_end + 1;
- tag_stack.push_front("opentype_features");
+ tag_stack.push_front(tag.substr(0, value_pos));
} else if (tag.begins_with("font=")) {
String fnt = tag.substr(5, tag.length());
@@ -4169,9 +4233,21 @@ void RichTextLabel::append_text(const String &p_bbcode) {
} else if (tag.begins_with("font ")) {
Vector<String> subtag = tag.substr(2, tag.length()).split(" ");
+ Ref<Font> font = theme_cache.normal_font;
+ DefaultFont def_font = NORMAL_FONT;
+
+ ItemFont *font_it = _find_font(current);
+ if (font_it) {
+ if (font_it->font.is_valid()) {
+ font = font_it->font;
+ def_font = font_it->def_font;
+ }
+ }
+
Ref<FontVariation> fc;
fc.instantiate();
- int fnt_size = 0;
+
+ int fnt_size = -1;
for (int i = 1; i < subtag.size(); i++) {
Vector<String> subtag_a = subtag[i].split("=", true, 2);
if (subtag_a.size() == 2) {
@@ -4179,7 +4255,8 @@ void RichTextLabel::append_text(const String &p_bbcode) {
String fnt = subtag_a[1];
Ref<Font> font_data = ResourceLoader::load(fnt, "Font");
if (font_data.is_valid()) {
- fc->set_base_font(font_data);
+ font = font_data;
+ def_font = CUSTOM_FONT;
}
} else if (subtag_a[0] == "size" || subtag_a[0] == "s") {
fnt_size = subtag_a[1].to_int();
@@ -4233,7 +4310,14 @@ void RichTextLabel::append_text(const String &p_bbcode) {
}
}
}
- push_font(fc, fnt_size);
+ fc->set_base_font(font);
+
+ if (def_font != CUSTOM_FONT) {
+ _push_def_font_var(def_font, fc, fnt_size);
+ } else {
+ push_font(fc, fnt_size);
+ }
+
pos = brk_end + 1;
tag_stack.push_front("font");
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index e714cb4ced..71123602ad 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -189,6 +189,8 @@ private:
struct ItemFont : public Item {
DefaultFont def_font = CUSTOM_FONT;
Ref<Font> font;
+ bool variation = false;
+ bool def_size = false;
int font_size = 0;
ItemFont() { type = ITEM_FONT; }
};
@@ -571,7 +573,8 @@ public:
void add_newline();
bool remove_line(const int p_line);
void push_dropcap(const String &p_string, const Ref<Font> &p_font, int p_size, const Rect2 &p_dropcap_margins = Rect2(), const Color &p_color = Color(1, 1, 1), int p_ol_size = 0, const Color &p_ol_color = Color(0, 0, 0, 0));
- void _push_def_font(DefaultFont p_font);
+ void _push_def_font(DefaultFont p_def_font);
+ void _push_def_font_var(DefaultFont p_def_font, const Ref<Font> &p_font, int p_size = -1);
void push_font(const Ref<Font> &p_font, int p_size = 0);
void push_font_size(int p_font_size);
void push_outline_size(int p_font_size);
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 318447ecd8..38302136d6 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1201,13 +1201,14 @@ void TextEdit::_notification(int p_what) {
current_color.a = font_readonly_color.a;
}
}
+ Color gl_color = current_color;
if (selection.active && line >= selection.from_line && line <= selection.to_line) { // Selection
int sel_from = (line > selection.from_line) ? TS->shaped_text_get_range(rid).x : selection.from_column;
int sel_to = (line < selection.to_line) ? TS->shaped_text_get_range(rid).y : selection.to_column;
if (glyphs[j].start >= sel_from && glyphs[j].end <= sel_to && override_selected_font_color) {
- current_color = font_selected_color;
+ gl_color = font_selected_color;
}
}
@@ -1217,29 +1218,29 @@ void TextEdit::_notification(int p_what) {
if ((brace_open_match_line == line && brace_open_match_column == glyphs[j].start) ||
(caret.column == glyphs[j].start && caret.line == line && caret_wrap_index == line_wrap_index && (brace_open_matching || brace_open_mismatch))) {
if (brace_open_mismatch) {
- current_color = brace_mismatch_color;
+ gl_color = brace_mismatch_color;
}
Rect2 rect = Rect2(char_pos, ofs_y + font->get_underline_position(font_size), glyphs[j].advance * glyphs[j].repeat, MAX(font->get_underline_thickness(font_size) * get_theme_default_base_scale(), 1));
- draw_rect(rect, current_color);
+ draw_rect(rect, gl_color);
}
if ((brace_close_match_line == line && brace_close_match_column == glyphs[j].start) ||
(caret.column == glyphs[j].start + 1 && caret.line == line && caret_wrap_index == line_wrap_index && (brace_close_matching || brace_close_mismatch))) {
if (brace_close_mismatch) {
- current_color = brace_mismatch_color;
+ gl_color = brace_mismatch_color;
}
Rect2 rect = Rect2(char_pos, ofs_y + font->get_underline_position(font_size), glyphs[j].advance * glyphs[j].repeat, MAX(font->get_underline_thickness(font_size) * get_theme_default_base_scale(), 1));
- draw_rect(rect, current_color);
+ draw_rect(rect, gl_color);
}
}
if (draw_tabs && ((glyphs[j].flags & TextServer::GRAPHEME_IS_TAB) == TextServer::GRAPHEME_IS_TAB)) {
int yofs = (text_height - tab_icon->get_height()) / 2 - ldata->get_line_ascent(line_wrap_index);
- tab_icon->draw(ci, Point2(char_pos, ofs_y + yofs), current_color);
+ tab_icon->draw(ci, Point2(char_pos, ofs_y + yofs), gl_color);
} else if (draw_spaces && ((glyphs[j].flags & TextServer::GRAPHEME_IS_SPACE) == TextServer::GRAPHEME_IS_SPACE)) {
int yofs = (text_height - space_icon->get_height()) / 2 - ldata->get_line_ascent(line_wrap_index);
int xofs = (glyphs[j].advance * glyphs[j].repeat - space_icon->get_width()) / 2;
- space_icon->draw(ci, Point2(char_pos + xofs, ofs_y + yofs), current_color);
+ space_icon->draw(ci, Point2(char_pos + xofs, ofs_y + yofs), gl_color);
}
}
@@ -1247,10 +1248,10 @@ void TextEdit::_notification(int p_what) {
for (int k = 0; k < glyphs[j].repeat; k++) {
if (!clipped && (char_ofs + char_margin) >= xmargin_beg && (char_ofs + glyphs[j].advance + char_margin) <= xmargin_end) {
if (glyphs[j].font_rid != RID()) {
- TS->font_draw_glyph(glyphs[j].font_rid, ci, glyphs[j].font_size, Vector2(char_margin + char_ofs + ofs_x + glyphs[j].x_off, ofs_y + glyphs[j].y_off), glyphs[j].index, current_color);
+ TS->font_draw_glyph(glyphs[j].font_rid, ci, glyphs[j].font_size, Vector2(char_margin + char_ofs + ofs_x + glyphs[j].x_off, ofs_y + glyphs[j].y_off), glyphs[j].index, gl_color);
had_glyphs_drawn = true;
} else if ((glyphs[j].flags & TextServer::GRAPHEME_IS_VIRTUAL) != TextServer::GRAPHEME_IS_VIRTUAL) {
- TS->draw_hex_code_box(ci, glyphs[j].font_size, Vector2(char_margin + char_ofs + ofs_x + glyphs[j].x_off, ofs_y + glyphs[j].y_off), glyphs[j].index, current_color);
+ TS->draw_hex_code_box(ci, glyphs[j].font_size, Vector2(char_margin + char_ofs + ofs_x + glyphs[j].x_off, ofs_y + glyphs[j].y_off), glyphs[j].index, gl_color);
had_glyphs_drawn = true;
}
}
diff --git a/scene/gui/video_stream_player.cpp b/scene/gui/video_stream_player.cpp
index 1e03ed6e76..0ea49b1645 100644
--- a/scene/gui/video_stream_player.cpp
+++ b/scene/gui/video_stream_player.cpp
@@ -381,14 +381,14 @@ String VideoStreamPlayer::get_stream_name() const {
return stream->get_name();
}
-float VideoStreamPlayer::get_stream_position() const {
+double VideoStreamPlayer::get_stream_position() const {
if (playback.is_null()) {
return 0;
}
return playback->get_playback_position();
}
-void VideoStreamPlayer::set_stream_position(float p_position) {
+void VideoStreamPlayer::set_stream_position(double p_position) {
if (playback.is_valid()) {
playback->seek(p_position);
}
diff --git a/scene/gui/video_stream_player.h b/scene/gui/video_stream_player.h
index 9974eb8488..b1ba8a65d7 100644
--- a/scene/gui/video_stream_player.h
+++ b/scene/gui/video_stream_player.h
@@ -105,8 +105,8 @@ public:
float get_volume_db() const;
String get_stream_name() const;
- float get_stream_position() const;
- void set_stream_position(float p_position);
+ double get_stream_position() const;
+ void set_stream_position(double p_position);
void set_autoplay(bool p_enable);
bool has_autoplay() const;