1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 19:25:07 +00:00

WindowServer: Rename WSMenuBarKeeper => WSMenuManager.

This commit is contained in:
Andreas Kling 2019-07-18 08:32:44 +02:00
parent b907608e46
commit 66e9de8aaa
4 changed files with 18 additions and 18 deletions

View file

@ -6,7 +6,7 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
WSMenuBarKeeper::WSMenuBarKeeper() WSMenuManager::WSMenuManager()
{ {
m_username = getlogin(); m_username = getlogin();
@ -21,17 +21,17 @@ WSMenuBarKeeper::WSMenuBarKeeper()
}); });
} }
WSMenuBarKeeper::~WSMenuBarKeeper() WSMenuManager::~WSMenuManager()
{ {
} }
void WSMenuBarKeeper::setup() void WSMenuManager::setup()
{ {
m_window = make<WSWindow>(*this, WSWindowType::Menubar); m_window = make<WSWindow>(*this, WSWindowType::Menubar);
m_window->set_rect(WSWindowManager::the().menubar_rect()); m_window->set_rect(WSWindowManager::the().menubar_rect());
} }
void WSMenuBarKeeper::draw() void WSMenuManager::draw()
{ {
auto& wm = WSWindowManager::the(); auto& wm = WSWindowManager::the();
auto menubar_rect = wm.menubar_rect(); auto menubar_rect = wm.menubar_rect();
@ -89,12 +89,12 @@ void WSMenuBarKeeper::draw()
m_cpu_monitor.paint(painter, cpu_rect); m_cpu_monitor.paint(painter, cpu_rect);
} }
void WSMenuBarKeeper::tick_clock() void WSMenuManager::tick_clock()
{ {
refresh(); refresh();
} }
void WSMenuBarKeeper::refresh() void WSMenuManager::refresh()
{ {
if (!m_window) if (!m_window)
return; return;
@ -102,7 +102,7 @@ void WSMenuBarKeeper::refresh()
window().invalidate(); window().invalidate();
} }
void WSMenuBarKeeper::event(CEvent& event) void WSMenuManager::event(CEvent& event)
{ {
if (event.type() == WSEvent::MouseMove || event.type() == WSEvent::MouseUp || event.type() == WSEvent::MouseDown || event.type() == WSEvent::MouseWheel) { if (event.type() == WSEvent::MouseMove || event.type() == WSEvent::MouseUp || event.type() == WSEvent::MouseDown || event.type() == WSEvent::MouseWheel) {
auto& mouse_event = static_cast<WSMouseEvent&>(event); auto& mouse_event = static_cast<WSMouseEvent&>(event);
@ -117,7 +117,7 @@ void WSMenuBarKeeper::event(CEvent& event)
return CObject::event(event); return CObject::event(event);
} }
void WSMenuBarKeeper::handle_menu_mouse_event(WSMenu& menu, const WSMouseEvent& event) void WSMenuManager::handle_menu_mouse_event(WSMenu& menu, const WSMouseEvent& event)
{ {
auto& wm = WSWindowManager::the(); auto& wm = WSWindowManager::the();
bool is_hover_with_any_menu_open = event.type() == WSMouseEvent::MouseMove && wm.current_menu() && (wm.current_menu()->menubar() || wm.current_menu() == wm.system_menu()); bool is_hover_with_any_menu_open = event.type() == WSMouseEvent::MouseMove && wm.current_menu() && (wm.current_menu()->menubar() || wm.current_menu() == wm.system_menu());

View file

@ -4,16 +4,16 @@
#include <WindowServer/WSCPUMonitor.h> #include <WindowServer/WSCPUMonitor.h>
#include <WindowServer/WSWindow.h> #include <WindowServer/WSWindow.h>
class WSMenuBarKeeper final : public CObject { class WSMenuManager final : public CObject {
public: public:
WSMenuBarKeeper(); WSMenuManager();
virtual ~WSMenuBarKeeper() override; virtual ~WSMenuManager() override;
void setup(); void setup();
void refresh(); void refresh();
virtual void event(CEvent&) override; virtual void event(CEvent&) override;
virtual const char* class_name() const override { return "WSMenuBarKeeper"; } virtual const char* class_name() const override { return "WSMenuManager"; }
private: private:
WSWindow& window() { return *m_window; } WSWindow& window() { return *m_window; }

View file

@ -102,7 +102,7 @@ WSWindowManager::WSWindowManager()
// NOTE: This ensures that the system menu has the correct dimensions. // NOTE: This ensures that the system menu has the correct dimensions.
set_current_menubar(nullptr); set_current_menubar(nullptr);
m_menubar_keeper.setup(); m_menu_manager.setup();
invalidate(); invalidate();
WSCompositor::the().compose(); WSCompositor::the().compose();
@ -239,7 +239,7 @@ void WSWindowManager::set_current_menubar(WSMenuBar* menubar)
++index; ++index;
return true; return true;
}); });
m_menubar_keeper.refresh(); m_menu_manager.refresh();
} }
void WSWindowManager::add_window(WSWindow& window) void WSWindowManager::add_window(WSWindow& window)
@ -392,7 +392,7 @@ void WSWindowManager::close_current_menu()
if (m_current_menu && m_current_menu->menu_window()) if (m_current_menu && m_current_menu->menu_window())
m_current_menu->menu_window()->set_visible(false); m_current_menu->menu_window()->set_visible(false);
m_current_menu = nullptr; m_current_menu = nullptr;
m_menubar_keeper.refresh(); m_menu_manager.refresh();
} }
void WSWindowManager::start_window_drag(WSWindow& window, const WSMouseEvent& event) void WSWindowManager::start_window_drag(WSWindow& window, const WSMouseEvent& event)
@ -682,7 +682,7 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& hovere
} }
if (menubar_rect().contains(event.position())) { if (menubar_rect().contains(event.position())) {
m_menubar_keeper.event(event); m_menu_manager.event(event);
return; return;
} }
if (m_current_menu && m_current_menu->menu_window()) { if (m_current_menu && m_current_menu->menu_window()) {
@ -987,7 +987,7 @@ void WSWindowManager::notify_client_changed_app_menubar(WSClientConnection& clie
{ {
if (active_client() == &client) if (active_client() == &client)
set_current_menubar(client.app_menubar()); set_current_menubar(client.app_menubar());
m_menubar_keeper.refresh(); m_menu_manager.refresh();
} }
const WSCursor& WSWindowManager::active_cursor() const const WSCursor& WSWindowManager::active_cursor() const

View file

@ -241,7 +241,7 @@ private:
WeakPtr<WSMenu> m_current_menu; WeakPtr<WSMenu> m_current_menu;
WSWindowSwitcher m_switcher; WSWindowSwitcher m_switcher;
WSMenuBarKeeper m_menubar_keeper; WSMenuManager m_menu_manager;
WeakPtr<WSButton> m_cursor_tracking_button; WeakPtr<WSButton> m_cursor_tracking_button;
WeakPtr<WSButton> m_hovered_button; WeakPtr<WSButton> m_hovered_button;