Code cleanup
This commit is contained in:
parent
5609c4d006
commit
ad4e1ab7e1
23
libs/draw.c
23
libs/draw.c
|
@ -538,9 +538,9 @@ void drawmenu(void) {
|
|||
drawimage();
|
||||
#endif
|
||||
if (listfile) {
|
||||
readfile();
|
||||
readstdin();
|
||||
|
||||
if (listchanged) {
|
||||
if (sp.listchanged) {
|
||||
resizeclient();
|
||||
match();
|
||||
|
||||
|
@ -559,10 +559,25 @@ void drawmenu(void) {
|
|||
wl_surface_damage(state.surface, 0, 0, state.width, state.height);
|
||||
wl_surface_commit(state.surface);
|
||||
} else {
|
||||
#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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
drawmenu_layer();
|
||||
#endif
|
||||
#if USEWAYLAND
|
||||
}
|
||||
#elif USEX
|
||||
drawmenu_layer();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -132,11 +132,12 @@ void readfile(void) {
|
|||
if (!o) img.longestedge = img.imagegaps = 0;
|
||||
#endif
|
||||
|
||||
if (i == listcount) {
|
||||
listchanged = 0;
|
||||
if (i == sp.listcount) {
|
||||
sp.listchanged = 0;
|
||||
sp.listcount = i;
|
||||
} else {
|
||||
listcount = i;
|
||||
listchanged = 1;
|
||||
sp.listcount = i;
|
||||
sp.listchanged = 1;
|
||||
|
||||
// prevents state->buffer from being NULL
|
||||
if (!protocol) {
|
||||
|
|
|
@ -42,21 +42,5 @@ void eventloop_x11(void) {
|
|||
drawmenu();
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
4
spmenu.c
4
spmenu.c
|
@ -137,6 +137,8 @@ struct sp {
|
|||
int plw; // powerline width
|
||||
|
||||
int itemnumber; // item number
|
||||
int listcount;
|
||||
int listchanged;
|
||||
|
||||
size_t cursor; // cursor width
|
||||
|
||||
|
@ -251,8 +253,6 @@ static void grabfocus(void);
|
|||
|
||||
static char **list;
|
||||
static size_t listsize;
|
||||
static int listcount;
|
||||
static int listchanged = 0;
|
||||
|
||||
// user configuration
|
||||
#include "libs/options.h"
|
||||
|
|
Loading…
Reference in a new issue