mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-11 08:50:37 +00:00
WindowServer: Rename WSMenuBarKeeper => WSMenuManager.
This commit is contained in:
parent
b907608e46
commit
66e9de8aaa
Notes:
sideshowbarker
2024-07-19 13:11:25 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/66e9de8aaa3
4 changed files with 18 additions and 18 deletions
|
@ -6,7 +6,7 @@
|
|||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
WSMenuBarKeeper::WSMenuBarKeeper()
|
||||
WSMenuManager::WSMenuManager()
|
||||
{
|
||||
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->set_rect(WSWindowManager::the().menubar_rect());
|
||||
}
|
||||
|
||||
void WSMenuBarKeeper::draw()
|
||||
void WSMenuManager::draw()
|
||||
{
|
||||
auto& wm = WSWindowManager::the();
|
||||
auto menubar_rect = wm.menubar_rect();
|
||||
|
@ -89,12 +89,12 @@ void WSMenuBarKeeper::draw()
|
|||
m_cpu_monitor.paint(painter, cpu_rect);
|
||||
}
|
||||
|
||||
void WSMenuBarKeeper::tick_clock()
|
||||
void WSMenuManager::tick_clock()
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
|
||||
void WSMenuBarKeeper::refresh()
|
||||
void WSMenuManager::refresh()
|
||||
{
|
||||
if (!m_window)
|
||||
return;
|
||||
|
@ -102,7 +102,7 @@ void WSMenuBarKeeper::refresh()
|
|||
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) {
|
||||
auto& mouse_event = static_cast<WSMouseEvent&>(event);
|
||||
|
@ -117,7 +117,7 @@ void WSMenuBarKeeper::event(CEvent& 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();
|
||||
bool is_hover_with_any_menu_open = event.type() == WSMouseEvent::MouseMove && wm.current_menu() && (wm.current_menu()->menubar() || wm.current_menu() == wm.system_menu());
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
#include <WindowServer/WSCPUMonitor.h>
|
||||
#include <WindowServer/WSWindow.h>
|
||||
|
||||
class WSMenuBarKeeper final : public CObject {
|
||||
class WSMenuManager final : public CObject {
|
||||
public:
|
||||
WSMenuBarKeeper();
|
||||
virtual ~WSMenuBarKeeper() override;
|
||||
WSMenuManager();
|
||||
virtual ~WSMenuManager() override;
|
||||
|
||||
void setup();
|
||||
void refresh();
|
||||
|
||||
virtual void event(CEvent&) override;
|
||||
virtual const char* class_name() const override { return "WSMenuBarKeeper"; }
|
||||
virtual const char* class_name() const override { return "WSMenuManager"; }
|
||||
|
||||
private:
|
||||
WSWindow& window() { return *m_window; }
|
||||
|
|
|
@ -102,7 +102,7 @@ WSWindowManager::WSWindowManager()
|
|||
// NOTE: This ensures that the system menu has the correct dimensions.
|
||||
set_current_menubar(nullptr);
|
||||
|
||||
m_menubar_keeper.setup();
|
||||
m_menu_manager.setup();
|
||||
|
||||
invalidate();
|
||||
WSCompositor::the().compose();
|
||||
|
@ -239,7 +239,7 @@ void WSWindowManager::set_current_menubar(WSMenuBar* menubar)
|
|||
++index;
|
||||
return true;
|
||||
});
|
||||
m_menubar_keeper.refresh();
|
||||
m_menu_manager.refresh();
|
||||
}
|
||||
|
||||
void WSWindowManager::add_window(WSWindow& window)
|
||||
|
@ -392,7 +392,7 @@ void WSWindowManager::close_current_menu()
|
|||
if (m_current_menu && m_current_menu->menu_window())
|
||||
m_current_menu->menu_window()->set_visible(false);
|
||||
m_current_menu = nullptr;
|
||||
m_menubar_keeper.refresh();
|
||||
m_menu_manager.refresh();
|
||||
}
|
||||
|
||||
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())) {
|
||||
m_menubar_keeper.event(event);
|
||||
m_menu_manager.event(event);
|
||||
return;
|
||||
}
|
||||
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)
|
||||
set_current_menubar(client.app_menubar());
|
||||
m_menubar_keeper.refresh();
|
||||
m_menu_manager.refresh();
|
||||
}
|
||||
|
||||
const WSCursor& WSWindowManager::active_cursor() const
|
||||
|
|
|
@ -241,7 +241,7 @@ private:
|
|||
WeakPtr<WSMenu> m_current_menu;
|
||||
|
||||
WSWindowSwitcher m_switcher;
|
||||
WSMenuBarKeeper m_menubar_keeper;
|
||||
WSMenuManager m_menu_manager;
|
||||
|
||||
WeakPtr<WSButton> m_cursor_tracking_button;
|
||||
WeakPtr<WSButton> m_hovered_button;
|
||||
|
|
Loading…
Reference in a new issue