void InteractionState::resetProximity() { m_proximityLeader.clear(); m_bestProximity = Proximity(); m_bestProximityPriority = std::numeric_limits<int>::min(); }
//---------------------------------------------------------------------------------------------------------------------- // Name: WndProc // Comments: // //---------------------------------------------------------------------------------------------------------------------- ///<summary>Windows call-back procedure.</summary> ///<remarks> ///Used to receive call-backs for the Windows system-wide Hot Key's ///</remarks> LRESULT CALLBACK WndProc( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam) // second message parameter { switch (uMsg) { case WM_HOTKEY: { if (g_pszRemoteMachineName != nullptr) { HANDLE hProximity; HRESULT hr = BeginProximity(g_pszRemoteMachineName, &hProximity); if (SUCCEEDED(hr)) { wprintf(L"In Proximity for 1 second...\n"); Sleep(1000); CloseHandle(hProximity); wprintf(L"Proximity Complete.\n"); } else { wprintf(L"ERROR: BeginProximity() failed: 0x%x\n", hr); } } else // No machine name specified, need to check for a name on the share { Proximity(); } } return 0; case WM_DESTROY: PostQuitMessage(0); return 0; // // Process other messages. // default: return DefWindowProc(hwnd, uMsg, wParam, lParam); } }
void InteractionState::updateProximity( Captor& captor, Proximity const& proximity, int priority, Proximity proximity_threshold) { if (captor.is_linked()) { return; } if (proximity_threshold == Proximity()) { proximity_threshold = m_proximityThreshold; } if (proximity <= proximity_threshold) { if (betterProximity(proximity, priority)) { m_proximityLeader.clear(); m_proximityLeader.push_back(captor); m_bestProximity = proximity; m_bestProximityPriority = priority; } } }
Proximity DraggablePoint::proximity(QPointF const& mouse_pos) { return Proximity(pointPosition(), mouse_pos); }