summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-01-12 07:11:24 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-01-12 07:11:24 +0100
commitb7d83e3265c03cef385cd5feb9a9ec80551a6d66 (patch)
treea514d6da616aa3d334620aadc41deb0de79cb377
parent07873332e79d257a3ee6a26a3139b3420c8f34d2 (diff)
downloadserenity-b7d83e3265c03cef385cd5feb9a9ec80551a6d66.zip
Redraw both incoming and outgoing widget when changing focus.
-rw-r--r--Widgets/ListBox.h1
-rw-r--r--Widgets/TextBox.h1
-rw-r--r--Widgets/Window.cpp5
3 files changed, 6 insertions, 1 deletions
diff --git a/Widgets/ListBox.h b/Widgets/ListBox.h
index ece6f46d9e..1e4125f4d4 100644
--- a/Widgets/ListBox.h
+++ b/Widgets/ListBox.h
@@ -13,6 +13,7 @@ public:
private:
virtual void paintEvent(PaintEvent&) override;
virtual void mouseDownEvent(MouseEvent&) override;
+ virtual const char* class_name() const override { return "ListBox"; }
unsigned itemHeight() const;
diff --git a/Widgets/TextBox.h b/Widgets/TextBox.h
index 97b0ab1de2..5236749099 100644
--- a/Widgets/TextBox.h
+++ b/Widgets/TextBox.h
@@ -14,6 +14,7 @@ public:
Function<void(TextBox&)> onReturnPressed;
private:
+ virtual const char* class_name() const override { return "TextBox"; }
virtual void paintEvent(PaintEvent&) override;
virtual void mouseDownEvent(MouseEvent&) override;
virtual void keyDownEvent(KeyEvent&) override;
diff --git a/Widgets/Window.cpp b/Widgets/Window.cpp
index 7f2de932b8..63c0408329 100644
--- a/Widgets/Window.cpp
+++ b/Widgets/Window.cpp
@@ -128,10 +128,13 @@ void Window::setFocusedWidget(Widget* widget)
m_focusedWidget = nullptr;
else {
m_focusedWidget = widget->makeWeakPtr();
+ m_focusedWidget->update();
EventLoop::main().postEvent(m_focusedWidget.ptr(), make<Event>(Event::FocusIn));
}
- if (previously_focused_widget)
+ if (previously_focused_widget) {
+ previously_focused_widget->update();
EventLoop::main().postEvent(previously_focused_widget, make<Event>(Event::FocusOut));
+ }
}
void Window::close()