WindowServer+LibGUI: Rename WindowType::MenuApplet => Applet
This commit is contained in:
parent
dabfeb6dd8
commit
0069020e6c
Notes:
sideshowbarker
2024-07-18 20:49:00 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0069020e6c4
13 changed files with 17 additions and 17 deletions
|
@ -230,7 +230,7 @@ int main(int argc, char** argv)
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_has_alpha_channel(true);
|
window->set_has_alpha_channel(true);
|
||||||
window->set_title("Audio");
|
window->set_title("Audio");
|
||||||
window->set_window_type(GUI::WindowType::MenuApplet);
|
window->set_window_type(GUI::WindowType::Applet);
|
||||||
window->resize(16, 16);
|
window->resize(16, 16);
|
||||||
|
|
||||||
window->set_main_widget<AudioWidget>();
|
window->set_main_widget<AudioWidget>();
|
||||||
|
|
|
@ -92,7 +92,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
auto applet_window = GUI::Window::construct();
|
auto applet_window = GUI::Window::construct();
|
||||||
applet_window->set_title("ClipboardHistory");
|
applet_window->set_title("ClipboardHistory");
|
||||||
applet_window->set_window_type(GUI::WindowType::MenuApplet);
|
applet_window->set_window_type(GUI::WindowType::Applet);
|
||||||
auto& icon = applet_window->set_main_widget<GUI::ImageWidget>();
|
auto& icon = applet_window->set_main_widget<GUI::ImageWidget>();
|
||||||
icon.load_from_file("/res/icons/16x16/edit-copy.png");
|
icon.load_from_file("/res/icons/16x16/edit-copy.png");
|
||||||
icon.set_fill_with_background_color(true);
|
icon.set_fill_with_background_color(true);
|
||||||
|
|
|
@ -218,7 +218,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_title(name);
|
window->set_title(name);
|
||||||
window->set_window_type(GUI::WindowType::MenuApplet);
|
window->set_window_type(GUI::WindowType::Applet);
|
||||||
window->resize(16, 16);
|
window->resize(16, 16);
|
||||||
auto& icon = window->set_main_widget<NetworkWidget>(display_notifications);
|
auto& icon = window->set_main_widget<NetworkWidget>(display_notifications);
|
||||||
icon.set_fill_with_background_color(true);
|
icon.set_fill_with_background_color(true);
|
||||||
|
|
|
@ -253,7 +253,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_title(name);
|
window->set_title(name);
|
||||||
window->set_window_type(GUI::WindowType::MenuApplet);
|
window->set_window_type(GUI::WindowType::Applet);
|
||||||
window->resize(GraphWidget::history_size + 2, 15);
|
window->resize(GraphWidget::history_size + 2, 15);
|
||||||
|
|
||||||
window->set_main_widget<GraphWidget>(graph_type, graph_color, graph_error_color);
|
window->set_main_widget<GraphWidget>(graph_type, graph_color, graph_error_color);
|
||||||
|
|
|
@ -91,7 +91,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_title("UserName");
|
window->set_title("UserName");
|
||||||
window->set_window_type(GUI::WindowType::MenuApplet);
|
window->set_window_type(GUI::WindowType::Applet);
|
||||||
|
|
||||||
auto& widget = window->set_main_widget<UserNameWidget>();
|
auto& widget = window->set_main_widget<UserNameWidget>();
|
||||||
window->resize(widget.get_width(), 16);
|
window->resize(widget.get_width(), 16);
|
||||||
|
|
|
@ -602,7 +602,7 @@ Gfx::IntRect Widget::window_relative_rect() const
|
||||||
|
|
||||||
Gfx::IntRect Widget::screen_relative_rect() const
|
Gfx::IntRect Widget::screen_relative_rect() const
|
||||||
{
|
{
|
||||||
auto window_position = window()->window_type() == WindowType::MenuApplet
|
auto window_position = window()->window_type() == WindowType::Applet
|
||||||
? window()->applet_rect_on_screen().location()
|
? window()->applet_rect_on_screen().location()
|
||||||
: window()->rect().location();
|
: window()->rect().location();
|
||||||
return window_relative_rect().translated(window_position);
|
return window_relative_rect().translated(window_position);
|
||||||
|
|
|
@ -237,7 +237,7 @@ String Window::title() const
|
||||||
|
|
||||||
Gfx::IntRect Window::applet_rect_on_screen() const
|
Gfx::IntRect Window::applet_rect_on_screen() const
|
||||||
{
|
{
|
||||||
VERIFY(m_window_type == WindowType::MenuApplet);
|
VERIFY(m_window_type == WindowType::Applet);
|
||||||
return WindowServerConnection::the().send_sync<Messages::WindowServer::GetAppletRectOnScreen>(m_window_id)->rect();
|
return WindowServerConnection::the().send_sync<Messages::WindowServer::GetAppletRectOnScreen>(m_window_id)->rect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ public:
|
||||||
String gmt_date_string() const;
|
String gmt_date_string() const;
|
||||||
String iso_date_string() const;
|
String iso_date_string() const;
|
||||||
|
|
||||||
// FIXME: One day, implement real locale support. Until then, everyone gets what the Clock MenuApplet displays.
|
// FIXME: One day, implement real locale support. Until then, everyone gets what the Clock Applet displays.
|
||||||
String locale_date_string() const { return m_datetime.to_string("%Y-%m-%d"); }
|
String locale_date_string() const { return m_datetime.to_string("%Y-%m-%d"); }
|
||||||
String locale_string() const { return m_datetime.to_string(); }
|
String locale_string() const { return m_datetime.to_string(); }
|
||||||
String locale_time_string() const { return m_datetime.to_string("%H:%M:%S"); }
|
String locale_time_string() const { return m_datetime.to_string("%H:%M:%S"); }
|
||||||
|
|
|
@ -84,7 +84,7 @@ ClientConnection::~ClientConnection()
|
||||||
auto windows = move(m_windows);
|
auto windows = move(m_windows);
|
||||||
for (auto& window : windows) {
|
for (auto& window : windows) {
|
||||||
window.value->detach_client({});
|
window.value->detach_client({});
|
||||||
if (window.value->type() == WindowType::MenuApplet)
|
if (window.value->type() == WindowType::Applet)
|
||||||
AppletManager::the().remove_applet(window.value);
|
AppletManager::the().remove_applet(window.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -539,7 +539,7 @@ OwnPtr<Messages::WindowServer::CreateWindowResponse> ClientConnection::handle(co
|
||||||
window->set_base_size(message.base_size());
|
window->set_base_size(message.base_size());
|
||||||
window->set_resize_aspect_ratio(message.resize_aspect_ratio());
|
window->set_resize_aspect_ratio(message.resize_aspect_ratio());
|
||||||
window->invalidate(true, true);
|
window->invalidate(true, true);
|
||||||
if (window->type() == WindowType::MenuApplet)
|
if (window->type() == WindowType::Applet)
|
||||||
AppletManager::the().add_applet(*window);
|
AppletManager::the().add_applet(*window);
|
||||||
m_windows.set(window_id, move(window));
|
m_windows.set(window_id, move(window));
|
||||||
return make<Messages::WindowServer::CreateWindowResponse>(window_id);
|
return make<Messages::WindowServer::CreateWindowResponse>(window_id);
|
||||||
|
@ -563,7 +563,7 @@ void ClientConnection::destroy_window(Window& window, Vector<i32>& destroyed_win
|
||||||
|
|
||||||
destroyed_window_ids.append(window.window_id());
|
destroyed_window_ids.append(window.window_id());
|
||||||
|
|
||||||
if (window.type() == WindowType::MenuApplet)
|
if (window.type() == WindowType::Applet)
|
||||||
AppletManager::the().remove_applet(window);
|
AppletManager::the().remove_applet(window);
|
||||||
|
|
||||||
window.destroy();
|
window.destroy();
|
||||||
|
|
|
@ -529,7 +529,7 @@ void Window::invalidate(bool invalidate_frame, bool re_render_frame)
|
||||||
|
|
||||||
void Window::invalidate(const Gfx::IntRect& rect, bool with_frame)
|
void Window::invalidate(const Gfx::IntRect& rect, bool with_frame)
|
||||||
{
|
{
|
||||||
if (type() == WindowType::MenuApplet) {
|
if (type() == WindowType::Applet) {
|
||||||
AppletManager::the().invalidate_applet(*this, rect);
|
AppletManager::the().invalidate_applet(*this, rect);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ public:
|
||||||
void clear_dirty_rects();
|
void clear_dirty_rects();
|
||||||
Gfx::DisjointRectSet& dirty_rects() { return m_dirty_rects; }
|
Gfx::DisjointRectSet& dirty_rects() { return m_dirty_rects; }
|
||||||
|
|
||||||
// Only used by WindowType::MenuApplet. Perhaps it could be a Window subclass? I don't know.
|
// Only used by WindowType::Applet. Perhaps it could be a Window subclass? I don't know.
|
||||||
void set_rect_in_applet_area(const Gfx::IntRect& rect) { m_rect_in_applet_area = rect; }
|
void set_rect_in_applet_area(const Gfx::IntRect& rect) { m_rect_in_applet_area = rect; }
|
||||||
const Gfx::IntRect& rect_in_applet_area() const { return m_rect_in_applet_area; }
|
const Gfx::IntRect& rect_in_applet_area() const { return m_rect_in_applet_area; }
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,7 @@ void WindowManager::notify_rect_changed(Window& window, const Gfx::IntRect& old_
|
||||||
|
|
||||||
tell_wm_listeners_window_rect_changed(window);
|
tell_wm_listeners_window_rect_changed(window);
|
||||||
|
|
||||||
if (window.type() == WindowType::MenuApplet)
|
if (window.type() == WindowType::Applet)
|
||||||
AppletManager::the().relayout();
|
AppletManager::the().relayout();
|
||||||
|
|
||||||
MenuManager::the().refresh();
|
MenuManager::the().refresh();
|
||||||
|
@ -953,7 +953,7 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
|
||||||
|
|
||||||
if (MenuManager::the().has_open_menu()
|
if (MenuManager::the().has_open_menu()
|
||||||
|| hitting_menu_in_window_with_active_menu) {
|
|| hitting_menu_in_window_with_active_menu) {
|
||||||
for_each_visible_window_of_type_from_front_to_back(WindowType::MenuApplet, [&](auto& window) {
|
for_each_visible_window_of_type_from_front_to_back(WindowType::Applet, [&](auto& window) {
|
||||||
if (!window.rect_in_applet_area().contains(event.position()))
|
if (!window.rect_in_applet_area().contains(event.position()))
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
hovered_window = &window;
|
hovered_window = &window;
|
||||||
|
@ -1158,7 +1158,7 @@ Gfx::IntRect WindowManager::arena_rect_for_type(WindowType type) const
|
||||||
case WindowType::WindowSwitcher:
|
case WindowType::WindowSwitcher:
|
||||||
case WindowType::Taskbar:
|
case WindowType::Taskbar:
|
||||||
case WindowType::Tooltip:
|
case WindowType::Tooltip:
|
||||||
case WindowType::MenuApplet:
|
case WindowType::Applet:
|
||||||
case WindowType::Notification:
|
case WindowType::Notification:
|
||||||
return Screen::the().rect();
|
return Screen::the().rect();
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -35,7 +35,7 @@ enum class WindowType {
|
||||||
WindowSwitcher,
|
WindowSwitcher,
|
||||||
Taskbar,
|
Taskbar,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
MenuApplet,
|
Applet,
|
||||||
Notification,
|
Notification,
|
||||||
Desktop,
|
Desktop,
|
||||||
ToolWindow,
|
ToolWindow,
|
||||||
|
|
Loading…
Add table
Reference in a new issue