mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Double click only works on same item (#555)
This patch disables accidental triggering of double clicking when you are just single clicking on multiple objects fast.
This commit is contained in:
parent
c9f0e279af
commit
65da1c1941
12
src/nnn.c
12
src/nnn.c
|
@ -5190,6 +5190,7 @@ static bool browse(char *ipath, const char *session)
|
||||||
#ifndef NOMOUSE
|
#ifndef NOMOUSE
|
||||||
MEVENT event;
|
MEVENT event;
|
||||||
struct timespec mousetimings[2] = {{.tv_sec = 0, .tv_nsec = 0}, {.tv_sec = 0, .tv_nsec = 0} };
|
struct timespec mousetimings[2] = {{.tv_sec = 0, .tv_nsec = 0}, {.tv_sec = 0, .tv_nsec = 0} };
|
||||||
|
int mousedent[2] = {-1, -1};
|
||||||
bool currentmouse = 1;
|
bool currentmouse = 1;
|
||||||
bool rightclicksel = 0;
|
bool rightclicksel = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -5423,13 +5424,16 @@ nochange:
|
||||||
CLOCK_REALTIME,
|
CLOCK_REALTIME,
|
||||||
#endif
|
#endif
|
||||||
&mousetimings[currentmouse]);
|
&mousetimings[currentmouse]);
|
||||||
|
mousedent[currentmouse] = cur;
|
||||||
|
|
||||||
/*Single click just selects, double click also opens */
|
/* Single click just selects, double click falls through to SEL_GOIN */
|
||||||
if (((_ABSSUB(mousetimings[0].tv_sec, mousetimings[1].tv_sec) << 30)
|
if ((mousedent[0] != mousedent[1]) ||
|
||||||
+ (mousetimings[0].tv_nsec - mousetimings[1].tv_nsec))
|
(((_ABSSUB(mousetimings[0].tv_sec, mousetimings[1].tv_sec) << 30)
|
||||||
> DOUBLECLICK_INTERVAL_NS)
|
+ (_ABSSUB(mousetimings[0].tv_nsec, mousetimings[1].tv_nsec)))
|
||||||
|
> DOUBLECLICK_INTERVAL_NS))
|
||||||
break;
|
break;
|
||||||
mousetimings[currentmouse].tv_sec = 0;
|
mousetimings[currentmouse].tv_sec = 0;
|
||||||
|
mousedent[currentmouse] = -1;
|
||||||
} else {
|
} else {
|
||||||
if (cfg.filtermode || filterset())
|
if (cfg.filtermode || filterset())
|
||||||
presel = FILTER;
|
presel = FILTER;
|
||||||
|
|
Loading…
Reference in a new issue