forked from speedie/spmenu
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();
|
drawimage();
|
||||||
#endif
|
#endif
|
||||||
if (listfile) {
|
if (listfile) {
|
||||||
readfile();
|
readstdin();
|
||||||
|
|
||||||
if (listchanged) {
|
if (sp.listchanged) {
|
||||||
resizeclient();
|
resizeclient();
|
||||||
match();
|
match();
|
||||||
|
|
||||||
|
@ -559,10 +559,25 @@ 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 {
|
||||||
|
#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();
|
drawmenu_layer();
|
||||||
|
#endif
|
||||||
|
#if USEWAYLAND
|
||||||
}
|
}
|
||||||
#elif USEX
|
|
||||||
drawmenu_layer();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
spmenu.c
4
spmenu.c
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue