libobs: Avoid xdg-screensaver log spam
Description
On systems without xdg-screensaver installed, the screensaver_thread whines every 30 seconds as it repeatedly tries and fails to execute it, resulting in this log spam:
warning: Failed to create xdg-screensaver: 2
warning: Failed to create xdg-screensaver: 2
warning: Failed to create xdg-screensaver: 2
...
Instead, verify that xdg-screensaver can be executed before starting the screensaver_thread. The (corrected) warning message appears only once if it can't, e.g.:
warning: Failed to reset xdg-screensaver: No such file or directory
Motivation and Context
Closes: obsproject/obs-studio#5479
How Has This Been Tested?
Manual testing on an installation without xdg-screensaver installed; logfile inspection.
Types of changes
- Tweak (non-breaking change to improve existing functionality)
- Performance enhancement (non-breaking change which improves efficiency)
Checklist:
- [x] My code has been run through clang-format.
- [x] I have read the contributing document.
- [x] My code is not on the master branch.
- [x] The code has been tested.
- [x] All commit messages are properly formatted and commits squashed where appropriate.
- [ ] I have included updates to all appropriate documentation.
This is not a fix for #9968, 9968 is in a Flatpak context.
It does fix the spam issue outside of one if the xdg-screensaver method is chosen and does not work, but the right fix inside a Flatpak is #10751. So just unlink the issue.
This is not a fix for #9968, 9968 is in a Flatpak context.
Dropped that Closes reference from the commit and PR description.
Is this still needed after the improved selection from #10751 ?
Is this still needed after the improved selection from #10751 ?
If fixes the log spam if we fallback to the xdg-screensaver method and is not functional.