1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:18:14 +00:00

Taskbar: Show minimized window titles in [brackets].

Had to plumb the minimization state from WindowServer to Toolbar in order
to implement this.
This commit is contained in:
Andreas Kling 2019-04-06 00:57:51 +02:00
parent 74142d78c1
commit ef9fbef4c6
9 changed files with 35 additions and 7 deletions

View file

@ -66,12 +66,13 @@ void TaskbarWindow::wm_event(GWMEvent& event)
}
case GEvent::WM_WindowStateChanged: {
auto& changed_event = static_cast<GWMWindowStateChangedEvent&>(event);
printf("WM_WindowStateChanged: client_id=%d, window_id=%d, title=%s, rect=%s, is_active=%u\n",
printf("WM_WindowStateChanged: client_id=%d, window_id=%d, title=%s, rect=%s, is_active=%u, is_minimized=%u\n",
changed_event.client_id(),
changed_event.window_id(),
changed_event.title().characters(),
changed_event.rect().to_string().characters(),
changed_event.is_active()
changed_event.is_active(),
changed_event.is_minimized()
);
if (!should_include_window(changed_event.window_type()))
break;
@ -79,8 +80,16 @@ void TaskbarWindow::wm_event(GWMEvent& event)
window.set_title(changed_event.title());
window.set_rect(changed_event.rect());
window.set_active(changed_event.is_active());
window.button()->set_caption(changed_event.title());
window.set_minimized(changed_event.is_minimized());
if (window.is_minimized()) {
window.button()->set_foreground_color(Color::DarkGray);
window.button()->set_caption(String::format("[%s]", changed_event.title().characters()));
} else {
window.button()->set_foreground_color(Color::Black);
window.button()->set_caption(changed_event.title());
}
window.button()->set_checked(changed_event.is_active());
window.button()->update();
break;
}
default: