comparison src/event-msw.c @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents b2472a1930f2
children ca9a9ec9c1c1
comparison
equal deleted inserted replaced
271:c7b7086b0a39 272:c5d627a313b1
25 25
26 /* Authorship: 26 /* Authorship:
27 27
28 Ultimately based on FSF. 28 Ultimately based on FSF.
29 Rewritten by Ben Wing. 29 Rewritten by Ben Wing.
30 Rewritten for mswindows by Jonathan Harris, November 1997 for 20.4. 30 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0.
31 */ 31 */
32 32
33 #include <config.h> 33 #include <config.h>
34 #include "lisp.h" 34 #include "lisp.h"
35 35
42 #ifdef HAVE_MENUBARS 42 #ifdef HAVE_MENUBARS
43 # include "menubar-msw.h" 43 # include "menubar-msw.h"
44 #endif 44 #endif
45 45
46 #include "device.h" 46 #include "device.h"
47 #include "emacsfns.h"
48 #include "events.h" 47 #include "events.h"
49 #include "frame.h" 48 #include "frame.h"
50 #include "process.h" 49 #include "process.h"
51 #include "redisplay.h" 50 #include "redisplay.h"
52 #include "sysproc.h" 51 #include "sysproc.h"
111 int mswindows_quit_chars_count = 0; 110 int mswindows_quit_chars_count = 0;
112 111
113 /* These are Lisp integers; see DEFVARS in this file for description. */ 112 /* These are Lisp integers; see DEFVARS in this file for description. */
114 int mswindows_dynamic_frame_resize; 113 int mswindows_dynamic_frame_resize;
115 int mswindows_num_mouse_buttons; 114 int mswindows_num_mouse_buttons;
116 int mswindows_button2_max_skew_x; 115 int mswindows_mouse_button_max_skew_x;
117 int mswindows_button2_max_skew_y; 116 int mswindows_mouse_button_max_skew_y;
118 int mswindows_button2_chord_time; 117 int mswindows_mouse_button_tolerance;
119 118
120 /* Number of wait handles */ 119 /* Number of wait handles */
121 static int mswindows_waitable_count=0; 120 static int mswindows_waitable_count=0;
122 121
123 /* This is the event signaled by the event pump. 122 /* This is the event signaled by the event pump.
1274 mswindows_set_chord_timer (HWND hwnd) 1273 mswindows_set_chord_timer (HWND hwnd)
1275 { 1274 {
1276 int interval; 1275 int interval;
1277 1276
1278 /* We get one third half system double click threshold */ 1277 /* We get one third half system double click threshold */
1279 if (mswindows_button2_chord_time <= 0) 1278 if (mswindows_mouse_button_tolerance <= 0)
1280 interval = GetDoubleClickTime () / 3; 1279 interval = GetDoubleClickTime () / 3;
1281 else 1280 else
1282 interval = mswindows_button2_chord_time; 1281 interval = mswindows_mouse_button_tolerance;
1283 1282
1284 SetTimer (hwnd, BUTTON_2_TIMER_ID, interval, 0); 1283 SetTimer (hwnd, BUTTON_2_TIMER_ID, interval, 0);
1285 } 1284 }
1286 1285
1287 static int 1286 static int
1288 mswindows_button2_near_enough (POINTS p1, POINTS p2) 1287 mswindows_button2_near_enough (POINTS p1, POINTS p2)
1289 { 1288 {
1290 int dx, dy; 1289 int dx, dy;
1291 if (mswindows_button2_max_skew_x <= 0) 1290 if (mswindows_mouse_button_max_skew_x <= 0)
1292 dx = GetSystemMetrics (SM_CXDOUBLECLK) / 2; 1291 dx = GetSystemMetrics (SM_CXDOUBLECLK) / 2;
1293 else 1292 else
1294 dx = mswindows_button2_max_skew_x; 1293 dx = mswindows_mouse_button_max_skew_x;
1295 1294
1296 if (mswindows_button2_max_skew_y <= 0) 1295 if (mswindows_mouse_button_max_skew_y <= 0)
1297 dy = GetSystemMetrics (SM_CYDOUBLECLK) / 2; 1296 dy = GetSystemMetrics (SM_CYDOUBLECLK) / 2;
1298 else 1297 else
1299 dy = mswindows_button2_max_skew_y; 1298 dy = mswindows_mouse_button_max_skew_y;
1300 1299
1301 return abs (p1.x - p2.x) < dx && abs (p1.y- p2.y)< dy; 1300 return abs (p1.x - p2.x) < dx && abs (p1.y- p2.y)< dy;
1302 } 1301 }
1303 1302
1304 static int 1303 static int
1701 settings. 1700 settings.
1702 Default is t on fast machines, nil on slow. 1701 Default is t on fast machines, nil on slow.
1703 */ ); 1702 */ );
1704 1703
1705 /* The description copied verbatim from nt-emacs. (C) Geoff Voelker */ 1704 /* The description copied verbatim from nt-emacs. (C) Geoff Voelker */
1706 DEFVAR_INT ("mswindows-mouse-button-tolerance", &mswindows_button2_chord_time /* 1705 DEFVAR_INT ("mswindows-mouse-button-tolerance", &mswindows_mouse_button_tolerance /*
1707 *Analogue of double click interval for faking middle mouse events. 1706 *Analogue of double click interval for faking middle mouse events.
1708 The value is the minimum time in milliseconds that must elapse between 1707 The value is the minimum time in milliseconds that must elapse between
1709 left/right button down events before they are considered distinct events. 1708 left/right button down events before they are considered distinct events.
1710 If both mouse buttons are depressed within this interval, a middle mouse 1709 If both mouse buttons are depressed within this interval, a middle mouse
1711 button down event is generated instead. 1710 button down event is generated instead.
1715 /* The description copied verbatim from nt-emacs. (C) Geoff Voelker */ 1714 /* The description copied verbatim from nt-emacs. (C) Geoff Voelker */
1716 DEFVAR_INT ("mswindows-num-mouse-buttons", &mswindows_num_mouse_buttons /* 1715 DEFVAR_INT ("mswindows-num-mouse-buttons", &mswindows_num_mouse_buttons /*
1717 Number of physical mouse buttons. 1716 Number of physical mouse buttons.
1718 */ ); 1717 */ );
1719 1718
1720 DEFVAR_INT ("mswindows-mouse-button-max-skew-x", &mswindows_button2_max_skew_x /* 1719 DEFVAR_INT ("mswindows-mouse-button-max-skew-x", &mswindows_mouse_button_max_skew_x /*
1721 *Maximum horizontal distance in pixels between points in which left and 1720 *Maximum horizontal distance in pixels between points in which left and
1722 right button clicks occured for them to be translated into single 1721 right button clicks occured for them to be translated into single
1723 middle button event. Clicks must occur in time not longer than defined 1722 middle button event. Clicks must occur in time not longer than defined
1724 by the variable mswindows-mouse-button-tolerance. 1723 by the variable `mswindows-mouse-button-tolerance'.
1725 If negative or zero, currently set system default is used instead. 1724 If negative or zero, currently set system default is used instead.
1726 */ ); 1725 */ );
1727 1726
1728 DEFVAR_INT ("mswindows-mouse-button-max-skew-y", &mswindows_button2_max_skew_y /* 1727 DEFVAR_INT ("mswindows-mouse-button-max-skew-y", &mswindows_mouse_button_max_skew_y /*
1729 *Maximum vertical distance in pixels between points in which left and 1728 *Maximum vertical distance in pixels between points in which left and
1730 right button clicks occured for them to be translated into single 1729 right button clicks occured for them to be translated into single
1731 middle button event. Clicks must occur in time not longer than defined 1730 middle button event. Clicks must occur in time not longer than defined
1732 by the variable mswindows-mouse-button-tolerance. 1731 by the variable `mswindows-mouse-button-tolerance'.
1733 If negative or zero, currently set system default is used instead. 1732 If negative or zero, currently set system default is used instead.
1734 */ ); 1733 */ );
1735 1734
1736 mswindows_button2_max_skew_x = 0; 1735 mswindows_mouse_button_max_skew_x = 0;
1737 mswindows_button2_max_skew_y = 0; 1736 mswindows_mouse_button_max_skew_y = 0;
1738 mswindows_button2_chord_time = 0; 1737 mswindows_mouse_button_tolerance = 0;
1739 } 1738 }
1740 1739
1741 void 1740 void
1742 syms_of_event_mswindows (void) 1741 syms_of_event_mswindows (void)
1743 { 1742 {