mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-21 19:55:00 +00:00
Compare commits
26 Commits
v0.5.3
...
dhalucario
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
271b4f8898 | ||
|
|
552d533435 | ||
|
|
9d774d93c5 | ||
|
|
90f18e9b34 | ||
|
|
ccb9dfabc5 | ||
|
|
4ba42400ce | ||
|
|
b336b70605 | ||
|
|
9c70ff5576 | ||
|
|
ec230541f3 | ||
|
|
d2fcb2e87d | ||
|
|
96a556a345 | ||
|
|
f79330cda3 | ||
|
|
3deedba040 | ||
|
|
dfe918358e | ||
|
|
cd738eafa7 | ||
|
|
289624bc88 | ||
|
|
7d4b25fc70 | ||
|
|
b8b31386e1 | ||
|
|
a14e6b5224 | ||
|
|
16922531e2 | ||
|
|
5c04c996d5 | ||
|
|
a7dedbab1b | ||
|
|
1926901eda | ||
|
|
43a40faf79 | ||
|
|
974aca51cb | ||
|
|
6ac03ab27e |
4
.copr/Makefile
Normal file
4
.copr/Makefile
Normal file
@@ -0,0 +1,4 @@
|
||||
srpm:
|
||||
cd $(spec)
|
||||
make github
|
||||
rpmbuild -vv -bs ly.spec --define "_srcrpmdir $(outdir)"
|
||||
15
.gitea
Normal file
15
.gitea
Normal file
@@ -0,0 +1,15 @@
|
||||
[submodule "sub/argoat"]
|
||||
path = sub/argoat
|
||||
url = https://git.nullgemm.fr/nullgemm/argoat.git
|
||||
[submodule "sub/configator"]
|
||||
path = sub/configator
|
||||
url = https://git.nullgemm.fr/nullgemm/configator.git
|
||||
[submodule "sub/ctypes"]
|
||||
path = sub/ctypes
|
||||
url = https://git.nullgemm.fr/nullgemm/ctypes.git
|
||||
[submodule "sub/dragonfail"]
|
||||
path = sub/dragonfail
|
||||
url = https://git.nullgemm.fr/nullgemm/dragonfail.git
|
||||
[submodule "sub/termbox_next"]
|
||||
path = sub/termbox_next
|
||||
url = https://git.nullgemm.fr/nullgemm/termbox_next.git
|
||||
@@ -4,6 +4,9 @@
|
||||
[submodule "sub/configator"]
|
||||
path = sub/configator
|
||||
url = https://github.com/nullgemm/configator.git
|
||||
[submodule "sub/ctypes"]
|
||||
path = sub/ctypes
|
||||
url = https://github.com/nullgemm/ctypes.git
|
||||
[submodule "sub/dragonfail"]
|
||||
path = sub/dragonfail
|
||||
url = https://github.com/nullgemm/dragonfail.git
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
bin
|
||||
obj
|
||||
.gitmodules
|
||||
valgrind.log
|
||||
|
||||
78
ly.spec.rpkg
Normal file
78
ly.spec.rpkg
Normal file
@@ -0,0 +1,78 @@
|
||||
%define relabel_files() \
|
||||
restorecon -R /usr/bin/ly; \
|
||||
|
||||
%define selinux_policyver 3.14.6-34
|
||||
|
||||
Name: {{{ git_dir_name }}}
|
||||
Version: {{{ git_dir_version }}}
|
||||
Release: 1%{?dist}
|
||||
Summary: A TUI display manager
|
||||
License: WTFPL
|
||||
URL: https://github.com/nullgemm/ly
|
||||
VCS: {{{ git_dir_vcs }}}
|
||||
Source: {{{ git_dir_pack }}}
|
||||
BuildRequires: libxcb-devel
|
||||
BuildRequires: pam-devel
|
||||
BuildRequires: make
|
||||
BuildRequires: git
|
||||
BuildRequires: gcc
|
||||
BuildRequires: selinux-policy-devel
|
||||
Requires: libxcb
|
||||
Requires: pam
|
||||
|
||||
%description
|
||||
Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD.
|
||||
|
||||
%prep
|
||||
git clone https://github.com/dhalucario/ly.git ly
|
||||
cd ly
|
||||
# git checkout v0.5.2
|
||||
make github
|
||||
|
||||
%build
|
||||
cd ly
|
||||
make
|
||||
|
||||
%install
|
||||
cd ly
|
||||
mkdir -p %{buildroot}/etc/
|
||||
mkdir -p %{buildroot}/usr/bin/
|
||||
mkdir -p %{buildroot}/usr/lib/systemd/system/
|
||||
mkdir -p %{buildroot}/etc/pam.d/
|
||||
DESTDIR="%{buildroot}" make install
|
||||
DESTDIR="%{buildroot}" make installselinux
|
||||
chmod -x %{buildroot}/etc/ly/config.ini
|
||||
chmod -x %{buildroot}/etc/ly/lang/*
|
||||
|
||||
%post
|
||||
semodule -n -i /usr/share/selinux/packages/ly.pp
|
||||
if /usr/sbin/selinuxenabled ; then
|
||||
/usr/sbin/load_policy
|
||||
%relabel_files
|
||||
|
||||
fi;
|
||||
exit 0
|
||||
|
||||
%postun
|
||||
if [ $1 -eq 0 ]; then
|
||||
semodule -n -r ly
|
||||
fi;
|
||||
exit 0
|
||||
|
||||
%files
|
||||
/usr/bin/ly
|
||||
/usr/lib/systemd/system/ly.service
|
||||
/etc/ly/lang/es.ini
|
||||
/etc/ly/lang/pt.ini
|
||||
/etc/ly/lang/ru.ini
|
||||
/etc/ly/lang/en.ini
|
||||
/etc/ly/lang/fr.ini
|
||||
/etc/ly/lang/ro.ini
|
||||
/etc/ly/xsetup.sh
|
||||
/etc/ly/wsetup.sh
|
||||
/etc/ly/config.ini
|
||||
/etc/pam.d/ly
|
||||
/usr/share/selinux/packages/ly.pp
|
||||
|
||||
%changelog
|
||||
{{{ git_dir_changelog }}}
|
||||
17
makefile
17
makefile
@@ -92,6 +92,11 @@ installnoconf: $(BIND)/$(NAME)
|
||||
@install -DZ $(RESD)/ly.service -m 644 -t ${DESTDIR}/usr/lib/systemd/system
|
||||
@install -DZ $(RESD)/pam.d/ly -m 644 -t ${DESTDIR}/etc/pam.d
|
||||
|
||||
installselinux:
|
||||
@echo "installing selinux modules"
|
||||
@make -f /usr/share/selinux/devel/Makefile ly.pp
|
||||
@install -DZ ly.pp ${DESTDIR}/usr/share/selinux/packages/ly.pp
|
||||
|
||||
uninstall:
|
||||
@echo "uninstalling"
|
||||
@rm -rf ${DESTDIR}/etc/ly
|
||||
@@ -110,10 +115,18 @@ remotes:
|
||||
@git remote add github git@github.com:nullgemm/$(NAME).git
|
||||
@git remote add gitea ssh://git@git.nullgem.fr:2999/nullgemm/$(NAME).git
|
||||
|
||||
gitea: github
|
||||
github:
|
||||
@echo "sourcing submodules"
|
||||
@echo "sourcing submodules from https://github.com"
|
||||
@cp .github .gitmodules
|
||||
@git submodule sync
|
||||
@git submodule update --init --remote
|
||||
@cd $(SUBD)/argoat && make github
|
||||
@git submodule update --init --recursive --remote
|
||||
|
||||
gitea:
|
||||
@echo "sourcing submodules from personal server"
|
||||
@cp .gitea .gitmodules
|
||||
@git submodule sync
|
||||
@git submodule update --init --remote
|
||||
@cd $(SUBD)/argoat && make gitea
|
||||
@git submodule update --init --recursive --remote
|
||||
|
||||
1
selinux/ly.fc
Normal file
1
selinux/ly.fc
Normal file
@@ -0,0 +1 @@
|
||||
/usr/bin/ly -- gen_context(system_u:object_r:ly_exec_t,s0)
|
||||
41
selinux/ly.if
Normal file
41
selinux/ly.if
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
## <summary>policy for ly</summary>
|
||||
|
||||
########################################
|
||||
## <summary>
|
||||
## Execute ly_exec_t in the ly domain.
|
||||
## </summary>
|
||||
## <param name="domain">
|
||||
## <summary>
|
||||
## Domain allowed to transition.
|
||||
## </summary>
|
||||
## </param>
|
||||
#
|
||||
interface(`ly_domtrans',`
|
||||
gen_require(`
|
||||
type ly_t, ly_exec_t;
|
||||
')
|
||||
|
||||
corecmd_search_bin($1)
|
||||
domtrans_pattern($1, ly_exec_t, ly_t)
|
||||
')
|
||||
|
||||
######################################
|
||||
## <summary>
|
||||
## Execute ly in the caller domain.
|
||||
## </summary>
|
||||
## <param name="domain">
|
||||
## <summary>
|
||||
## Domain allowed access.
|
||||
## </summary>
|
||||
## </param>
|
||||
#
|
||||
interface(`ly_exec',`
|
||||
gen_require(`
|
||||
type ly_exec_t;
|
||||
')
|
||||
|
||||
corecmd_search_bin($1)
|
||||
can_exec($1, ly_exec_t)
|
||||
')
|
||||
|
||||
32
selinux/ly.te
Executable file
32
selinux/ly.te
Executable file
@@ -0,0 +1,32 @@
|
||||
policy_module(ly, 1.0.0)
|
||||
|
||||
########################################
|
||||
#
|
||||
# Declarations
|
||||
#
|
||||
|
||||
type ly_t;
|
||||
type ly_exec_t;
|
||||
init_daemon_domain(ly_t, ly_exec_t)
|
||||
|
||||
permissive ly_t;
|
||||
|
||||
########################################
|
||||
#
|
||||
# ly local policy
|
||||
#
|
||||
allow ly_t self:capability { setgid setuid };
|
||||
allow ly_t self:process { fork signal_perms };
|
||||
allow ly_t self:process transition;
|
||||
allow ly_t self:fifo_file rw_fifo_file_perms;
|
||||
allow ly_t self:unix_stream_socket create_stream_socket_perms;
|
||||
|
||||
domain_use_interactive_fds(ly_t)
|
||||
|
||||
files_read_etc_files(ly_t)
|
||||
|
||||
auth_use_nsswitch(ly_t)
|
||||
|
||||
logging_send_audit_msgs(ly_t)
|
||||
|
||||
miscfiles_read_localization(ly_t)
|
||||
10
src/config.c
10
src/config.c
@@ -2,9 +2,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@@ -32,11 +30,11 @@ static void config_handle_u8(void* data, char** pars, const int pars_count)
|
||||
{
|
||||
if (strcmp(*pars, "") == 0)
|
||||
{
|
||||
*((uint8_t*)data) = 0;
|
||||
*((u8*)data) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint8_t*)data) = atoi(*pars);
|
||||
*((u8*)data) = atoi(*pars);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,11 +42,11 @@ static void config_handle_u16(void* data, char** pars, const int pars_count)
|
||||
{
|
||||
if (strcmp(*pars, "") == 0)
|
||||
{
|
||||
*((uint16_t*)data) = 0;
|
||||
*((u16*)data) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint16_t*)data) = atoi(*pars);
|
||||
*((u16*)data) = atoi(*pars);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
27
src/config.h
27
src/config.h
@@ -1,8 +1,7 @@
|
||||
#ifndef H_LY_CONFIG
|
||||
#define H_LY_CONFIG
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "ctypes.h"
|
||||
|
||||
enum INPUTS {
|
||||
SESSION_SWITCH,
|
||||
@@ -62,25 +61,25 @@ struct lang
|
||||
struct config
|
||||
{
|
||||
bool animate;
|
||||
uint8_t animation;
|
||||
u8 animation;
|
||||
char asterisk;
|
||||
uint8_t bg;
|
||||
u8 bg;
|
||||
bool blank_box;
|
||||
bool blank_password;
|
||||
char* console_dev;
|
||||
uint8_t default_input;
|
||||
uint8_t fg;
|
||||
u8 default_input;
|
||||
u8 fg;
|
||||
bool hide_borders;
|
||||
uint8_t input_len;
|
||||
u8 input_len;
|
||||
char* lang;
|
||||
bool load;
|
||||
uint8_t margin_box_h;
|
||||
uint8_t margin_box_v;
|
||||
uint8_t max_desktop_len;
|
||||
uint8_t max_login_len;
|
||||
uint8_t max_password_len;
|
||||
u8 margin_box_h;
|
||||
u8 margin_box_v;
|
||||
u8 max_desktop_len;
|
||||
u8 max_login_len;
|
||||
u8 max_password_len;
|
||||
char* mcookie_cmd;
|
||||
uint16_t min_refresh_delta;
|
||||
u16 min_refresh_delta;
|
||||
char* path;
|
||||
char* restart_cmd;
|
||||
bool save;
|
||||
@@ -88,7 +87,7 @@ struct config
|
||||
char* service_name;
|
||||
char* shutdown_cmd;
|
||||
char* term_reset_cmd;
|
||||
uint8_t tty;
|
||||
u8 tty;
|
||||
char* wayland_cmd;
|
||||
bool wayland_specifier;
|
||||
char* waylandsessions;
|
||||
|
||||
75
src/draw.c
75
src/draw.c
@@ -1,5 +1,6 @@
|
||||
#include "dragonfail.h"
|
||||
#include "termbox.h"
|
||||
#include "ctypes.h"
|
||||
|
||||
#include "inputs.h"
|
||||
#include "utils.h"
|
||||
@@ -8,8 +9,6 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
@@ -30,8 +29,8 @@ void draw_init(struct term_buf* buf)
|
||||
buf->height = tb_height();
|
||||
hostname(&buf->info_line);
|
||||
|
||||
uint16_t len_login = strlen(lang.login);
|
||||
uint16_t len_password = strlen(lang.password);
|
||||
u16 len_login = strlen(lang.login);
|
||||
u16 len_password = strlen(lang.password);
|
||||
|
||||
if (len_login > len_password)
|
||||
{
|
||||
@@ -79,10 +78,10 @@ void draw_free(struct term_buf* buf)
|
||||
|
||||
void draw_box(struct term_buf* buf)
|
||||
{
|
||||
uint16_t box_x = (buf->width - buf->box_width) / 2;
|
||||
uint16_t box_y = (buf->height - buf->box_height) / 2;
|
||||
uint16_t box_x2 = (buf->width + buf->box_width) / 2;
|
||||
uint16_t box_y2 = (buf->height + buf->box_height) / 2;
|
||||
u16 box_x = (buf->width - buf->box_width) / 2;
|
||||
u16 box_y = (buf->height - buf->box_height) / 2;
|
||||
u16 box_x2 = (buf->width + buf->box_width) / 2;
|
||||
u16 box_y2 = (buf->height + buf->box_height) / 2;
|
||||
buf->box_x = box_x;
|
||||
buf->box_y = box_y;
|
||||
|
||||
@@ -118,7 +117,7 @@ void draw_box(struct term_buf* buf)
|
||||
struct tb_cell c1 = {buf->box_chars.top, config.fg, config.bg};
|
||||
struct tb_cell c2 = {buf->box_chars.bot, config.fg, config.bg};
|
||||
|
||||
for (uint8_t i = 0; i < buf->box_width; ++i)
|
||||
for (u8 i = 0; i < buf->box_width; ++i)
|
||||
{
|
||||
tb_put_cell(
|
||||
box_x + i,
|
||||
@@ -134,7 +133,7 @@ void draw_box(struct term_buf* buf)
|
||||
c1.ch = buf->box_chars.left;
|
||||
c2.ch = buf->box_chars.right;
|
||||
|
||||
for (uint8_t i = 0; i < buf->box_height; ++i)
|
||||
for (u8 i = 0; i < buf->box_height; ++i)
|
||||
{
|
||||
tb_put_cell(
|
||||
box_x - 1,
|
||||
@@ -152,9 +151,9 @@ void draw_box(struct term_buf* buf)
|
||||
{
|
||||
struct tb_cell blank = {' ', config.fg, config.bg};
|
||||
|
||||
for (uint8_t i = 0; i < buf->box_height; ++i)
|
||||
for (u8 i = 0; i < buf->box_height; ++i)
|
||||
{
|
||||
for (uint8_t k = 0; k < buf->box_width; ++k)
|
||||
for (u8 k = 0; k < buf->box_width; ++k)
|
||||
{
|
||||
tb_put_cell(
|
||||
box_x + k,
|
||||
@@ -165,15 +164,15 @@ void draw_box(struct term_buf* buf)
|
||||
}
|
||||
}
|
||||
|
||||
struct tb_cell* strn_cell(char* s, uint16_t len) // throws
|
||||
struct tb_cell* strn_cell(char* s, u16 len) // throws
|
||||
{
|
||||
struct tb_cell* cells = malloc((sizeof (struct tb_cell)) * len);
|
||||
char* s2 = s;
|
||||
uint32_t c;
|
||||
u32 c;
|
||||
|
||||
if (cells != NULL)
|
||||
{
|
||||
for (uint16_t i = 0; i < len; ++i)
|
||||
for (u16 i = 0; i < len; ++i)
|
||||
{
|
||||
if ((s2 - s) >= len)
|
||||
{
|
||||
@@ -240,7 +239,7 @@ void draw_labels(struct term_buf* buf) // throws
|
||||
|
||||
if (buf->info_line != NULL)
|
||||
{
|
||||
uint16_t len = strlen(buf->info_line);
|
||||
u16 len = strlen(buf->info_line);
|
||||
struct tb_cell* info_cell = str_cell(buf->info_line);
|
||||
|
||||
if (dgn_catch())
|
||||
@@ -316,7 +315,7 @@ void draw_lock_state(struct term_buf* buf)
|
||||
close(fd);
|
||||
|
||||
// print text
|
||||
uint16_t pos_x = buf->width - strlen(lang.numlock);
|
||||
u16 pos_x = buf->width - strlen(lang.numlock);
|
||||
|
||||
if (numlock_on)
|
||||
{
|
||||
@@ -353,7 +352,7 @@ void draw_lock_state(struct term_buf* buf)
|
||||
|
||||
void draw_desktop(struct desktop* target)
|
||||
{
|
||||
uint16_t len = strlen(target->list[target->cur]);
|
||||
u16 len = strlen(target->list[target->cur]);
|
||||
|
||||
if (len > (target->visible_len - 3))
|
||||
{
|
||||
@@ -374,7 +373,7 @@ void draw_desktop(struct desktop* target)
|
||||
config.fg,
|
||||
config.bg);
|
||||
|
||||
for (uint16_t i = 0; i < len; ++ i)
|
||||
for (u16 i = 0; i < len; ++ i)
|
||||
{
|
||||
tb_change_cell(
|
||||
target->x + i + 2,
|
||||
@@ -387,8 +386,8 @@ void draw_desktop(struct desktop* target)
|
||||
|
||||
void draw_input(struct text* input)
|
||||
{
|
||||
uint16_t len = strlen(input->text);
|
||||
uint16_t visible_len = input->visible_len;
|
||||
u16 len = strlen(input->text);
|
||||
u16 visible_len = input->visible_len;
|
||||
|
||||
if (len > visible_len)
|
||||
{
|
||||
@@ -408,7 +407,7 @@ void draw_input(struct text* input)
|
||||
|
||||
struct tb_cell c1 = {' ', config.fg, config.bg};
|
||||
|
||||
for (uint16_t i = input->end - input->visible_start; i < visible_len; ++i)
|
||||
for (u16 i = input->end - input->visible_start; i < visible_len; ++i)
|
||||
{
|
||||
tb_put_cell(
|
||||
input->x + i,
|
||||
@@ -420,8 +419,8 @@ void draw_input(struct text* input)
|
||||
|
||||
void draw_input_mask(struct text* input)
|
||||
{
|
||||
uint16_t len = strlen(input->text);
|
||||
uint16_t visible_len = input->visible_len;
|
||||
u16 len = strlen(input->text);
|
||||
u16 visible_len = input->visible_len;
|
||||
|
||||
if (len > visible_len)
|
||||
{
|
||||
@@ -431,7 +430,7 @@ void draw_input_mask(struct text* input)
|
||||
struct tb_cell c1 = {config.asterisk, config.fg, config.bg};
|
||||
struct tb_cell c2 = {' ', config.fg, config.bg};
|
||||
|
||||
for (uint16_t i = 0; i < visible_len; ++i)
|
||||
for (u16 i = 0; i < visible_len; ++i)
|
||||
{
|
||||
if (input->visible_start + i < input->end)
|
||||
{
|
||||
@@ -456,8 +455,8 @@ void position_input(
|
||||
struct text* login,
|
||||
struct text* password)
|
||||
{
|
||||
uint16_t x = buf->box_x + config.margin_box_h + buf->labels_max_len + 1;
|
||||
int32_t len = buf->box_x + buf->box_width - config.margin_box_h - x;
|
||||
u16 x = buf->box_x + config.margin_box_h + buf->labels_max_len + 1;
|
||||
i32 len = buf->box_x + buf->box_width - config.margin_box_h - x;
|
||||
|
||||
if (len < 0)
|
||||
{
|
||||
@@ -482,7 +481,7 @@ static void doom_init(struct term_buf* buf)
|
||||
buf->init_width = buf->width;
|
||||
buf->init_height = buf->height;
|
||||
|
||||
uint16_t tmp_len = buf->width * buf->height;
|
||||
u16 tmp_len = buf->width * buf->height;
|
||||
buf->tmp_buf = malloc(tmp_len);
|
||||
tmp_len -= buf->width;
|
||||
|
||||
@@ -529,12 +528,12 @@ static void doom(struct term_buf* term_buf)
|
||||
{0x2588, 8, 4}, // white
|
||||
};
|
||||
|
||||
uint16_t src;
|
||||
uint16_t random;
|
||||
uint16_t dst;
|
||||
u16 src;
|
||||
u16 random;
|
||||
u16 dst;
|
||||
|
||||
uint16_t w = term_buf->init_width;
|
||||
uint8_t* tmp = term_buf->tmp_buf;
|
||||
u16 w = term_buf->init_width;
|
||||
u8* tmp = term_buf->tmp_buf;
|
||||
|
||||
if ((term_buf->width != term_buf->init_width) || (term_buf->height != term_buf->init_height))
|
||||
{
|
||||
@@ -543,9 +542,9 @@ static void doom(struct term_buf* term_buf)
|
||||
|
||||
struct tb_cell* buf = tb_cell_buffer();
|
||||
|
||||
for (uint16_t x = 0; x < w; ++x)
|
||||
for (u16 x = 0; x < w; ++x)
|
||||
{
|
||||
for (uint16_t y = 1; y < term_buf->init_height; ++y)
|
||||
for (u16 y = 1; y < term_buf->init_height; ++y)
|
||||
{
|
||||
src = y * w + x;
|
||||
random = ((rand() % 7) & 3);
|
||||
@@ -591,10 +590,10 @@ void animate(struct term_buf* buf)
|
||||
}
|
||||
}
|
||||
|
||||
bool cascade(struct term_buf* term_buf, uint8_t* fails)
|
||||
bool cascade(struct term_buf* term_buf, u8* fails)
|
||||
{
|
||||
uint16_t width = term_buf->width;
|
||||
uint16_t height = term_buf->height;
|
||||
u16 width = term_buf->width;
|
||||
u16 height = term_buf->height;
|
||||
|
||||
struct tb_cell* buf = tb_cell_buffer();
|
||||
bool changes = false;
|
||||
|
||||
45
src/draw.h
45
src/draw.h
@@ -2,46 +2,45 @@
|
||||
#define H_LY_DRAW
|
||||
|
||||
#include "termbox.h"
|
||||
#include "inputs.h"
|
||||
#include "ctypes.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "inputs.h"
|
||||
|
||||
struct box
|
||||
{
|
||||
uint32_t left_up;
|
||||
uint32_t left_down;
|
||||
uint32_t right_up;
|
||||
uint32_t right_down;
|
||||
uint32_t top;
|
||||
uint32_t bot;
|
||||
uint32_t left;
|
||||
uint32_t right;
|
||||
u32 left_up;
|
||||
u32 left_down;
|
||||
u32 right_up;
|
||||
u32 right_down;
|
||||
u32 top;
|
||||
u32 bot;
|
||||
u32 left;
|
||||
u32 right;
|
||||
};
|
||||
|
||||
struct term_buf
|
||||
{
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
uint16_t init_width;
|
||||
uint16_t init_height;
|
||||
u16 width;
|
||||
u16 height;
|
||||
u16 init_width;
|
||||
u16 init_height;
|
||||
|
||||
struct box box_chars;
|
||||
char* info_line;
|
||||
uint16_t labels_max_len;
|
||||
uint16_t box_x;
|
||||
uint16_t box_y;
|
||||
uint16_t box_width;
|
||||
uint16_t box_height;
|
||||
u16 labels_max_len;
|
||||
u16 box_x;
|
||||
u16 box_y;
|
||||
u16 box_width;
|
||||
u16 box_height;
|
||||
|
||||
uint8_t* tmp_buf;
|
||||
u8* tmp_buf;
|
||||
};
|
||||
|
||||
void draw_init(struct term_buf* buf);
|
||||
void draw_free(struct term_buf* buf);
|
||||
void draw_box(struct term_buf* buf);
|
||||
|
||||
struct tb_cell* strn_cell(char* s, uint16_t len);
|
||||
struct tb_cell* strn_cell(char* s, u16 len);
|
||||
struct tb_cell* str_cell(char* s);
|
||||
|
||||
void draw_labels(struct term_buf* buf);
|
||||
@@ -59,6 +58,6 @@ void position_input(
|
||||
|
||||
void animate_init(struct term_buf* buf);
|
||||
void animate(struct term_buf* buf);
|
||||
bool cascade(struct term_buf* buf, uint8_t* fails);
|
||||
bool cascade(struct term_buf* buf, u8* fails);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "dragonfail.h"
|
||||
#include "termbox.h"
|
||||
#include "ctypes.h"
|
||||
|
||||
#include "inputs.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
@@ -88,7 +89,7 @@ void input_desktop(struct desktop* target)
|
||||
#endif
|
||||
}
|
||||
|
||||
void input_text(struct text* target, uint64_t len)
|
||||
void input_text(struct text* target, u64 len)
|
||||
{
|
||||
target->text = malloc(len + 1);
|
||||
|
||||
@@ -122,7 +123,7 @@ void input_desktop_free(struct desktop* target)
|
||||
{
|
||||
if (target != NULL)
|
||||
{
|
||||
for (uint16_t i = 0; i < target->len; ++i)
|
||||
for (u16 i = 0; i < target->len; ++i)
|
||||
{
|
||||
if (target->list[i] != NULL)
|
||||
{
|
||||
|
||||
23
src/inputs.h
23
src/inputs.h
@@ -2,8 +2,7 @@
|
||||
#define H_LY_INPUTS
|
||||
|
||||
#include "termbox.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include "ctypes.h"
|
||||
|
||||
enum display_server {DS_WAYLAND, DS_SHELL, DS_XINITRC, DS_XORG};
|
||||
|
||||
@@ -11,13 +10,13 @@ struct text
|
||||
{
|
||||
char* text;
|
||||
char* end;
|
||||
int64_t len;
|
||||
i64 len;
|
||||
char* cur;
|
||||
char* visible_start;
|
||||
uint16_t visible_len;
|
||||
u16 visible_len;
|
||||
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
u16 x;
|
||||
u16 y;
|
||||
};
|
||||
|
||||
struct desktop
|
||||
@@ -26,17 +25,17 @@ struct desktop
|
||||
char** cmd;
|
||||
enum display_server* display_server;
|
||||
|
||||
uint16_t cur;
|
||||
uint16_t len;
|
||||
uint16_t visible_len;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
u16 cur;
|
||||
u16 len;
|
||||
u16 visible_len;
|
||||
u16 x;
|
||||
u16 y;
|
||||
};
|
||||
|
||||
void handle_desktop(void* input_struct, struct tb_event* event);
|
||||
void handle_text(void* input_struct, struct tb_event* event);
|
||||
void input_desktop(struct desktop* target);
|
||||
void input_text(struct text* target, uint64_t len);
|
||||
void input_text(struct text* target, u64 len);
|
||||
void input_desktop_free(struct desktop* target);
|
||||
void input_text_free(struct text* target);
|
||||
void input_desktop_right(struct desktop* target);
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <pwd.h>
|
||||
#include <security/pam_appl.h>
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -25,7 +24,7 @@
|
||||
int get_free_display()
|
||||
{
|
||||
char xlock[1024];
|
||||
uint8_t i;
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < 200; ++i)
|
||||
{
|
||||
@@ -595,7 +594,7 @@ void auth(
|
||||
// add pam variables
|
||||
char** env = pam_getenvlist(handle);
|
||||
|
||||
for (uint16_t i = 0; env && env[i]; ++i)
|
||||
for (u16 i = 0; env && env[i]; ++i)
|
||||
{
|
||||
putenv(env[i]);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "configator.h"
|
||||
#include "dragonfail.h"
|
||||
#include "termbox.h"
|
||||
#include "ctypes.h"
|
||||
|
||||
#include "draw.h"
|
||||
#include "inputs.h"
|
||||
@@ -9,10 +10,8 @@
|
||||
#include "utils.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
@@ -139,7 +138,7 @@ int main(int argc, char** argv)
|
||||
// init visible elements
|
||||
struct tb_event event;
|
||||
struct term_buf buf;
|
||||
uint8_t active_input = config.default_input;
|
||||
u8 active_input = config.default_input;
|
||||
|
||||
(*input_handles[active_input])(input_structs[active_input], NULL);
|
||||
|
||||
@@ -163,7 +162,7 @@ int main(int argc, char** argv)
|
||||
bool update = true;
|
||||
bool reboot = false;
|
||||
bool shutdown = false;
|
||||
uint8_t auth_fails = 0;
|
||||
u8 auth_fails = 0;
|
||||
|
||||
switch_tty(&buf);
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "configator.h"
|
||||
#include "dragonfail.h"
|
||||
|
||||
#include "inputs.h"
|
||||
#include "config.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
1
sub/ctypes
Submodule
1
sub/ctypes
Submodule
Submodule sub/ctypes added at eb4b36559d
Reference in New Issue
Block a user