Code cleanup

This commit is contained in:
speedie 2023-07-09 23:56:34 +02:00
parent 5609c4d006
commit ad4e1ab7e1
4 changed files with 26 additions and 26 deletions

View file

@ -538,9 +538,9 @@ void drawmenu(void) {
drawimage(); drawimage();
#endif #endif
if (listfile) { if (listfile) {
readfile(); readstdin();
if (listchanged) { if (sp.listchanged) {
resizeclient(); resizeclient();
match(); match();
@ -559,11 +559,26 @@ void drawmenu(void) {
wl_surface_damage(state.surface, 0, 0, state.width, state.height); wl_surface_damage(state.surface, 0, 0, state.width, state.height);
wl_surface_commit(state.surface); wl_surface_commit(state.surface);
} else { } else {
drawmenu_layer(); #endif
#if USEX
if (listfile) {
readstdin();
if (sp.listchanged) {
match();
for (int i = 0; i < sp.itemnumber; i++) {
if (sel && sel->right && (sel = sel->right) == next) {
curr = next;
}
}
}
} }
#elif USEX
drawmenu_layer(); drawmenu_layer();
#endif #endif
#if USEWAYLAND
}
#endif
} }
void drawmenu_layer(void) { void drawmenu_layer(void) {

View file

@ -132,11 +132,12 @@ void readfile(void) {
if (!o) img.longestedge = img.imagegaps = 0; if (!o) img.longestedge = img.imagegaps = 0;
#endif #endif
if (i == listcount) { if (i == sp.listcount) {
listchanged = 0; sp.listchanged = 0;
sp.listcount = i;
} else { } else {
listcount = i; sp.listcount = i;
listchanged = 1; sp.listchanged = 1;
// prevents state->buffer from being NULL // prevents state->buffer from being NULL
if (!protocol) { if (!protocol) {

View file

@ -42,21 +42,5 @@ void eventloop_x11(void) {
drawmenu(); drawmenu();
break; break;
} }
if (listfile) {
readfile();
if (listchanged) {
match();
for (int i = 0; i < sp.itemnumber; i++) {
if (sel && sel->right && (sel = sel->right) == next) {
curr = next;
}
}
drawmenu();
}
}
} }
} }

View file

@ -137,6 +137,8 @@ struct sp {
int plw; // powerline width int plw; // powerline width
int itemnumber; // item number int itemnumber; // item number
int listcount;
int listchanged;
size_t cursor; // cursor width size_t cursor; // cursor width
@ -251,8 +253,6 @@ static void grabfocus(void);
static char **list; static char **list;
static size_t listsize; static size_t listsize;
static int listcount;
static int listchanged = 0;
// user configuration // user configuration
#include "libs/options.h" #include "libs/options.h"