jed-users mailing list

[2004 Date Index] [2004 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Building jed 0.99-17 & slang 1.4.9 for Win32 (part 3)


Greetings again folks,

Jed 0.99-17 on Win32 misses alternate mouse wheel movements due to (as far
as I can tell) some tightened-up mouse-button-checking code that was
getting confused because Windows doesn't quite treat the mouse wheel as if
it were a pair of mouse buttons (that would, of course, have been far too
straightforward and obvious). A diff for wterm.c that fixes it is listed
below - its a bit long I'm afraid and my line numbers don't match the
release any more because of other modifications I'm working on, but it
should be fairly easy to apply.

Share & enjoy

John Skilleter

--- C:\SOURCE\Jed\jed-B0.99-17.original\src\wterm.c	Fri Jun 11 19:15:36
2004
+++ wterm.c	Tue Jun 22 22:23:20 2004
@@ -1397,11 +1534,12 @@
 
 static void push_mouse_event(int button, int x, int y, int state, int
type)
 {
    unsigned int s = 0;
    int col, row;
-   static int last_button;
+	static int last_state = 0;
    static JMouse_Type jm;
 #if JED_HAS_MULTICLICK
    static long last_press_time;
    static unsigned int clicks = 0;
    static long MultiClick_Time = -1;
@@ -1409,10 +1547,19 @@
    int id;
 
    col = 1 + x / This_Window.font_width;
    row = 1 + y / This_Window.font_height;
 
+	if(state == -1)
+	{
+		state = last_state;
+	}
+	else
+	{
+		last_state = state;
+	}
+	
    if ((type == JMOUSE_DRAG)
        && (col == jm.x) && (row == jm.y))
      return;
 
    if (button == 0)
@@ -1422,13 +1569,18 @@
 
 #if JED_HAS_MULTICLICK
    if (type == JMOUSE_DOWN)
      {
 	long the_time = GetTickCount();
+		
 	if (MultiClick_Time == -1)
 	  MultiClick_Time = GetDoubleClickTime();
+		
+		// [JMS] Added checks for buttons 4 & 5 to if() to prevent wheel
movements being considered as double-clicks
+		
 	if ((last_button == button)
+			 && button!=JMOUSE_BUTTON_4 && button!=JMOUSE_BUTTON_5
 	    && (the_time - last_press_time < MultiClick_Time))
 	  {
 	     clicks++;
 	     if (clicks == 2)
 	       type = JMOUSE_DOUBLE_CLICK;
@@ -1450,10 +1603,12 @@
 #endif
    
    jm.button = button;
 
    if ((type == JMOUSE_UP)
+		 && button != JMOUSE_BUTTON_4 
+		 && button != JMOUSE_BUTTON_5
        && (0 == (jm.state & jm.button)))
      {
 	/* Make sure this button was down. */
 	return;
      }
@@ -2145,15 +2384,22 @@
           {
 	     /* Under X, the wheel mouse produces JMOUSE_BUTTON_4 and
  	      * JMOUSE_BUTTON_5 events.  jed/lib/mouse.sl maps JMOUSE_BUTTON_4
  	      * events to upward movement and JMOUSE_BUTTON_5 to downward 
  	      * movement in the buffer.
- 	      */
+			* [JMS] Added 'up' events for each wheel press event (as windows only
generates down events) 	      */
+
 	     if ((int) wParam < 0) 
-	       push_mouse_event (JMOUSE_BUTTON_5, LOWORD(lParam), HIWORD(lParam),
wParam, JMOUSE_DOWN);
+				 {
+					 push_mouse_event (JMOUSE_BUTTON_5, LOWORD(lParam), HIWORD(lParam),
-1, JMOUSE_DOWN);
+					 push_mouse_event (JMOUSE_BUTTON_5, LOWORD(lParam), HIWORD(lParam),
-1, JMOUSE_UP);
+				 }				 
 	     else 
-	       push_mouse_event (JMOUSE_BUTTON_4, LOWORD(lParam), HIWORD(lParam),
wParam, JMOUSE_DOWN);
+				 {					 
+		               push_mouse_event (JMOUSE_BUTTON_4, LOWORD(lParam),
HIWORD(lParam), -1, JMOUSE_DOWN);
+      		          push_mouse_event (JMOUSE_BUTTON_4, LOWORD(lParam),
HIWORD(lParam), -1, JMOUSE_UP);
+				 }
 
  	     return 0;
           }
 #endif
         return DefWindowProc(hWnd, msg, wParam, lParam);

-----------------------------------------
John Skilleter - john@xxxxxxxxxxxxxxxx & elsewhere
'DOS is best spelt backwards!'
    http://www.skilleter.org.uk
    http://www.roada.org.uk
-----------------------------------------



--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2004 date index] [2004 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]