Compare commits

..

72 Commits

Author SHA1 Message Date
3a13017ede
wind: Move more fallible operations before window creation
All checks were successful
continuous-integration/drone/pr Build is passing
2023-09-05 10:47:08 +02:00
4a85f03d02
wind: Make sure stdin is always a TTY 2023-09-05 10:47:08 +02:00
fb40f5c9b2
libui+wind+libos: Move shared memory handling code to os::SharedMemory 2023-09-05 10:47:08 +02:00
47db5da419
libui: Add default handlers for events in Widget 2023-09-05 10:47:07 +02:00
64e8f30f02
libui: Propagate Container events only if they are in the child widget's rect 2023-09-05 10:47:07 +02:00
b5b90f13f7
libui+wind: Handle mouse leave events when the mouse leaves a window 2023-09-05 10:47:07 +02:00
562cbb3cc3
wind: Stop using the removed 'signal' pledge 2023-09-05 10:47:06 +02:00
903e363254
libui: Install the built library into the system root 2023-09-05 10:47:06 +02:00
248aedee72
wind: Show memory usage in debug output 2023-09-05 10:47:06 +02:00
46c67c1e7f
wind: Handle ftruncate() and mmap() errors properly 2023-09-05 10:47:06 +02:00
c20e4bad05
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-09-05 10:47:06 +02:00
241e11de0d
taskbar: Wait for terminated child windows 2023-09-05 10:47:05 +02:00
99f1263fba
wind: Add debug keybind 2023-09-05 10:47:05 +02:00
1550c1ffc5
wind+libos+libui: Handle interrupted reads properly 2023-09-05 10:47:05 +02:00
bab456591e
base: Actually add the start icon to source control 2023-09-05 10:47:05 +02:00
6fec9aa158
libui: Add Buttons 2023-09-05 10:47:04 +02:00
dc1d8a9b38
libui: Handle other mouse events 2023-09-05 10:47:04 +02:00
c8cfee514e
libui: Add aligned items using Containers, ImageWidget 2023-09-05 10:47:04 +02:00
c161a86893
libui: Add VerticalLayout 2023-09-05 10:47:04 +02:00
3af8301dec
wind+libui+taskbar: Add GetScreenRect IPC, non-decorated windows, taskbar 2023-09-05 10:47:03 +02:00
496715c3a6
libui: Actually fill window backgrounds with the correct color 2023-09-05 10:47:03 +02:00
3c93266dd8
libui: Add basic widget and layout system =D 2023-09-05 10:47:03 +02:00
a022dd2d07
ui+wind: Send mouse move events through IPC 2023-09-05 10:47:02 +02:00
3072641362
wind+libui: Add protocol for window close requests 2023-09-05 10:47:02 +02:00
93a5826b5b
libos+libui+wind: Use uppercase for static struct IDs to avoid confusion with fields 2023-09-05 10:47:02 +02:00
6116f57876
libui+gclient: Add basic OOP wrappers around the IPC protocol 2023-09-05 10:47:02 +02:00
344f299bd7
wind+gclient: Add SetWindowTitle and support shm buffers 2023-09-05 10:47:01 +02:00
bc22430ec5
gclient: Create two example windows 2023-09-05 10:47:01 +02:00
b39a6f5c00
wind: Handle CreateWindow IPC messages 2023-09-05 10:47:01 +02:00
e12a02d63f
libui: Add CreateWindow IPC message definitions 2023-09-05 10:47:01 +02:00
8fa4bb854b
libos: Add basic IPC message framework 2023-09-05 10:47:00 +02:00
ff9be2f4e7
kernel: Fix poll syscall 2023-09-05 10:47:00 +02:00
4d7db20d6f
wind: Monitor data on client connections 2023-09-05 10:47:00 +02:00
306966183e
kernel: Add POLLHUP and store it when a polled socket's peer disconnects 2023-09-05 10:46:59 +02:00
01b74c0a8c
libui: Add copyright/author text 2023-09-05 10:46:59 +02:00
af18824f29
libos: Add copyright/author comments to LocalServer and LocalClient 2023-09-05 10:46:59 +02:00
a23f0b93d2
wind: Use init --user and pledge() 2023-09-05 10:46:59 +02:00
77d33ca737
Update .gitignore 2023-09-05 10:46:58 +02:00
4dae2c8571
libos: Remove some shared pointers and change them to owned/live on the stack 2023-09-05 10:46:58 +02:00
9a9e9a7efe
wind: Spawn a new client process after startup
Also, create the socket after dropping privileges.
2023-09-05 10:46:58 +02:00
d3a4054e5b
apps: Add gclient 2023-09-05 10:46:58 +02:00
a3979caf2e
libos: Add os::LocalClient 2023-09-05 10:46:57 +02:00
8c4fbdb30d
libui: Change 'into' to 'onto' 2023-09-05 10:46:57 +02:00
70fed7e27f
libui: Document ui::Font 2023-09-05 10:46:57 +02:00
f26ba66801
libui+wind: Move some static variables inside functions 2023-09-05 10:46:57 +02:00
15b5b5cc4d
wind: Generate random windows on keypresses 2023-09-05 10:46:57 +02:00
1281989a8a
wind: Make sure windows have a minimum size to fit the titlebar 2023-09-05 10:46:56 +02:00
95c5eeeb0d
libui: Properly cut off the last drawn character if necessary 2023-09-05 10:46:56 +02:00
f0265a347d
libui: Add Rect::contains(Rect) 2023-09-05 10:46:56 +02:00
328aa16656
libui: Render font characters properly with no spacing, matching the width calculations 2023-09-05 10:46:56 +02:00
3cdc8e818a
wind: Render an actual TGA mouse cursor 2023-09-05 10:46:56 +02:00
d49f59500b
wind: Add a close button to windows using a TGA icon 2023-09-05 10:46:55 +02:00
bb2fe8a9d7
libui: Add support for TGA image loading 2023-09-05 10:46:55 +02:00
be54a2e663
libui: Add an interface to fill a Canvas with an array of pixels 2023-09-05 10:46:55 +02:00
857d0011b3
wind: Add window titlebars using ui::Font 2023-09-05 10:46:55 +02:00
7bb7f63587
libui: Add PSF font loading and rendering 2023-09-05 10:46:54 +02:00
99148870fc
libui: Add Color::GRAY 2023-09-05 10:46:54 +02:00
a5089ab9ee
libui: Rename Rect::absolute to normalized and add a new absolute function 2023-09-05 10:46:54 +02:00
ff03cc189c
libluna: Add assignment operators to Buffer 2023-09-05 10:46:54 +02:00
2dc9236aaf
wind: Reorder drag sequence 2023-09-05 10:46:53 +02:00
a08dbbc33f
libui: Add Rect::relative 2023-09-05 10:46:53 +02:00
670d8d9445
libui: Remove redundant statement 2023-09-05 10:46:53 +02:00
9c35a0acde
libui: Add getters for separate color values 2023-09-05 10:46:53 +02:00
a1089da945
libui: Remove unnecessary stuff 2023-09-05 10:46:52 +02:00
da879bc2b4
base: Remove startup items not necessary for GUI startup 2023-09-05 10:46:52 +02:00
54af27ceaa
libui+wind: (Draggable) windows 2023-09-05 10:46:52 +02:00
1fbafe3f3a
wind: Create a local server object 2023-09-05 10:46:51 +02:00
9007c40dd7
libos: Add a new LocalServer class for local domain sockets 2023-09-05 10:46:51 +02:00
d29de852cf
kernel: Support listening sockets in poll() 2023-09-05 10:46:51 +02:00
b2e12127f3
base: Start wind on startup instead of the shell 2023-09-05 10:46:50 +02:00
09fab9d96d
wind: Add a simple display server skeleton using libui
No client functionality yet, but it's a start.
2023-09-05 10:46:50 +02:00
c7f4cb4868
libui: Add a GUI and graphics library 2023-09-05 10:46:50 +02:00
3 changed files with 13 additions and 52 deletions

View File

@ -503,17 +503,11 @@ namespace ATA
}
else
{
u8 buf[8];
memcpy(buf, &m_identify_words[100], 8);
if (m_identify_data.big_lba) m_is_lba48 = true;
m_block_count = *reinterpret_cast<u64*>(buf);
if (!m_block_count)
{
memcpy(buf, &m_identify_words[60], 4);
m_block_count = *reinterpret_cast<u32*>(buf);
}
else { m_is_lba48 = true; }
if (m_is_lba48) m_block_count = m_identify_data.sectors_48;
else
m_block_count = m_identify_data.sectors_28;
// FIXME: Should we check for CHS?

View File

@ -7,13 +7,6 @@ namespace Ext2
{
}
Result<void> Inode::prepare_buffer() const
{
if (!m_block_buffer.is_empty()) return {};
return m_block_buffer.try_resize(m_fs->m_block_size);
}
// FIXME: This code seems awfully similar to BlockDevice::read(). Can this be merged with it in some way?
Result<usize> Inode::read(u8* buf, usize offset, usize length) const
{
if (length == 0) return 0;
@ -73,47 +66,22 @@ namespace Ext2
{
if (index < 12) return m_raw_inode.direct_pointers[index];
const usize block_size = m_fs->m_block_size;
const usize blocks_per_indirect_block = block_size / sizeof(u32);
index -= 12;
TRY(prepare_buffer());
// Singly indirect block
if (index < blocks_per_indirect_block)
usize block_index = (index - 12) * sizeof(u32);
if (block_index >= m_fs->m_block_size)
{
TRY(m_fs->m_host_device->read(m_block_buffer.data(), m_raw_inode.singly_indirect_ptr * block_size,
block_size));
return ((u32*)m_block_buffer.data())[index];
fail("ext2: Finding blocks beyond the singly indirect pointer block is not yet supported");
}
index -= blocks_per_indirect_block;
usize block_size = m_fs->m_block_size;
// Doubly indirect block
if (index < blocks_per_indirect_block * blocks_per_indirect_block)
if (m_singly_indirect_block.is_empty())
{
TRY(m_fs->m_host_device->read(m_block_buffer.data(), m_raw_inode.doubly_indirect_ptr * block_size,
TRY(m_singly_indirect_block.try_resize(block_size));
TRY(m_fs->m_host_device->read(m_singly_indirect_block.data(), m_raw_inode.singly_indirect_ptr * block_size,
block_size));
const u32 block = ((u32*)m_block_buffer.data())[index / blocks_per_indirect_block];
TRY(m_fs->m_host_device->read(m_block_buffer.data(), block * block_size, block_size));
return ((u32*)m_block_buffer.data())[index % blocks_per_indirect_block];
}
index -= blocks_per_indirect_block * blocks_per_indirect_block;
check(index < blocks_per_indirect_block * blocks_per_indirect_block * blocks_per_indirect_block);
// Triply indirect block
TRY(m_fs->m_host_device->read(m_block_buffer.data(), m_raw_inode.triply_indirect_ptr * block_size, block_size));
u32 block = ((u32*)m_block_buffer.data())[index / (blocks_per_indirect_block * blocks_per_indirect_block)];
TRY(m_fs->m_host_device->read(m_block_buffer.data(), block * block_size, block_size));
block = ((u32*)m_block_buffer.data())[(index / blocks_per_indirect_block) % blocks_per_indirect_block];
TRY(m_fs->m_host_device->read(m_block_buffer.data(), block * block_size, block_size));
return ((u32*)m_block_buffer.data())[index % blocks_per_indirect_block];
return *reinterpret_cast<u32*>(&m_singly_indirect_block.data()[block_index]);
}
Result<void> Inode::lazy_initialize_dir() const

View File

@ -115,7 +115,7 @@ namespace Ext2
FileSystem* m_fs;
ino_t m_inum;
mutable Buffer m_block_buffer;
mutable Buffer m_singly_indirect_block;
String m_link;
@ -123,7 +123,6 @@ namespace Ext2
mutable bool m_dir_already_lazily_initialized { false };
Result<usize> find_block(usize index) const;
Result<void> prepare_buffer() const;
friend class FileSystem;
};