summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2021-03-15 20:11:43 -0400
committerAndreas Kling <kling@serenityos.org>2021-03-16 17:58:24 +0100
commitd2d69f3efb14e9e68b7ce29c7b9e99aa18dc3d9c (patch)
tree431741a6767efadd19a2b2921140f2105bd759f4
parent906cccbf7f2280e2b5d89e9dd9606deaaa29cbfb (diff)
downloadserenity-d2d69f3efb14e9e68b7ce29c7b9e99aa18dc3d9c.zip
LibGUI: Remove has_visible_list members from TextEditor
This was a kludge to paint ComboBox editors before the advent of accessory windows, isn't being used anymore, and was inadvertently letting two ComboBoxes paint as if both had focus.
-rw-r--r--Userland/Libraries/LibGUI/ComboBox.cpp3
-rw-r--r--Userland/Libraries/LibGUI/TextEditor.cpp13
-rw-r--r--Userland/Libraries/LibGUI/TextEditor.h4
3 files changed, 3 insertions, 17 deletions
diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp
index 896d302b83..776f7068d3 100644
--- a/Userland/Libraries/LibGUI/ComboBox.cpp
+++ b/Userland/Libraries/LibGUI/ComboBox.cpp
@@ -251,7 +251,6 @@ void ComboBox::open()
Gfx::IntRect list_window_rect { my_screen_rect.bottom_left(), size };
list_window_rect.intersect(Desktop::the().rect().shrunken(0, taskbar_height + menubar_height + offset));
- m_editor->set_has_visible_list(true);
m_editor->set_focus(true);
if (m_selected_index.has_value()) {
// Don't set m_updating_model to true here because we only want to
@@ -272,8 +271,6 @@ void ComboBox::open()
void ComboBox::close()
{
m_list_window->hide();
- m_editor->set_has_visible_list(false);
- m_editor->set_focus(true);
}
String ComboBox::text() const
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp
index 29ad65c188..8e39173d2c 100644
--- a/Userland/Libraries/LibGUI/TextEditor.cpp
+++ b/Userland/Libraries/LibGUI/TextEditor.cpp
@@ -400,7 +400,7 @@ void TextEditor::paint_event(PaintEvent& event)
painter.add_clip_rect(event.rect());
painter.fill_rect(event.rect(), widget_background_color);
- if (is_displayonly() && (is_focused() || has_visible_list())) {
+ if (is_displayonly() && is_focused()) {
widget_background_color = palette().selection();
Gfx::IntRect display_rect {
widget_inner_rect().x() + 1,
@@ -502,12 +502,12 @@ void TextEditor::paint_event(PaintEvent& event)
} else if (!document().has_spans()) {
// Fast-path for plain text
auto color = palette().color(is_enabled() ? foreground_role() : Gfx::ColorRole::DisabledText);
- if (is_displayonly() && (is_focused() || has_visible_list()))
+ if (is_displayonly() && is_focused())
color = palette().color(is_enabled() ? Gfx::ColorRole::SelectionText : Gfx::ColorRole::DisabledText);
painter.draw_text(visual_line_rect, visual_line_text, m_text_alignment, color);
} else {
auto unspanned_color = palette().color(is_enabled() ? foreground_role() : Gfx::ColorRole::DisabledText);
- if (is_displayonly() && (is_focused() || has_visible_list()))
+ if (is_displayonly() && is_focused())
unspanned_color = palette().color(is_enabled() ? Gfx::ColorRole::SelectionText : Gfx::ColorRole::DisabledText);
RefPtr<Gfx::Font> unspanned_font = this->font();
@@ -1375,13 +1375,6 @@ void TextEditor::set_mode(const Mode mode)
set_override_cursor(Gfx::StandardCursor::None);
}
-void TextEditor::set_has_visible_list(bool visible)
-{
- if (m_has_visible_list == visible)
- return;
- m_has_visible_list = visible;
-}
-
void TextEditor::did_update_selection()
{
m_cut_action->set_enabled(is_editable() && has_selection());
diff --git a/Userland/Libraries/LibGUI/TextEditor.h b/Userland/Libraries/LibGUI/TextEditor.h
index 30083da163..46949770a7 100644
--- a/Userland/Libraries/LibGUI/TextEditor.h
+++ b/Userland/Libraries/LibGUI/TextEditor.h
@@ -81,9 +81,6 @@ public:
void set_visualize_trailing_whitespace(bool);
bool visualize_trailing_whitespace() const { return m_visualize_trailing_whitespace; }
- bool has_visible_list() const { return m_has_visible_list; }
- void set_has_visible_list(bool);
-
virtual bool is_automatic_indentation_enabled() const final { return m_automatic_indentation_enabled; }
void set_automatic_indentation_enabled(bool enabled) { m_automatic_indentation_enabled = enabled; }
@@ -320,7 +317,6 @@ private:
bool m_has_pending_change_notification { false };
bool m_automatic_indentation_enabled { false };
WrappingMode m_wrapping_mode { WrappingMode::NoWrap };
- bool m_has_visible_list { false };
bool m_visualize_trailing_whitespace { true };
int m_line_spacing { 4 };
size_t m_soft_tab_width { 4 };