mirror of
https://github.com/javalsai/lidm.git
synced 2025-08-30 18:08:00 +02:00
feat: ithnk full utf8 support & ui 100% consistent
This commit is contained in:
@@ -14,20 +14,13 @@ enum introspection_type {
|
||||
KEY,
|
||||
STRING_ARRAY,
|
||||
};
|
||||
static const char* const intros_tys_names[] = {
|
||||
static const char* NNULLABLE const intros_tys_names[] = {
|
||||
[STRING] = "STRING",
|
||||
[BOOL] = "BOOL",
|
||||
[KEY] = "KEY",
|
||||
[STRING_ARRAY] = "STRING_ARRAY",
|
||||
};
|
||||
|
||||
union introspection_variant {
|
||||
char* string;
|
||||
bool boolean;
|
||||
enum keys key;
|
||||
char** string_array;
|
||||
};
|
||||
|
||||
struct introspection_item {
|
||||
char* NNULLABLE name;
|
||||
size_t offset;
|
||||
|
@@ -18,6 +18,6 @@ void ofield_kbd_type(struct opts_field* self, char* typed, char* empty_default);
|
||||
bool ofield_opts_seek(struct opts_field* self, char seek);
|
||||
bool ofield_seek(struct opts_field* self, char seek);
|
||||
|
||||
u_char ofield_display_cursor_col(struct opts_field* self);
|
||||
u_char ofield_display_cursor_col(struct opts_field* self, u_char maxlen);
|
||||
|
||||
#endif
|
||||
|
38
include/ui.h
38
include/ui.h
@@ -5,13 +5,43 @@
|
||||
#include "ofield.h"
|
||||
#include "util.h"
|
||||
|
||||
// [box_start]
|
||||
// ↓
|
||||
// 0 [┌]───────────────────────────────────────────────┐
|
||||
// 1 │ │
|
||||
// 2 │ the-art 2025-06-20 21:40:44 │
|
||||
// 3 │ | │
|
||||
// 4 │ | │
|
||||
// 5 │ xorg < Default > | │
|
||||
// 6 │ | │
|
||||
// 7 │ user javalsai | │
|
||||
// 8 │ | │
|
||||
// 9 │ password ________________________________ │
|
||||
// 10 │ | | │
|
||||
// 11 └────────────────────────────────────────────────┘
|
||||
// 01234567890123456789012345678901234567890123456789
|
||||
// 00000000001111111111222222222233333333334444444444
|
||||
// |--| | ↑ |--|[BOX_HMARGIN]
|
||||
// [BOX_HMARGIN] [VALUES_COL] |
|
||||
// |---|[VALUES_SEPR] |
|
||||
// |--------------------------------|[VALUE_MAXLEN]
|
||||
|
||||
#define HEAD_ROW 2
|
||||
#define SESSION_ROW 5
|
||||
#define USER_ROW 7
|
||||
#define PASSWD_ROW 9
|
||||
|
||||
#define BOX_WIDTH 50
|
||||
#define BOX_HEIGHT 12
|
||||
#define BOX_HMARGIN 2
|
||||
|
||||
#define VALUES_COL 15
|
||||
#define VALUES_SEPR 3
|
||||
#define VALUE_MAXLEN (BOX_WIDTH - VALUES_COL + 1 - BOX_HMARGIN - 2)
|
||||
|
||||
enum input { SESSION, USER, PASSWD };
|
||||
extern const u_char inputs_n;
|
||||
|
||||
// not customizable (for now)
|
||||
extern const uint boxw;
|
||||
extern const uint boxh;
|
||||
|
||||
void setup(struct config* config);
|
||||
int load(struct Vector* users, struct Vector* sessions);
|
||||
void print_err(const char*);
|
||||
|
@@ -9,15 +9,16 @@
|
||||
|
||||
#include "keys.h"
|
||||
|
||||
int find_keyname(enum keys* at, char* name);
|
||||
enum keys find_ansi(char*);
|
||||
int find_keyname(enum keys* at, const char* name);
|
||||
enum keys find_ansi(const char*);
|
||||
void read_press(u_char*, char*);
|
||||
|
||||
bool utf8_iscont(char byte);
|
||||
size_t utf8len(char* str);
|
||||
size_t utf8len_until(char* str, char* until);
|
||||
char* utf8back(char* str);
|
||||
char* utf8seek(char* str);
|
||||
size_t utf8len(const char* str);
|
||||
size_t utf8len_until(const char* str, const char* until);
|
||||
const char* utf8back(const char* str);
|
||||
const char* utf8seek(const char* str);
|
||||
const char* utf8seekn(const char* str, size_t n);
|
||||
|
||||
struct Vector {
|
||||
uint32_t length;
|
||||
|
Reference in New Issue
Block a user