From 260c446b56c7e26775df670fef6004870d1f36a5 Mon Sep 17 00:00:00 2001 From: Steven Edwards Date: Wed, 1 Aug 2007 02:06:27 -0400 Subject: [PATCH] Implement LockWorkStation using xdg-screensaver --- dlls/user32/user32.spec | 2 +- dlls/user32/user_main.c | 14 ++++++++++++++ programs/explorer/desktop.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletions(-) diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 8bf9ad1..452e380 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -475,7 +475,7 @@ # @ stub LoadKeyboardLayoutEx @ stdcall LockSetForegroundWindow (long) @ stub LockWindowStation @ stdcall LockWindowUpdate(long) -@ stub LockWorkStation +@ stdcall LockWorkStation() @ stdcall LookupIconIdFromDirectory(ptr long) @ stdcall LookupIconIdFromDirectoryEx(ptr long long long long) @ stub MBToWCSEx diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index e572220..09255f9 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -318,3 +318,17 @@ BOOL WINAPI ExitWindowsEx( UINT flags, D CloseHandle( pi.hThread ); return TRUE; } + +/*********************************************************************** + * LockWorkStation (USER32.@) + */ +BOOL WINAPI LockWorkStation( void ) +{ + HWND hwnd; + int retval; + + hwnd = GetDesktopWindow(); + retval = SendMessageW( hwnd, 0xC000, 0, 0 ); + + return retval; +} diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index 7f2e23f..cef1bff 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -18,7 +18,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include #include +#include +#ifdef HAVE_UNISTD_H +#include +#endif #define OEMRESOURCE @@ -35,6 +43,26 @@ extern HANDLE __wine_make_process_system static BOOL using_root; +int lock_desktop( void ) +{ + /* FIXME: do something here about running in desktop mode */ + int retcode; + const char *argv[3]; + + argv[0] = "xdg-screensaver"; + argv[1] = "lock"; + argv[2] = NULL; + + retcode=spawnvp( _P_WAIT, "xdg-screensaver", argv ); + + if (retcode!=0) + { + WINE_ERR("%s returned %d\n",(const char*)argv,retcode); + return retcode; + } + return TRUE; +} + /* window procedure for the desktop window */ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPARAM lp ) { @@ -69,6 +97,9 @@ static LRESULT WINAPI desktop_wnd_proc( } return 0; + case 0xC000: + return lock_desktop(); + default: return DefWindowProcW( hwnd, message, wp, lp ); } -- 1.4.1