diff --git a/main.c b/main.c
index e1475d3..ca08e4f 100644
--- a/main.c
+++ b/main.c
@@ -287,21 +287,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
                     ShowWindow(ddraw->hWnd, SW_RESTORE);
                 }
             }
-
-            /* fall trough */
-        case WM_WINDOWPOSCHANGED:
-            GetClientRect(ddraw->hWnd, &ddraw->cursorclip);
-
-            POINT pt = { ddraw->cursorclip.left, ddraw->cursorclip.top };
-            POINT pt2 = { ddraw->cursorclip.right, ddraw->cursorclip.bottom };
-            ClientToScreen(ddraw->hWnd, &pt);
-            ClientToScreen(ddraw->hWnd, &pt2);
-            SetRect(&ddraw->cursorclip, pt.x, pt.y, pt2.x, pt2.y);
-
-            ddraw->center.x = ddraw->cursorclip.left + ( (ddraw->cursorclip.right - ddraw->cursorclip.left) / 2);
-            ddraw->center.y = ddraw->cursorclip.top + ( (ddraw->cursorclip.bottom - ddraw->cursorclip.top) / 2);
-
-            DefWindowProc(hWnd, uMsg, wParam, lParam);
             return 0;
         case WM_KEYDOWN:
             if(wParam == VK_CONTROL || wParam == VK_TAB)
@@ -323,31 +308,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
             }
             lParam = MAKELPARAM(ddraw->cursor.x, ddraw->cursor.y);
             break;
-        case WM_MOUSEMOVE:
-            if(ddraw->locked)
-            {
-                if(LOWORD(lParam) != ddraw->render.width / 2 || HIWORD(lParam) != ddraw->render.height / 2)
-                {
-                    if(ddraw->adjmouse)
-                    {
-                        ddraw->cursor.x += (LOWORD(lParam) - ddraw->render.width / 2) * ((float)ddraw->width / ddraw->render.width);
-                        ddraw->cursor.y += (HIWORD(lParam) - ddraw->render.height / 2) * ((float)ddraw->height / ddraw->render.height);
-                    }
-                    else
-                    {
-                        ddraw->cursor.x += LOWORD(lParam) - ddraw->render.width / 2;
-                        ddraw->cursor.y += HIWORD(lParam) - ddraw->render.height / 2;
-                    }
-
-                    if(ddraw->cursor.x < 0) ddraw->cursor.x = 0;
-                    if(ddraw->cursor.y < 0) ddraw->cursor.y = 0;
-                    if(ddraw->cursor.x > ddraw->width-1) ddraw->cursor.x = ddraw->width-1;
-                    if(ddraw->cursor.y > ddraw->height-1) ddraw->cursor.y = ddraw->height-1;
-
-                    SetCursorPos(ddraw->center.x, ddraw->center.y);
-                }
-            }
-            break;
     }
 
     return ddraw->WndProc(hWnd, uMsg, wParam, lParam);
diff --git a/mouse.c b/mouse.c
index bea2baa..f482d43 100644
--- a/mouse.c
+++ b/mouse.c
@@ -34,6 +34,34 @@ struct hack
 
 BOOL WINAPI fake_GetCursorPos(LPPOINT lpPoint)
 {
+    POINT pt;
+
+    if(mouse_active && ddraw->locked)
+    {
+        GetCursorPos(&pt);
+
+        if(ddraw->adjmouse)
+        {
+            ddraw->cursor.x += (pt.x - ddraw->center.x) * ((float)ddraw->width / ddraw->render.width);
+            ddraw->cursor.y += (pt.y - ddraw->center.y) * ((float)ddraw->height / ddraw->render.height);
+        }
+        else
+        {
+            ddraw->cursor.x += pt.x - ddraw->center.x;
+            ddraw->cursor.y += pt.y - ddraw->center.y;
+        }
+
+        if(ddraw->cursor.x < 0) ddraw->cursor.x = 0;
+        if(ddraw->cursor.y < 0) ddraw->cursor.y = 0;
+        if(ddraw->cursor.x > ddraw->width-1) ddraw->cursor.x = ddraw->width-1;
+        if(ddraw->cursor.y > ddraw->height-1) ddraw->cursor.y = ddraw->height-1;
+
+        if(pt.x != ddraw->center.x || pt.y != ddraw->center.y)
+        {
+            SetCursorPos(ddraw->center.x, ddraw->center.y);
+        }
+    }
+
     lpPoint->x = (int)ddraw->cursor.x;
     lpPoint->y = (int)ddraw->cursor.y;
     return TRUE;
@@ -138,12 +166,21 @@ void hack_iat(struct hack *hck)
 
 void mouse_lock()
 {
+    RECT rc;
+
     if(mouse_active && !ddraw->locked)
     {
-        ddraw->locked = TRUE;
+        GetWindowRect(ddraw->hWnd, &rc);
+        
+        ddraw->center.x = (rc.right + rc.left) / 2;
+        ddraw->center.y = (rc.top + rc.bottom) / 2;
+
         SetCursorPos(ddraw->center.x, ddraw->center.y);
-        ClipCursor(&ddraw->cursorclip);
+        SetCapture(ddraw->hWnd);
+        ClipCursor(&rc);
+
         while(ShowCursor(FALSE) > 0);
+        ddraw->locked = TRUE;
     }
 }
 
@@ -158,10 +195,13 @@ void mouse_unlock()
     {
         while(ShowCursor(TRUE) < 0);
         SetCursor(LoadCursor(NULL, IDC_ARROW));
+
+        ClipCursor(NULL);
+        ReleaseCapture();
+
+        ddraw->locked = FALSE;
     }
 
-    ddraw->locked = FALSE;
-    ClipCursor(NULL);
     ddraw->cursor.x = ddraw->width / 2;
     ddraw->cursor.y = ddraw->height / 2;
 }
@@ -170,7 +210,6 @@ void mouse_init(HWND hWnd)
 {
     if(ddraw->mhack)
     {
-        SetCursor(LoadCursor(NULL, IDC_ARROW));
         hack_iat(&hacks[0]);
         mouse_active = TRUE;
     }