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 "Mouse.h"
|
||||||
#include "Screen.h"
|
#include "Screen.h"
|
||||||
#include <luna/Alignment.h>
|
#include <luna/Alignment.h>
|
||||||
#include <luna/String.h>
|
#include <luna/RefString.h>
|
||||||
#include <os/File.h>
|
#include <os/File.h>
|
||||||
#include <os/SharedMemory.h>
|
#include <os/SharedMemory.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
@ -35,9 +35,9 @@ static Result<void> handle_create_window_message(Client& client)
|
|||||||
|
|
||||||
request.rect = request.rect.normalized();
|
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));
|
auto* window = new (std::nothrow) Window(request.rect, move(name));
|
||||||
if (!window)
|
if (!window)
|
||||||
@ -88,7 +88,7 @@ static Result<void> handle_set_window_title_message(Client& client)
|
|||||||
ui::SetWindowTitleRequest request;
|
ui::SetWindowTitleRequest request;
|
||||||
if (!TRY(client.conn->read_message(request))) return {};
|
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);
|
os::println("wind: SetWindowTitle(\"%s\") for window %d", name.chars(), request.window);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ void Window::focus()
|
|||||||
g_windows.append(this);
|
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();
|
auto font = ui::Font::default_font();
|
||||||
titlebar = ui::Rect { 0, 0, 0, 0 };
|
titlebar = ui::Rect { 0, 0, 0, 0 };
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <luna/LinkedList.h>
|
#include <luna/LinkedList.h>
|
||||||
#include <luna/String.h>
|
#include <luna/RefString.h>
|
||||||
#include <ui/Canvas.h>
|
#include <ui/Canvas.h>
|
||||||
#include <ui/Color.h>
|
#include <ui/Color.h>
|
||||||
#include <ui/Rect.h>
|
#include <ui/Rect.h>
|
||||||
@ -13,14 +13,14 @@ struct Window : public LinkedListNode<Window>
|
|||||||
ui::Rect surface;
|
ui::Rect surface;
|
||||||
ui::Rect titlebar;
|
ui::Rect titlebar;
|
||||||
u32* pixels;
|
u32* pixels;
|
||||||
String name;
|
RefString name;
|
||||||
String shm_path;
|
RefString shm_path;
|
||||||
bool dirty { false };
|
bool dirty { false };
|
||||||
Client* client;
|
Client* client;
|
||||||
int id;
|
int id;
|
||||||
ui::WindowAttributes attributes { 0 };
|
ui::WindowAttributes attributes { 0 };
|
||||||
|
|
||||||
Window(ui::Rect, String&&);
|
Window(ui::Rect, RefString&&);
|
||||||
~Window();
|
~Window();
|
||||||
|
|
||||||
void focus();
|
void focus();
|
||||||
|
Loading…
Reference in New Issue
Block a user