Compare commits

..

73 Commits

Author SHA1 Message Date
6eea3bda06
wind: Move more fallible operations before window creation
All checks were successful
continuous-integration/drone/pr Build is passing
2023-09-04 12:16:55 +02:00
2f608d46ac
wind: Make sure stdin is always a TTY 2023-09-04 12:16:55 +02:00
1edf10380f
libui+wind+libos: Move shared memory handling code to os::SharedMemory 2023-09-04 12:16:55 +02:00
5867195168
libui: Add default handlers for events in Widget 2023-09-04 12:16:55 +02:00
5e1d70819a
libui: Propagate Container events only if they are in the child widget's rect 2023-09-04 12:16:54 +02:00
07e992f61a
libui+wind: Handle mouse leave events when the mouse leaves a window 2023-09-04 12:16:54 +02:00
d47c25a2fb
wind: Stop using the removed 'signal' pledge 2023-09-04 12:16:54 +02:00
9a7cb66c34
libui: Install the built library into the system root 2023-09-04 12:16:54 +02:00
7a93b15a02
wind: Show memory usage in debug output 2023-09-04 12:16:54 +02:00
de15730db5
wind: Handle ftruncate() and mmap() errors properly 2023-09-04 12:16:54 +02:00
1774eadd60
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-04 12:16:54 +02:00
ea34f782e8
taskbar: Wait for terminated child windows 2023-09-04 12:16:53 +02:00
09ac7b0730
wind: Add debug keybind 2023-09-04 12:16:53 +02:00
077a42c15c
wind+libos+libui: Handle interrupted reads properly 2023-09-04 12:16:53 +02:00
2278a0b947
base: Actually add the start icon to source control 2023-09-04 12:16:53 +02:00
1214d1711d
libui: Add Buttons 2023-09-04 12:16:53 +02:00
6d92eefd5f
libui: Handle other mouse events 2023-09-04 12:16:53 +02:00
56a2284b39
libui: Add aligned items using Containers, ImageWidget 2023-09-04 12:16:52 +02:00
5e3b9fc950
libui: Add VerticalLayout 2023-09-04 12:16:52 +02:00
c8edb55eb2
wind+libui+taskbar: Add GetScreenRect IPC, non-decorated windows, taskbar 2023-09-04 12:16:52 +02:00
ca92ff9d96
libui: Actually fill window backgrounds with the correct color 2023-09-04 12:16:52 +02:00
b2de0d2b84
libui: Add basic widget and layout system =D 2023-09-04 12:16:52 +02:00
ccd5551450
ui+wind: Send mouse move events through IPC 2023-09-04 12:16:52 +02:00
51b9acac31
wind+libui: Add protocol for window close requests 2023-09-04 12:16:51 +02:00
d7d18c7c31
libos+libui+wind: Use uppercase for static struct IDs to avoid confusion with fields 2023-09-04 12:16:51 +02:00
51ef9536d3
libui+gclient: Add basic OOP wrappers around the IPC protocol 2023-09-04 12:16:51 +02:00
87a54a6187
wind+gclient: Add SetWindowTitle and support shm buffers 2023-09-04 12:16:51 +02:00
35b645c5c9
gclient: Create two example windows 2023-09-04 12:16:51 +02:00
5b875bc12a
wind: Handle CreateWindow IPC messages 2023-09-04 12:16:51 +02:00
e35c940bd9
libui: Add CreateWindow IPC message definitions 2023-09-04 12:16:50 +02:00
63098bb5af
libos: Add basic IPC message framework 2023-09-04 12:16:50 +02:00
133541b7e4
kernel: Fix poll syscall 2023-09-04 12:16:50 +02:00
0629719975
wind: Monitor data on client connections 2023-09-04 12:16:50 +02:00
39278465ac
kernel: Add POLLHUP and store it when a polled socket's peer disconnects 2023-09-04 12:16:50 +02:00
210d322886
libui: Add copyright/author text 2023-09-04 12:16:50 +02:00
4011aa0467
libos: Add copyright/author comments to LocalServer and LocalClient 2023-09-04 12:16:50 +02:00
0aaac192d8
wind: Use init --user and pledge() 2023-09-04 12:16:49 +02:00
a703238ff9
Update .gitignore 2023-09-04 12:16:49 +02:00
8e2def7d88
libos: Remove some shared pointers and change them to owned/live on the stack 2023-09-04 12:16:49 +02:00
bfa5ce4c00
wind: Spawn a new client process after startup
Also, create the socket after dropping privileges.
2023-09-04 12:16:49 +02:00
1aa0406649
apps: Add gclient 2023-09-04 12:16:49 +02:00
8ebc5e88a6
libos: Add os::LocalClient 2023-09-04 12:16:49 +02:00
b380d84347
libui: Change 'into' to 'onto' 2023-09-04 12:16:48 +02:00
2d7ece4e9b
libui: Document ui::Font 2023-09-04 12:16:48 +02:00
1c4f2dfb15
libui+wind: Move some static variables inside functions 2023-09-04 12:16:48 +02:00
7066a976c3
wind: Generate random windows on keypresses 2023-09-04 12:16:48 +02:00
3442ae0bdb
wind: Make sure windows have a minimum size to fit the titlebar 2023-09-04 12:16:48 +02:00
d6b7a4a921
libui: Properly cut off the last drawn character if necessary 2023-09-04 12:16:48 +02:00
feb84ac3fa
libui: Add Rect::contains(Rect) 2023-09-04 12:16:47 +02:00
80c8a80301
libui: Render font characters properly with no spacing, matching the width calculations 2023-09-04 12:16:47 +02:00
0fcd984c21
wind: Render an actual TGA mouse cursor 2023-09-04 12:16:47 +02:00
3755d4c0a3
wind: Add a close button to windows using a TGA icon 2023-09-04 12:16:47 +02:00
218278fb22
libui: Add support for TGA image loading 2023-09-04 12:16:47 +02:00
117edb3e90
libui: Add an interface to fill a Canvas with an array of pixels 2023-09-04 12:16:47 +02:00
739b05ab67
wind: Add window titlebars using ui::Font 2023-09-04 12:16:47 +02:00
dd3611cb25
libui: Add PSF font loading and rendering 2023-09-04 12:16:46 +02:00
e932efd72c
libui: Add Color::GRAY 2023-09-04 12:16:46 +02:00
35d07206d7
libui: Rename Rect::absolute to normalized and add a new absolute function 2023-09-04 12:16:46 +02:00
40143597d8
libluna: Add assignment operators to Buffer 2023-09-04 12:16:46 +02:00
f90634e1b1
wind: Reorder drag sequence 2023-09-04 12:16:46 +02:00
f61dd9ba99
libui: Add Rect::relative 2023-09-04 12:16:46 +02:00
eef6483192
libui: Remove redundant statement 2023-09-04 12:16:45 +02:00
88fb4be5ed
libui: Add getters for separate color values 2023-09-04 12:16:45 +02:00
94c06379ea
libui: Remove unnecessary stuff 2023-09-04 12:16:45 +02:00
156092cbbb
base: Remove startup items not necessary for GUI startup 2023-09-04 12:16:45 +02:00
4933e1e32c
libui+wind: (Draggable) windows 2023-09-04 12:16:45 +02:00
2a22b751e9
wind: Create a local server object 2023-09-04 12:16:45 +02:00
ea4e374718
libos: Add a new LocalServer class for local domain sockets 2023-09-04 12:16:44 +02:00
6191039bfb
kernel: Support listening sockets in poll() 2023-09-04 12:16:44 +02:00
b222221517
base: Start wind on startup instead of the shell 2023-09-04 12:16:44 +02:00
c17f6d0e57
wind: Add a simple display server skeleton using libui
No client functionality yet, but it's a start.
2023-09-04 12:16:44 +02:00
4502073b7d
libui: Add a GUI and graphics library 2023-09-04 12:16:44 +02:00
6fe2343233
kernel: Fix negative movement in the PS/2 mouse driver 2023-09-04 12:16:40 +02:00
5 changed files with 26 additions and 6 deletions

View File

@ -35,6 +35,7 @@ luna_app(time.cpp time)
luna_app(ln.cpp ln) luna_app(ln.cpp ln)
luna_app(mktemp.cpp mktemp) luna_app(mktemp.cpp mktemp)
luna_app(sysfuzz.cpp sysfuzz) luna_app(sysfuzz.cpp sysfuzz)
luna_app(pivot_root.cpp pivot_root)
luna_app(cp.cpp cp) luna_app(cp.cpp cp)
luna_app(kill.cpp kill) luna_app(kill.cpp kill)
luna_app(gol.cpp gol) luna_app(gol.cpp gol)

19
apps/pivot_root.cpp Normal file
View File

@ -0,0 +1,19 @@
#include <os/ArgumentParser.h>
#include <sys/syscall.h>
#include <unistd.h>
Result<int> luna_main(int argc, char** argv)
{
StringView new_root;
StringView put_old;
os::ArgumentParser parser;
parser.add_description("Move the current root directory to another directory and replace it with another mount.");
parser.add_system_program_info("pivot_root"_sv);
parser.add_positional_argument(new_root, "new_root", true);
parser.add_positional_argument(put_old, "put_old", true);
parser.parse(argc, argv);
long rc = syscall(SYS_pivot_root, new_root.chars(), put_old.chars());
return Result<int>::from_syscall(rc);
}

View File

@ -19,20 +19,21 @@ constexpr u8 RIGHT_SHIFT = 0x36;
constexpr u8 CAPS_LOCK = 0x3a; constexpr u8 CAPS_LOCK = 0x3a;
constexpr u8 LEFT_CONTROL = 0x1D; constexpr u8 LEFT_CONTROL = 0x1D;
constexpr u8 TAB = 0x0F;
constexpr u8 LEFT_ALT = 0x38; constexpr u8 LEFT_ALT = 0x38;
constexpr u8 F11 = 0x57; constexpr u8 F11 = 0x57;
constexpr u8 F12 = 0x58; constexpr u8 F12 = 0x58;
static bool should_ignore_key(u8 scancode) static bool should_ignore_key(u8 scancode)
{ {
return (scancode > 0x3A && scancode < 0x47) || scancode == F11 || scancode == F12; return (scancode > 0x3A && scancode < 0x47) || scancode == TAB || scancode == F11 || scancode == F12;
} }
constexpr char key_table[] = { constexpr char key_table[] = {
'\0', '\0',
'\1', // escape '\1', // escape
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b',
'\t', // tab '\0', // tab
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n',
'\0', // left ctrl '\0', // left ctrl
'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`',
@ -74,7 +75,7 @@ constexpr char shifted_key_table[] = {
'\0', '\0',
'\1', // escape '\1', // escape
'!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '\b', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '\b',
'\t', // tab '\0', // tab
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n',
'\0', // left ctrl '\0', // left ctrl
'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~',

View File

@ -106,7 +106,6 @@ void ConsoleDevice::process_key_event(u8 scancode)
{ {
TextConsole::putwchar(L'\b'); TextConsole::putwchar(L'\b');
if (_iscntrl(maybe_char.value())) TextConsole::putwchar(L'\b'); if (_iscntrl(maybe_char.value())) TextConsole::putwchar(L'\b');
if (maybe_char.value() == '\t') TextConsole::wprint(L"\b\b");
} }
return; return;
} }
@ -180,7 +179,7 @@ void ConsoleDevice::process_key_event(u8 scancode)
if (m_settings.c_lflag & ECHOCTL) if (m_settings.c_lflag & ECHOCTL)
{ {
bool should_echo = true; bool should_echo = true;
if (key == '\n' || key == '\t' || key == '\0' || key == m_settings.c_cc[VEOF]) should_echo = false; if (key == '\n' || key == '\0' || key == m_settings.c_cc[VEOF]) should_echo = false;
if (should_echo) if (should_echo)
{ {