*** gpm-1.19.6/src/synaptics.c	Sun Sep 23 12:00:03 2001
--- gpm-1.19.6-dw/src/synaptics.c	Wed Jan  2 16:49:11 2002
***************
*** 145,151 ****
  /* edge motion related configuration constants */
  static int   x_min_center            = 1632;  /* left edge   */
! static int   x_max_center            = 5312;  /* right edge  */
! static int   y_min_center            = 1408;  /* bottom edge */
! static int   y_max_center            = 4108;  /* top edge    */
  static int   edge_speed              = 20;                                /*C*/
  
--- 145,151 ----
  /* edge motion related configuration constants */
  static int   x_min_center            = 1632;  /* left edge   */
! static int   x_max_center            = 5112;  /* right edge  */
! static int   y_min_center            = 1508;  /* bottom edge */
! static int   y_max_center            = 4208;  /* top edge    */
  static int   edge_speed              = 20;                                /*C*/
  
***************
*** 301,304 ****
--- 301,305 ----
    int x;
    int y;
+   int w;
    int pressure;
  } report_type;
***************
*** 520,524 ****
  {
    gpm_debug_log (LOG_DEBUG,
!                  "\r%c%c%c%c%c  %4dx%-4d  %3d  %c%c%c%c  %c%c",
                   report.gesture ? 'g' : '-',
                   report.finger  ? 'f' : '-',  
--- 521,526 ----
  {
    gpm_debug_log (LOG_DEBUG,
! //fprintf(stderr,
!                  "\r%c%c%c%c%c%c  %4dx%-4d %2d %3d  %c%c%c%c  %c%c  %c" ,
                   report.gesture ? 'g' : '-',
                   report.finger  ? 'f' : '-',  
***************
*** 526,532 ****
                   report.left    ? 'l' : '-',
                   report.middle  ? 'm' : '-',  
- 
                   report.right   ? 'r' : '-',
!                  report.x, report.y, report.pressure,
                   edges & LEFT_EDGE   ? 'l' : '-',
                   edges & RIGHT_EDGE  ? 'r' : '-',
--- 528,534 ----
                   report.left    ? 'l' : '-',
                   report.middle  ? 'm' : '-',  
                   report.right   ? 'r' : '-',
!                  report.down    ? 'd' : '-',
!                  report.x, report.y, report.w, report.pressure,
                   edges & LEFT_EDGE   ? 'l' : '-',
                   edges & RIGHT_EDGE  ? 'r' : '-',
***************
*** 534,538 ****
                   edges & TOP_EDGE    ? 't' : '-',
                   report.gesture && !report.finger ? 't' : '-',
!                  report.gesture && report.finger  ? 'd' : '-');
  }
  
--- 536,541 ----
                   edges & TOP_EDGE    ? 't' : '-',
                   report.gesture && !report.finger ? 't' : '-',
!                  report.gesture && report.finger  ? 'd' : '-',
! 		use_wmode ? 'W':'w');
  }
  
***************
*** 689,692 ****
--- 692,696 ----
      ** Otherwise compute new buttons.
      */
+ //	fprintf(stderr,"\nstate->buttons: %i last_buttons: %i report.left: %c report.middle: %c report.right: %c report.down: %c\n",state->buttons,last_buttons,report.left?'y':'n',report.middle?'y':'n',report.right?'y':'n',report.down?'y':'n');
      if (!report.gesture && !report.left && !report.right && !report.middle && !report.down) {
        state->buttons = 0;
***************
*** 747,751 ****
  	    param++;
  	  }
! 
  	  /* was a param found? */
  	  if (!param_data [param].name) {
--- 751,755 ----
  	    param++;
  	  }
! fprintf(stderr,"token=[%s] param = %i\n",token,param);
  	  /* was a param found? */
  	  if (!param_data [param].name) {
***************
*** 753,757 ****
  	  } else {
  	    token = strtok (NULL, "[] ");
! 
  	    switch (param_data [param].p_type) {
  	    case Integer_Param:
--- 757,761 ----
  	  } else {
  	    token = strtok (NULL, "[] ");
! fprintf(stderr,"  token=[%s]\n",token);
  	    switch (param_data [param].p_type) {
  	    case Integer_Param:
***************
*** 1230,1239 ****
  
    if (((data[0] & 0xc8) == 0x80) && ((data[3] & 0xc8) == 0xc0)) {
!     unsigned int w = ((data[3] & 0x04) >> 2) |
  	    		((data[0] & 0x04) >> 1) |
  			((data[0] & 0x30) >> 2);
      report->left     = check_bits (data[0], 0x01);
!     report->middle   = check_bits (data[0] ^ data[3], 0x01);
!     report->down     = check_bits (data[0] ^ data[3], 0x02);
      report->right    = check_bits (data[0], 0x02);
      report->x        = (((data[1] & 0x0f) << 8) |
--- 1234,1243 ----
  
    if (((data[0] & 0xc8) == 0x80) && ((data[3] & 0xc8) == 0xc0)) {
!     report->w = ((data[3] & 0x04) >> 2) |
  	    		((data[0] & 0x04) >> 1) |
  			((data[0] & 0x30) >> 2);
      report->left     = check_bits (data[0], 0x01);
!     report->middle   = 0; // check_bits (data[0] ^ data[3], 0x01);
!     report->down     = 0; // check_bits (data[0] ^ data[3], 0x02);
      report->right    = check_bits (data[0], 0x02);
      report->x        = (((data[1] & 0x0f) << 8) |
***************
*** 1245,1251 ****
      report->pressure = data[2];
      report->finger   = (data[2] > finger_threshold);
!     
      if (report->finger) {
- 	    
        if (finger_timer == 0) { /* finger down */
  	stroke_x = report->x;
--- 1249,1266 ----
      report->pressure = data[2];
      report->finger   = (data[2] > finger_threshold);
!     if (report->w < 4 || report->w > 4) // don't report thumb action
!       report->finger = 0; 
!     if (report->x < 4 && report->y < 4 && (report->x || report->y)) {
!       // looks like 4 way scroll button!
!       if (report->x & 1) 
! 	report->middle = 1; // "UP"
!       if (report->x & 2)
!         report->left = 1; // "LEFT"
!       if (report->y & 1) 
!         report->down = 1; // "DOWN"
!       if (report->y & 2) 
! 	report->right = 1; // "RIGHT"
!     }
      if (report->finger) {
        if (finger_timer == 0) { /* finger down */
  	stroke_x = report->x;
***************
*** 1395,1399 ****
--- 1410,1417 ----
    syn_read_ps2_model_id (fd, &model);
    syn_read_ps2_cap (fd, &cap);
+   fprintf(stderr,"Wmode: %c\n",use_wmode?'y':'n');
    if (! (cap.cap_ext)) use_wmode = 0; /* wmode not support by the pad */
+ if (!cap.cap_ext) fprintf(stderr,"Disabling wmode\n");
+ else { use_wmode=1; fprintf(stderr,"Enabling wmode\n");}
    syn_process_config (ident, model);
  
