mirror of https://github.com/xemu-project/xemu.git
ui: Add option to hide cursor after a period of time
This commit is contained in:
parent
e5dd3cc1ce
commit
1d3c7c05d4
|
@ -136,6 +136,9 @@ display:
|
||||||
show_notifications:
|
show_notifications:
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
|
hide_cursor:
|
||||||
|
type: bool
|
||||||
|
default: true
|
||||||
use_animations:
|
use_animations:
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
|
|
|
@ -316,6 +316,8 @@ void MainMenuDisplayView::Draw()
|
||||||
"Show main menu bar when mouse is activated");
|
"Show main menu bar when mouse is activated");
|
||||||
Toggle("Show notifications", &g_config.display.ui.show_notifications,
|
Toggle("Show notifications", &g_config.display.ui.show_notifications,
|
||||||
"Display notifications in upper-right corner");
|
"Display notifications in upper-right corner");
|
||||||
|
Toggle("Hide mouse cursor", &g_config.display.ui.hide_cursor,
|
||||||
|
"Hide the mouse cursor when it is not moving");
|
||||||
|
|
||||||
int ui_scale_idx;
|
int ui_scale_idx;
|
||||||
if (g_config.display.ui.auto_scale) {
|
if (g_config.display.ui.auto_scale) {
|
||||||
|
|
|
@ -256,6 +256,16 @@ void xemu_hud_render(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t last_mouse_move = 0;
|
||||||
|
if (g_input_mgr.MouseMoved()) {
|
||||||
|
last_mouse_move = now;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: Handle time wrap around
|
||||||
|
if (g_config.display.ui.hide_cursor && (now - last_mouse_move) > 3000) {
|
||||||
|
ImGui::SetMouseCursor(ImGuiMouseCursor_None);
|
||||||
|
}
|
||||||
|
|
||||||
if (!ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow) &&
|
if (!ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow) &&
|
||||||
!g_scene_mgr.IsDisplayingScene()) {
|
!g_scene_mgr.IsDisplayingScene()) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue