mirror of
https://github.com/eRgo35/dots.git
synced 2025-12-16 15:36:11 +01:00
moving software to separate submodules part 1
This commit is contained in:
53
desktop/.dmenu/patch/multiselect.c
Normal file
53
desktop/.dmenu/patch/multiselect.c
Normal file
@@ -0,0 +1,53 @@
|
||||
static int
|
||||
issel(size_t id)
|
||||
{
|
||||
for (int i = 0;i < selidsize;i++)
|
||||
if (selid[i] == id)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
printsel(unsigned int state)
|
||||
{
|
||||
for (int i = 0;i < selidsize;i++)
|
||||
if (selid[i] != -1 && (!sel || sel->id != selid[i])) {
|
||||
#if PRINTINDEX_PATCH
|
||||
if (print_index)
|
||||
printf("%d\n", selid[i]);
|
||||
else
|
||||
#endif // PRINTINDEX_PATCH
|
||||
puts(items[selid[i]].text);
|
||||
}
|
||||
if (sel && !(state & ShiftMask)) {
|
||||
#if PRINTINDEX_PATCH
|
||||
if (print_index)
|
||||
printf("%d\n", sel->index);
|
||||
else
|
||||
#endif // PRINTINDEX_PATCH
|
||||
puts(sel->text);
|
||||
} else
|
||||
puts(text);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
selsel()
|
||||
{
|
||||
if (!sel)
|
||||
return;
|
||||
if (issel(sel->id)) {
|
||||
for (int i = 0; i < selidsize; i++)
|
||||
if (selid[i] == sel->id)
|
||||
selid[i] = -1;
|
||||
} else {
|
||||
for (int i = 0; i < selidsize; i++)
|
||||
if (selid[i] == -1) {
|
||||
selid[i] = sel->id;
|
||||
return;
|
||||
}
|
||||
selidsize++;
|
||||
selid = realloc(selid, (selidsize + 1) * sizeof(int));
|
||||
selid[selidsize - 1] = sel->id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user