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

UI: Hide mouse cursor option #1307

Merged
merged 1 commit into from
Aug 2, 2023
Merged

Conversation

Fabxx
Copy link
Contributor

@Fabxx Fabxx commented Dec 19, 2022

Fixes #825

Hides the cursor when option is enabled and outside of UI:

2023-01-13.00-32-33.mp4

@Fabxx Fabxx changed the title UI: Hide mouse cursor when inactive on window UI: Hide mouse cursor option Jan 12, 2023
@antoniodesousa
Copy link

I hope this gets merged soon...

Copy link
Member

@mborgerson mborgerson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the feature, but it needs some minor changes before being merged

config_spec.yml Show resolved Hide resolved
ui/xui/main-menu.cc Outdated Show resolved Hide resolved
ui/xui/main.cc Outdated
@@ -252,6 +252,9 @@ void xemu_hud_render(void)
ShowMainMenu();
ImGui::PopStyleColor();
} else {
if (g_config.display.ui.hide_cursor && !g_scene_mgr.IsDisplayingScene()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of where this is placed, this hides the cursor only if the menu bar is shown. What if the menu bar is configured to be hidden also? This code will never trigger and the mouse cursor will not be hidden in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you agree i can add a simple check on the alpha state of the menu bar with an OR, so i can either check this, or if the bar has become invisible to hide the cursor, so if you check the hide bar option, it can hide the cursor based directly on that state, and it won't conflict with the menu open since then the menu state is active

Copy link
Member

@mborgerson mborgerson Jul 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to consider the alpha state of the menu bar. Just hide the cursor if it is not being moved after some period of time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reworked the code, but i still have to figure out how to add a small delay after the cursor stopped moving before hiding the cursor.

@mborgerson mborgerson merged commit 1d3c7c0 into xemu-project:master Aug 2, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hide Mouse Cursor
4 participants