Compare commits

..

68 Commits

Author SHA1 Message Date
44f2a4e97e
libui: Install the built library into the system root
Some checks failed
continuous-integration/drone/pr Build is failing
2023-08-22 11:54:23 +02:00
db9b9c53e9
wind: Show memory usage in debug output 2023-08-22 11:54:23 +02:00
a5217a1401
wind: Handle ftruncate() and mmap() errors properly 2023-08-22 11:54:22 +02:00
86e6e7aea5
wind: Fix client references being out-of-date in windows when disconnecting other clients
Classic "keeping a pointer to an element inside a vector after the vector is updated" bug, ah yes.
2023-08-22 11:54:22 +02:00
3efa9e267a
taskbar: Wait for terminated child windows 2023-08-22 11:54:22 +02:00
62673876fb
wind: Add debug keybind 2023-08-22 11:54:22 +02:00
ca2fb9e442
wind+libos+libui: Handle interrupted reads properly 2023-08-22 11:54:22 +02:00
e743c83fe0
base: Actually add the start icon to source control 2023-08-22 11:54:22 +02:00
38d0a42eac
libui: Add Buttons 2023-08-22 11:54:21 +02:00
1e5a762620
libui: Handle other mouse events 2023-08-22 11:54:21 +02:00
491e46cfcb
libui: Add aligned items using Containers, ImageWidget 2023-08-22 11:54:21 +02:00
3009920c0e
libui: Add VerticalLayout 2023-08-22 11:54:21 +02:00
bfbe166679
wind+libui+taskbar: Add GetScreenRect IPC, non-decorated windows, taskbar 2023-08-22 11:54:21 +02:00
73e3c271ff
libui: Actually fill window backgrounds with the correct color 2023-08-22 11:54:21 +02:00
e3a6877962
libui: Add basic widget and layout system =D 2023-08-22 11:54:20 +02:00
526af76d51
ui+wind: Send mouse move events through IPC 2023-08-22 11:54:20 +02:00
c6a67d9361
wind+libui: Add protocol for window close requests 2023-08-22 11:54:20 +02:00
610e3c9c80
libos+libui+wind: Use uppercase for static struct IDs to avoid confusion with fields 2023-08-22 11:54:20 +02:00
b55287e0a1
libui+gclient: Add basic OOP wrappers around the IPC protocol 2023-08-22 11:54:20 +02:00
ec50a03f1b
wind+gclient: Add SetWindowTitle and support shm buffers 2023-08-22 11:54:20 +02:00
c233c9b98e
gclient: Create two example windows 2023-08-22 11:54:19 +02:00
570b9464c6
wind: Handle CreateWindow IPC messages 2023-08-22 11:54:19 +02:00
c45c153773
libui: Add CreateWindow IPC message definitions 2023-08-22 11:54:19 +02:00
0d3983432e
libos: Add basic IPC message framework 2023-08-22 11:54:19 +02:00
6efd55dce8
kernel: Fix poll syscall 2023-08-22 11:54:19 +02:00
63c8f4131f
wind: Monitor data on client connections 2023-08-22 11:54:19 +02:00
03dc260ba9
kernel: Add POLLHUP and store it when a polled socket's peer disconnects 2023-08-22 11:54:19 +02:00
cfabd62687
libui: Add copyright/author text 2023-08-22 11:54:18 +02:00
4c91191b4e
libos: Add copyright/author comments to LocalServer and LocalClient 2023-08-22 11:54:18 +02:00
a281a35806
wind: Use init --user and pledge() 2023-08-22 11:54:18 +02:00
c835979f9f
Update .gitignore 2023-08-22 11:54:18 +02:00
4da16c1eaa
libos: Remove some shared pointers and change them to owned/live on the stack 2023-08-22 11:54:18 +02:00
e6ef86e620
wind: Spawn a new client process after startup
Also, create the socket after dropping privileges.
2023-08-22 11:54:18 +02:00
2e50829d0a
apps: Add gclient 2023-08-22 11:54:17 +02:00
676b95af04
libos: Add os::LocalClient 2023-08-22 11:54:17 +02:00
6b47a8c732
libui: Change 'into' to 'onto' 2023-08-22 11:54:17 +02:00
8346adf87f
libui: Document ui::Font 2023-08-22 11:54:17 +02:00
897ef6f91d
libui+wind: Move some static variables inside functions 2023-08-22 11:54:17 +02:00
290f391ea9
wind: Generate random windows on keypresses 2023-08-22 11:54:17 +02:00
708b408861
wind: Make sure windows have a minimum size to fit the titlebar 2023-08-22 11:54:16 +02:00
d8ae676faa
libui: Properly cut off the last drawn character if necessary 2023-08-22 11:54:16 +02:00
88961e1cc3
libui: Add Rect::contains(Rect) 2023-08-22 11:54:16 +02:00
8f61062b72
libui: Render font characters properly with no spacing, matching the width calculations 2023-08-22 11:54:16 +02:00
9a47d84313
wind: Render an actual TGA mouse cursor 2023-08-22 11:54:16 +02:00
593e37a0f4
wind: Add a close button to windows using a TGA icon 2023-08-22 11:54:16 +02:00
2134a55a3a
libui: Add support for TGA image loading 2023-08-22 11:54:15 +02:00
a04759aa0e
libui: Add an interface to fill a Canvas with an array of pixels 2023-08-22 11:54:15 +02:00
ec5fad5b21
wind: Add window titlebars using ui::Font 2023-08-22 11:54:15 +02:00
6656e2164a
libui: Add PSF font loading and rendering 2023-08-22 11:54:15 +02:00
d4ca297a68
libui: Add Color::GRAY 2023-08-22 11:54:15 +02:00
84a7a8855a
libui: Rename Rect::absolute to normalized and add a new absolute function 2023-08-22 11:54:15 +02:00
861c4454e7
libluna: Add assignment operators to Buffer 2023-08-22 11:54:14 +02:00
1302e3dc12
wind: Reorder drag sequence 2023-08-22 11:54:14 +02:00
37c3003ec9
libui: Add Rect::relative 2023-08-22 11:54:14 +02:00
4bed2d15f0
libui: Remove redundant statement 2023-08-22 11:54:14 +02:00
626eb7a977
libui: Add getters for separate color values 2023-08-22 11:54:14 +02:00
787db55888
libui: Remove unnecessary stuff 2023-08-22 11:54:14 +02:00
cdc01f6772
base: Remove startup items not necessary for GUI startup 2023-08-22 11:54:13 +02:00
f3e73b241e
libui+wind: (Draggable) windows 2023-08-22 11:54:13 +02:00
505551e349
wind: Create a local server object 2023-08-22 11:54:13 +02:00
e1a7e93f52
libos: Add a new LocalServer class for local domain sockets 2023-08-22 11:54:13 +02:00
0e75cc3feb
kernel: Support listening sockets in poll() 2023-08-22 11:54:13 +02:00
0f95a3637d
base: Start wind on startup instead of the shell 2023-08-22 11:54:12 +02:00
221fa360b3
wind: Add a simple display server skeleton using libui
No client functionality yet, but it's a start.
2023-08-22 11:54:12 +02:00
fd8d8b4f34
libui: Add a GUI and graphics library 2023-08-22 11:54:12 +02:00
5a13dd4dae
kernel: Fix negative movement in the PS/2 mouse driver 2023-08-22 11:54:12 +02:00
2abb43d709
kernel+libos: Call Vector::try_reserve where it is appropriate
Some checks failed
continuous-integration/drone/push Build is failing
2023-08-22 11:54:00 +02:00
70a232cfcd
libluna: Make Vector grow exponentially 2023-08-22 11:53:42 +02:00
5 changed files with 16 additions and 2 deletions

View File

@ -49,6 +49,7 @@ Result<u64> ScriptLoader::load(AddressSpace* space)
Result<Vector<String>> ScriptLoader::cmdline(const String& path, Vector<String> args) Result<Vector<String>> ScriptLoader::cmdline(const String& path, Vector<String> args)
{ {
Vector<String> new_args; Vector<String> new_args;
TRY(new_args.try_reserve(m_interpreter_cmdline.size() + args.size() + 1));
for (auto& arg : m_interpreter_cmdline) { TRY(new_args.try_append(move(arg))); } for (auto& arg : m_interpreter_cmdline) { TRY(new_args.try_append(move(arg))); }
auto arg = TRY(path.clone()); auto arg = TRY(path.clone());
TRY(new_args.try_append(move(arg))); TRY(new_args.try_append(move(arg)));

View File

@ -18,10 +18,12 @@ Result<u64> sys_poll(Registers*, SyscallArgs args)
if (!MemoryManager::copy_from_user(fds, kfds, nfds * sizeof(pollfd))) return err(EFAULT); if (!MemoryManager::copy_from_user(fds, kfds, nfds * sizeof(pollfd))) return err(EFAULT);
Vector<SharedPtr<VFS::Inode>> inodes;
auto* current = Scheduler::current(); auto* current = Scheduler::current();
TRY(check_pledge(current, Promise::p_stdio)); TRY(check_pledge(current, Promise::p_stdio));
Vector<SharedPtr<VFS::Inode>> inodes;
TRY(inodes.try_reserve(nfds));
for (nfds_t i = 0; i < nfds; i++) for (nfds_t i = 0; i < nfds; i++)
{ {
int fd = kfds[i].fd; int fd = kfds[i].fd;

View File

@ -88,6 +88,7 @@ Result<u64> ThreadImage::push_mem_on_stack(const u8* mem, usize size)
Result<u64> ThreadImage::push_string_vector_on_stack(const Vector<String>& vec) Result<u64> ThreadImage::push_string_vector_on_stack(const Vector<String>& vec)
{ {
Vector<u64> user_vec; Vector<u64> user_vec;
TRY(user_vec.try_reserve(vec.size() + 1));
for (const auto& item : vec) for (const auto& item : vec)
{ {
// Copy each individual string and retrieve a userspace pointer to said copy // Copy each individual string and retrieve a userspace pointer to said copy

View File

@ -62,7 +62,7 @@ template <typename T> class Vector
Result<void> try_append(T&& item) Result<void> try_append(T&& item)
{ {
if (m_capacity == m_size) TRY(resize(m_capacity + 8)); if (m_capacity == m_size) TRY(resize(m_capacity ? m_capacity * 2 : 8));
new (&m_data[m_size]) T(move(item)); new (&m_data[m_size]) T(move(item));
@ -252,6 +252,8 @@ template <typename T> class Vector
Result<void> resize(usize new_capacity) Result<void> resize(usize new_capacity)
{ {
if (new_capacity < m_capacity) return {};
const usize new_byte_capacity = new_capacity * sizeof(T); const usize new_byte_capacity = new_capacity * sizeof(T);
void* const ptr = TRY(realloc_impl(m_data, new_byte_capacity)); void* const ptr = TRY(realloc_impl(m_data, new_byte_capacity));

View File

@ -26,6 +26,7 @@ namespace os
Result<void> Process::exec(StringView path, Slice<String> args, bool search_in_path) Result<void> Process::exec(StringView path, Slice<String> args, bool search_in_path)
{ {
Vector<const char*> argv; Vector<const char*> argv;
TRY(argv.try_reserve(args.size() + 1));
for (const auto& arg : args) { TRY(argv.try_append(arg.chars())); } for (const auto& arg : args) { TRY(argv.try_append(arg.chars())); }
TRY(argv.try_append(nullptr)); TRY(argv.try_append(nullptr));
@ -39,6 +40,7 @@ namespace os
Result<void> Process::exec(StringView path, Slice<StringView> args, bool search_in_path) Result<void> Process::exec(StringView path, Slice<StringView> args, bool search_in_path)
{ {
Vector<const char*> argv; Vector<const char*> argv;
TRY(argv.try_reserve(args.size() + 1));
for (const auto& arg : args) { TRY(argv.try_append(arg.chars())); } for (const auto& arg : args) { TRY(argv.try_append(arg.chars())); }
TRY(argv.try_append(nullptr)); TRY(argv.try_append(nullptr));
@ -52,10 +54,12 @@ namespace os
Result<void> Process::exec(StringView path, Slice<String> args, Slice<String> env, bool search_in_path) Result<void> Process::exec(StringView path, Slice<String> args, Slice<String> env, bool search_in_path)
{ {
Vector<const char*> argv; Vector<const char*> argv;
TRY(argv.try_reserve(args.size() + 1));
for (const auto& arg : args) { TRY(argv.try_append(arg.chars())); } for (const auto& arg : args) { TRY(argv.try_append(arg.chars())); }
TRY(argv.try_append(nullptr)); TRY(argv.try_append(nullptr));
Vector<const char*> envp; Vector<const char*> envp;
TRY(envp.try_reserve(env.size() + 1));
for (const auto& arg : env) { TRY(envp.try_append(arg.chars())); } for (const auto& arg : env) { TRY(envp.try_append(arg.chars())); }
TRY(envp.try_append(nullptr)); TRY(envp.try_append(nullptr));
@ -83,6 +87,7 @@ namespace os
Result<pid_t> Process::spawn(StringView path, Slice<String> args, bool search_in_path) Result<pid_t> Process::spawn(StringView path, Slice<String> args, bool search_in_path)
{ {
Vector<const char*> argv; Vector<const char*> argv;
TRY(argv.try_reserve(args.size() + 1));
for (const auto& arg : args) { TRY(argv.try_append(arg.chars())); } for (const auto& arg : args) { TRY(argv.try_append(arg.chars())); }
TRY(argv.try_append(nullptr)); TRY(argv.try_append(nullptr));
@ -92,6 +97,7 @@ namespace os
Result<pid_t> Process::spawn(StringView path, Slice<StringView> args, bool search_in_path) Result<pid_t> Process::spawn(StringView path, Slice<StringView> args, bool search_in_path)
{ {
Vector<const char*> argv; Vector<const char*> argv;
TRY(argv.try_reserve(args.size() + 1));
for (const auto& arg : args) { TRY(argv.try_append(arg.chars())); } for (const auto& arg : args) { TRY(argv.try_append(arg.chars())); }
TRY(argv.try_append(nullptr)); TRY(argv.try_append(nullptr));
@ -101,10 +107,12 @@ namespace os
Result<pid_t> Process::spawn(StringView path, Slice<String> args, Slice<String> env, bool search_in_path) Result<pid_t> Process::spawn(StringView path, Slice<String> args, Slice<String> env, bool search_in_path)
{ {
Vector<const char*> argv; Vector<const char*> argv;
TRY(argv.try_reserve(args.size() + 1));
for (const auto& arg : args) { TRY(argv.try_append(arg.chars())); } for (const auto& arg : args) { TRY(argv.try_append(arg.chars())); }
TRY(argv.try_append(nullptr)); TRY(argv.try_append(nullptr));
Vector<const char*> envp; Vector<const char*> envp;
TRY(envp.try_reserve(env.size() + 1));
for (const auto& arg : env) { TRY(envp.try_append(arg.chars())); } for (const auto& arg : env) { TRY(envp.try_append(arg.chars())); }
TRY(envp.try_append(nullptr)); TRY(envp.try_append(nullptr));