1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:47:34 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -14,7 +14,7 @@
namespace WindowServer {
static AppletManager* s_the;
Vector<DeprecatedString> order_vector;
Vector<ByteString> order_vector;
AppletManager::AppletManager()
{

View file

@ -33,7 +33,7 @@ Compositor& Compositor::the()
return s_the;
}
static WallpaperMode mode_to_enum(DeprecatedString const& name)
static WallpaperMode mode_to_enum(ByteString const& name)
{
if (name == "Tile")
return WallpaperMode::Tile;
@ -776,7 +776,7 @@ void Compositor::start_compose_async_timer()
}
}
bool Compositor::set_background_color(DeprecatedString const& background_color)
bool Compositor::set_background_color(ByteString const& background_color)
{
auto color = Color::from_string(background_color);
if (!color.has_value())
@ -795,7 +795,7 @@ bool Compositor::set_background_color(DeprecatedString const& background_color)
return succeeded;
}
bool Compositor::set_wallpaper_mode(DeprecatedString const& mode)
bool Compositor::set_wallpaper_mode(ByteString const& mode)
{
g_config->write_entry("Background", "Mode", mode);
bool succeeded = !g_config->sync().is_error();

View file

@ -103,9 +103,9 @@ public:
void screen_resolution_changed();
bool set_background_color(DeprecatedString const& background_color);
bool set_background_color(ByteString const& background_color);
bool set_wallpaper_mode(DeprecatedString const& mode);
bool set_wallpaper_mode(ByteString const& mode);
bool set_wallpaper(RefPtr<Gfx::Bitmap const>);
RefPtr<Gfx::Bitmap const> wallpaper_bitmap() const { return m_wallpaper; }

View file

@ -148,8 +148,8 @@ void ConnectionFromClient::add_menu(i32 window_id, i32 menu_id)
}
void ConnectionFromClient::add_menu_item(i32 menu_id, i32 identifier, i32 submenu_id,
DeprecatedString const& text, bool enabled, bool visible, bool checkable, bool checked, bool is_default,
DeprecatedString const& shortcut, Gfx::ShareableBitmap const& icon, bool exclusive)
ByteString const& text, bool enabled, bool visible, bool checkable, bool checked, bool is_default,
ByteString const& shortcut, Gfx::ShareableBitmap const& icon, bool exclusive)
{
auto it = m_menus.find(menu_id);
if (it == m_menus.end()) {
@ -193,8 +193,8 @@ void ConnectionFromClient::dismiss_menu(i32 menu_id)
}
void ConnectionFromClient::update_menu_item(i32 menu_id, i32 identifier, [[maybe_unused]] i32 submenu_id,
DeprecatedString const& text, bool enabled, bool visible, bool checkable, bool checked, bool is_default,
DeprecatedString const& shortcut, Gfx::ShareableBitmap const& icon)
ByteString const& text, bool enabled, bool visible, bool checkable, bool checked, bool is_default,
ByteString const& shortcut, Gfx::ShareableBitmap const& icon)
{
auto it = m_menus.find(menu_id);
if (it == m_menus.end()) {
@ -327,12 +327,12 @@ Messages::WindowServer::SetWallpaperResponse ConnectionFromClient::set_wallpaper
return Compositor::the().set_wallpaper(bitmap.bitmap());
}
void ConnectionFromClient::set_background_color(DeprecatedString const& background_color)
void ConnectionFromClient::set_background_color(ByteString const& background_color)
{
Compositor::the().set_background_color(background_color);
}
void ConnectionFromClient::set_wallpaper_mode(DeprecatedString const& mode)
void ConnectionFromClient::set_wallpaper_mode(ByteString const& mode)
{
Compositor::the().set_wallpaper_mode(mode);
}
@ -344,7 +344,7 @@ Messages::WindowServer::GetWallpaperResponse ConnectionFromClient::get_wallpaper
Messages::WindowServer::SetScreenLayoutResponse ConnectionFromClient::set_screen_layout(ScreenLayout const& screen_layout, bool save)
{
DeprecatedString error_msg;
ByteString error_msg;
bool success = WindowManager::the().set_screen_layout(ScreenLayout(screen_layout), save, error_msg);
return { success, move(error_msg) };
}
@ -356,7 +356,7 @@ Messages::WindowServer::GetScreenLayoutResponse ConnectionFromClient::get_screen
Messages::WindowServer::SaveScreenLayoutResponse ConnectionFromClient::save_screen_layout()
{
DeprecatedString error_msg;
ByteString error_msg;
bool success = WindowManager::the().save_screen_layout(error_msg);
return { success, move(error_msg) };
}
@ -386,7 +386,7 @@ void ConnectionFromClient::show_screen_numbers(bool show)
Compositor::the().decrement_show_screen_number({});
}
void ConnectionFromClient::set_window_title(i32 window_id, DeprecatedString const& title)
void ConnectionFromClient::set_window_title(i32 window_id, ByteString const& title)
{
auto it = m_windows.find(window_id);
if (it == m_windows.end()) {
@ -478,7 +478,7 @@ Messages::WindowServer::SetWindowRectResponse ConnectionFromClient::set_window_r
return nullptr;
}
if (rect.width() > INT16_MAX || rect.height() > INT16_MAX) {
did_misbehave(DeprecatedString::formatted("SetWindowRect: Bad window sizing(width={}, height={}), dimension exceeds INT16_MAX", rect.width(), rect.height()).characters());
did_misbehave(ByteString::formatted("SetWindowRect: Bad window sizing(width={}, height={}), dimension exceeds INT16_MAX", rect.width(), rect.height()).characters());
return nullptr;
}
@ -616,7 +616,7 @@ void ConnectionFromClient::create_window(i32 window_id, i32 process_id, Gfx::Int
bool fullscreen, bool frameless, bool forced_shadow,
float alpha_hit_threshold, Gfx::IntSize base_size, Gfx::IntSize size_increment,
Gfx::IntSize minimum_size, Optional<Gfx::IntSize> const& resize_aspect_ratio, i32 type, i32 mode,
DeprecatedString const& title, i32 parent_window_id, Gfx::IntRect const& launch_origin_rect)
ByteString const& title, i32 parent_window_id, Gfx::IntRect const& launch_origin_rect)
{
Window* parent_window = nullptr;
if (parent_window_id) {
@ -871,7 +871,7 @@ void ConnectionFromClient::start_window_resize(i32 window_id, i32 resize_directi
WindowManager::the().start_window_resize(window, ScreenInput::the().cursor_location(), MouseButton::Primary, (ResizeDirection)resize_direction);
}
Messages::WindowServer::StartDragResponse ConnectionFromClient::start_drag(DeprecatedString const& text, HashMap<String, ByteBuffer> const& mime_data, Gfx::ShareableBitmap const& drag_bitmap)
Messages::WindowServer::StartDragResponse ConnectionFromClient::start_drag(ByteString const& text, HashMap<String, ByteBuffer> const& mime_data, Gfx::ShareableBitmap const& drag_bitmap)
{
auto& wm = WindowManager::the();
if (wm.dnd_client() || !(wm.last_processed_buttons() & MouseButton::Primary))
@ -888,7 +888,7 @@ void ConnectionFromClient::set_accepts_drag(bool accepts)
wm.set_accepts_drag(accepts);
}
Messages::WindowServer::SetSystemThemeResponse ConnectionFromClient::set_system_theme(DeprecatedString const& theme_path, DeprecatedString const& theme_name, bool keep_desktop_background, Optional<DeprecatedString> const& color_scheme_path)
Messages::WindowServer::SetSystemThemeResponse ConnectionFromClient::set_system_theme(ByteString const& theme_path, ByteString const& theme_name, bool keep_desktop_background, Optional<ByteString> const& color_scheme_path)
{
bool success = WindowManager::the().update_theme(theme_path, theme_name, keep_desktop_background, color_scheme_path);
return success;
@ -925,7 +925,7 @@ Messages::WindowServer::GetPreferredColorSchemeResponse ConnectionFromClient::ge
return WindowManager::the().get_preferred_color_scheme();
}
void ConnectionFromClient::apply_cursor_theme(DeprecatedString const& name)
void ConnectionFromClient::apply_cursor_theme(ByteString const& name)
{
WindowManager::the().apply_cursor_theme(name);
}
@ -955,7 +955,7 @@ Messages::WindowServer::GetCursorThemeResponse ConnectionFromClient::get_cursor_
return g_config->read_entry("Mouse", "CursorTheme");
}
Messages::WindowServer::SetSystemFontsResponse ConnectionFromClient::set_system_fonts(DeprecatedString const& default_font_query, DeprecatedString const& fixed_width_font_query, DeprecatedString const& window_title_font_query)
Messages::WindowServer::SetSystemFontsResponse ConnectionFromClient::set_system_fonts(ByteString const& default_font_query, ByteString const& fixed_width_font_query, ByteString const& window_title_font_query)
{
if (!Gfx::FontDatabase::the().get_by_name(default_font_query)
|| !Gfx::FontDatabase::the().get_by_name(fixed_width_font_query)) {

View file

@ -97,16 +97,16 @@ private:
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;
virtual void add_menu_item(i32, i32, i32, ByteString const&, bool, bool, bool, bool, bool, ByteString const&, Gfx::ShareableBitmap const&, bool) override;
virtual void add_menu_separator(i32) override;
virtual void update_menu_item(i32, i32, i32, DeprecatedString const&, bool, bool, bool, bool, bool, DeprecatedString const&, Gfx::ShareableBitmap const&) override;
virtual void update_menu_item(i32, i32, i32, ByteString const&, bool, bool, bool, bool, bool, ByteString const&, Gfx::ShareableBitmap const&) override;
virtual void remove_menu_item(i32 menu_id, i32 identifier) override;
virtual void flash_menubar_menu(i32, i32) override;
virtual void create_window(i32, i32, Gfx::IntRect const&, bool, bool, bool,
bool, bool, bool, bool, bool, float, Gfx::IntSize, Gfx::IntSize, Gfx::IntSize,
Optional<Gfx::IntSize> const&, i32, i32, DeprecatedString const&, i32, Gfx::IntRect const&) override;
Optional<Gfx::IntSize> const&, i32, i32, ByteString const&, i32, Gfx::IntRect const&) override;
virtual Messages::WindowServer::DestroyWindowResponse destroy_window(i32) override;
virtual void set_window_title(i32, DeprecatedString const&) override;
virtual void set_window_title(i32, ByteString const&) override;
virtual Messages::WindowServer::GetWindowTitleResponse get_window_title(i32) override;
virtual Messages::WindowServer::IsMaximizedResponse is_maximized(i32) override;
virtual void set_maximized(i32, bool) override;
@ -130,8 +130,8 @@ private:
virtual void set_frameless(i32, bool) override;
virtual void set_forced_shadow(i32, bool) override;
virtual Messages::WindowServer::SetWallpaperResponse set_wallpaper(Gfx::ShareableBitmap const&) override;
virtual void set_background_color(DeprecatedString const&) override;
virtual void set_wallpaper_mode(DeprecatedString const&) override;
virtual void set_background_color(ByteString const&) override;
virtual void set_wallpaper_mode(ByteString const&) override;
virtual Messages::WindowServer::GetWallpaperResponse get_wallpaper() override;
virtual Messages::WindowServer::SetScreenLayoutResponse set_screen_layout(ScreenLayout const&, bool) override;
virtual Messages::WindowServer::GetScreenLayoutResponse get_screen_layout() override;
@ -144,22 +144,22 @@ private:
virtual void popup_menu(i32, Gfx::IntPoint, Gfx::IntRect const&) override;
virtual void dismiss_menu(i32) override;
virtual void set_window_icon_bitmap(i32, Gfx::ShareableBitmap const&) override;
virtual Messages::WindowServer::StartDragResponse start_drag(DeprecatedString const&, HashMap<String, ByteBuffer> const&, Gfx::ShareableBitmap const&) override;
virtual Messages::WindowServer::StartDragResponse start_drag(ByteString const&, HashMap<String, ByteBuffer> const&, Gfx::ShareableBitmap const&) override;
virtual void set_accepts_drag(bool) override;
virtual Messages::WindowServer::SetSystemThemeResponse set_system_theme(DeprecatedString const&, DeprecatedString const&, bool keep_desktop_background, Optional<DeprecatedString> const& color_scheme_path) override;
virtual Messages::WindowServer::SetSystemThemeResponse set_system_theme(ByteString const&, ByteString const&, bool keep_desktop_background, Optional<ByteString> const& color_scheme_path) override;
virtual Messages::WindowServer::GetSystemThemeResponse get_system_theme() override;
virtual Messages::WindowServer::SetSystemThemeOverrideResponse set_system_theme_override(Core::AnonymousBuffer const&) override;
virtual Messages::WindowServer::GetSystemThemeOverrideResponse get_system_theme_override() override;
virtual void clear_system_theme_override() override;
virtual Messages::WindowServer::IsSystemThemeOverriddenResponse is_system_theme_overridden() override;
virtual Messages::WindowServer::GetPreferredColorSchemeResponse get_preferred_color_scheme() override;
virtual void apply_cursor_theme(DeprecatedString const&) override;
virtual void apply_cursor_theme(ByteString const&) override;
virtual void set_cursor_highlight_radius(int radius) override;
virtual Messages::WindowServer::GetCursorHighlightRadiusResponse get_cursor_highlight_radius() override;
virtual void set_cursor_highlight_color(Gfx::Color color) override;
virtual Messages::WindowServer::GetCursorHighlightColorResponse get_cursor_highlight_color() override;
virtual Messages::WindowServer::GetCursorThemeResponse get_cursor_theme() override;
virtual Messages::WindowServer::SetSystemFontsResponse set_system_fonts(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) override;
virtual Messages::WindowServer::SetSystemFontsResponse set_system_fonts(ByteString const&, ByteString const&, ByteString const&) override;
virtual void set_system_effects(Vector<bool> const&, u8, u8) override;
virtual void set_window_base_size_and_size_increment(i32, Gfx::IntSize, Gfx::IntSize) override;
virtual void set_window_resize_aspect_ratio(i32, Optional<Gfx::IntSize> const&) override;

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <Kernel/API/KeyCode.h>
#include <LibCore/Event.h>
#include <LibCore/MimeData.h>

View file

@ -17,7 +17,7 @@
namespace WindowServer {
HardwareScreenBackend::HardwareScreenBackend(DeprecatedString device)
HardwareScreenBackend::HardwareScreenBackend(ByteString device)
: m_device(move(device))
{
}
@ -28,7 +28,7 @@ ErrorOr<void> HardwareScreenBackend::open()
GraphicsConnectorProperties properties;
if (graphics_connector_get_properties(m_display_connector_fd, &properties) < 0)
return Error::from_syscall(DeprecatedString::formatted("failed to ioctl {}", m_device), errno);
return Error::from_syscall(ByteString::formatted("failed to ioctl {}", m_device), errno);
m_can_device_flush_buffers = (properties.partial_flushing_support != 0);
m_can_device_flush_entire_framebuffer = (properties.flushing_support != 0);

View file

@ -8,7 +8,7 @@
#include "ScreenBackend.h"
#include "ScreenLayout.h"
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Error.h>
#include <AK/Span.h>
#include <sys/ioctl.h>
@ -18,7 +18,7 @@ class HardwareScreenBackend : public ScreenBackend {
public:
virtual ~HardwareScreenBackend();
explicit HardwareScreenBackend(DeprecatedString device);
explicit HardwareScreenBackend(ByteString device);
virtual ErrorOr<void> open() override;
@ -36,7 +36,7 @@ public:
virtual ErrorOr<void> set_head_mode_setting(GraphicsHeadModeSetting) override;
virtual ErrorOr<GraphicsHeadModeSetting> get_head_mode_setting() override;
DeprecatedString m_device {};
ByteString m_device {};
int m_display_connector_fd { -1 };
Gfx::ARGB32* scanline(int buffer_index, int y) const

View file

@ -87,17 +87,17 @@ void KeymapSwitcher::next_keymap()
}
}
DeprecatedString KeymapSwitcher::get_current_keymap() const
ByteString KeymapSwitcher::get_current_keymap() const
{
auto proc_keymap = Core::File::open("/sys/kernel/keymap"sv, Core::File::OpenMode::Read).release_value_but_fixme_should_propagate_errors();
auto proc_keymap_data = proc_keymap->read_until_eof().release_value_but_fixme_should_propagate_errors();
auto json = JsonValue::from_string(proc_keymap_data).release_value_but_fixme_should_propagate_errors();
auto const& keymap_object = json.as_object();
VERIFY(keymap_object.has_string("keymap"sv));
return keymap_object.get_deprecated_string("keymap"sv).value();
return keymap_object.get_byte_string("keymap"sv).value();
}
void KeymapSwitcher::set_keymap(const AK::DeprecatedString& keymap)
void KeymapSwitcher::set_keymap(const AK::ByteString& keymap)
{
if (Core::Process::spawn("/bin/keymap"sv, Array { "-m", keymap.characters() }).is_error())
dbgln("Failed to call /bin/keymap, error: {} ({})", errno, strerror(errno));

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Vector.h>
#include <AK/WeakPtr.h>
#include <LibCore/EventReceiver.h>
@ -23,18 +23,18 @@ public:
void next_keymap();
Function<void(DeprecatedString const& keymap)> on_keymap_change;
Function<void(ByteString const& keymap)> on_keymap_change;
DeprecatedString get_current_keymap() const;
ByteString get_current_keymap() const;
void set_keymap(AK::DeprecatedString const&);
void set_keymap(AK::ByteString const&);
private:
void refresh();
KeymapSwitcher();
Vector<AK::DeprecatedString> m_keymaps;
Vector<AK::ByteString> m_keymaps;
RefPtr<Core::FileWatcher> m_file_watcher;

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/WeakPtr.h>
#include <LibCore/EventReceiver.h>
#include <LibGfx/Font/Font.h>

View file

@ -12,7 +12,7 @@
namespace WindowServer {
MenuItem::MenuItem(Menu& menu, unsigned identifier, DeprecatedString const& text, DeprecatedString const& shortcut_text, bool enabled, bool visible, bool checkable, bool checked, Gfx::Bitmap const* icon)
MenuItem::MenuItem(Menu& menu, unsigned identifier, ByteString const& text, ByteString const& shortcut_text, bool enabled, bool visible, bool checkable, bool checked, Gfx::Bitmap const* icon)
: m_menu(menu)
, m_type(Text)
, m_enabled(enabled)

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Function.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Rect.h>
@ -23,7 +23,7 @@ public:
Separator,
};
MenuItem(Menu&, unsigned identifier, DeprecatedString const& text, DeprecatedString const& shortcut_text = {}, bool enabled = true, bool visible = true, bool checkable = false, bool checked = false, Gfx::Bitmap const* icon = nullptr);
MenuItem(Menu&, unsigned identifier, ByteString const& text, ByteString const& shortcut_text = {}, bool enabled = true, bool visible = true, bool checkable = false, bool checked = false, Gfx::Bitmap const* icon = nullptr);
MenuItem(Menu&, Type);
~MenuItem() = default;
@ -44,11 +44,11 @@ public:
bool is_default() const { return m_default; }
void set_default(bool);
DeprecatedString text() const { return m_text; }
void set_text(DeprecatedString text) { m_text = move(text); }
ByteString text() const { return m_text; }
void set_text(ByteString text) { m_text = move(text); }
DeprecatedString shortcut_text() const { return m_shortcut_text; }
void set_shortcut_text(DeprecatedString text) { m_shortcut_text = move(text); }
ByteString shortcut_text() const { return m_shortcut_text; }
void set_shortcut_text(ByteString text) { m_shortcut_text = move(text); }
void set_rect(Gfx::IntRect const& rect) { m_rect = rect; }
Gfx::IntRect rect() const;
@ -77,8 +77,8 @@ private:
bool m_checked { false };
bool m_default { false };
unsigned m_identifier { 0 };
DeprecatedString m_text;
DeprecatedString m_shortcut_text;
ByteString m_text;
ByteString m_shortcut_text;
Gfx::IntRect m_rect;
RefPtr<Gfx::Bitmap const> m_icon;
int m_submenu_id { -1 };

View file

@ -170,7 +170,7 @@ void ScreenNumberOverlay::pick_font()
auto screen_number_content_rect_size = calculate_content_rect_for_screen(Screen::main()).size();
auto& font_database = Gfx::FontDatabase::the();
auto& default_font = WindowManager::the().font();
DeprecatedString best_font_name;
ByteString best_font_name;
int best_font_size = -1;
font_database.for_each_font([&](Gfx::Font const& font) {
// TODO: instead of picking *any* font we should probably compare font.name()
@ -183,7 +183,7 @@ void ScreenNumberOverlay::pick_font()
return;
}
}
best_font_name = font.qualified_name().to_deprecated_string();
best_font_name = font.qualified_name().to_byte_string();
best_font_size = size;
}
});
@ -212,7 +212,7 @@ Gfx::Font const& ScreenNumberOverlay::font()
void ScreenNumberOverlay::render_overlay_bitmap(Gfx::Painter& painter)
{
painter.draw_text(Gfx::IntRect { {}, rect().size() }, DeprecatedString::formatted("{}", m_screen.index() + 1), font(), Gfx::TextAlignment::Center, Color::White);
painter.draw_text(Gfx::IntRect { {}, rect().size() }, ByteString::formatted("{}", m_screen.index() + 1), font(), Gfx::TextAlignment::Center, Color::White);
}
Gfx::IntRect ScreenNumberOverlay::calculate_content_rect_for_screen(Screen& screen)
@ -319,9 +319,9 @@ void WindowGeometryOverlay::window_rect_changed()
if (!window->size_increment().is_empty()) {
int width_steps = (window->width() - window->base_size().width()) / window->size_increment().width();
int height_steps = (window->height() - window->base_size().height()) / window->size_increment().height();
m_label = DeprecatedString::formatted("{} ({}x{})", geometry_rect, width_steps, height_steps);
m_label = ByteString::formatted("{} ({}x{})", geometry_rect, width_steps, height_steps);
} else {
m_label = geometry_rect.to_deprecated_string();
m_label = geometry_rect.to_byte_string();
}
m_label_rect = Gfx::IntRect { 0, 0, static_cast<int>(ceilf(wm.font().width(m_label))) + 16, wm.font().pixel_size_rounded_up() + 10 };
@ -341,7 +341,7 @@ void WindowGeometryOverlay::render_overlay_bitmap(Gfx::Painter& painter)
painter.draw_text(Gfx::IntRect { {}, rect().size() }, m_label, WindowManager::the().font(), Gfx::TextAlignment::Center, Color::White);
}
DndOverlay::DndOverlay(DeprecatedString const& text, Gfx::Bitmap const* bitmap)
DndOverlay::DndOverlay(ByteString const& text, Gfx::Bitmap const* bitmap)
: m_bitmap(bitmap)
, m_text(text)
{

View file

@ -154,7 +154,7 @@ private:
Gfx::IntRect calculate_ideal_overlay_rect() const;
WeakPtr<Window> m_window;
DeprecatedString m_label;
ByteString m_label;
Gfx::IntRect m_label_rect;
Gfx::IntRect m_ideal_overlay_rect;
@ -182,7 +182,7 @@ private:
class DndOverlay : public BitmapOverlay {
public:
DndOverlay(DeprecatedString const&, Gfx::Bitmap const*);
DndOverlay(ByteString const&, Gfx::Bitmap const*);
void cursor_moved()
{
@ -197,7 +197,7 @@ private:
void update_rect();
RefPtr<Gfx::Bitmap const> m_bitmap;
DeprecatedString m_text;
ByteString m_text;
Gfx::IntRect m_label_rect;
};

View file

@ -54,7 +54,7 @@ Screen const& ScreenInput::cursor_location_screen() const
return *screen;
}
bool Screen::apply_layout(ScreenLayout&& screen_layout, DeprecatedString& error_msg)
bool Screen::apply_layout(ScreenLayout&& screen_layout, ByteString& error_msg)
{
if (!screen_layout.is_valid(&error_msg))
return false;
@ -145,7 +145,7 @@ bool Screen::apply_layout(ScreenLayout&& screen_layout, DeprecatedString& error_
} else {
screen = WindowServer::Screen::create(index);
if (!screen) {
error_msg = DeprecatedString::formatted("Error creating screen #{}", index);
error_msg = ByteString::formatted("Error creating screen #{}", index);
return false;
}
@ -153,7 +153,7 @@ bool Screen::apply_layout(ScreenLayout&& screen_layout, DeprecatedString& error_
}
if (need_to_open_device && !screen->open_device()) {
error_msg = DeprecatedString::formatted("Error opening device for screen #{}", index);
error_msg = ByteString::formatted("Error opening device for screen #{}", index);
return false;
}

View file

@ -81,7 +81,7 @@ public:
}
~Screen();
static bool apply_layout(ScreenLayout&&, DeprecatedString&);
static bool apply_layout(ScreenLayout&&, ByteString&);
static ScreenLayout const& layout() { return s_layout; }
static Screen& main()

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Vector.h>
#include <LibCore/ConfigFile.h>
#include <LibGfx/Rect.h>
@ -23,7 +23,7 @@ public:
Device,
Virtual,
} mode;
Optional<DeprecatedString> device;
Optional<ByteString> device;
Gfx::IntPoint location;
Gfx::IntSize resolution;
int scale_factor;
@ -55,11 +55,11 @@ public:
Vector<Screen> screens;
unsigned main_screen_index { 0 };
bool is_valid(DeprecatedString* error_msg = nullptr) const;
bool is_valid(ByteString* error_msg = nullptr) const;
bool normalize();
bool load_config(Core::ConfigFile const& config_file, DeprecatedString* error_msg = nullptr);
bool load_config(Core::ConfigFile const& config_file, ByteString* error_msg = nullptr);
bool save_config(Core::ConfigFile& config_file, bool sync = true) const;
bool try_auto_add_display_connector(DeprecatedString const&);
bool try_auto_add_display_connector(ByteString const&);
// TODO: spaceship operator
bool operator!=(ScreenLayout const& other) const;

View file

@ -15,7 +15,7 @@
namespace WindowServer {
bool ScreenLayout::is_valid(DeprecatedString* error_msg) const
bool ScreenLayout::is_valid(ByteString* error_msg) const
{
if (screens.is_empty()) {
if (error_msg)
@ -24,7 +24,7 @@ bool ScreenLayout::is_valid(DeprecatedString* error_msg) const
}
if (main_screen_index >= screens.size()) {
if (error_msg)
*error_msg = DeprecatedString::formatted("Invalid main screen index: {}", main_screen_index);
*error_msg = ByteString::formatted("Invalid main screen index: {}", main_screen_index);
return false;
}
int smallest_x = 0;
@ -33,7 +33,7 @@ bool ScreenLayout::is_valid(DeprecatedString* error_msg) const
auto& screen = screens[i];
if (screen.mode == Screen::Mode::Device && screen.device->is_empty()) {
if (error_msg)
*error_msg = DeprecatedString::formatted("Screen #{} has no path", i);
*error_msg = ByteString::formatted("Screen #{} has no path", i);
return false;
}
for (size_t j = 0; j < screens.size(); j++) {
@ -42,28 +42,28 @@ bool ScreenLayout::is_valid(DeprecatedString* error_msg) const
continue;
if (screen.device == other_screen.device) {
if (error_msg)
*error_msg = DeprecatedString::formatted("Screen #{} is using same device as screen #{}", i, j);
*error_msg = ByteString::formatted("Screen #{} is using same device as screen #{}", i, j);
return false;
}
if (screen.virtual_rect().intersects(other_screen.virtual_rect())) {
if (error_msg)
*error_msg = DeprecatedString::formatted("Screen #{} overlaps with screen #{}", i, j);
*error_msg = ByteString::formatted("Screen #{} overlaps with screen #{}", i, j);
return false;
}
}
if (screen.location.x() < 0 || screen.location.y() < 0) {
if (error_msg)
*error_msg = DeprecatedString::formatted("Screen #{} has invalid location: {}", i, screen.location);
*error_msg = ByteString::formatted("Screen #{} has invalid location: {}", i, screen.location);
return false;
}
if (screen.resolution.width() <= 0 || screen.resolution.height() <= 0) {
if (error_msg)
*error_msg = DeprecatedString::formatted("Screen #{} has invalid resolution: {}", i, screen.resolution);
*error_msg = ByteString::formatted("Screen #{} has invalid resolution: {}", i, screen.resolution);
return false;
}
if (screen.scale_factor < 1) {
if (error_msg)
*error_msg = DeprecatedString::formatted("Screen #{} has invalid scale factor: {}", i, screen.scale_factor);
*error_msg = ByteString::formatted("Screen #{} has invalid scale factor: {}", i, screen.scale_factor);
return false;
}
if (i == 0 || screen.location.x() < smallest_x)
@ -96,7 +96,7 @@ bool ScreenLayout::is_valid(DeprecatedString* error_msg) const
auto& screen = screens[i];
if (!reachable_screens.contains_slow(&screen)) {
if (error_msg)
*error_msg = DeprecatedString::formatted("Screen #{} {} cannot be reached from main screen #{} {}", i, screen.virtual_rect(), main_screen_index, screens[main_screen_index].virtual_rect());
*error_msg = ByteString::formatted("Screen #{} {} cannot be reached from main screen #{} {}", i, screen.virtual_rect(), main_screen_index, screens[main_screen_index].virtual_rect());
break;
}
}
@ -225,12 +225,12 @@ bool ScreenLayout::normalize()
return did_change;
}
bool ScreenLayout::load_config(Core::ConfigFile const& config_file, DeprecatedString* error_msg)
bool ScreenLayout::load_config(Core::ConfigFile const& config_file, ByteString* error_msg)
{
screens.clear_with_capacity();
main_screen_index = config_file.read_num_entry("Screens", "MainScreen", 0);
for (size_t index = 0;; index++) {
auto group_name = DeprecatedString::formatted("Screen{}", index);
auto group_name = ByteString::formatted("Screen{}", index);
if (!config_file.has_group(group_name))
break;
auto str_mode = config_file.read_entry(group_name, "Mode");
@ -242,11 +242,11 @@ bool ScreenLayout::load_config(Core::ConfigFile const& config_file, DeprecatedSt
}
if (mode == Screen::Mode::Invalid) {
*error_msg = DeprecatedString::formatted("Invalid screen mode '{}'", str_mode);
*error_msg = ByteString::formatted("Invalid screen mode '{}'", str_mode);
*this = {};
return false;
}
auto device = (mode == Screen::Mode::Device) ? config_file.read_entry(group_name, "Device") : Optional<DeprecatedString> {};
auto device = (mode == Screen::Mode::Device) ? config_file.read_entry(group_name, "Device") : Optional<ByteString> {};
screens.append({ mode, device,
{ config_file.read_num_entry(group_name, "Left"), config_file.read_num_entry(group_name, "Top") },
{ config_file.read_num_entry(group_name, "Width"), config_file.read_num_entry(group_name, "Height") },
@ -266,7 +266,7 @@ bool ScreenLayout::save_config(Core::ConfigFile& config_file, bool sync) const
size_t index = 0;
while (index < screens.size()) {
auto& screen = screens[index];
auto group_name = DeprecatedString::formatted("Screen{}", index);
auto group_name = ByteString::formatted("Screen{}", index);
config_file.write_entry(group_name, "Mode", Screen::mode_to_string(screen.mode));
if (screen.mode == Screen::Mode::Device)
config_file.write_entry(group_name, "Device", screen.device.value());
@ -279,7 +279,7 @@ bool ScreenLayout::save_config(Core::ConfigFile& config_file, bool sync) const
}
// Prune screens no longer in the layout
for (;;) {
auto group_name = DeprecatedString::formatted("Screen{}", index++);
auto group_name = ByteString::formatted("Screen{}", index++);
if (!config_file.has_group(group_name))
break;
config_file.remove_group(group_name);
@ -305,7 +305,7 @@ bool ScreenLayout::operator!=(ScreenLayout const& other) const
return false;
}
bool ScreenLayout::try_auto_add_display_connector(DeprecatedString const& device_path)
bool ScreenLayout::try_auto_add_display_connector(ByteString const& device_path)
{
int display_connector_fd = open(device_path.characters(), O_RDWR | O_CLOEXEC);
if (display_connector_fd < 0) {
@ -408,7 +408,7 @@ template<>
ErrorOr<WindowServer::ScreenLayout::Screen> decode(Decoder& decoder)
{
auto mode = TRY(decoder.decode<WindowServer::ScreenLayout::Screen::Mode>());
auto device = TRY(decoder.decode<Optional<DeprecatedString>>());
auto device = TRY(decoder.decode<Optional<ByteString>>());
auto location = TRY(decoder.decode<Gfx::IntPoint>());
auto resolution = TRY(decoder.decode<Gfx::IntSize>());
auto scale_factor = TRY(decoder.decode<int>());

View file

@ -182,7 +182,7 @@ void WMConnectionFromClient::set_window_taskbar_rect(i32 client_id, i32 window_i
window.set_taskbar_rect(rect);
}
void WMConnectionFromClient::set_keymap(DeprecatedString const& keymap)
void WMConnectionFromClient::set_keymap(ByteString const& keymap)
{
WindowManager::the().keymap_switcher()->set_keymap(keymap);
}

View file

@ -31,7 +31,7 @@ public:
virtual void set_event_mask(u32) override;
virtual void set_manager_window(i32) override;
virtual void set_workspace(u32, u32) override;
virtual void set_keymap(DeprecatedString const&) override;
virtual void set_keymap(ByteString const&) override;
unsigned event_mask() const { return m_event_mask; }
int window_id() const { return m_window_id; }

View file

@ -24,7 +24,7 @@
namespace WindowServer {
static DeprecatedString default_window_icon_path()
static ByteString default_window_icon_path()
{
return "/res/icons/16x16/window.png";
}
@ -136,7 +136,7 @@ void Window::destroy()
set_visible(false);
}
void Window::set_title(DeprecatedString const& title)
void Window::set_title(ByteString const& title)
{
if (m_title == title)
return;
@ -1136,17 +1136,17 @@ void Window::set_modified(bool modified)
frame().invalidate_titlebar();
}
DeprecatedString Window::computed_title() const
ByteString Window::computed_title() const
{
DeprecatedString title = m_title.replace("[*]"sv, is_modified() ? " (*)"sv : ""sv, ReplaceMode::FirstOnly);
ByteString title = m_title.replace("[*]"sv, is_modified() ? " (*)"sv : ""sv, ReplaceMode::FirstOnly);
if (m_title_username.has_value())
title = DeprecatedString::formatted("{} [{}]", title, m_title_username.value());
title = ByteString::formatted("{} [{}]", title, m_title_username.value());
if (client() && client()->is_unresponsive())
return DeprecatedString::formatted("{} (Not responding)", title);
return ByteString::formatted("{} (Not responding)", title);
return title;
}
ErrorOr<Optional<DeprecatedString>> Window::compute_title_username(ConnectionFromClient* client)
ErrorOr<Optional<ByteString>> Window::compute_title_username(ConnectionFromClient* client)
{
if (!client)
return Error::from_string_literal("Tried to compute title username without a client");
@ -1160,7 +1160,7 @@ ErrorOr<Optional<DeprecatedString>> Window::compute_title_username(ConnectionFro
if (!login_session_stat.has_value())
return Error::from_string_literal("Failed to find login process stat");
if (login_session_stat.value().uid == client_stat.value().uid)
return Optional<DeprecatedString> {};
return Optional<ByteString> {};
return client_stat.value().username;
}

View file

@ -8,7 +8,7 @@
#pragma once
#include "HitTestResult.h"
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/IntrusiveList.h>
#include <AK/WeakPtr.h>
#include <LibCore/EventReceiver.h>
@ -152,10 +152,10 @@ public:
bool is_internal() const { return m_client_id == -1; }
i32 client_id() const { return m_client_id; }
DeprecatedString title() const { return m_title; }
void set_title(DeprecatedString const&);
ByteString title() const { return m_title; }
void set_title(ByteString const&);
DeprecatedString computed_title() const;
ByteString computed_title() const;
void set_hit_testing_enabled(bool value)
{
@ -387,7 +387,7 @@ private:
void ensure_window_menu();
void update_window_menu_items();
void tile_type_changed(Optional<Screen const&> = {});
ErrorOr<Optional<DeprecatedString>> compute_title_username(ConnectionFromClient* client);
ErrorOr<Optional<ByteString>> compute_title_username(ConnectionFromClient* client);
void exit_roll_up_mode();
@ -398,8 +398,8 @@ private:
Menubar m_menubar;
DeprecatedString m_title;
Optional<DeprecatedString> m_title_username;
ByteString m_title;
Optional<ByteString> m_title_username;
Gfx::IntRect m_rect;
Gfx::IntRect m_saved_before_roll_up_rect;
Gfx::IntRect m_saved_nonfullscreen_rect;

View file

@ -3,7 +3,7 @@
endpoint WindowClient
{
fast_greet(Vector<Gfx::IntRect> screen_rects, u32 main_screen_index, u32 workspace_rows, u32 workspace_columns, Core::AnonymousBuffer theme_buffer, DeprecatedString default_font_query, DeprecatedString fixed_width_font_query, DeprecatedString window_title_font_query, Vector<bool> effects, i32 client_id) =|
fast_greet(Vector<Gfx::IntRect> screen_rects, u32 main_screen_index, u32 workspace_rows, u32 workspace_columns, Core::AnonymousBuffer theme_buffer, ByteString default_font_query, ByteString fixed_width_font_query, ByteString window_title_font_query, Vector<bool> effects, i32 client_id) =|
paint(i32 window_id, Gfx::IntSize window_size, Vector<Gfx::IntRect> rects) =|
mouse_move(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y, bool is_drag, Vector<String> mime_types) =|
@ -36,10 +36,10 @@ endpoint WindowClient
drag_accepted() =|
drag_cancelled() =|
drag_dropped(i32 window_id, Gfx::IntPoint mouse_position, [UTF8] DeprecatedString text, HashMap<String,ByteBuffer> mime_data) =|
drag_dropped(i32 window_id, Gfx::IntPoint mouse_position, [UTF8] ByteString text, HashMap<String,ByteBuffer> mime_data) =|
update_system_theme(Core::AnonymousBuffer theme_buffer) =|
update_system_fonts(DeprecatedString default_font_query, DeprecatedString fixed_width_font_query, DeprecatedString window_title_font_query) =|
update_system_fonts(ByteString default_font_query, ByteString fixed_width_font_query, ByteString window_title_font_query) =|
update_system_effects(Vector<bool> effects) =|
display_link_notification() =|

View file

@ -54,11 +54,11 @@ static RefPtr<MultiScaleBitmaps> s_inactive_window_shadow;
static RefPtr<MultiScaleBitmaps> s_menu_shadow;
static RefPtr<MultiScaleBitmaps> s_taskbar_shadow;
static RefPtr<MultiScaleBitmaps> s_tooltip_shadow;
static DeprecatedString s_last_active_window_shadow_path;
static DeprecatedString s_last_inactive_window_shadow_path;
static DeprecatedString s_last_menu_shadow_path;
static DeprecatedString s_last_taskbar_shadow_path;
static DeprecatedString s_last_tooltip_shadow_path;
static ByteString s_last_active_window_shadow_path;
static ByteString s_last_inactive_window_shadow_path;
static ByteString s_last_menu_shadow_path;
static ByteString s_last_taskbar_shadow_path;
static ByteString s_last_tooltip_shadow_path;
Gfx::IntRect WindowFrame::frame_rect_for_window(Window& window, Gfx::IntRect const& rect)
{
@ -148,7 +148,7 @@ void WindowFrame::set_button_icons()
void WindowFrame::reload_config()
{
DeprecatedString icons_path = WindowManager::the().palette().title_button_icons_path();
ByteString icons_path = WindowManager::the().palette().title_button_icons_path();
auto reload_bitmap = [&](RefPtr<MultiScaleBitmaps>& multiscale_bitmap, StringView path, StringView default_path = ""sv) {
StringBuilder full_path;
@ -177,9 +177,9 @@ void WindowFrame::reload_config()
reload_icon(s_close_icon, "window-close"sv, "/res/icons/16x16/window-close.png"sv);
reload_icon(s_close_modified_icon, "window-close-modified"sv, "/res/icons/16x16/window-close-modified.png"sv);
auto load_shadow = [](DeprecatedString const& path, DeprecatedString& last_path, RefPtr<MultiScaleBitmaps>& shadow_bitmap) {
auto load_shadow = [](ByteString const& path, ByteString& last_path, RefPtr<MultiScaleBitmaps>& shadow_bitmap) {
if (path.is_empty()) {
last_path = DeprecatedString::empty();
last_path = ByteString::empty();
shadow_bitmap = nullptr;
} else if (!shadow_bitmap || last_path != path) {
if (shadow_bitmap)
@ -189,7 +189,7 @@ void WindowFrame::reload_config()
if (shadow_bitmap)
last_path = path;
else
last_path = DeprecatedString::empty();
last_path = ByteString::empty();
}
};
load_shadow(WindowManager::the().palette().active_window_shadow_path(), s_last_active_window_shadow_path, s_active_window_shadow);

View file

@ -126,7 +126,7 @@ private:
void handle_menu_mouse_event(Menu&, MouseEvent const&);
Gfx::WindowTheme::WindowState window_state_for_theme() const;
DeprecatedString computed_title() const;
ByteString computed_title() const;
Gfx::IntRect constrained_render_rect_to_screen(Gfx::IntRect const&) const;
Gfx::IntRect leftmost_titlebar_button_rect() const;

View file

@ -55,7 +55,7 @@ WindowManager::WindowManager(Gfx::PaletteImpl& palette)
reload_config();
m_keymap_switcher->on_keymap_change = [&](DeprecatedString const& keymap) {
m_keymap_switcher->on_keymap_change = [&](ByteString const& keymap) {
for_each_window_manager([&keymap](WMConnectionFromClient& conn) {
if (!(conn.event_mask() & WMEventMask::KeymapChanged))
return IterationDecision::Continue;
@ -89,7 +89,7 @@ void WindowManager::reload_config()
m_cursor_highlight_color = Color::from_string(g_config->read_entry("Mouse", "CursorHighlightColor")).value_or(default_highlight_color);
apply_cursor_theme(g_config->read_entry("Mouse", "CursorTheme", "Default"));
auto reload_graphic = [&](RefPtr<MultiScaleBitmaps>& bitmap, DeprecatedString const& name) {
auto reload_graphic = [&](RefPtr<MultiScaleBitmaps>& bitmap, ByteString const& name) {
if (bitmap) {
if (!bitmap->load(name))
bitmap = nullptr;
@ -116,7 +116,7 @@ Gfx::Font const& WindowManager::window_title_font() const
return Gfx::FontDatabase::window_title_font();
}
bool WindowManager::set_screen_layout(ScreenLayout&& screen_layout, bool save, DeprecatedString& error_msg)
bool WindowManager::set_screen_layout(ScreenLayout&& screen_layout, bool save, ByteString& error_msg)
{
if (!Screen::apply_layout(move(screen_layout), error_msg))
return false;
@ -146,7 +146,7 @@ ScreenLayout WindowManager::get_screen_layout() const
return Screen::layout();
}
bool WindowManager::save_screen_layout(DeprecatedString& error_msg)
bool WindowManager::save_screen_layout(ByteString& error_msg)
{
if (!Screen::layout().save_config(*g_config)) {
error_msg = "Could not save";
@ -266,7 +266,7 @@ void WindowManager::set_acceleration_factor(double factor)
{
ScreenInput::the().set_acceleration_factor(factor);
dbgln("Saving acceleration factor {} to config file at {}", factor, g_config->filename());
g_config->write_entry("Mouse", "AccelerationFactor", DeprecatedString::formatted("{}", factor));
g_config->write_entry("Mouse", "AccelerationFactor", ByteString::formatted("{}", factor));
sync_config_to_disk();
}
@ -274,7 +274,7 @@ void WindowManager::set_scroll_step_size(unsigned step_size)
{
ScreenInput::the().set_scroll_step_size(step_size);
dbgln("Saving scroll step size {} to config file at {}", step_size, g_config->filename());
g_config->write_entry("Mouse", "ScrollStepSize", DeprecatedString::number(step_size));
g_config->write_entry("Mouse", "ScrollStepSize", ByteString::number(step_size));
sync_config_to_disk();
}
@ -283,7 +283,7 @@ void WindowManager::set_double_click_speed(int speed)
VERIFY(speed >= double_click_speed_min && speed <= double_click_speed_max);
m_double_click_speed = speed;
dbgln("Saving double-click speed {} to config file at {}", speed, g_config->filename());
g_config->write_entry("Input", "DoubleClickSpeed", DeprecatedString::number(speed));
g_config->write_entry("Input", "DoubleClickSpeed", ByteString::number(speed));
sync_config_to_disk();
}
@ -2117,7 +2117,7 @@ Gfx::IntRect WindowManager::tiled_window_rect(Window const& window, Optional<Scr
return rect;
}
void WindowManager::start_dnd_drag(ConnectionFromClient& client, DeprecatedString const& text, Gfx::Bitmap const* bitmap, Core::MimeData const& mime_data)
void WindowManager::start_dnd_drag(ConnectionFromClient& client, ByteString const& text, Gfx::Bitmap const* bitmap, Core::MimeData const& mime_data)
{
VERIFY(!m_dnd_client);
m_dnd_client = client;
@ -2148,7 +2148,7 @@ void WindowManager::set_accepts_drag(bool accepts)
void WindowManager::invalidate_after_theme_or_font_change()
{
Compositor::the().set_background_color(g_config->read_entry("Background", "Color", palette().desktop_background().to_deprecated_string()));
Compositor::the().set_background_color(g_config->read_entry("Background", "Color", palette().desktop_background().to_byte_string()));
WindowFrame::reload_config();
for_each_window_stack([&](auto& window_stack) {
window_stack.for_each_window([&](Window& window) {
@ -2166,7 +2166,7 @@ void WindowManager::invalidate_after_theme_or_font_change()
Compositor::the().invalidate_after_theme_or_font_change();
}
bool WindowManager::update_theme(DeprecatedString theme_path, DeprecatedString theme_name, bool keep_desktop_background, Optional<DeprecatedString> const& color_scheme_path)
bool WindowManager::update_theme(ByteString theme_path, ByteString theme_name, bool keep_desktop_background, Optional<ByteString> const& color_scheme_path)
{
auto error_or_new_theme = Gfx::load_system_theme(theme_path, color_scheme_path);
if (error_or_new_theme.is_error()) {
@ -2217,7 +2217,7 @@ void WindowManager::clear_theme_override()
{
m_theme_overridden = false;
auto previous_theme_name = g_config->read_entry("Theme", "Name");
auto previous_theme = MUST(Gfx::load_system_theme(DeprecatedString::formatted("/res/themes/{}.ini", previous_theme_name), m_preferred_color_scheme));
auto previous_theme = MUST(Gfx::load_system_theme(ByteString::formatted("/res/themes/{}.ini", previous_theme_name), m_preferred_color_scheme));
Gfx::set_system_theme(previous_theme);
m_palette = Gfx::PaletteImpl::create_with_anonymous_buffer(previous_theme);
invalidate_after_theme_or_font_change();
@ -2329,9 +2329,9 @@ WindowStack& WindowManager::get_rendering_window_stacks(WindowStack*& transition
return Compositor::the().get_rendering_window_stacks(transitioning_window_stack);
}
void WindowManager::apply_cursor_theme(DeprecatedString const& theme_name)
void WindowManager::apply_cursor_theme(ByteString const& theme_name)
{
auto theme_path = DeprecatedString::formatted("/res/cursor-themes/{}/{}", theme_name, "Config.ini");
auto theme_path = ByteString::formatted("/res/cursor-themes/{}/{}", theme_name, "Config.ini");
auto cursor_theme_config_or_error = Core::ConfigFile::open(theme_path);
if (cursor_theme_config_or_error.is_error()) {
dbgln("Unable to open cursor theme '{}': {}", theme_path, cursor_theme_config_or_error.error());
@ -2340,11 +2340,11 @@ void WindowManager::apply_cursor_theme(DeprecatedString const& theme_name)
auto cursor_theme_config = cursor_theme_config_or_error.release_value();
auto* current_cursor = Compositor::the().current_cursor();
auto reload_cursor = [&](RefPtr<Cursor const>& cursor, DeprecatedString const& name) {
auto reload_cursor = [&](RefPtr<Cursor const>& cursor, ByteString const& name) {
bool is_current_cursor = current_cursor && current_cursor == cursor.ptr();
static auto const s_default_cursor_path = "/res/cursor-themes/Default/arrow.x2y2.png"sv;
cursor = Cursor::create(DeprecatedString::formatted("/res/cursor-themes/{}/{}", theme_name, cursor_theme_config->read_entry("Cursor", name)), s_default_cursor_path);
cursor = Cursor::create(ByteString::formatted("/res/cursor-themes/{}/{}", theme_name, cursor_theme_config->read_entry("Cursor", name)), s_default_cursor_path);
if (is_current_cursor) {
Compositor::the().current_cursor_was_reloaded(cursor.ptr());
@ -2397,7 +2397,7 @@ void WindowManager::set_cursor_highlight_color(Gfx::Color color)
{
m_cursor_highlight_color = color;
Compositor::the().invalidate_cursor();
g_config->write_entry("Mouse", "CursorHighlightColor", color.to_deprecated_string());
g_config->write_entry("Mouse", "CursorHighlightColor", color.to_byte_string());
sync_config_to_disk();
}

View file

@ -85,7 +85,7 @@ public:
ConnectionFromClient const* dnd_client() const { return m_dnd_client.ptr(); }
Core::MimeData const& dnd_mime_data() const { return *m_dnd_mime_data; }
void start_dnd_drag(ConnectionFromClient&, DeprecatedString const& text, Gfx::Bitmap const*, Core::MimeData const&);
void start_dnd_drag(ConnectionFromClient&, ByteString const& text, Gfx::Bitmap const*, Core::MimeData const&);
void end_dnd_drag();
void set_accepts_drag(bool);
@ -146,9 +146,9 @@ public:
Gfx::Font const& font() const;
Gfx::Font const& window_title_font() const;
bool set_screen_layout(ScreenLayout&&, bool, DeprecatedString&);
bool set_screen_layout(ScreenLayout&&, bool, ByteString&);
ScreenLayout get_screen_layout() const;
bool save_screen_layout(DeprecatedString&);
bool save_screen_layout(ByteString&);
void set_acceleration_factor(double);
void set_scroll_step_size(unsigned);
@ -202,14 +202,14 @@ public:
return nullptr;
}
bool update_theme(DeprecatedString theme_path, DeprecatedString theme_name, bool keep_desktop_background, Optional<DeprecatedString> const& color_scheme_path);
bool update_theme(ByteString theme_path, ByteString theme_name, bool keep_desktop_background, Optional<ByteString> const& color_scheme_path);
void invalidate_after_theme_or_font_change();
bool set_theme_override(Core::AnonymousBuffer const& theme_override);
Optional<Core::AnonymousBuffer> get_theme_override() const;
void clear_theme_override();
bool is_theme_overridden() { return m_theme_overridden; }
Optional<DeprecatedString> get_preferred_color_scheme() { return m_preferred_color_scheme; }
Optional<ByteString> get_preferred_color_scheme() { return m_preferred_color_scheme; }
bool set_hovered_window(Window*);
void deliver_mouse_event(Window&, MouseEvent const&);
@ -321,7 +321,7 @@ public:
MultiScaleBitmaps const* overlay_rect_shadow() const { return m_overlay_rect_shadow.ptr(); }
void apply_cursor_theme(DeprecatedString const& name);
void apply_cursor_theme(ByteString const& name);
void set_cursor_highlight_radius(int radius);
void set_cursor_highlight_color(Gfx::Color color);
@ -449,7 +449,7 @@ private:
bool m_mouse_buttons_switched { false };
bool m_natural_scroll { false };
bool m_theme_overridden { false };
Optional<DeprecatedString> m_preferred_color_scheme { OptionalNone() };
Optional<ByteString> m_preferred_color_scheme { OptionalNone() };
WeakPtr<Window> m_hovered_window;
WeakPtr<Window> m_highlight_window;
@ -488,7 +488,7 @@ private:
OwnPtr<DndOverlay> m_dnd_overlay;
WeakPtr<ConnectionFromClient> m_dnd_client;
DeprecatedString m_dnd_text;
ByteString m_dnd_text;
bool m_dnd_accepts_drag { false };
RefPtr<Core::MimeData const> m_dnd_mime_data;

View file

@ -3,7 +3,7 @@
endpoint WindowManagerClient
{
window_removed(i32 wm_id, i32 client_id, i32 window_id) =|
window_state_changed(i32 wm_id, i32 client_id, i32 window_id, u32 workspace_row, u32 workspace_column, bool is_active, bool is_blocking, bool is_minimized, bool is_frameless, i32 window_type, [UTF8] DeprecatedString title, Gfx::IntRect rect, Optional<i32> progress) =|
window_state_changed(i32 wm_id, i32 client_id, i32 window_id, u32 workspace_row, u32 workspace_column, bool is_active, bool is_blocking, bool is_minimized, bool is_frameless, i32 window_type, [UTF8] ByteString title, Gfx::IntRect rect, Optional<i32> progress) =|
window_icon_bitmap_changed(i32 wm_id, i32 client_id, i32 window_id, Gfx::ShareableBitmap bitmap) =|
window_rect_changed(i32 wm_id, i32 client_id, i32 window_id, Gfx::IntRect rect) =|
applet_area_size_changed(i32 wm_id, Gfx::IntSize size) =|
@ -12,6 +12,6 @@ endpoint WindowManagerClient
super_d_key_pressed(i32 wm_id) =|
super_digit_key_pressed(i32 wm_id, u8 digit) =|
workspace_changed(i32 wm_id, u32 row, u32 column) =|
keymap_changed(i32 wm_id, [UTF8] DeprecatedString keymap) =|
keymap_changed(i32 wm_id, [UTF8] ByteString keymap) =|
add_to_quick_launch(i32 wm_id, i32 process_id) =|
}

View file

@ -13,5 +13,5 @@ endpoint WindowManagerServer
set_window_taskbar_rect(i32 client_id, i32 window_id, Gfx::IntRect rect) =|
set_applet_area_position(Gfx::IntPoint position) =|
set_workspace(u32 row, u32 column) =|
set_keymap([UTF8] DeprecatedString keymap) =|
set_keymap([UTF8] ByteString keymap) =|
}

View file

@ -14,13 +14,13 @@ endpoint WindowServer
i32 menu_id,
i32 identifier,
i32 submenu_id,
[UTF8] DeprecatedString text,
[UTF8] ByteString text,
bool enabled,
bool visible,
bool checkable,
bool checked,
bool is_default,
[UTF8] DeprecatedString shortcut,
[UTF8] ByteString shortcut,
Gfx::ShareableBitmap icon,
bool exclusive) =|
@ -30,13 +30,13 @@ endpoint WindowServer
i32 menu_id,
i32 identifier,
i32 submenu_id,
[UTF8] DeprecatedString text,
[UTF8] ByteString text,
bool enabled,
bool visible,
bool checkable,
bool checked,
bool is_default,
[UTF8] DeprecatedString shortcut,
[UTF8] ByteString shortcut,
Gfx::ShareableBitmap icon) =|
remove_menu_item(i32 menu_id, i32 identifier) =|
@ -61,14 +61,14 @@ endpoint WindowServer
Optional<Gfx::IntSize> resize_aspect_ratio,
i32 type,
i32 mode,
[UTF8] DeprecatedString title,
[UTF8] ByteString title,
i32 parent_window_id,
Gfx::IntRect launch_origin_rect) =|
destroy_window(i32 window_id) => (Vector<i32> destroyed_window_ids)
set_window_title(i32 window_id, [UTF8] DeprecatedString title) =|
get_window_title(i32 window_id) => ([UTF8] DeprecatedString title)
set_window_title(i32 window_id, [UTF8] ByteString title) =|
get_window_title(i32 window_id) => ([UTF8] ByteString title)
set_window_progress(i32 window_id, Optional<i32> progress) =|
@ -112,12 +112,12 @@ endpoint WindowServer
set_wallpaper(Gfx::ShareableBitmap wallpaper_bitmap) => (bool success)
set_background_color(DeprecatedString background_color) =|
set_wallpaper_mode(DeprecatedString mode) =|
set_background_color(ByteString background_color) =|
set_wallpaper_mode(ByteString mode) =|
set_screen_layout(::WindowServer::ScreenLayout screen_layout, bool save) => (bool success, DeprecatedString error_msg)
set_screen_layout(::WindowServer::ScreenLayout screen_layout, bool save) => (bool success, ByteString error_msg)
get_screen_layout() => (::WindowServer::ScreenLayout screen_layout)
save_screen_layout() => (bool success, DeprecatedString error_msg)
save_screen_layout() => (bool success, ByteString error_msg)
show_screen_numbers(bool show) =|
apply_workspace_settings(u32 rows, u32 columns, bool save) => (bool success)
@ -129,11 +129,11 @@ endpoint WindowServer
set_window_cursor(i32 window_id, i32 cursor_type) =|
set_window_custom_cursor(i32 window_id, Gfx::ShareableBitmap cursor) =|
start_drag([UTF8] DeprecatedString text, HashMap<String,ByteBuffer> mime_data, Gfx::ShareableBitmap drag_bitmap) => (bool started)
start_drag([UTF8] ByteString text, HashMap<String,ByteBuffer> mime_data, Gfx::ShareableBitmap drag_bitmap) => (bool started)
set_accepts_drag(bool accepts) =|
set_system_theme(DeprecatedString theme_path, [UTF8] DeprecatedString theme_name, bool keep_desktop_background, Optional<DeprecatedString> color_scheme_path) => (bool success)
get_system_theme() => ([UTF8] DeprecatedString theme_name)
set_system_theme(ByteString theme_path, [UTF8] ByteString theme_name, bool keep_desktop_background, Optional<ByteString> color_scheme_path) => (bool success)
get_system_theme() => ([UTF8] ByteString theme_name)
refresh_system_theme() =|
set_system_theme_override(Core::AnonymousBuffer buffer) => (bool success)
@ -141,10 +141,10 @@ endpoint WindowServer
clear_system_theme_override() =|
is_system_theme_overridden() => (bool overridden)
get_preferred_color_scheme() => (Optional<DeprecatedString> path)
get_preferred_color_scheme() => (Optional<ByteString> path)
apply_cursor_theme(DeprecatedString name) =|
get_cursor_theme() => (DeprecatedString name)
apply_cursor_theme(ByteString name) =|
get_cursor_theme() => (ByteString name)
set_cursor_highlight_radius(int radius) =|
get_cursor_highlight_radius() => (int radius)
@ -152,7 +152,7 @@ endpoint WindowServer
set_cursor_highlight_color(Gfx::Color color) =|
get_cursor_highlight_color() => (Gfx::Color color)
set_system_fonts(DeprecatedString default_font_query, DeprecatedString fixed_width_font_query, DeprecatedString window_title_font_query) => (bool success)
set_system_fonts(ByteString default_font_query, ByteString fixed_width_font_query, ByteString window_title_font_query) => (bool success)
set_system_effects(Vector<bool> effects, u8 geometry, u8 tile_window) =|
set_window_base_size_and_size_increment(i32 window_id, Gfx::IntSize base_size, Gfx::IntSize size_increment) =|

View file

@ -203,7 +203,7 @@ void WindowSwitcher::draw()
painter.blit(icon_rect.location(), window.icon(), window.icon().rect());
painter.draw_text(item_rect.translated(thumbnail_width() + 12, 0).translated(1), window.computed_title(), WindowManager::the().window_title_font(), Gfx::TextAlignment::CenterLeft, text_color.inverted());
painter.draw_text(item_rect.translated(thumbnail_width() + 12, 0), window.computed_title(), WindowManager::the().window_title_font(), Gfx::TextAlignment::CenterLeft, text_color);
auto window_details = m_windows_on_multiple_stacks ? DeprecatedString::formatted("{} on {}:{}", window.rect().to_deprecated_string(), window.window_stack().row() + 1, window.window_stack().column() + 1) : window.rect().to_deprecated_string();
auto window_details = m_windows_on_multiple_stacks ? ByteString::formatted("{} on {}:{}", window.rect().to_byte_string(), window.window_stack().row() + 1, window.window_stack().column() + 1) : window.rect().to_byte_string();
painter.draw_text(item_rect, window_details, Gfx::TextAlignment::CenterRight, rect_text_color);
}
}

View file

@ -47,11 +47,11 @@ ErrorOr<int> serenity_main(Main::Arguments)
WindowServer::g_config = TRY(Core::ConfigFile::open("/etc/WindowServer.ini", Core::ConfigFile::AllowWriting::Yes));
auto theme_name = WindowServer::g_config->read_entry("Theme", "Name", "Default");
Optional<DeprecatedString> custom_color_scheme_path = OptionalNone();
Optional<ByteString> custom_color_scheme_path = OptionalNone();
if (WindowServer::g_config->read_bool_entry("Theme", "LoadCustomColorScheme", false))
custom_color_scheme_path = WindowServer::g_config->read_entry("Theme", "CustomColorSchemePath");
auto theme = TRY(Gfx::load_system_theme(DeprecatedString::formatted("/res/themes/{}.ini", theme_name), custom_color_scheme_path));
auto theme = TRY(Gfx::load_system_theme(ByteString::formatted("/res/themes/{}.ini", theme_name), custom_color_scheme_path));
Gfx::set_system_theme(theme);
auto palette = Gfx::PaletteImpl::create_with_anonymous_buffer(theme);
@ -77,9 +77,9 @@ ErrorOr<int> serenity_main(Main::Arguments)
// First check which screens are explicitly configured
{
AK::HashTable<DeprecatedString> fb_devices_configured;
AK::HashTable<ByteString> fb_devices_configured;
WindowServer::ScreenLayout screen_layout;
DeprecatedString error_msg;
ByteString error_msg;
auto add_unconfigured_display_connector_devices = [&]() -> ErrorOr<void> {
// Enumerate the /dev/gpu/connectorX devices and try to set up any ones we find that we haven't already used
@ -88,7 +88,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
auto path = di.next_path();
if (!path.starts_with("connector"sv))
continue;
auto full_path = DeprecatedString::formatted("/dev/gpu/{}", path);
auto full_path = ByteString::formatted("/dev/gpu/{}", path);
if (!FileSystem::is_device(full_path))
continue;
auto display_connector_fd = TRY(Core::System::open(full_path, O_RDWR | O_CLOEXEC));