|
|
@ -483,6 +483,18 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
|
|
static bool gDragging = false; |
|
|
|
static bool gDragging = false; |
|
|
|
static UInt8 mouse_down = 0; |
|
|
|
static UInt8 mouse_down = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Messages we registered for manually (no const value)
|
|
|
|
|
|
|
|
if (message == s_WmTaskbarList) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Grab the Windows 7 taskbar list stuff
|
|
|
|
|
|
|
|
if (gTaskbarList) |
|
|
|
|
|
|
|
gTaskbarList->Release(); |
|
|
|
|
|
|
|
HRESULT result = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&gTaskbarList); |
|
|
|
|
|
|
|
if (FAILED(result)) |
|
|
|
|
|
|
|
gTaskbarList = nil; |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Handle messages
|
|
|
|
// Handle messages
|
|
|
|
switch (message) {
|
|
|
|
switch (message) {
|
|
|
|
case WM_LBUTTONDOWN: |
|
|
|
case WM_LBUTTONDOWN: |
|
|
@ -505,7 +517,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
|
|
if (gClient->WindowActive() && gClient->GetInputManager()) |
|
|
|
if (gClient->WindowActive() && gClient->GetInputManager()) |
|
|
|
gClient->GetInputManager()->HandleWin32ControlEvent(message, wParam, lParam, hWnd); |
|
|
|
gClient->GetInputManager()->HandleWin32ControlEvent(message, wParam, lParam, hWnd); |
|
|
|
} |
|
|
|
} |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
case WM_LBUTTONUP: |
|
|
|
case WM_LBUTTONUP: |
|
|
|
case WM_RBUTTONUP: |
|
|
|
case WM_RBUTTONUP: |
|
|
|
case WM_MBUTTONUP: |
|
|
|
case WM_MBUTTONUP: |
|
|
@ -517,19 +529,19 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
|
|
case WM_KEYUP: |
|
|
|
case WM_KEYUP: |
|
|
|
if (gClient && gClient->WindowActive() && gClient->GetInputManager()) |
|
|
|
if (gClient && gClient->WindowActive() && gClient->GetInputManager()) |
|
|
|
gClient->GetInputManager()->HandleWin32ControlEvent(message, wParam, lParam, hWnd); |
|
|
|
gClient->GetInputManager()->HandleWin32ControlEvent(message, wParam, lParam, hWnd); |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case WM_MOUSEMOVE: |
|
|
|
case WM_MOUSEMOVE: |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (gClient && gClient->GetInputManager()) |
|
|
|
if (gClient && gClient->GetInputManager()) |
|
|
|
gClient->GetInputManager()->HandleWin32ControlEvent(message, wParam, lParam, hWnd); |
|
|
|
gClient->GetInputManager()->HandleWin32ControlEvent(message, wParam, lParam, hWnd); |
|
|
|
} |
|
|
|
} |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
#if 0 |
|
|
|
case WM_KILLFOCUS: |
|
|
|
case WM_KILLFOCUS: |
|
|
|
SetForegroundWindow(hWnd); |
|
|
|
SetForegroundWindow(hWnd); |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
case WM_SYSKEYUP: |
|
|
|
case WM_SYSKEYUP: |
|
|
@ -541,7 +553,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
|
|
} |
|
|
|
} |
|
|
|
//DefWindowProc(hWnd, message, wParam, lParam);
|
|
|
|
//DefWindowProc(hWnd, message, wParam, lParam);
|
|
|
|
} |
|
|
|
} |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case WM_SYSCOMMAND: |
|
|
|
case WM_SYSCOMMAND: |
|
|
|
switch (wParam) { |
|
|
|
switch (wParam) { |
|
|
@ -557,9 +569,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
|
|
if (plNetClientMgr * mgr = plNetClientMgr::GetInstance()) |
|
|
|
if (plNetClientMgr * mgr = plNetClientMgr::GetInstance()) |
|
|
|
mgr->QueueDisableNet(false, nil); |
|
|
|
mgr->QueueDisableNet(false, nil); |
|
|
|
DestroyWindow(gClient->GetWindowHandle()); |
|
|
|
DestroyWindow(gClient->GetWindowHandle()); |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case WM_SETCURSOR: |
|
|
|
case WM_SETCURSOR: |
|
|
|
{ |
|
|
|
{ |
|
|
@ -583,7 +595,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case WM_ACTIVATE: |
|
|
|
case WM_ACTIVATE: |
|
|
|
{ |
|
|
|
{ |
|
|
@ -603,7 +615,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
|
|
gPendingActivateFlag = active; |
|
|
|
gPendingActivateFlag = active; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
// Let go of the mouse if the window is being moved.
|
|
|
|
// Let go of the mouse if the window is being moved.
|
|
|
|
case WM_ENTERSIZEMOVE: |
|
|
|
case WM_ENTERSIZEMOVE: |
|
|
@ -611,7 +623,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
|
|
gDragging = true; |
|
|
|
gDragging = true; |
|
|
|
if( gClient ) |
|
|
|
if( gClient ) |
|
|
|
gClient->WindowActivate(false); |
|
|
|
gClient->WindowActivate(false); |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
// Redo the mouse capture if the window gets moved
|
|
|
|
// Redo the mouse capture if the window gets moved
|
|
|
|
case WM_EXITSIZEMOVE: |
|
|
|
case WM_EXITSIZEMOVE: |
|
|
@ -619,7 +631,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
|
|
gDragging = false; |
|
|
|
gDragging = false; |
|
|
|
if( gClient ) |
|
|
|
if( gClient ) |
|
|
|
gClient->WindowActivate(true); |
|
|
|
gClient->WindowActivate(true); |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
// Redo the mouse capture if the window gets moved (special case for Colin
|
|
|
|
// Redo the mouse capture if the window gets moved (special case for Colin
|
|
|
|
// and his cool program that bumps windows out from under the taskbar)
|
|
|
|
// and his cool program that bumps windows out from under the taskbar)
|
|
|
@ -631,7 +643,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
DebugMsgF("Got WM_MOVE, but ignoring"); |
|
|
|
DebugMsgF("Got WM_MOVE, but ignoring"); |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
/// Resize the window
|
|
|
|
/// Resize the window
|
|
|
|
// (we do WM_SIZING here instead of WM_SIZE because, for some reason, WM_SIZE is
|
|
|
|
// (we do WM_SIZING here instead of WM_SIZE because, for some reason, WM_SIZE is
|
|
|
@ -646,7 +658,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
|
|
::GetClientRect(hWnd, &r); |
|
|
|
::GetClientRect(hWnd, &r); |
|
|
|
gClient->GetPipeline()->Resize(r.right - r.left, r.bottom - r.top); |
|
|
|
gClient->GetPipeline()->Resize(r.right - r.left, r.bottom - r.top); |
|
|
|
} |
|
|
|
} |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case WM_SIZE: |
|
|
|
case WM_SIZE: |
|
|
|
// Let go of the mouse if the window is being minimized
|
|
|
|
// Let go of the mouse if the window is being minimized
|
|
|
@ -663,37 +675,22 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
|
|
if (gClient) |
|
|
|
if (gClient) |
|
|
|
gClient->WindowActivate(true); |
|
|
|
gClient->WindowActivate(true); |
|
|
|
} |
|
|
|
} |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case WM_CLOSE: |
|
|
|
case WM_CLOSE: |
|
|
|
gClient->SetDone(TRUE); |
|
|
|
gClient->SetDone(TRUE); |
|
|
|
if (plNetClientMgr * mgr = plNetClientMgr::GetInstance()) |
|
|
|
if (plNetClientMgr * mgr = plNetClientMgr::GetInstance()) |
|
|
|
mgr->QueueDisableNet(false, nil); |
|
|
|
mgr->QueueDisableNet(false, nil); |
|
|
|
DestroyWindow(gClient->GetWindowHandle()); |
|
|
|
DestroyWindow(gClient->GetWindowHandle()); |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
case WM_DESTROY: |
|
|
|
case WM_DESTROY: |
|
|
|
gClient->SetDone(TRUE); |
|
|
|
gClient->SetDone(TRUE); |
|
|
|
if (plNetClientMgr * mgr = plNetClientMgr::GetInstance()) |
|
|
|
if (plNetClientMgr * mgr = plNetClientMgr::GetInstance()) |
|
|
|
mgr->QueueDisableNet(false, nil); |
|
|
|
mgr->QueueDisableNet(false, nil); |
|
|
|
PostQuitMessage(0); |
|
|
|
PostQuitMessage(0); |
|
|
|
return TRUE; |
|
|
|
break; |
|
|
|
case WM_CREATE: |
|
|
|
|
|
|
|
// Create renderer
|
|
|
|
|
|
|
|
return TRUE; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Messages we registered for manually (no const value)
|
|
|
|
|
|
|
|
if (message == s_WmTaskbarList) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Grab the Windows 7 taskbar list stuff
|
|
|
|
|
|
|
|
if (gTaskbarList) |
|
|
|
|
|
|
|
gTaskbarList->Release(); |
|
|
|
|
|
|
|
HRESULT result = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&gTaskbarList); |
|
|
|
|
|
|
|
if (FAILED(result)) |
|
|
|
|
|
|
|
gTaskbarList = nil; |
|
|
|
|
|
|
|
return TRUE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam); |
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|