wind: Move some stuff from String to RefString
This commit is contained in:
parent
e3613d1653
commit
d908ccea6b
@ -2,7 +2,7 @@
|
||||
#include "Mouse.h"
|
||||
#include "Screen.h"
|
||||
#include <luna/Alignment.h>
|
||||
#include <luna/String.h>
|
||||
#include <luna/RefString.h>
|
||||
#include <os/File.h>
|
||||
#include <os/SharedMemory.h>
|
||||
#include <sys/mman.h>
|
||||
@ -35,9 +35,9 @@ static Result<void> handle_create_window_message(Client& client)
|
||||
|
||||
request.rect = request.rect.normalized();
|
||||
|
||||
auto name = TRY_OR_IPC_ERROR(String::from_cstring("Window"));
|
||||
auto name = TRY_OR_IPC_ERROR(RefString::from_cstring("Window"));
|
||||
|
||||
auto shm_path = TRY_OR_IPC_ERROR(String::format("/wind-shm-%d-%lu"_sv, client.conn->fd(), time(NULL)));
|
||||
auto shm_path = TRY_OR_IPC_ERROR(RefString::format("/wind-shm-%d-%lu"_sv, client.conn->fd(), time(NULL)));
|
||||
|
||||
auto* window = new (std::nothrow) Window(request.rect, move(name));
|
||||
if (!window)
|
||||
@ -88,7 +88,7 @@ static Result<void> handle_set_window_title_message(Client& client)
|
||||
ui::SetWindowTitleRequest request;
|
||||
if (!TRY(client.conn->read_message(request))) return {};
|
||||
|
||||
auto name = COPY_IPC_STRING(request.title);
|
||||
auto name = TRY(RefString::from_string(COPY_IPC_STRING(request.title)));
|
||||
|
||||
os::println("wind: SetWindowTitle(\"%s\") for window %d", name.chars(), request.window);
|
||||
|
||||
|
@ -22,7 +22,7 @@ void Window::focus()
|
||||
g_windows.append(this);
|
||||
}
|
||||
|
||||
Window::Window(ui::Rect r, String&& n) : surface(r), name(move(n))
|
||||
Window::Window(ui::Rect r, RefString&& n) : surface(r), name(move(n))
|
||||
{
|
||||
auto font = ui::Font::default_font();
|
||||
titlebar = ui::Rect { 0, 0, 0, 0 };
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <luna/LinkedList.h>
|
||||
#include <luna/String.h>
|
||||
#include <luna/RefString.h>
|
||||
#include <ui/Canvas.h>
|
||||
#include <ui/Color.h>
|
||||
#include <ui/Rect.h>
|
||||
@ -13,14 +13,14 @@ struct Window : public LinkedListNode<Window>
|
||||
ui::Rect surface;
|
||||
ui::Rect titlebar;
|
||||
u32* pixels;
|
||||
String name;
|
||||
String shm_path;
|
||||
RefString name;
|
||||
RefString shm_path;
|
||||
bool dirty { false };
|
||||
Client* client;
|
||||
int id;
|
||||
ui::WindowAttributes attributes { 0 };
|
||||
|
||||
Window(ui::Rect, String&&);
|
||||
Window(ui::Rect, RefString&&);
|
||||
~Window();
|
||||
|
||||
void focus();
|
||||
|
Loading…
Reference in New Issue
Block a user