Changeset 56930 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 14, 2015 2:24:12 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101637
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/platform/x11
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.cpp
r56929 r56930 36 36 static BOOL gX11ScreenSaverDpmsAvailable; 37 37 static BOOL gX11DpmsState; 38 39 void X11ScreenSaverSettingsInit()40 {41 int dummy;42 Display *display = QX11Info::display();43 gX11ScreenSaverDpmsAvailable = DPMSQueryExtension(display, &dummy, &dummy);44 }45 46 void X11ScreenSaverSettingsSave()47 {48 /* Actually this is a big mess. By default the libSDL disables the screen saver49 * during the SDL_InitSubSystem() call and restores the saved settings during50 * the SDL_QuitSubSystem() call. This mechanism can be disabled by setting the51 * environment variable SDL_VIDEO_ALLOW_SCREENSAVER to 1. However, there is a52 * known bug in the Debian libSDL: If this environment variable is set, the53 * screen saver is still disabled but the old state is not restored during54 * SDL_QuitSubSystem()! So the only solution to overcome this problem is to55 * save and restore the state prior and after each of these function calls. */56 57 int dummy;58 CARD16 dummy2;59 Display *display = QX11Info::display();60 61 XGetScreenSaver(display, &gX11ScreenSaverTimeout, &dummy, &dummy, &dummy);62 if (gX11ScreenSaverDpmsAvailable)63 DPMSInfo(display, &dummy2, &gX11DpmsState);64 }65 66 void X11ScreenSaverSettingsRestore()67 {68 int timeout, interval, preferBlank, allowExp;69 Display *display = QX11Info::display();70 71 XGetScreenSaver(display, &timeout, &interval, &preferBlank, &allowExp);72 timeout = gX11ScreenSaverTimeout;73 XSetScreenSaver(display, timeout, interval, preferBlank, allowExp);74 75 if (gX11DpmsState && gX11ScreenSaverDpmsAvailable)76 DPMSEnable(display);77 }78 38 79 39 X11WMType X11WindowManagerType() … … 123 83 } 124 84 85 void X11ScreenSaverSettingsInit() 86 { 87 int dummy; 88 Display *display = QX11Info::display(); 89 gX11ScreenSaverDpmsAvailable = DPMSQueryExtension(display, &dummy, &dummy); 90 } 91 92 void X11ScreenSaverSettingsSave() 93 { 94 /* Actually this is a big mess. By default the libSDL disables the screen saver 95 * during the SDL_InitSubSystem() call and restores the saved settings during 96 * the SDL_QuitSubSystem() call. This mechanism can be disabled by setting the 97 * environment variable SDL_VIDEO_ALLOW_SCREENSAVER to 1. However, there is a 98 * known bug in the Debian libSDL: If this environment variable is set, the 99 * screen saver is still disabled but the old state is not restored during 100 * SDL_QuitSubSystem()! So the only solution to overcome this problem is to 101 * save and restore the state prior and after each of these function calls. */ 102 103 int dummy; 104 CARD16 dummy2; 105 Display *display = QX11Info::display(); 106 107 XGetScreenSaver(display, &gX11ScreenSaverTimeout, &dummy, &dummy, &dummy); 108 if (gX11ScreenSaverDpmsAvailable) 109 DPMSInfo(display, &dummy2, &gX11DpmsState); 110 } 111 112 void X11ScreenSaverSettingsRestore() 113 { 114 int timeout, interval, preferBlank, allowExp; 115 Display *display = QX11Info::display(); 116 117 XGetScreenSaver(display, &timeout, &interval, &preferBlank, &allowExp); 118 timeout = gX11ScreenSaverTimeout; 119 XSetScreenSaver(display, timeout, interval, preferBlank, allowExp); 120 121 if (gX11DpmsState && gX11ScreenSaverDpmsAvailable) 122 DPMSEnable(display); 123 } 124 -
trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.h
r56929 r56930 27 27 }; 28 28 29 /** X11: Determines and returns current Window Manager type. */ 30 X11WMType X11WindowManagerType(); 31 29 32 /** X11: Inits the screen saver save/restore mechanism. */ 30 33 void X11ScreenSaverSettingsInit(); … … 34 37 void X11ScreenSaverSettingsRestore(); 35 38 36 /** X11: Determines and returns current Window Manager type. */37 X11WMType X11WindowManagerType();38 39 39 #endif /* !___VBoxX11Helpers_h___ */ 40 40
Note:
See TracChangeset
for help on using the changeset viewer.