Alexandre Julliard : explorer: Move screen saver activation to the X11 driver.
Alexandre Julliard
julliard at winehq.org
Fri May 3 15:46:17 CDT 2019
Module: wine
Branch: master
Commit: ed22f0454bc50f7820fc93fbe8c2af4877083006
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ed22f0454bc50f7820fc93fbe8c2af4877083006
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri May 3 12:28:38 2019 +0200
explorer: Move screen saver activation to the X11 driver.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winex11.drv/window.c | 26 +++++++++++++++++++++++++-
programs/explorer/desktop.c | 22 ++--------------------
2 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 97dee52..fb97ec5 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -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)
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c
index 27b9b24..f4cc7b1 100644
--- a/programs/explorer/desktop.c
+++ b/programs/explorer/desktop.c
@@ -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);
More information about the wine-cvs
mailing list