1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:17:35 +00:00

More window manager hacking. FocusIn/FocusOut events.

This commit is contained in:
Andreas Kling 2019-01-09 05:38:13 +01:00
parent 7577ee0c67
commit ceb373cf71
8 changed files with 20 additions and 22 deletions

View file

@ -74,7 +74,7 @@ void Window::event(Event& event)
if (event.isPaintEvent()) {
auto& pe = static_cast<PaintEvent&>(event);
printf("Window[\"%s\"]: paintEvent %d,%d %dx%d\n", class_name(),
printf("Window[\"%s\"]: paintEvent %d,%d %dx%d\n", title().characters(),
pe.rect().x(),
pe.rect().y(),
pe.rect().width(),
@ -123,15 +123,15 @@ void Window::setFocusedWidget(Widget* widget)
{
if (m_focusedWidget.ptr() == widget)
return;
auto* previouslyFocusedWidget = m_focusedWidget.ptr();
if (!widget) {
auto* previously_focused_widget = m_focusedWidget.ptr();
if (!widget)
m_focusedWidget = nullptr;
} else {
else {
m_focusedWidget = widget->makeWeakPtr();
m_focusedWidget->repaint(Rect());
EventLoop::main().postEvent(m_focusedWidget.ptr(), make<Event>(Event::FocusIn));
}
if (previouslyFocusedWidget)
previouslyFocusedWidget->repaint(Rect());
if (previously_focused_widget)
EventLoop::main().postEvent(previously_focused_widget, make<Event>(Event::FocusOut));
}
void Window::close()