Fix issue #14 by replacing bad code.
I don't know what I was thinking to be honest.
This commit is contained in:
parent
7f5caf7bf0
commit
ea48ea69ed
|
@ -607,7 +607,7 @@ void switchmode(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void selecthover(Arg *arg) {
|
void selecthover(Arg *arg) {
|
||||||
puts(items[sp.clickitemindex].text);
|
puts(mouseitem->text);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -289,8 +289,6 @@ void buttonpress_wl(uint32_t button, double ex, double ey) {
|
||||||
ey += h;
|
ey += h;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
for (item = currentitem; item != nextitem; item = item->right) {
|
for (item = currentitem; item != nextitem; item = item->right) {
|
||||||
if (item_num++ == lines) {
|
if (item_num++ == lines) {
|
||||||
item_num = 1;
|
item_num = 1;
|
||||||
|
@ -301,15 +299,14 @@ void buttonpress_wl(uint32_t button, double ex, double ey) {
|
||||||
y += h;
|
y += h;
|
||||||
|
|
||||||
if (ey >= y && ey <= (y + h) && ex >= x + (powerlineitems ? sp.plw : 0) && ex <= (x + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
if (ey >= y && ey <= (y + h) && ex >= x + (powerlineitems ? sp.plw : 0) && ex <= (x + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
||||||
sp.clickitemindex = i;
|
|
||||||
click = ClickItem;
|
click = ClickItem;
|
||||||
|
mouseitem = item;
|
||||||
#if USEIMAGE
|
#if USEIMAGE
|
||||||
} else if (ey >= y && ey <= (y + h) && ex >= x + (powerlineitems ? sp.plw : 0) - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) && ex <= (x - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
} else if (ey >= y && ey <= (y + h) && ex >= x + (powerlineitems ? sp.plw : 0) - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) && ex <= (x - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
||||||
click = ClickImage;
|
click = ClickImage;
|
||||||
|
mouseitem = item;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
} else if (matches) { // a single line, meaning it could be arrows too, so we check that here
|
} else if (matches) { // a single line, meaning it could be arrows too, so we check that here
|
||||||
x += sp.inputw;
|
x += sp.inputw;
|
||||||
|
|
|
@ -73,8 +73,6 @@ void buttonpress_x11(XEvent *e) {
|
||||||
ev->y += h;
|
ev->y += h;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
for (item = currentitem; item != nextitem; item = item->right) {
|
for (item = currentitem; item != nextitem; item = item->right) {
|
||||||
if (item_num++ == lines) {
|
if (item_num++ == lines) {
|
||||||
item_num = 1;
|
item_num = 1;
|
||||||
|
@ -87,14 +85,13 @@ void buttonpress_x11(XEvent *e) {
|
||||||
// ClickSelItem, called function doesn't matter
|
// ClickSelItem, called function doesn't matter
|
||||||
if (ev->y >= y && ev->y <= (y + h) && ev->x >= x + (powerlineitems ? sp.plw : 0) && ev->x <= (x + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
if (ev->y >= y && ev->y <= (y + h) && ev->x >= x + (powerlineitems ? sp.plw : 0) && ev->x <= (x + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
||||||
click = ClickItem;
|
click = ClickItem;
|
||||||
sp.clickitemindex = i;
|
mouseitem = item;
|
||||||
#if USEIMAGE
|
#if USEIMAGE
|
||||||
} else if (ev->y >= y && ev->y <= (y + h) && ev->x >= x + (powerlineitems ? sp.plw : 0) - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) && ev->x <= (x - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
} else if (ev->y >= y && ev->y <= (y + h) && ev->x >= x + (powerlineitems ? sp.plw : 0) - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) && ev->x <= (x - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
||||||
click = ClickImage;
|
click = ClickImage;
|
||||||
|
mouseitem = item;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
} else if (matches) { // a single line, meaning it could be arrows too, so we check that here
|
} else if (matches) { // a single line, meaning it could be arrows too, so we check that here
|
||||||
x += sp.inputw;
|
x += sp.inputw;
|
||||||
|
|
3
spmenu.c
3
spmenu.c
|
@ -140,8 +140,6 @@ struct sp {
|
||||||
int listcount;
|
int listcount;
|
||||||
int listchanged;
|
int listchanged;
|
||||||
|
|
||||||
int clickitemindex;
|
|
||||||
|
|
||||||
size_t cursor; // cursor width
|
size_t cursor; // cursor width
|
||||||
|
|
||||||
int ignoreconfkeys; // can be set globally if you don't want to override keybinds with config file keys
|
int ignoreconfkeys; // can be set globally if you don't want to override keybinds with config file keys
|
||||||
|
@ -206,6 +204,7 @@ static struct item *previousitem; // previous item
|
||||||
static struct item *currentitem; // current item
|
static struct item *currentitem; // current item
|
||||||
static struct item *nextitem; // next item
|
static struct item *nextitem; // next item
|
||||||
static struct item *selecteditem; // selected item
|
static struct item *selecteditem; // selected item
|
||||||
|
static struct item *mouseitem; // clicked item
|
||||||
|
|
||||||
// various headers
|
// various headers
|
||||||
#include "libs/draw/draw.h"
|
#include "libs/draw/draw.h"
|
||||||
|
|
Loading…
Reference in a new issue