Compare commits

..

28 Commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen 3730c07330 Aurora procedural wallpaper. 2023-05-14 23:14:16 +02:00
Jonas 'Sortie' Termansen 3b2685931b Work around pty deadlock. 2023-05-14 23:14:16 +02:00
Jonas 'Sortie' Termansen 86acd95309 Add cdrom mounting live environment. 2023-05-14 23:14:16 +02:00
Jonas 'Sortie' Termansen 64c65ddba0 Revert "Parallelize driver initialization."
This reverts commit 0fef08bbc4.
2023-05-14 23:14:16 +02:00
Jonas 'Sortie' Termansen 4552947ac9 Parallelize driver initialization. 2023-05-14 23:14:16 +02:00
Jonas 'Sortie' Termansen d22b3ddd15 Speed up ata(4) 400 ns waits.
Waiting for any non-zero duration currently waits for at least one timer
cycle (10 ms), which is especially expensive during early boot.

The current workaround of simply reading the status 14 times seems really
suspicious although the osdev wiki documents it, but let's see how well it
works on real hardware, it's probably good enough.

Try to determine the initial selected drive to save one drive selection.
2023-05-14 23:14:16 +02:00
Jonas 'Sortie' Termansen 0c82f0236a Decrease PS/2 timeouts. 2023-05-14 23:14:16 +02:00
Jonas 'Sortie' Termansen fa53637420 Add uptime(1) -pr options. 2023-05-14 23:14:16 +02:00
Jonas 'Sortie' Termansen 9c27584adf Add iso9660 filesystem implementation. 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen b93ce9f6d0 Add kernel virtual address space usage debug information. 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen ba51698db2 Revert "Update to bison-3.8.2."
This reverts commit b82fae810b42c5426d21c4dc153b32f086dd7fde.
2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen be9d4bdf36 Update to bison-3.8.2. 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen f57ad489b6 Debug TCP socket state listing. 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen 956ec4355d Add kernel heap allocation tracing debug facility. 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen 76cf62062b Add m4, perl, and texinfo to the basic ports set. 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen eab3628b2d Trianglix 4. 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen 74569706a5 Add tix-check(8). 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen 27b7ad2fab Volatile release. 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen 77ac43ea39 Add tix-upgrade(8). 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen 80054fe389 Add display server. 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen 348e89d5be Add pty(1). 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen 5aa7e56123 Add signify port. 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen 26284dec59 Add irc(1).
Co-authored-by: Juhani Krekelä <juhani@krekelä.fi>
2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen 3462079741 Add getaddrinfo(1). 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen 3a72e024de Add host(1). 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen c6f2dd602f Add automatic installer and upgrader. 2023-05-14 23:14:15 +02:00
Jonas 'Sortie' Termansen eaee5c4838 Enable stack smash protection by default. 2023-04-23 23:35:08 +02:00
Jonas 'Sortie' Termansen 2abdecf59a Enable undefined behavior sanitization by default. 2023-04-23 23:35:08 +02:00
5 changed files with 73 additions and 203 deletions

View File

@ -476,7 +476,17 @@ void display_keyboard_event(struct display* display, uint32_t codepoint)
if ( (display->key_lalt && kbkey == KBKEY_F4) /* ||
(display->key_lctrl && kbkey == KBKEY_Q)*/ )
{
window_quit(window);
struct event_keyboard event;
event.window_id = display->active_window->window_id;
struct display_packet_header header;
header.message_id = EVENT_QUIT;
header.message_length = sizeof(event);
assert(window->connection);
connection_schedule_transmit(window->connection, &header, sizeof(header));
connection_schedule_transmit(window->connection, &event, sizeof(event));
return;
}
@ -603,27 +613,14 @@ void display_mouse_event(struct display* display, uint8_t byte)
display->pointer_x += xm;
display->pointer_y += ym;
bool clipped_edge = false;
if ( display->pointer_x < 0 )
{
display->pointer_x = 0;
clipped_edge = true;
}
if ( display->pointer_y < 0 )
{
display->pointer_y = 0;
clipped_edge = true;
}
if ( display->screen_width < (size_t) display->pointer_x )
{
if ( display->screen_width <= (size_t) display->pointer_x )
display->pointer_x = display->screen_width;
clipped_edge = true;
}
if ( display->screen_height < (size_t) display->pointer_y )
{
if ( display->screen_height <= (size_t) display->pointer_y )
display->pointer_y = display->screen_height;
clipped_edge = true;
}
xm = display->pointer_x - old_pointer_x;
ym = display->pointer_y - old_pointer_y;
@ -662,23 +659,8 @@ void display_mouse_event(struct display* display, uint8_t byte)
window_pointer_x < (ssize_t) window->width &&
0 <= window_pointer_y &&
window_pointer_y <= (ssize_t) TITLE_HEIGHT) )
{
size_t border_width = window_border_width(window);
size_t button_width = FONT_WIDTH * 2;
ssize_t buttons_x = window->width - border_width
- button_width * 3 + 1;
ssize_t rel_x = window_pointer_x - buttons_x;
if ( 0 <= rel_x && rel_x < (ssize_t) button_width )
{
// TODO Minimize window.
}
else if ( 0 <= rel_x && rel_x < (ssize_t) button_width * 2 )
window_toggle_maximized(window);
else if ( 0 <= rel_x && rel_x < (ssize_t) button_width * 3 )
window_quit(window);
else
display->mouse_state = MOUSE_STATE_TITLE_MOVE;
} else if ( window_pointer_x < 0 && window_pointer_y < 0 )
display->mouse_state = MOUSE_STATE_TITLE_MOVE;
else if ( window_pointer_x < 0 && window_pointer_y < 0 )
display->mouse_state = MOUSE_STATE_RESIZE_TOP_LEFT;
else if ( window_pointer_x < 0 &&
0 <= window_pointer_y &&
@ -708,60 +690,13 @@ void display_mouse_event(struct display* display, uint8_t byte)
}
if ( xm || ym )
{
bool floating = window->window_state == WINDOW_STATE_REGULAR;
bool on_edge = display->pointer_x == 0
|| display->pointer_y == 0
|| display->pointer_x
== (ssize_t) display->screen_width
|| display->pointer_y
== (ssize_t) display->screen_height;
switch ( display->mouse_state )
{
case MOUSE_STATE_NONE: break;
case MOUSE_STATE_TITLE_MOVE:
if ( clipped_edge )
{
// I'd declare those in function scope but I'm afraid of
// messing with the code too much.
ssize_t x = display->pointer_x;
ssize_t y = display->pointer_y;
ssize_t sw = display->screen_width;
ssize_t sh = display->screen_height;
ssize_t corner_size = (sw < sh ? sw : sh) / 4;
if ( x < corner_size && y < corner_size )
window_tile_top_left(window);
else if (sw - x < corner_size && y < corner_size )
window_tile_top_right(window);
else if ( x < corner_size && sh - y < corner_size )
window_tile_bottom_left(window);
else if (sw - x < corner_size && sh - y < corner_size )
window_tile_bottom_right(window);
else if (x == 0)
window_tile_left(window);
else if (x == sw)
window_tile_right(window);
else if (y == 0)
window_tile_top(window);
else if (y == sh)
window_tile_bottom(window);
}
else if (floating || !on_edge)
{
if ( !floating )
{
// The current behaviour of window_restore becomes
// awkward with tiling gestures. I could change the
// function itself, especially since this is currently
// its only callsite, but the old behaviour could be
// nice for a future untile hotkey. Thus, this hack.
window_restore(window);
window->top = display->pointer_y - TITLE_HEIGHT / 2;
window->left = display->pointer_x - window->width / 2;
}
window_move(window, window->left + xm, window->top + ym);
}
if ( window->window_state != WINDOW_STATE_REGULAR )
window_restore(window);
window_move(window, window->left + xm, window->top + ym);
break;
case MOUSE_STATE_RESIZE_TOP_LEFT:
window_drag_resize(window, xm, ym, -xm, -ym);

View File

@ -101,97 +101,62 @@ void window_render_frame(struct window* window)
}
const char* tt = window->title ? window->title : "";
ssize_t tt_width = render_text_width(tt); // Potentially adjusted later.
size_t tt_max_width = window->width - 2 * BORDER_WIDTH;
size_t tt_desired_width = render_text_width(tt);
size_t tt_width = tt_desired_width < tt_max_width ? tt_desired_width : tt_max_width;
size_t tt_height = FONT_HEIGHT;
size_t tt_pos_x = BORDER_WIDTH + (tt_max_width - tt_width) / 2;
size_t tt_pos_y = (TITLE_HEIGHT - FONT_HEIGHT) / 2 + 2;
uint32_t tt_color = title_color;
size_t border_width = window_border_width(window);
size_t button_width = FONT_WIDTH * 2;
size_t button_height = FONT_HEIGHT;
ssize_t buttons_x = window->width - border_width - button_width * 3 + 1;
struct framebuffer buttons_fb =
framebuffer_crop(window->buffer, buttons_x,
tt_pos_y, button_width * 3, tt_height);
size_t button_size = FONT_WIDTH - 1;
#if 0
for (size_t x = 0; x < button_width; x++)
for (size_t y = 0; y < button_height; y++)
framebuffer_set_pixel(buttons_fb, button_width * 0 + x, y, 0xFF8080FF);
for (size_t x = 0; x < button_width; x++)
for (size_t y = 0; y < button_height; y++)
framebuffer_set_pixel(buttons_fb, button_width * 1 + x, y, 0xFFFF8080);
for (size_t x = 0; x < button_width; x++)
for (size_t y = 0; y < button_height; y++)
framebuffer_set_pixel(buttons_fb, button_width * 2 + x, y, 0xFF8080FF);
#endif
for ( size_t i = 0; i < button_size; i++ )
{
size_t bx = button_width * 0 + (button_width - button_size) / 2;
size_t by = (button_height - button_size) / 2;
framebuffer_set_pixel(buttons_fb, bx + i,
by + button_size - 1, tt_color);
framebuffer_set_pixel(buttons_fb, bx + i,
by + button_size - 2, tt_color);
}
for ( size_t i = 0; i < button_size; i++ )
{
size_t bx = button_width * 1 + (button_width - button_size) / 2;
size_t by = (button_height - button_size) / 2;
framebuffer_set_pixel(buttons_fb, bx + i,
by, tt_color);
framebuffer_set_pixel(buttons_fb, bx + i,
by + button_size - 1 , tt_color);
framebuffer_set_pixel(buttons_fb, bx,
by + i, tt_color);
framebuffer_set_pixel(buttons_fb, bx + button_size - 1,
by + i, tt_color);
framebuffer_set_pixel(buttons_fb, bx + i,
by + 1, tt_color);
framebuffer_set_pixel(buttons_fb, bx + i,
by + button_size - 2 , tt_color);
framebuffer_set_pixel(buttons_fb, bx + 1,
by + i, tt_color);
framebuffer_set_pixel(buttons_fb, bx + button_size - 2,
by + i, tt_color);
}
for ( size_t i = 0; i < button_size; i++ )
{
size_t bx = button_width * 2 + (button_width - button_size) / 2;
size_t by = (button_height - button_size) / 2;
framebuffer_set_pixel(buttons_fb, bx + i,
by + i, tt_color);
framebuffer_set_pixel(buttons_fb, bx + i,
by + button_size - 1 - i, tt_color);
framebuffer_set_pixel(buttons_fb, bx + i - 1,
by + i, tt_color);
framebuffer_set_pixel(buttons_fb, bx + i - 1,
by + button_size - 1 - i, tt_color);
}
ssize_t q = 500 - window->width;
ssize_t q_width = 200;
q = q < q_width ? q : q_width;
q = 0 < q ? q : 0;
ssize_t center_over = window->width - (button_width * 3 * q / q_width);
ssize_t tt_pos_x = (center_over - tt_width) / 2;
#if 0
for (int y = 0; y < 10; y++)
{
framebuffer_set_pixel(window->buffer, window->width / 2, y, 0xFFFF0000);
framebuffer_set_pixel(window->buffer, (window->width - button_width * 3) / 2, y, 0xFFFF0000);
framebuffer_set_pixel(window->buffer, center_over/2, y, 0xFFFF00FF);
}
#endif
if ( tt_pos_x < (ssize_t)border_width )
{
tt_pos_x = border_width;
tt_width = buttons_x - border_width;
tt_width = 0 < tt_width ? tt_width : 0;
}
render_text(framebuffer_crop(window->buffer, tt_pos_x, tt_pos_y, tt_width, tt_height), tt, tt_color);
size_t border_width = maximized ? BORDER_WIDTH / 2 : BORDER_WIDTH;
size_t button_size = FONT_WIDTH - 1;
size_t button_spacing = FONT_WIDTH;
struct framebuffer buttons_fb =
framebuffer_crop(window->buffer,
window->width - border_width - (FONT_HEIGHT - button_size) / 2 - 5 * button_spacing,
tt_pos_y, tt_width, tt_height);
size_t buttons_top = (FONT_HEIGHT - button_size) / 2;
for ( size_t i = 0; i < button_size; i++ )
{
framebuffer_set_pixel(buttons_fb, 0 * button_spacing + i,
buttons_top + button_size - 1, tt_color);
framebuffer_set_pixel(buttons_fb, 0 * button_spacing + i,
buttons_top + button_size - 2, tt_color);
}
for ( size_t i = 0; i < button_size; i++ )
{
framebuffer_set_pixel(buttons_fb, 2 * button_spacing + i,
buttons_top, tt_color);
framebuffer_set_pixel(buttons_fb, 2 * button_spacing + i,
buttons_top + button_size - 1 , tt_color);
framebuffer_set_pixel(buttons_fb, 2 * button_spacing,
buttons_top + i, tt_color);
framebuffer_set_pixel(buttons_fb, 2 * button_spacing + button_size - 1,
buttons_top + i, tt_color);
framebuffer_set_pixel(buttons_fb, 2 * button_spacing + i,
buttons_top + 1, tt_color);
framebuffer_set_pixel(buttons_fb, 2 * button_spacing + i,
buttons_top + button_size - 2 , tt_color);
framebuffer_set_pixel(buttons_fb, 2 * button_spacing + 1,
buttons_top + i, tt_color);
framebuffer_set_pixel(buttons_fb, 2 * button_spacing + button_size - 2,
buttons_top + i, tt_color);
}
for ( size_t i = 0; i < button_size; i++ )
{
framebuffer_set_pixel(buttons_fb, 4 * button_spacing + i,
buttons_top + i, tt_color);
framebuffer_set_pixel(buttons_fb, 4 * button_spacing + i,
buttons_top + button_size - 1 - i, tt_color);
framebuffer_set_pixel(buttons_fb, 4 * button_spacing + i + 1,
buttons_top + i, tt_color);
framebuffer_set_pixel(buttons_fb, 4 * button_spacing + i + 1,
buttons_top + button_size - 1 - i, tt_color);
}
}
void window_move(struct window* window, size_t left, size_t top)
@ -207,7 +172,7 @@ void window_client_resize(struct window* window,
if ( window->window_state != WINDOW_STATE_MINIMIZED )
window->window_state = WINDOW_STATE_REGULAR;
struct framebuffer old_fb = window->buffer;
free(window->buffer.buffer);
window->width = client_width + BORDER_WIDTH + BORDER_WIDTH;
window->height = client_height + TITLE_HEIGHT + BORDER_WIDTH;
@ -217,12 +182,7 @@ void window_client_resize(struct window* window,
window->buffer.pitch = window->width;
window->buffer.buffer = (uint32_t*)
malloc(sizeof(uint32_t) * window->width * window->height);
for ( size_t y = 0; y < window->height; y++ )
for ( size_t x = 0; x < window->width; x++ )
framebuffer_set_pixel(window->buffer, x, y,
framebuffer_get_pixel(old_fb, x, y));
free(old_fb.buffer);
memset(window->buffer.buffer, 0, sizeof(uint32_t) * window->width * window->height);
window_render_frame(window);
window_notify_client_resize(window);
@ -283,21 +243,6 @@ void window_initialize(struct window* window,
window_client_resize(window, 0, 0);
}
void window_quit(struct window* window)
{
struct event_keyboard event;
event.window_id = window->window_id;
struct display_packet_header header;
header.message_id = EVENT_QUIT;
header.message_length = sizeof(event);
assert(window->connection);
connection_schedule_transmit(window->connection, &header, sizeof(header));
connection_schedule_transmit(window->connection, &event, sizeof(event));
}
void window_destroy(struct window* window)
{
display_remove_window(window->display, window);
@ -535,9 +480,3 @@ void window_notify_client_resize(struct window* window)
connection_schedule_transmit(window->connection, &header, sizeof(header));
connection_schedule_transmit(window->connection, &event, sizeof(event));
}
size_t window_border_width(const struct window* window)
{
bool maximized = window->window_state != WINDOW_STATE_REGULAR;
return maximized ? BORDER_WIDTH / 2 : BORDER_WIDTH;
}

View File

@ -80,7 +80,6 @@ void window_move(struct window* window, size_t left, size_t top);
void window_resize(struct window* window, size_t width, size_t height);
void window_client_resize(struct window* window, size_t client_width, size_t client_height);
void window_initialize(struct window* window, struct connection* connection, struct display* display, uint32_t window_id);
void window_quit(struct window* window);
void window_destroy(struct window* window);
void window_drag_resize(struct window* window, int ld, int td, int wd, int hd);
void window_on_display_resolution_change(struct window* window, struct display* display);
@ -102,6 +101,4 @@ void window_tile_bottom_left(struct window* window);
void window_tile_bottom_right(struct window* window);
void window_notify_client_resize(struct window* window);
size_t window_border_width(const struct window* window);
#endif

View File

@ -288,7 +288,6 @@ Copy the sshd private keys (if they exist) into the installation?
These are
.Pa /etc/ssh_host_ecdsa_key ,
.Pa /etc/ssh_host_ed25519_key ,
and
.Pa /etc/ssh_host_rsa_key .
.It Sy finally Ns "=" Ns Oo Sy exit "|" Sy poweroff "|" Sy reboot "|" Sy halt "|" Sy boot Oc ( default Sy boot )
What action should be taken when the installation is finished?

View File

@ -221,7 +221,7 @@ bool minmax_parameter(const char* option,
}
#define MINMAX_PARAMETER(option, min_result, max_result) \
minmax_parameter("--" option, "--min-" option, "--max-" option, arg, \
minmax_parameter("--" option, "--min-" option, "--max" option, arg, \
argc, argv, &i, argv0, min_result, max_result)
bool bool_parameter(const char* option,