mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 19:25:10 +00:00
Taskbar: Plumb window active state from the WindowServer to the taskbar.
This commit is contained in:
parent
19eb814850
commit
7b1384c4ef
11 changed files with 70 additions and 29 deletions
|
@ -18,10 +18,6 @@
|
|||
#include <SharedGraphics/PNGLoader.h>
|
||||
#include "WSCursor.h"
|
||||
|
||||
#ifdef KERNEL
|
||||
#include <Kernel/ProcFS.h>
|
||||
#endif
|
||||
|
||||
//#define DEBUG_COUNTERS
|
||||
//#define DEBUG_WID_IN_TITLE_BAR
|
||||
//#define RESIZE_DEBUG
|
||||
|
@ -510,7 +506,7 @@ void WSWindowManager::add_window(WSWindow& window)
|
|||
|
||||
for_each_window_listening_to_wm_events([&window] (WSWindow& listener) {
|
||||
if (window.client())
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowAddedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect()));
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowAddedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active()));
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
@ -548,6 +544,15 @@ void WSWindowManager::remove_window(WSWindow& window)
|
|||
});
|
||||
}
|
||||
|
||||
void WSWindowManager::tell_wm_listeners_window_state_changed(WSWindow& window)
|
||||
{
|
||||
for_each_window_listening_to_wm_events([&window] (WSWindow& listener) {
|
||||
if (window.client())
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowStateChangedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active()));
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
||||
void WSWindowManager::notify_title_changed(WSWindow& window)
|
||||
{
|
||||
dbgprintf("[WM] WSWindow{%p} title set to '%s'\n", &window, window.title().characters());
|
||||
|
@ -555,11 +560,7 @@ void WSWindowManager::notify_title_changed(WSWindow& window)
|
|||
if (m_switcher.is_visible())
|
||||
m_switcher.refresh();
|
||||
|
||||
for_each_window_listening_to_wm_events([&window] (WSWindow& listener) {
|
||||
if (window.client())
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowStateChangedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect()));
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
tell_wm_listeners_window_state_changed(window);
|
||||
}
|
||||
|
||||
void WSWindowManager::notify_rect_changed(WSWindow& window, const Rect& old_rect, const Rect& new_rect)
|
||||
|
@ -572,11 +573,7 @@ void WSWindowManager::notify_rect_changed(WSWindow& window, const Rect& old_rect
|
|||
if (m_switcher.is_visible() && window.type() != WSWindowType::WindowSwitcher)
|
||||
m_switcher.refresh();
|
||||
|
||||
for_each_window_listening_to_wm_events([&window] (WSWindow& listener) {
|
||||
if (window.client())
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowStateChangedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect()));
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
tell_wm_listeners_window_state_changed(window);
|
||||
}
|
||||
|
||||
void WSWindowManager::handle_menu_mouse_event(WSMenu& menu, const WSMouseEvent& event)
|
||||
|
@ -1139,7 +1136,8 @@ void WSWindowManager::set_active_window(WSWindow* window)
|
|||
if (window == m_active_window.ptr())
|
||||
return;
|
||||
|
||||
if (auto* previously_active_window = m_active_window.ptr()) {
|
||||
auto* previously_active_window = m_active_window.ptr();
|
||||
if (previously_active_window) {
|
||||
WSMessageLoop::the().post_message(*previously_active_window, make<WSMessage>(WSMessage::WindowDeactivated));
|
||||
invalidate(*previously_active_window);
|
||||
}
|
||||
|
@ -1151,6 +1149,9 @@ void WSWindowManager::set_active_window(WSWindow* window)
|
|||
auto* client = window->client();
|
||||
ASSERT(client);
|
||||
set_current_menubar(client->app_menubar());
|
||||
if (previously_active_window)
|
||||
tell_wm_listeners_window_state_changed(*previously_active_window);
|
||||
tell_wm_listeners_window_state_changed(*m_active_window);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue