[LMH] Lisp timing issue solved

Björn Victor Bjorn@Victor.se
Mon, 05 Dec 2005 18:53:03 +0100


This is a multi-part message in MIME format.
--------------010702030202080807090605
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Brad Parker wrote:
> I could not get the mouse to work at all, however - no doubt an SDL
> problem.  And the SDL window is *huge* - was it always that way?  What'=
s
> the correct window size it really wants?

Here's a patch to get the mouse working in SDL.  The window size wasn't
that easy to fix, since there are FB size/code dependencies.  I'm
looking at this next (unless someone else is doing that, in which case
I'll go directly to networking).

-- Bj=F6rn

--------------010702030202080807090605
Content-Type: text/x-patch;
 name="sdl.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="sdl.c.patch"

*** sdl.c.~1~	2005-11-28 21:26:00.000000000 +0100
--- sdl.c	2005-12-05 16:57:44.000000000 +0100
***************
*** 87,108 ****
  
  static void sdl_send_mouse_event(void)
  {
! 	int x, y, dx, dy, /*dz, */state, buttons;
  
  	state = SDL_GetRelativeMouseState(&dx, &dy);
  
- 	buttons = 0;
  	if (state & SDL_BUTTON(SDL_BUTTON_LEFT))
! 		buttons |= MOUSE_EVENT_LBUTTON;
  
  	if (state & SDL_BUTTON(SDL_BUTTON_MIDDLE))
! 		buttons |= MOUSE_EVENT_MBUTTON;
  
  	if (state & SDL_BUTTON(SDL_BUTTON_RIGHT))
! 		buttons |= MOUSE_EVENT_RBUTTON;
! 
! 	state = SDL_GetMouseState(&x, &y);
  
  //	iob_sdl_mouse_event(x, y, dx, dy, buttons);
  }
  
--- 87,122 ----
  
  static void sdl_send_mouse_event(void)
  {
!   int dx, dy, state;
!   extern unsigned char sib_mouse_motion_reg;
!   extern unsigned int sib_mouse_x_pos;
!   extern unsigned int sib_mouse_y_pos;
  
  	state = SDL_GetRelativeMouseState(&dx, &dy);
  
  	if (state & SDL_BUTTON(SDL_BUTTON_LEFT))
! 	  sib_mouse_motion_reg |= 1<<6;
! 	else
! 	  sib_mouse_motion_reg &= ~(1<<6);
  
  	if (state & SDL_BUTTON(SDL_BUTTON_MIDDLE))
! 	  sib_mouse_motion_reg |= 1<<5;
! 	else
! 	  sib_mouse_motion_reg &= ~(1<<5);
  
  	if (state & SDL_BUTTON(SDL_BUTTON_RIGHT))
! 	  sib_mouse_motion_reg |= 1<<4;
! 	else
! 	  sib_mouse_motion_reg &= ~(1<<4);
! 	
! 	sib_mouse_x_pos += dx;
! 	sib_mouse_y_pos += dy;
  
+ #if 0
+ 	logmsgf("Mouse event: x %d (%d), y %d (%d), buttons %04x\n",
+ 		sib_mouse_x_pos, dx, sib_mouse_y_pos, dy, sib_mouse_motion_reg);
+ #endif
+ 	
  //	iob_sdl_mouse_event(x, y, dx, dy, buttons);
  }
  

--------------010702030202080807090605--