Add MOUSE_MODE_CONFINED_HIDDEN

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
This commit is contained in:
Aaron Franke 2021-03-30 18:35:08 -04:00
parent f288a79482
commit 98aa3b669e
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
12 changed files with 69 additions and 37 deletions

View file

@ -333,8 +333,9 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Co
os->input_event(screen_drag);
} else {
// In case the mouse grabbed, MouseMoved will handle this
if (os->get_mouse_mode() == OS::MouseMode::MOUSE_MODE_CAPTURED)
if (os->get_mouse_mode() == OS::MouseMode::MOUSE_MODE_CAPTURED) {
return;
}
Ref<InputEventMouseMotion> mouse_motion;
mouse_motion.instance();
@ -351,8 +352,9 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Co
void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) {
// In case the mouse isn't grabbed, PointerMoved will handle this
if (os->get_mouse_mode() != OS::MouseMode::MOUSE_MODE_CAPTURED)
if (os->get_mouse_mode() != OS::MouseMode::MOUSE_MODE_CAPTURED) {
return;
}
Windows::Foundation::Point pos;
pos.X = last_mouse_pos.X + args->MouseDelta.X;

View file

@ -400,14 +400,12 @@ void OS_UWP::ManagedType::on_gyroscope_reading_changed(Gyrometer ^ sender, Gyrom
void OS_UWP::set_mouse_mode(MouseMode p_mode) {
if (p_mode == MouseMode::MOUSE_MODE_CAPTURED) {
CoreWindow::GetForCurrentThread()->SetPointerCapture();
} else {
CoreWindow::GetForCurrentThread()->ReleasePointerCapture();
}
if (p_mode == MouseMode::MOUSE_MODE_CAPTURED || p_mode == MouseMode::MOUSE_MODE_HIDDEN) {
if (p_mode == MouseMode::MOUSE_MODE_HIDDEN || p_mode == MouseMode::MOUSE_MODE_CAPTURED || p_mode == MouseMode::MOUSE_MODE_CONFINED_HIDDEN) {
CoreWindow::GetForCurrentThread()->PointerCursor = nullptr;
} else {
CoreWindow::GetForCurrentThread()->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0);
}