explorer: Move screen saver activation to the X11 driver.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-05-03 12:28:38 +02:00
parent 43c430a6d8
commit ed22f0454b
2 changed files with 27 additions and 21 deletions

View File

@ -21,6 +21,7 @@
*/ */
#include "config.h" #include "config.h"
#include "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
@ -2763,6 +2764,25 @@ static BOOL is_netwm_supported( Display *display, Atom atom )
} }
/***********************************************************************
* start_screensaver
*/
static LRESULT start_screensaver(void)
{
if (root_window == DefaultRootWindow(gdi_display))
{
const char *argv[3] = { "xdg-screensaver", "activate", NULL };
int pid = _spawnvp( _P_DETACH, argv[0], argv );
if (pid > 0)
{
TRACE( "started process %d\n", pid );
return 0;
}
}
return -1;
}
/*********************************************************************** /***********************************************************************
* SysCommand (X11DRV.@) * SysCommand (X11DRV.@)
* *
@ -2774,7 +2794,11 @@ LRESULT CDECL X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
int dir; int dir;
struct x11drv_win_data *data; struct x11drv_win_data *data;
if (!(data = get_win_data( hwnd ))) return -1; if (!(data = get_win_data( hwnd )))
{
if (wparam == SC_SCREENSAVE && hwnd == GetDesktopWindow()) return start_screensaver();
return -1;
}
if (!data->whole_window || !data->managed || !data->mapped) goto failed; if (!data->whole_window || !data->managed || !data->mapped) goto failed;
switch (wparam & 0xfff0) switch (wparam & 0xfff0)

View File

@ -583,22 +583,6 @@ static void initialize_launchers( HWND hwnd )
} }
} }
/* screen saver handler */
static BOOL start_screensaver( void )
{
if (using_root)
{
const char *argv[3] = { "xdg-screensaver", "activate", NULL };
int pid = _spawnvp( _P_DETACH, argv[0], argv );
if (pid > 0)
{
WINE_TRACE( "started process %d\n", pid );
return TRUE;
}
}
return FALSE;
}
static WNDPROC desktop_orig_wndproc; static WNDPROC desktop_orig_wndproc;
/* window procedure for the desktop window */ /* window procedure for the desktop window */
@ -613,11 +597,9 @@ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPAR
{ {
case SC_CLOSE: case SC_CLOSE:
ExitWindows( 0, 0 ); ExitWindows( 0, 0 );
break; return 0;
case SC_SCREENSAVE:
return start_screensaver();
} }
return 0; break;
case WM_CLOSE: case WM_CLOSE:
PostQuitMessage(0); PostQuitMessage(0);