mirror of
https://github.com/javalsai/lidm.git
synced 2025-07-03 22:38:41 +02:00
format: let clang-format run ._.
(won't even talk about clang-tidy)
This commit is contained in:
parent
b34528d1cb
commit
dbbab78e23
@ -74,8 +74,7 @@ struct config {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool line_parser(
|
bool line_parser(
|
||||||
FILE* fd,
|
FILE *fd, ssize_t *blksize,
|
||||||
ssize_t* blksize,
|
|
||||||
u_char (*cb)(char *key,
|
u_char (*cb)(char *key,
|
||||||
char *value)); // might use this for parsing .desktop files too
|
char *value)); // might use this for parsing .desktop files too
|
||||||
struct config *parse_config(char *path);
|
struct config *parse_config(char *path);
|
||||||
|
22
src/efield.c
22
src/efield.c
@ -30,7 +30,8 @@ void field_update(struct editable_field *field, char *update) {
|
|||||||
if (insert_len == 1) {
|
if (insert_len == 1) {
|
||||||
// backspace
|
// backspace
|
||||||
if (*update == 127) {
|
if (*update == 127) {
|
||||||
if (field->pos == 0) return;
|
if (field->pos == 0)
|
||||||
|
return;
|
||||||
if (field->pos < field->length) {
|
if (field->pos < field->length) {
|
||||||
memmove(&field->content[field->pos - 1], &field->content[field->pos],
|
memmove(&field->content[field->pos - 1], &field->content[field->pos],
|
||||||
field->length - field->pos);
|
field->length - field->pos);
|
||||||
@ -48,8 +49,8 @@ void field_update(struct editable_field *field, char *update) {
|
|||||||
}
|
}
|
||||||
if (field->pos < field->length) {
|
if (field->pos < field->length) {
|
||||||
// move with immediate buffer
|
// move with immediate buffer
|
||||||
memmove(&field->content[field->pos + insert_len], &field->content[field->pos],
|
memmove(&field->content[field->pos + insert_len],
|
||||||
field->length - field->pos);
|
&field->content[field->pos], field->length - field->pos);
|
||||||
}
|
}
|
||||||
memcpy(&field->content[field->pos], update, insert_len);
|
memcpy(&field->content[field->pos], update, insert_len);
|
||||||
|
|
||||||
@ -60,13 +61,18 @@ void field_update(struct editable_field *field, char *update) {
|
|||||||
|
|
||||||
// returns bool depending if it was able to "use" the seek
|
// returns bool depending if it was able to "use" the seek
|
||||||
bool field_seek(struct editable_field *field, char seek) {
|
bool field_seek(struct editable_field *field, char seek) {
|
||||||
if(field->length == 0) return false;
|
if (field->length == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
if(seek < 0 && -seek > field->pos) field->pos = 0;
|
if (seek < 0 && -seek > field->pos)
|
||||||
else if(seek > 0 && 255 - field->pos < seek) field->pos = 255;
|
field->pos = 0;
|
||||||
else field->pos += seek;
|
else if (seek > 0 && 255 - field->pos < seek)
|
||||||
|
field->pos = 255;
|
||||||
|
else
|
||||||
|
field->pos += seek;
|
||||||
|
|
||||||
if(field->pos > field->length) field->pos = field->length;
|
if (field->pos > field->length)
|
||||||
|
field->pos = field->length;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@ int main(int argc, char *argv[]) {
|
|||||||
chvt_str(argv[1]);
|
chvt_str(argv[1]);
|
||||||
|
|
||||||
char *conf_override = getenv("LIDM_CONF");
|
char *conf_override = getenv("LIDM_CONF");
|
||||||
struct config *config = parse_config(conf_override == NULL ? "/etc/lidm.ini" : conf_override);
|
struct config *config =
|
||||||
|
parse_config(conf_override == NULL ? "/etc/lidm.ini" : conf_override);
|
||||||
if (config == NULL) {
|
if (config == NULL) {
|
||||||
fprintf(stderr, "error parsing config\n");
|
fprintf(stderr, "error parsing config\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -40,7 +40,8 @@ static u_int16_t used_size = 0;
|
|||||||
static struct session *sessions = NULL;
|
static struct session *sessions = NULL;
|
||||||
static struct sessions_list *__sessions_list = NULL;
|
static struct sessions_list *__sessions_list = NULL;
|
||||||
|
|
||||||
// NOTE: commented printf's here would be nice to have debug logs if I ever implement it
|
// NOTE: commented printf's here would be nice to have debug logs if I ever
|
||||||
|
// implement it
|
||||||
static enum session_type session_type;
|
static enum session_type session_type;
|
||||||
static int fn(const char *fpath, const struct stat *sb, int typeflag) {
|
static int fn(const char *fpath, const struct stat *sb, int typeflag) {
|
||||||
// practically impossible to reach this
|
// practically impossible to reach this
|
||||||
|
4
src/ui.c
4
src/ui.c
@ -228,8 +228,8 @@ struct user get_current_user() {
|
|||||||
|
|
||||||
struct session get_current_session() {
|
struct session get_current_session() {
|
||||||
if (of_session.current_opt != 0) {
|
if (of_session.current_opt != 0) {
|
||||||
// this is for the default user shell :P, not the greatest implementation
|
// this is for the default user shell :P, not the greatest
|
||||||
// but I want to get his done
|
// implementation but I want to get his done
|
||||||
if (behavior.include_defshell &&
|
if (behavior.include_defshell &&
|
||||||
of_session.current_opt == gsessions->length + 1) {
|
of_session.current_opt == gsessions->length + 1) {
|
||||||
struct session shell_session;
|
struct session shell_session;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user