| 1 | = Screensaver Logic = |
| 2 | |
| 3 | The screensaver supports: |
| 4 | |
| 5 | |
| 6 | 1. Fullscreen graphics from project applications |
| 7 | 1. A default BOINC logo screensaver when no running applications support graphics |
| 8 | 1. Screen blanking after a given time |
| 9 | |
| 10 | If the screensaver is running, the core client will try to devote screen time to a different project each time the CPUs are rescheduled. |
| 11 | |
| 12 | |
| 13 | {{{ |
| 14 | request_ss_app(): |
| 15 | choose some app that can do graphics |
| 16 | if app exists: |
| 17 | request app (from a different project if possible) |
| 18 | to do fullscreen graphics |
| 19 | ACK deadline = now + 5 sec |
| 20 | else: |
| 21 | do_boinc_logo_ss = true |
| 22 | |
| 23 | // called to force poll function to request another app to do graphics |
| 24 | // |
| 25 | // this is called by schedule_cpus() whenever CPUs are rescheduled |
| 26 | // |
| 27 | reset(): |
| 28 | tell any fullscreen app to hide |
| 29 | do_boinc_logo_ss = false |
| 30 | |
| 31 | // called when core client receives a message from the screensaver module |
| 32 | // |
| 33 | start_ss(new_blank_time): |
| 34 | save all apps' modes |
| 35 | hide all apps |
| 36 | blank_time = new_blank_time |
| 37 | if activities not suspended: |
| 38 | request_ss_app() |
| 39 | |
| 40 | // called when screensaver module quits |
| 41 | // |
| 42 | stop_ss(): |
| 43 | clean up stuff |
| 44 | restore apps' modes |
| 45 | |
| 46 | // called once a second |
| 47 | // |
| 48 | poll(): |
| 49 | if activities not suspended: |
| 50 | if doing screensaver: |
| 51 | if blank_time != 0 && now > blank_time: |
| 52 | if not screen not already blanked: |
| 53 | tell any fullscreen app to hide |
| 54 | blank screen |
| 55 | do_boinc_logo_ss = false |
| 56 | else: |
| 57 | get the fullscreen app |
| 58 | if app exists: |
| 59 | if app has sent ACK: |
| 60 | do_boinc_logo_ss = false |
| 61 | else if ACK deadline has passed: |
| 62 | tell app to hide |
| 63 | do_boinc_logo_ss = true |
| 64 | else: |
| 65 | request_ss_app() |
| 66 | else: |
| 67 | do_boinc_logo_ss = true |
| 68 | |
| 69 | |
| 70 | ///////////////////////// |
| 71 | logic of screensaver program: |
| 72 | screensaver starts |
| 73 | creates blank windows on every screen |
| 74 | show "screensaver loading" in all windows |
| 75 | |
| 76 | if core client not running and not set to run on startup |
| 77 | show "boinc not running, auto startup not detected |
| 78 | please reinstall and select this option" |
| 79 | 10 times, every 1 sec, then once every 30 sec |
| 80 | set_screensaver_mode RPC to core client |
| 81 | pass desktop/windowstation, blank time |
| 82 | get_screensaver_mode |
| 83 | returns: |
| 84 | - some app is doing fullscreen |
| 85 | - no graphics-capable app |
| 86 | - BOINC suspended |
| 87 | - time to blank |
| 88 | |
| 89 | after each get_screensaver_mode (beyond initial 10 sec): |
| 90 | if no app is doing graphics, |
| 91 | do get_results RPC |
| 92 | show string on all windows |
| 93 | |
| 94 | }}} |