Cuperino / QPrompt-Teleprompter

Teleprompter software for all video creators. Built with ease of use, productivity, control accuracy, and smooth performance in mind.
https://qprompt.app
GNU General Public License v3.0
378 stars 26 forks source link

Auto-hide mouse cursor after a moment of stillness while prompting #122

Closed Cuperino closed 1 year ago

Cuperino commented 2 years ago

Request

[..] there is a cross symbol for the mouse and it sits on top of the text and moves if I move the mouse. I currently just move it to the bottom so that the client does not see it in their prompter glass. If it could be made to go away after 2-3 seconds or so of no mouse movement and come back if mouse movement.

Planned Solution

Use a transparent blank image to make all cursors invisible until its changed back:

QGuiApplication::setOverrideCursor(QCursor(QPixmap("invisibleCursorImage.png"));

Method to run the following code to restore normal cursor behavior:

QGuiApplication::restoreOverrideCursor();

Restore cursors when:

Cancel previous timer if it exists when:

Set 3 second countdown to make cursor blank when:

Reference

videosmith commented 2 years ago

Would hiding the cursor affect animation performance?

Cuperino commented 2 years ago

It should not. Mouse cursors are drawn by X11 or by the shell when you're using a Wayland session. Drawing a blank image, like I've described, should not increase nor reduce GPU processing costs.

The timer used to determine when to hide the cursor would use a separate CPU thread, so there is a small CPU cost that would have its greatest impact in systems with few cores. Nonetheless, this impact should be negligible.

videosmith commented 2 years ago

Would it be possible to make this a selectable option in your preferences?

Cuperino commented 2 years ago

What I do to keep performance optimal is perform checks to prevent unnecessary code from running. The faster the checks and the less are needed, the better. If the feature in question doesn't cost much more than performing a settings check, there may be not be a need to make this something you can disable.

Taking the overlay contrast effect as an example, that added a big layer of semi-transparent content that needed to be composited in the GPU.

The question that needs to be answered first is, will "changing the cursor image" or "running a timer" impact performance noticeably? I think it should make no difference if the new cursor image is registered to video memory from beforehand. The timer's impact should also be negligible. The Timer object would only need to be instantiated once when entering Countdown or Prompting mode. After that, the same timer would just be reset with every mouse move, meaning no extra time is dedicated to resource allocation and de-allocation while prompting; all that is used is already in memory.

Cuperino commented 1 year ago

Feature added to v1.2 development branch.