Commit 222d557c authored by Gerd Moellmann's avatar Gerd Moellmann

(abs): New macro.

(double_click_fuzz): New variable.
(make_lispy_event): Use it to determine what makes a double-click.
(syms_of_keyboard): DEFVAR_INT it.
parent 21f79512
......@@ -106,6 +106,8 @@ extern int input_fd;
#define KBD_BUFFER_SIZE 4096
#endif /* No X-windows */
#define abs(x) ((x) >= 0 ? (x) : -(x))
/* Following definition copied from eval.c */
struct backtrace
......@@ -4543,11 +4545,16 @@ static int last_mouse_x;
static int last_mouse_y;
static unsigned long button_down_time;
/* The maximum time between clicks to make a double-click,
or Qnil to disable double-click detection,
or Qt for no time limit. */
/* The maximum time between clicks to make a double-click, or Qnil to
disable double-click detection, or Qt for no time limit. */
Lisp_Object Vdouble_click_time;
/* Maximum number of pixels the mouse may be moved between clicks
to make a double-click. */
int double_click_fuzz;
/* The number of clicks in this multiple-click. */
int double_click_count;
......@@ -4846,13 +4853,16 @@ make_lispy_event (event)
*start_pos_ptr = Qnil;
is_double = (button == last_mouse_button
&& XINT (event->x) == last_mouse_x
&& XINT (event->y) == last_mouse_y
&& (abs (XINT (event->x) - last_mouse_x)
<= double_click_fuzz)
&& (abs (XINT (event->y) - last_mouse_y)
<= double_click_fuzz)
&& button_down_time != 0
&& (EQ (Vdouble_click_time, Qt)
|| (INTEGERP (Vdouble_click_time)
&& ((int)(event->timestamp - button_down_time)
< XINT (Vdouble_click_time)))));
last_mouse_button = button;
last_mouse_x = XINT (event->x);
last_mouse_y = XINT (event->y);
......@@ -10514,6 +10524,12 @@ t means double-clicks have no time limit and are detected\n\
by position only.");
Vdouble_click_time = make_number (500);
DEFVAR_INT ("double-click-fuzz", &double_click_fuzz,
"*Maximum mouse movement between clicks to make a double-click.\n\
Value is the number of pixels the mouse may ha moved horizontally or\n\
vertically between two clicks to make a double-click.");
double_click_fuzz = 3;
DEFVAR_BOOL ("inhibit-local-menu-bar-menus", &inhibit_local_menu_bar_menus,
"*Non-nil means inhibit local map menu bar menus.");
inhibit_local_menu_bar_menus = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment