diff options
author | Andrzej Hunt <andrzej@ahunt.org> | 2015-10-19 20:11:53 +0200 |
---|---|---|
committer | Andrzej Hunt <andrzej@ahunt.org> | 2015-10-20 18:14:39 +0200 |
commit | 5074d1b4d712cd35798758e8168ffbdfe59a11a9 (patch) | |
tree | 08a67859c2bd39050ec8fb859dc0d08f5d15f831 /vcl/unx/gtk | |
parent | e97b1b6c28529487467ad9b4051ec288aa0f0c31 (diff) |
Deduplicate XAutoLock inhibition and move to ScreenSaverInhibitor
(Successfully tested with xautolock 2.2)
Change-Id: I55a3703322dd6792689ff3c3e85b27840ee2bc55
Diffstat (limited to 'vcl/unx/gtk')
-rw-r--r-- | vcl/unx/gtk/window/gtksalframe.cxx | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 4d74e67ac15c..498161e60d24 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -2538,40 +2538,21 @@ void GtkSalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nScreen ) } } -/* definitions from xautolock.c (pl15) */ -#define XAUTOLOCK_DISABLE 1 -#define XAUTOLOCK_ENABLE 2 - -void GtkSalFrame::setAutoLock( bool bLock ) -{ - if( isChild() || !getDisplay()->IsX11Display() ) - return; - - GdkScreen *pScreen = gtk_window_get_screen( GTK_WINDOW(m_pWindow) ); - GdkDisplay *pDisplay = gdk_screen_get_display( pScreen ); - GdkWindow *pRootWin = gdk_screen_get_root_window( pScreen ); - - Atom nAtom = XInternAtom( GDK_DISPLAY_XDISPLAY( pDisplay ), - "XAUTOLOCK_MESSAGE", False ); - - int nMessage = bLock ? XAUTOLOCK_ENABLE : XAUTOLOCK_DISABLE; - - XChangeProperty( GDK_DISPLAY_XDISPLAY( pDisplay ), - GDK_WINDOW_XID( pRootWin ), - nAtom, XA_INTEGER, - 8, PropModeReplace, - reinterpret_cast<unsigned char*>(&nMessage), - sizeof( nMessage ) ); -} - void GtkSalFrame::StartPresentation( bool bStart ) { + boost::optional<guint> aWindow; + boost::optional<Display*> aDisplay; + if( getDisplay()->IsX11Display() ) + { + aWindow = widget_get_xid(m_pWindow); + aDisplay = GDK_DISPLAY_XDISPLAY( getGdkDisplay() ); + } + m_ScreenSaverInhibitor.inhibit( bStart, "presentation", getDisplay()->IsX11Display(), - widget_get_xid(m_pWindow) ); - - setAutoLock( !bStart ); + aWindow, + aDisplay ); if( !getDisplay()->IsX11Display() ) return; |