mirror of
https://github.com/JannisHeydemann/BoredOS.git
synced 2026-05-30 02:16:58 +00:00
FEATURE: add Bsh + userspace terminal, remove legacy cmd/cli utils
This commit is contained in:
2332
src/wm/cmd.c
2332
src/wm/cmd.c
File diff suppressed because it is too large
Load Diff
31
src/wm/cmd.h
31
src/wm/cmd.h
@@ -1,31 +0,0 @@
|
||||
// Copyright (c) 2023-2026 Chris (boreddevnl)
|
||||
// This software is released under the GNU General Public License v3.0. See LICENSE file for details.
|
||||
// This header needs to maintain in any file it is present in, as per the GPL license terms.
|
||||
#ifndef CMD_H
|
||||
#define CMD_H
|
||||
|
||||
#include "wm.h"
|
||||
|
||||
extern Window win_cmd;
|
||||
|
||||
void cmd_init(void);
|
||||
void cmd_reset(void);
|
||||
|
||||
// IO Functions
|
||||
void cmd_write(const char *str);
|
||||
void cmd_putchar(char c);
|
||||
void cmd_write_int(int n);
|
||||
void cmd_write_hex(uint64_t n);
|
||||
int cmd_get_cursor_col(void);
|
||||
void cmd_screen_clear(void);
|
||||
|
||||
void cmd_increment_msg_count(void);
|
||||
void cmd_reset_msg_count(void);
|
||||
|
||||
void cmd_handle_resize(Window *win, int w, int h);
|
||||
void cmd_handle_click(Window *win, int x, int y);
|
||||
|
||||
uint32_t cmd_get_config_value(const char *key);
|
||||
void cmd_set_current_color(uint32_t color);
|
||||
|
||||
#endif
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "disk.h"
|
||||
#include "wm.h"
|
||||
#include "memory_manager.h"
|
||||
#include "cmd.h"
|
||||
#include "process.h"
|
||||
#define EXPLORER_ITEM_HEIGHT 80
|
||||
#define EXPLORER_ITEM_WIDTH 120
|
||||
@@ -848,7 +847,7 @@ static void explorer_open_item(Window *win, int index) {
|
||||
} else if (explorer_strcmp(state->items[index].name, "Calculator.shortcut") == 0) {
|
||||
process_create_elf("/bin/calculator.elf", NULL); return;
|
||||
} else if (explorer_strcmp(state->items[index].name, "Terminal.shortcut") == 0) {
|
||||
target = &win_cmd; cmd_reset();
|
||||
process_create_elf("/bin/terminal.elf", NULL); return;
|
||||
} else if (explorer_strcmp(state->items[index].name, "Minesweeper.shortcut") == 0) {
|
||||
process_create_elf("/bin/minesweeper.elf", NULL); return;
|
||||
} else if (explorer_strcmp(state->items[index].name, "Control Panel.shortcut") == 0 || explorer_strcmp(state->items[index].name, "Settings.shortcut") == 0) {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
// External windows references (for opening other apps)
|
||||
extern Window win_explorer;
|
||||
extern Window win_editor;
|
||||
extern Window win_cmd;
|
||||
extern Window win_notepad;
|
||||
extern Window win_markdown;
|
||||
|
||||
|
||||
18
src/wm/wm.c
18
src/wm/wm.c
@@ -4,7 +4,6 @@
|
||||
#include "wm.h"
|
||||
#include "graphics.h"
|
||||
#include "io.h"
|
||||
#include "cmd.h"
|
||||
#include "process.h"
|
||||
#include "syscall.h"
|
||||
#include "kutils.h"
|
||||
@@ -2485,7 +2484,7 @@ static void wm_handle_mouse_internal(int dx, int dy, uint8_t buttons, int dz) {
|
||||
if (existing) wm_bring_to_front_locked(existing);
|
||||
else process_create_elf("/bin/boredword.elf", NULL);
|
||||
} else if (str_starts_with(start_menu_pending_app, "Terminal")) {
|
||||
cmd_reset(); wm_bring_to_front_locked(&win_cmd);
|
||||
process_create_elf("/bin/terminal.elf", NULL);
|
||||
} else if (str_starts_with(start_menu_pending_app, "Grapher")) {
|
||||
Window *existing = wm_find_window_by_title_locked("Grapher");
|
||||
if (existing) wm_bring_to_front_locked(existing);
|
||||
@@ -2550,7 +2549,7 @@ static void wm_handle_mouse_internal(int dx, int dy, uint8_t buttons, int dz) {
|
||||
} else if (str_ends_with(icon->name, "Settings.shortcut")) {
|
||||
process_create_elf("/bin/settings.elf", NULL); handled = true;
|
||||
} else if (str_ends_with(icon->name, "Terminal.shortcut")) {
|
||||
wm_bring_to_front_locked(&win_cmd); handled = true;
|
||||
process_create_elf("/bin/terminal.elf", NULL); handled = true;
|
||||
} else if (str_ends_with(icon->name, "About.shortcut")) {
|
||||
process_create_elf("/bin/about.elf", NULL); handled = true;
|
||||
} else if (str_ends_with(icon->name, "Files.shortcut")) {
|
||||
@@ -3104,9 +3103,6 @@ void wm_init(void) {
|
||||
disk_manager_scan();
|
||||
log_ok("Disk scanning complete");
|
||||
|
||||
cmd_init();
|
||||
log_ok("Command CLI ready");
|
||||
|
||||
explorer_init();
|
||||
log_ok("Explorer ready");
|
||||
|
||||
@@ -3128,19 +3124,15 @@ void wm_init(void) {
|
||||
log_ok("Desktop icons refreshed");
|
||||
|
||||
// Initialize z-indices
|
||||
win_cmd.z_index = 0;
|
||||
win_explorer.z_index = 1;
|
||||
|
||||
all_windows[0] = &win_cmd;
|
||||
all_windows[1] = &win_explorer;
|
||||
window_count = 2;
|
||||
|
||||
all_windows[0] = &win_explorer;
|
||||
window_count = 1;
|
||||
|
||||
win_explorer.visible = false;
|
||||
win_explorer.focused = false;
|
||||
win_explorer.z_index = 10;
|
||||
|
||||
win_cmd.visible = false;
|
||||
|
||||
force_redraw = true;
|
||||
|
||||
serial_write("[WM] Initialization complete, transitioning to GUI\n");
|
||||
|
||||
Reference in New Issue
Block a user