mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
Handle window activation and deactivation a little better, force topmost
This commit is contained in:
parent
c196186614
commit
da3f185491
11
main.c
11
main.c
@ -150,6 +150,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
mouse_unlock();
|
mouse_unlock();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mouse_lock();
|
||||||
|
}
|
||||||
|
SetCursor(LoadCursor((HINSTANCE)GetWindowLong(ddraw->hWnd, GWL_HINSTANCE), IDC_ARROW));
|
||||||
return 0;
|
return 0;
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
if(wParam == VK_CONTROL)
|
if(wParam == VK_CONTROL)
|
||||||
@ -289,11 +294,7 @@ HRESULT __stdcall ddraw_SetDisplayMode(IDirectDrawImpl *This, DWORD width, DWORD
|
|||||||
int y = (mode.dmPelsHeight / 2) - (This->height / 2);
|
int y = (mode.dmPelsHeight / 2) - (This->height / 2);
|
||||||
RECT dst = { x, y, This->width+x, This->height+y };
|
RECT dst = { x, y, This->width+x, This->height+y };
|
||||||
AdjustWindowRect(&dst, GetWindowLong(This->hWnd, GWL_STYLE), FALSE);
|
AdjustWindowRect(&dst, GetWindowLong(This->hWnd, GWL_STYLE), FALSE);
|
||||||
MoveWindow(This->hWnd, dst.left, dst.top, (dst.right - dst.left), (dst.bottom - dst.top), TRUE);
|
SetWindowPos(This->hWnd, HWND_TOPMOST, dst.left, dst.top, (dst.right - dst.left), (dst.bottom - dst.top), SWP_SHOWWINDOW);
|
||||||
|
|
||||||
SetCursor(LoadCursor((HINSTANCE)GetWindowLong(This->hWnd, GWL_HINSTANCE), IDC_ARROW));
|
|
||||||
ShowWindow(This->hWnd, SW_SHOW);
|
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user