mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-12 17:30:38 +00:00
LibGUI: Don't paint TextEditor selection in non-focused widgets
Showing the selection in non-focused text editors was not really useful, since refocusing the widget would clear or change the selection immediately anyway. Note that TextEditors in inactive windows can still be the focused widget within that window, and will still be painted with an "inactive" looking selection.
This commit is contained in:
parent
c1576aca11
commit
649cb67f28
Notes:
sideshowbarker
2024-07-18 02:04:50 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/649cb67f28d
1 changed files with 3 additions and 3 deletions
|
@ -670,7 +670,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
if (physical_line_has_selection) {
|
||||
if (physical_line_has_selection && window()->focused_widget() == this) {
|
||||
size_t start_of_selection_within_visual_line = (size_t)max(0, (int)selection_start_column_within_line - (int)start_of_visual_line);
|
||||
size_t end_of_selection_within_visual_line = selection_end_column_within_line - start_of_visual_line;
|
||||
|
||||
|
@ -696,8 +696,8 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
visual_line_rect.height()
|
||||
};
|
||||
|
||||
Color background_color = is_focused() ? palette().selection() : palette().inactive_selection();
|
||||
Color text_color = is_focused() ? palette().selection_text() : palette().inactive_selection_text();
|
||||
Color background_color = window()->is_active() ? palette().selection() : palette().inactive_selection();
|
||||
Color text_color = window()->is_active() ? palette().selection_text() : palette().inactive_selection_text();
|
||||
|
||||
painter.fill_rect(selection_rect, background_color);
|
||||
|
||||
|
|
Loading…
Reference in a new issue