Skip to content

Commit

Permalink
Fix for GLUI_List double-click callback
Browse files Browse the repository at this point in the history
  • Loading branch information
nigels-com committed Oct 3, 2017
1 parent 6358144 commit ad0f3a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions glui_list.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void GLUI_List::common_construct(
int GLUI_List::mouse_down_handler( int local_x, int local_y ) int GLUI_List::mouse_down_handler( int local_x, int local_y )
{ {
int tmp_line; int tmp_line;
unsigned long int ms; uint64_t ms;
timeb time; timeb time;
ftime(&time); ftime(&time);
ms = time.millitm + (time.time)*1000; ms = time.millitm + (time.time)*1000;
Expand All @@ -126,7 +126,7 @@ int GLUI_List::mouse_down_handler( int local_x, int local_y )
obj_cb(this); obj_cb(this);
} }
} else { } else {
if (last_line == curr_line && (ms - last_click_time) < 300) { if (last_line == curr_line && last_click_time && (ms - last_click_time) < 300) {
//obj_cb(associated_object, user_id); //obj_cb(associated_object, user_id);
obj_cb(this); obj_cb(this);
} else { } else {
Expand Down
3 changes: 2 additions & 1 deletion include/GL/glui.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@


#include <cstdlib> #include <cstdlib>
#include <cstdio> #include <cstdio>
#include <cstdint>
#include <cstring> #include <cstring>


#include <array> #include <array>
Expand Down Expand Up @@ -2031,7 +2032,7 @@ class GLUIAPI GLUI_List : public GLUI_Control
GLUI_CB obj_cb; GLUI_CB obj_cb;
int cb_click_type; int cb_click_type;
int last_line; int last_line;
int last_click_time; uint64_t last_click_time;


int mouse_down_handler( int local_x, int local_y ) override; int mouse_down_handler( int local_x, int local_y ) override;
int mouse_up_handler( int local_x, int local_y, bool inside ) override; int mouse_up_handler( int local_x, int local_y, bool inside ) override;
Expand Down

0 comments on commit ad0f3a8

Please sign in to comment.