Index: camera.c
===================================================================
--- camera.c	(revision 841)
+++ camera.c	(revision 842)
@@ -630,13 +630,19 @@
 static GLfloat rffp_cam_pos_x = 0;
 static GLfloat rffp_cam_pos_y = 0;
 static GLfloat rffp_cam_pos_z = 0;
-static GLint   rffp_delta_x=0;
-static GLint   rffp_delta_y=0;
+GLint rffp_delta_x=0;
+GLint rffp_delta_y=0;
+GLint border;
+static GLint   old_x;
+static GLint   old_y;
 static int prev_state=0;
 float *data;
+
 dir_x=0;
 dir_y=0;
 
+border = raydium_math_max(raydium_window_tx,raydium_window_ty) / 4;
+
 switch(move)
 {
     //RAYDIUM_CAMERA_FREEMOVE_NORMAL
@@ -660,8 +666,10 @@
         }
         else
         {
-            rffp_delta_x = raydium_mouse_x - (raydium_window_tx/2);
-            rffp_delta_y = raydium_mouse_y - (raydium_window_ty/2);
+            rffp_delta_x = raydium_mouse_x - old_x;
+            rffp_delta_y = raydium_mouse_y - old_y;
+			old_x = raydium_mouse_x;
+			old_y = raydium_mouse_y;
         }
         //calculating the position (x,y,z) of the camera
         rffp_cam_pos_z += (raydium_math_sin(rffp_cam_angle_x+90)*dir_y*raydium_camera_freemove_speed*raydium_math_sin(90-rffp_cam_angle_y));
@@ -680,7 +688,16 @@
 
 
         //putting the mouse in the middle of the screen, the read the next data of the mouse correctly
-        raydium_mouse_move(raydium_window_tx/2.0f, raydium_window_ty/2.0f);
+		// xf: small update, we now only move the mouse when it's needed, allow
+		// a smoother handling of odd screen resolutions
+		if(raydium_mouse_x < border || raydium_mouse_x > raydium_window_tx-border ||
+		   raydium_mouse_y < border || raydium_mouse_y > raydium_window_ty-border ||
+		   prev_state==0)
+		   	{
+			old_x=raydium_window_tx/2.0f;
+			old_y=raydium_window_ty/2.0f;
+        	raydium_mouse_move(old_x, old_y);
+			}
         prev_state=1;
 
         //raydium_camera_place(rffp_cam_pos_y,-rffp_cam_pos_z,rffp_cam_pos_x,rffp_cam_angle_x,rffp_cam_angle_y,rffp_cam_angle_z);
@@ -725,12 +742,25 @@
 float mult=0.05f;
 static float zoom=10.0f; //really is the distance, not zoom
 float Matrix[16];
+static int old_x;
+static int old_y;
+int border;
 
-raydium_mouse_move(raydium_window_tx/2.0f, raydium_window_ty/2.0f);
+border = raydium_math_max(raydium_window_tx,raydium_window_ty) / 4;
 
-delta_x+= raydium_mouse_x - (raydium_window_tx/2.0f);
-delta_y+= raydium_mouse_y - (raydium_window_ty/2.0f);
+delta_x += raydium_mouse_x - old_x;
+delta_y += raydium_mouse_y - old_y;
+old_x = raydium_mouse_x;
+old_y = raydium_mouse_y;
 
+if(raydium_mouse_x < border || raydium_mouse_x > raydium_window_tx-border ||
+   raydium_mouse_y < border || raydium_mouse_y > raydium_window_ty-border )
+	{
+	old_x=raydium_window_tx/2.0f;
+	old_y=raydium_window_ty/2.0f;
+	raydium_mouse_move(old_x, old_y);
+	}
+
 if(raydium_key[GLUT_KEY_UP])if(zoom>0)zoom-=0.1;
 if(raydium_key[GLUT_KEY_DOWN])zoom+=0.1;
 if(raydium_mouse_click==4)zoom-=1;