fix: update template, prevent double-spaced persisted kernel logs
This commit is contained in:
@@ -10,8 +10,10 @@
|
||||
#include "gui/svg.hpp"
|
||||
#include "gui/window.hpp"
|
||||
#include "gui/widgets.hpp"
|
||||
#include "gui/mtk/widgets.hpp"
|
||||
#include "gui/terminal.hpp"
|
||||
#include <Api/Syscall.hpp>
|
||||
#include <montauk/keyboard.h>
|
||||
|
||||
namespace gui {
|
||||
|
||||
@@ -172,8 +174,8 @@ struct DesktopState {
|
||||
int desktop_item_count;
|
||||
int desktop_item_capacity;
|
||||
|
||||
bool ctx_menu_open;
|
||||
int ctx_menu_x, ctx_menu_y;
|
||||
// Right-click menu on the desktop background (MTK context menu).
|
||||
mtk::ContextMenuState ctx_menu;
|
||||
|
||||
bool net_popup_open;
|
||||
montauk::abi::NetCfg cached_net_cfg;
|
||||
@@ -209,18 +211,11 @@ struct DesktopState {
|
||||
bool wifi_autoconnect_done; // saved-network join already tried
|
||||
bool wifi_joining; // a join we started is in flight
|
||||
bool wifi_dhcp_pending; // ask for a lease once the link is up
|
||||
bool wifi_dhcp_waiting; // dhcp.elf running, no address yet
|
||||
char wifi_joining_ssid[WIFI_SSID_CAP];
|
||||
char wifi_status[96]; // last result line in the popup
|
||||
uint64_t wifi_status_time;
|
||||
|
||||
// Passphrase prompt, shown when a selected network needs a key.
|
||||
bool wifi_prompt_open;
|
||||
char wifi_prompt_ssid[WIFI_SSID_CAP];
|
||||
char wifi_prompt_password[WIFI_PSK_CAP];
|
||||
int wifi_prompt_len;
|
||||
bool wifi_prompt_reveal;
|
||||
bool wifi_prompt_remember;
|
||||
uint8_t wifi_prompt_security;
|
||||
|
||||
bool vol_popup_open;
|
||||
Rect vol_icon_rect;
|
||||
@@ -240,6 +235,12 @@ struct DesktopState {
|
||||
uint64_t thermal_last_poll;
|
||||
Rect temp_icon_rect;
|
||||
|
||||
// Keyboard layouts. The desktop translates hardware scan codes before
|
||||
// dispatching events, so embedded and external apps see the same layout.
|
||||
montauk::keyboard::State keyboard;
|
||||
Rect keyboard_layout_rect;
|
||||
uint64_t keyboard_last_poll;
|
||||
|
||||
int screen_w, screen_h;
|
||||
uint32_t* background_cache;
|
||||
int background_cache_pitch;
|
||||
@@ -275,5 +276,6 @@ void desktop_draw_panel(DesktopState* ds);
|
||||
void desktop_draw_window(DesktopState* ds, int idx);
|
||||
void desktop_handle_mouse(DesktopState* ds);
|
||||
void desktop_handle_keyboard(DesktopState* ds, const montauk::abi::KeyEvent& key);
|
||||
bool desktop_refresh_keyboard_layouts(DesktopState* ds, bool force);
|
||||
|
||||
} // namespace gui
|
||||
|
||||
@@ -40,6 +40,8 @@ struct ContextMenuItem {
|
||||
const char* label;
|
||||
int id;
|
||||
bool enabled;
|
||||
const char* shortcut;
|
||||
bool separator_after;
|
||||
};
|
||||
|
||||
enum ContextMenuResult : int {
|
||||
@@ -210,8 +212,8 @@ inline void draw_context_menu(Canvas& c,
|
||||
|
||||
Rect menu = context_menu_rect(state, item_count, c.w, c.h,
|
||||
menu_w, item_h);
|
||||
c.fill_rect(menu.x + 2, menu.y + 2, menu.w, menu.h,
|
||||
Color::from_rgb(0x80, 0x80, 0x80));
|
||||
c.fill_rounded_rect(menu.x + 2, menu.y + 2, menu.w, menu.h, 4,
|
||||
Color::from_rgb(0x80, 0x80, 0x80));
|
||||
c.fill_rounded_rect(menu.x, menu.y, menu.w, menu.h, 4,
|
||||
colors::MENU_BG);
|
||||
c.rect(menu.x, menu.y, menu.w, menu.h, theme.border);
|
||||
@@ -226,6 +228,19 @@ inline void draw_context_menu(Canvas& c,
|
||||
Color label_color = items[i].enabled ? theme.text : theme.text_muted;
|
||||
context_menu_draw_label(c, menu.x + 12, item.y + (item.h - fh) / 2,
|
||||
items[i].label, label_color, font, font_size);
|
||||
if (items[i].shortcut && items[i].shortcut[0]) {
|
||||
int shortcut_w = font && font->valid && font_size > 0
|
||||
? font->measure_text(items[i].shortcut, font_size)
|
||||
: text_width(items[i].shortcut);
|
||||
context_menu_draw_label(c, menu.x + menu.w - 12 - shortcut_w,
|
||||
item.y + (item.h - fh) / 2,
|
||||
items[i].shortcut, theme.text_muted,
|
||||
font, font_size);
|
||||
}
|
||||
if (items[i].separator_after) {
|
||||
c.hline(menu.x + 10, item.y + item.h - 1,
|
||||
menu.w - 20, theme.border);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +395,7 @@ inline void text_input_delete_range(char* text, int* len, int start, int end) {
|
||||
inline bool text_input_char_allowed(char ch, TextInputCharFilter filter = nullptr,
|
||||
void* userdata = nullptr) {
|
||||
unsigned char u = (unsigned char)ch;
|
||||
if (u < 0x20 || u >= 0x7F) return false;
|
||||
if (u < 0x20 || u == 0x7F) return false;
|
||||
return filter == nullptr || filter(ch, userdata);
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +240,8 @@ struct TextBox {
|
||||
cursor--;
|
||||
text[text_len] = '\0';
|
||||
}
|
||||
} else if (key.ascii >= 32 && key.ascii < 127) {
|
||||
} else if ((unsigned char)key.ascii >= 32
|
||||
&& (unsigned char)key.ascii != 127) {
|
||||
// Printable character
|
||||
if (text_len < 254) {
|
||||
for (int i = text_len; i > cursor; i--) {
|
||||
|
||||
Reference in New Issue
Block a user