[CF-Devel] [PATCH] fix compile problem; wheelmouse support.

Edgar Toernig froese at gmx.de
Tue Jan 8 19:30:41 CST 2002


Hi,

another patch.  It has to be applied on top of the previous one
I sent.  It fixes a compile problem on FreeBSD and adds wheel
mouse support to cfclient.

Ciao, ET.
-------------- next part --------------
diff -ru crossfire-client-1.1.0-et/common/client.c crossfire-client-1.1.0-et2/common/client.c
--- crossfire-client-1.1.0-et/common/client.c	Mon Jan  7 17:05:59 2002
+++ crossfire-client-1.1.0-et2/common/client.c	Wed Jan  9 02:20:09 2002
@@ -161,6 +161,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <netinet/tcp.h>
 #include <ctype.h>
 #include <arpa/inet.h>
 
@@ -205,6 +206,10 @@
 	fprintf(stderr,"InitConnection:  Error on fcntl.\n");
     }
 
+#ifdef TCP_NODELAY
+#ifndef SOL_TCP
+#define SOL_TCP IPPROTO_TCP
+#endif
     /* turn off nagle algorithm */
     if (getenv("CF_NAGLE") == NULL) {	/* disabled by setting CF_NAGLE */
 	int i=1;
@@ -212,6 +217,7 @@
 	if (setsockopt(fd, SOL_TCP, TCP_NODELAY, &i, sizeof(i)) == -1)
 	    perror("TCP_NODELAY");
     }
+#endif
 
     if (getsockopt(fd,SOL_SOCKET,SO_RCVBUF, (char*)&oldbufsize, &buflen)==-1)
         oldbufsize=0;
diff -ru crossfire-client-1.1.0-et/x11/x11.c crossfire-client-1.1.0-et2/x11/x11.c
--- crossfire-client-1.1.0-et/x11/x11.c	Mon Jan  7 21:59:11 2002
+++ crossfire-client-1.1.0-et2/x11/x11.c	Wed Jan  9 01:26:29 2002
@@ -2299,7 +2299,10 @@
 {
     int y = xbutton->y-16, x=xbutton->x, button = xbutton->button,dy,pos=0;
 
-    if (!infodata.has_scrollbar || x<=(infodata.width-SCROLLBAR_WIDTH-4))
+    if (!infodata.has_scrollbar)
+	return;
+
+    if (button < 4 && x <= infodata.width-SCROLLBAR_WIDTH-4)
 	return;
 
     dy = y / FONTHEIGHT > 0 ? y / FONTHEIGHT : 1;
@@ -2317,6 +2320,14 @@
 	    pos = infodata.bar_pos + dy;
 	    break;
 
+	  case 4:
+	    pos = infodata.bar_pos - 1;
+	    break;
+
+	  case 5:
+	    pos = infodata.bar_pos + 1;
+	    break;
+
     }
     if (pos<infodata.maxdisp) {
 	if (infodata.numlines<infodata.maxdisp)
@@ -2350,6 +2361,16 @@
  
     if (y < 0 || y > image_size * l->size)
 	return 1;
+
+    if (button == 4 || button == 5)
+    {
+	if (button == 4)
+	    l->item_pos--;
+	else
+	    l->item_pos++;
+	draw_list(l);
+	return 1;
+    }
 
     if (x > l->width-23) {    /* scrollbar */
 
    
    


More information about the crossfire mailing list