VLC's handling of idle timeouts on Windows seems to be wrong
Right now, VLC disables the idle timer (e.g., to prevent the screen saver from firing) by clobbering (and later restoring) the system's timeout settings. I do not think that this is the correct approach.
First, is there any reason why VLC fiddles with SCREENSAVETIMEOUT to disable the screensaver, instead of toggling the more appropriate SCREENSAVEACTIVE? While clobbering the timeout does do the job, the use of this method triggers a bug in Windows XP that, under certain circumstances, can interfere with the proper function of the monitor-off power management setting after VLC exits (the exact details of how and when this bug is triggered is not relevant, but I can elaborate further, if so desired). Plus, toggling the active flag, by its very name, seems more logical.
Second, I believe that setting the ES_SYSTEM_REQUIRED flag in the thread execution state (VLC is already setting the ES_DISPLAY_REQUIRED flag anyway) is a far better, more elegant method for preventing system sleep/shutdown from idle. And given the choice between a system-wide setting with a system-wide effect or a localized thread-specific setting with a system-wide effect (with the automatic reversal of the effect if the thread exits--or crashes), the latter seems better.
Anyway, I am attaching a patch with the changes that I have suggested in this bug.
NOTE: This is my first time looking at VLC code, so I don't know much about the history of this code that I'm changing. Maybe there's a reason that I'm not aware of, due to my lack of familiarity with this code's history, of why things are done the way it is now. My primary impetus for filing this bug is to address the aforementioned monitor-blanking bug resulting from the toggling of the timeout parameter.