Commit ed22f045 authored by Alexandre Julliard's avatar Alexandre Julliard

explorer: Move screen saver activation to the X11 driver.

parent 43c430a6
......@@ -21,6 +21,7 @@
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdlib.h>
......@@ -2764,6 +2765,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.@)
*
* Perform WM_SYSCOMMAND handling.
......@@ -2774,7 +2794,11 @@ LRESULT CDECL X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
int dir;
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;
switch (wparam & 0xfff0)
......
......@@ -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;
/* 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:
ExitWindows( 0, 0 );
break;
case SC_SCREENSAVE:
return start_screensaver();
return 0;
}
return 0;
break;
case WM_CLOSE:
PostQuitMessage(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment