Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 3-tap-to-hide GUI gesture #932

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/misc.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
////
- Copyright (c) 2019-2023, Arm Limited and Contributors
- Copyright (c) 2019-2024, Arm Limited and Contributors
-
- SPDX-License-Identifier: Apache-2.0
-
Expand Down Expand Up @@ -45,8 +45,8 @@
| -

| toggle GUI
| +++<kbd>+++left click+++</kbd>+++
| +++<kbd>+++tap+++</kbd>+++
| +++<kbd>+++F1+++</kbd>+++
| 3 finger +++<kbd>+++tap+++</kbd>+++

| toggle Debug Window
| +++<kbd>+++right click+++</kbd>+++
Expand Down
17 changes: 15 additions & 2 deletions framework/gui.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2018-2023, Arm Limited and Contributors
* Copyright (c) 2019-2023, Sascha Willems
/* Copyright (c) 2018-2024, Arm Limited and Contributors
* Copyright (c) 2019-2024, Sascha Willems
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -1061,6 +1061,10 @@ bool Gui::input_event(const InputEvent &input_event)
{
two_finger_tap = true;
}
else if (touch_event.get_touch_points() == 3)
{
three_finger_tap = true;
}
}
}
if (press_up)
Expand All @@ -1087,6 +1091,15 @@ bool Gui::input_event(const InputEvent &input_event)
{
two_finger_tap = false;
}

if (three_finger_tap && touch_event.get_touch_points() == 3)
{
visible = !visible;
}
else
{
three_finger_tap = false;
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions framework/gui.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2018-2023, Arm Limited and Contributors
* Copyright (c) 2019-2023, Sascha Willems
/* Copyright (c) 2018-2024, Arm Limited and Contributors
* Copyright (c) 2019-2024, Sascha Willems
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -478,6 +478,8 @@ class Gui
/// Whether or not the GUI has detected a multi touch gesture
bool two_finger_tap = false;

bool three_finger_tap = false;

bool show_graph_file_output = false;

uint32_t subpass = 0;
Expand Down
15 changes: 14 additions & 1 deletion framework/hpp_gui.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
/* Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -989,6 +989,10 @@ bool HPPGui::input_event(const InputEvent &input_event)
{
two_finger_tap = true;
}
else if (touch_event.get_touch_points() == 3)
{
three_finger_tap = true;
}
}
}
if (press_up)
Expand All @@ -1015,6 +1019,15 @@ bool HPPGui::input_event(const InputEvent &input_event)
{
two_finger_tap = false;
}

if (three_finger_tap && touch_event.get_touch_points() == 3)
{
visible = !visible;
}
else
{
three_finger_tap = false;
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion framework/hpp_gui.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
/* Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -437,6 +437,7 @@ class HPPGui
Timer timer; // Used to measure duration of input events
bool prev_visible = true;
bool two_finger_tap = false; // Whether or not the GUI has detected a multi touch gesture
bool three_finger_tap = false;
bool show_graph_file_output = false;
};
} // namespace vkb
Loading