Ignore:
Timestamp:
May 5, 2000, 8:23:07 PM (25 years ago)
Author:
sandervl
Message:

SetCapture bugfix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/winmouse.cpp

    r3488 r3499  
    1 /* $Id: winmouse.cpp,v 1.9 2000-05-03 18:35:56 sandervl Exp $ */
     1/* $Id: winmouse.cpp,v 1.10 2000-05-05 18:23:07 sandervl Exp $ */
    22/*
    33 * Mouse handler for DINPUT
     
    117117//******************************************************************************
    118118//******************************************************************************
    119 HWND WIN32API SetCapture( HWND hwnd)
     119HWND WIN32API SetCapture(HWND hwnd)
    120120{
    121121 HWND hwndPrev = GetCapture();
     122 BOOL rc;
    122123
    123124    if(hwnd == 0) {
     
    125126        return hwndPrev;
    126127    }
    127     OSLibWinSetCapture(Win32Window::Win32ToOS2Handle(hwnd));
    128     dprintf(("USER32: SetCapture %x (prev %x)", hwnd, hwndPrev));
     128    if(hwndPrev != NULL) {
     129        //SvL: WinSetCapture returns an error if mouse is already captured
     130        ReleaseCapture();
     131    }
     132    rc = OSLibWinSetCapture(Win32Window::Win32ToOS2Handle(hwnd));
     133    dprintf(("USER32: SetCapture %x (prev %x) returned %d", hwnd, hwndPrev, rc));
    129134    if(hwndPrev) {
    130135        SendMessageA(hwndPrev, WM_CAPTURECHANGED, 0L, hwnd);
    131136    }
    132137    return hwndPrev;
    133 //    return 0;
    134138}
    135139//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.