From a49ef9d063c2d7021e3012e4f5572cb96ca8d4d1 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Sun, 18 Nov 2018 19:02:25 +0900 Subject: [PATCH] file-browser: catch a bad double click --- apps/file-browser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/file-browser.c b/apps/file-browser.c index 5c2ea108..fdab58d4 100644 --- a/apps/file-browser.c +++ b/apps/file-browser.c @@ -446,6 +446,7 @@ int main(int argc, char * argv[]) { redraw_window(); uint64_t last_click = 0; /* For double click */ + int last_click_offset = -1; int modifiers = 0; /* For shift-click */ while (application_running) { @@ -559,7 +560,7 @@ int main(int argc, char * argv[]) { if (me->command == YUTANI_MOUSE_EVENT_CLICK || _close_enough(me)) { struct File * f = get_file_at_offset(hilighted_offset); if (f) { - if (precise_time_since(last_click) < 400) { + if (last_click_offset == hilighted_offset && precise_time_since(last_click) < 400) { if (f->type == 1) { char tmp[1024]; sprintf(tmp,"%s/%s", last_directory, f->name); @@ -570,6 +571,7 @@ int main(int argc, char * argv[]) { last_click = 0; } else { last_click = precise_current_time(); + last_click_offset = hilighted_offset; f->selected = !f->selected; if (!(modifiers & KEY_MOD_LEFT_SHIFT)) { for (int i = 0; i < file_pointers_len; ++i) {