VirtualBox

Ignore:
Timestamp:
Jul 14, 2015 2:24:12 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
101637
Message:

FE/Qt: X11: Helpers cleanup/rework (step 4): Just some code reordering.

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  
    3636static BOOL gX11ScreenSaverDpmsAvailable;
    3737static 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 saver
    49      * during the SDL_InitSubSystem() call and restores the saved settings during
    50      * the SDL_QuitSubSystem() call. This mechanism can be disabled by setting the
    51      * environment variable SDL_VIDEO_ALLOW_SCREENSAVER to 1. However, there is a
    52      * known bug in the Debian libSDL: If this environment variable is set, the
    53      * screen saver is still disabled but the old state is not restored during
    54      * SDL_QuitSubSystem()! So the only solution to overcome this problem is to
    55      * 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 }
    7838
    7939X11WMType X11WindowManagerType()
     
    12383}
    12484
     85void X11ScreenSaverSettingsInit()
     86{
     87    int     dummy;
     88    Display *display = QX11Info::display();
     89    gX11ScreenSaverDpmsAvailable = DPMSQueryExtension(display, &dummy, &dummy);
     90}
     91
     92void 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
     112void 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  
    2727};
    2828
     29/** X11: Determines and returns current Window Manager type. */
     30X11WMType X11WindowManagerType();
     31
    2932/** X11: Inits the screen saver save/restore mechanism. */
    3033void X11ScreenSaverSettingsInit();
     
    3437void X11ScreenSaverSettingsRestore();
    3538
    36 /** X11: Determines and returns current Window Manager type. */
    37 X11WMType X11WindowManagerType();
    38 
    3939#endif /* !___VBoxX11Helpers_h___ */
    4040
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette