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

WindowServer: Expose window parent information and more modal improvements

* The parent information is necessary by the Taskbar to be able to
  determine a modal window's parent
* Minimize and maximize modal window stacks together
This commit is contained in:
Tom 2020-07-15 17:40:52 -06:00 committed by Andreas Kling
parent 2f731150a2
commit bbdf0665fc
8 changed files with 113 additions and 43 deletions

View file

@ -214,11 +214,10 @@ void Window::set_minimized(bool minimized)
return;
if (minimized && !m_minimizable)
return;
if (is_blocked_by_modal_window())
return;
m_minimized = minimized;
update_menu_item_text(PopupMenuItem::Minimize);
start_minimize_animation();
if (!is_blocked_by_modal_window())
start_minimize_animation();
if (!minimized)
request_update({ {}, size() });
invalidate();
@ -256,8 +255,6 @@ void Window::set_maximized(bool maximized)
return;
if (maximized && !is_resizable())
return;
if (is_blocked_by_modal_window())
return;
set_tiled(WindowTileType::None);
m_maximized = maximized;
update_menu_item_text(PopupMenuItem::Maximize);
@ -446,14 +443,12 @@ void Window::ensure_window_menu()
m_window_menu->on_item_activation = [&](auto& item) {
switch (item.identifier()) {
case 1:
set_minimized(!m_minimized);
WindowManager::the().minimize_windows(*this, !m_minimized);
if (!m_minimized)
WindowManager::the().move_to_front_and_make_active(*this);
break;
case 2:
set_maximized(!m_maximized);
if (m_minimized)
set_minimized(false);
WindowManager::the().maximize_windows(*this, !m_maximized);
WindowManager::the().move_to_front_and_make_active(*this);
break;
case 3:
@ -613,6 +608,23 @@ bool Window::is_accessory_of(Window& window) const
return parent_window() == &window;
}
void Window::modal_unparented()
{
m_modal = false;
WindowManager::the().notify_modal_unparented(*this);
}
bool Window::is_modal() const
{
if (!m_modal)
return false;
if (!m_parent_window) {
const_cast<Window*>(this)->modal_unparented();
return false;
}
return true;
}
void Window::set_progress(int progress)
{
if (m_progress == progress)