PCem
changeset 42:2dc5624aebab
Mouse capture clipping now updated when window resized.
| author | TomW |
|---|---|
| date | Tue Nov 26 19:35:52 2013 +0000 |
| parents | ed02b0da1714 |
| children | f53b76ab6f15 |
| files | src/win.c |
| diffstat | 1 files changed, 21 insertions(+), 7 deletions(-) [+] |
line diff
1.1 --- a/src/win.c Wed Nov 20 21:34:09 2013 +0000 1.2 +++ b/src/win.c Tue Nov 26 19:35:52 2013 +0000 1.3 @@ -76,7 +76,7 @@ 1.4 int romspresent[26]; 1.5 int quited=0; 1.6 1.7 -RECT oldclip,pcclip; 1.8 +RECT oldclip; 1.9 int mousecapture=0; 1.10 int drawit; 1.11 /* Declare Windows procedure */ 1.12 @@ -1589,14 +1589,16 @@ 1.13 case WM_LBUTTONUP: 1.14 if (!mousecapture) 1.15 { 1.16 + RECT pcclip; 1.17 + 1.18 GetClipCursor(&oldclip); 1.19 - GetWindowRect(hwnd,&pcclip); 1.20 - pcclip.left+=GetSystemMetrics(SM_CXFIXEDFRAME)+10; 1.21 - pcclip.right-=GetSystemMetrics(SM_CXFIXEDFRAME)+10; 1.22 - pcclip.top+=GetSystemMetrics(SM_CXFIXEDFRAME)+GetSystemMetrics(SM_CYMENUSIZE)+GetSystemMetrics(SM_CYCAPTION)+10; 1.23 - pcclip.bottom-=GetSystemMetrics(SM_CXFIXEDFRAME)+10; 1.24 + GetWindowRect(hwnd, &pcclip); 1.25 + pcclip.left += GetSystemMetrics(SM_CXFIXEDFRAME) + 10; 1.26 + pcclip.right -= GetSystemMetrics(SM_CXFIXEDFRAME) + 10; 1.27 + pcclip.top += GetSystemMetrics(SM_CXFIXEDFRAME) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 10; 1.28 + pcclip.bottom -= GetSystemMetrics(SM_CXFIXEDFRAME) + 10; 1.29 ClipCursor(&pcclip); 1.30 - mousecapture=1; 1.31 + mousecapture = 1; 1.32 ShowCursor(FALSE); 1.33 } 1.34 break; 1.35 @@ -1615,6 +1617,18 @@ 1.36 vid_apis[vid_api].resize(winsizex, winsizey); 1.37 endblit(); 1.38 } 1.39 + 1.40 + if (mousecapture) 1.41 + { 1.42 + RECT pcclip; 1.43 + 1.44 + GetWindowRect(hwnd, &pcclip); 1.45 + pcclip.left += GetSystemMetrics(SM_CXFIXEDFRAME) + 10; 1.46 + pcclip.right -= GetSystemMetrics(SM_CXFIXEDFRAME) + 10; 1.47 + pcclip.top += GetSystemMetrics(SM_CXFIXEDFRAME) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 10; 1.48 + pcclip.bottom -= GetSystemMetrics(SM_CXFIXEDFRAME) + 10; 1.49 + ClipCursor(&pcclip); 1.50 + } 1.51 break; 1.52 1.53 case WM_TIMER:
