Compare commits
3 Commits
53f8a583dc
...
9e65131452
Author | SHA1 | Date | |
---|---|---|---|
9e65131452 | |||
d908ccea6b | |||
e3613d1653 |
@ -1,4 +1,4 @@
|
|||||||
#include <luna/String.h>
|
#include <luna/RefString.h>
|
||||||
#include <luna/Utf8.h>
|
#include <luna/Utf8.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -325,7 +325,7 @@ class GameWidget final : public ui::Widget
|
|||||||
|
|
||||||
canvas.fill(colors[tile.color]);
|
canvas.fill(colors[tile.color]);
|
||||||
|
|
||||||
auto fmt = TRY(String::format("%d"_sv, tile.number));
|
auto fmt = TRY(RefString::format("%d"_sv, tile.number));
|
||||||
|
|
||||||
auto font = ui::Font::default_bold_font();
|
auto font = ui::Font::default_bold_font();
|
||||||
auto rect = ui::align({ 0, 0, canvas.width, canvas.height },
|
auto rect = ui::align({ 0, 0, canvas.width, canvas.height },
|
||||||
|
@ -157,7 +157,7 @@ Result<void> EditorWidget::save_file()
|
|||||||
if (m_path.is_empty())
|
if (m_path.is_empty())
|
||||||
{
|
{
|
||||||
TRY(save_file_as());
|
TRY(save_file_as());
|
||||||
return err(ENOENT);
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto file = TRY(os::File::open_or_create(m_path.view(), os::File::WriteOnly));
|
auto file = TRY(os::File::open_or_create(m_path.view(), os::File::WriteOnly));
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <luna/String.h>
|
#include <luna/RefString.h>
|
||||||
#include <os/ArgumentParser.h>
|
#include <os/ArgumentParser.h>
|
||||||
#include <os/Config.h>
|
#include <os/Config.h>
|
||||||
#include <os/File.h>
|
#include <os/File.h>
|
||||||
@ -68,7 +68,7 @@ Result<int> luna_main(int argc, char** argv)
|
|||||||
|
|
||||||
if (!username.is_empty())
|
if (!username.is_empty())
|
||||||
{
|
{
|
||||||
auto flag = String::format("--user=%s"_sv, username.chars()).release_value();
|
auto flag = RefString::format("--user=%s"_sv, username.chars()).release_value();
|
||||||
|
|
||||||
StringView startui_command[] = { "/usr/bin/startui", flag.view() };
|
StringView startui_command[] = { "/usr/bin/startui", flag.view() };
|
||||||
os::Process::exec(startui_command[0], Slice<StringView>(startui_command, 2));
|
os::Process::exec(startui_command[0], Slice<StringView>(startui_command, 2));
|
||||||
@ -118,7 +118,7 @@ Result<int> luna_main(int argc, char** argv)
|
|||||||
stage = Stage::PasswordInput;
|
stage = Stage::PasswordInput;
|
||||||
label.set_text("Password:");
|
label.set_text("Password:");
|
||||||
|
|
||||||
String title = String::format("Log in: %s"_sv, data.chars()).release_value();
|
RefString title = RefString::format("Log in: %s"_sv, data.chars()).release_value();
|
||||||
window->set_title(title.view());
|
window->set_title(title.view());
|
||||||
|
|
||||||
input.clear();
|
input.clear();
|
||||||
@ -160,7 +160,7 @@ Result<int> luna_main(int argc, char** argv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto flag = String::format("--user=%s"_sv, pw->pw_name).release_value();
|
auto flag = RefString::format("--user=%s"_sv, pw->pw_name).release_value();
|
||||||
|
|
||||||
StringView startui_command[] = { "/usr/bin/startui", flag.view() };
|
StringView startui_command[] = { "/usr/bin/startui", flag.view() };
|
||||||
os::Process::exec(startui_command[0], Slice<StringView>(startui_command, 2));
|
os::Process::exec(startui_command[0], Slice<StringView>(startui_command, 2));
|
||||||
|
@ -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