Преглед изворни кода

WindowServer+LibGUI: Port WindowServer's Menu name to new String

Karol Kosek пре 2 година
родитељ
комит
7e33857afa

+ 2 - 2
Userland/Libraries/LibGUI/Menu.cpp

@@ -93,7 +93,7 @@ void Menu::set_name(String name)
 {
     m_name = move(name);
     if (m_menu_id != -1) {
-        ConnectionToWindowServer::the().async_set_menu_name(m_menu_id, m_name.to_deprecated_string());
+        ConnectionToWindowServer::the().async_set_menu_name(m_menu_id, m_name);
         update_parent_menu_item();
     }
 }
@@ -168,7 +168,7 @@ int Menu::realize_menu(RefPtr<Action> default_action)
     unrealize_menu();
     m_menu_id = s_menu_id_allocator.allocate();
 
-    ConnectionToWindowServer::the().async_create_menu(m_menu_id, m_name.to_deprecated_string());
+    ConnectionToWindowServer::the().async_create_menu(m_menu_id, m_name);
 
     dbgln_if(MENU_DEBUG, "GUI::Menu::realize_menu(): New menu ID: {}", m_menu_id);
     VERIFY(m_menu_id > 0);

+ 2 - 2
Userland/Services/WindowServer/ConnectionFromClient.cpp

@@ -90,13 +90,13 @@ void ConnectionFromClient::notify_about_new_screen_rects()
     async_screen_rects_changed(Screen::rects(), Screen::main().index(), wm.window_stack_rows(), wm.window_stack_columns());
 }
 
-void ConnectionFromClient::create_menu(i32 menu_id, DeprecatedString const& name)
+void ConnectionFromClient::create_menu(i32 menu_id, String const& name)
 {
     auto menu = Menu::construct(this, menu_id, name);
     m_menus.set(menu_id, move(menu));
 }
 
-void ConnectionFromClient::set_menu_name(i32 menu_id, DeprecatedString const& name)
+void ConnectionFromClient::set_menu_name(i32 menu_id, String const& name)
 {
     auto it = m_menus.find(menu_id);
     if (it == m_menus.end()) {

+ 2 - 2
Userland/Services/WindowServer/ConnectionFromClient.h

@@ -93,8 +93,8 @@ private:
     void set_unresponsive(bool);
     void destroy_window(Window&, Vector<i32>& destroyed_window_ids);
 
-    virtual void create_menu(i32, DeprecatedString const&) override;
-    virtual void set_menu_name(i32, DeprecatedString const&) override;
+    virtual void create_menu(i32, String const&) override;
+    virtual void set_menu_name(i32, String const&) override;
     virtual void destroy_menu(i32) override;
     virtual void add_menu(i32, i32) override;
     virtual void add_menu_item(i32, i32, i32, DeprecatedString const&, bool, bool, bool, bool, bool, DeprecatedString const&, Gfx::ShareableBitmap const&, bool) override;

+ 2 - 2
Userland/Services/WindowServer/Menu.cpp

@@ -38,7 +38,7 @@ u32 find_ampersand_shortcut_character(StringView string)
     return 0;
 }
 
-Menu::Menu(ConnectionFromClient* client, int menu_id, DeprecatedString name)
+Menu::Menu(ConnectionFromClient* client, int menu_id, String name)
     : Core::Object(client)
     , m_client(client)
     , m_menu_id(menu_id)
@@ -752,7 +752,7 @@ void Menu::set_hovered_index(int index, bool make_input)
         redraw(*old_hovered_item);
 }
 
-void Menu::set_name(DeprecatedString name)
+void Menu::set_name(String name)
 {
     m_name = move(name);
 }

+ 4 - 4
Userland/Services/WindowServer/Menu.h

@@ -58,8 +58,8 @@ public:
     void update_alt_shortcuts_for_items();
     void add_item(NonnullOwnPtr<MenuItem>);
 
-    DeprecatedString const& name() const { return m_name; }
-    void set_name(DeprecatedString);
+    String const& name() const { return m_name; }
+    void set_name(String);
 
     template<typename Callback>
     IterationDecision for_each_item(Callback callback)
@@ -138,7 +138,7 @@ public:
     Vector<size_t> const* items_with_alt_shortcut(u32 alt_shortcut) const;
 
 private:
-    Menu(ConnectionFromClient*, int menu_id, DeprecatedString name);
+    Menu(ConnectionFromClient*, int menu_id, String name);
 
     virtual void event(Core::Event&) override;
 
@@ -155,7 +155,7 @@ private:
 
     ConnectionFromClient* m_client { nullptr };
     int m_menu_id { 0 };
-    DeprecatedString m_name;
+    String m_name;
     u32 m_alt_shortcut_character { 0 };
     Gfx::IntRect m_rect_in_window_menubar;
     Gfx::IntPoint m_unadjusted_position;

+ 1 - 1
Userland/Services/WindowServer/Window.cpp

@@ -718,7 +718,7 @@ void Window::request_update(Gfx::IntRect const& rect, bool ignore_occlusion)
 void Window::ensure_window_menu()
 {
     if (!m_window_menu) {
-        m_window_menu = Menu::construct(nullptr, -1, "(Window Menu)");
+        m_window_menu = Menu::construct(nullptr, -1, "(Window Menu)"_string.release_value_but_fixme_should_propagate_errors());
         m_window_menu->set_window_menu_of(*this);
 
         auto minimize_item = make<MenuItem>(*m_window_menu, (unsigned)WindowMenuAction::MinimizeOrUnminimize, "");

+ 2 - 2
Userland/Services/WindowServer/WindowServer.ipc

@@ -4,8 +4,8 @@
 
 endpoint WindowServer
 {
-    create_menu(i32 menu_id, [UTF8] DeprecatedString name) =|
-    set_menu_name(i32 menu_id, DeprecatedString name) =|
+    create_menu(i32 menu_id, [UTF8] String name) =|
+    set_menu_name(i32 menu_id, String name) =|
     destroy_menu(i32 menu_id) =|
 
     add_menu(i32 window_id, i32 menu_id) =|