[PATCH v2 1/4] explorer: Add a private message to notify the graphics driver when activity occurs.
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> --- programs/explorer/desktop.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index a2d9e1a..f5a01c2 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -46,6 +46,10 @@ static const WCHAR default_driver[] = {'m','a','c',',','x','1','1',0}; static const WCHAR default_driver[] = {'x','1','1',0}; #endif +static void (CDECL *wine_notify_activity)(void); + +#define WM_WINE_NOTIFY_ACTIVITY WM_USER + static BOOL using_root; struct launcher @@ -661,6 +665,11 @@ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPAR } return 0; + case WM_WINE_NOTIFY_ACTIVITY: + if (wine_notify_activity) + wine_notify_activity(); + return 0; + default: return DefWindowProcW( hwnd, message, wp, lp ); } @@ -1005,6 +1014,8 @@ void manage_desktop( WCHAR *arg ) { pShellDDEInit( TRUE ); } + + wine_notify_activity = (void *)GetProcAddress( graphics_driver, "wine_notify_activity" ); } } -- 2.7.4
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> --- dlls/dinput/device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 7b83a39..daa6406 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -39,6 +39,8 @@ #include "device_private.h" #include "dinput_private.h" +#define WM_WINE_NOTIFY_ACTIVITY WM_USER + WINE_DEFAULT_DEBUG_CHANNEL(dinput); static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface) @@ -935,6 +937,8 @@ void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD tim /* Event is being set regardless of the queue state */ if (This->hEvent) SetEvent(This->hEvent); + SendMessageW(GetDesktopWindow(), WM_WINE_NOTIFY_ACTIVITY, 0, 0); + if (!This->queue_len || This->overflow || ofs < 0) return; next_pos = (This->queue_head + 1) % This->queue_len; -- 2.7.4
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> --- dlls/winex11.drv/winex11.drv.spec | 1 + dlls/winex11.drv/x11drv_main.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index 614f0b9..c833edb 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -57,6 +57,7 @@ # Desktop @ cdecl wine_create_desktop(long long) X11DRV_create_desktop +@ cdecl wine_notify_activity() X11DRV_notify_activity # System tray @ cdecl wine_notify_icon(long ptr) diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 4654556..0dbd4f6 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -739,3 +739,15 @@ BOOL CDECL X11DRV_SystemParametersInfo( UINT action, UINT int_param, void *ptr_p } return FALSE; /* let user32 handle it */ } + +/*********************************************************************** + * wine_notify_activity (X11DRV.@) + * + * Notify the display server that activity has occurred, e.g. to wake up + * the display and reset any power management related timeouts. + */ +void CDECL X11DRV_notify_activity(void) +{ + XResetScreenSaver( gdi_display ); + XFlush( gdi_display ); +} -- 2.7.4
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> --- dlls/winemac.drv/macdrv_main.c | 12 ++++++++++++ dlls/winemac.drv/winemac.drv.spec | 3 +++ 2 files changed, 15 insertions(+) diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c index 491ab06..ea0beec 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -451,3 +451,15 @@ BOOL CDECL macdrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr_p } return FALSE; } + +/*********************************************************************** + * wine_notify_activity (MACDRV.@) + * + * Notify the display server that activity has occurred, e.g. to wake up + * the display and reset any power management related timeouts. + */ +void CDECL macdrv_notify_activity(void) +{ + static IOPMAssertionID assertion; + IOPMAssertionDeclareUserActivity(CFSTR("Wine user input"), kIOPMUserActiveLocal, &assertion); +} diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec index 6fa723a..9658fad 100644 --- a/dlls/winemac.drv/winemac.drv.spec +++ b/dlls/winemac.drv/winemac.drv.spec @@ -45,6 +45,9 @@ @ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) macdrv_WindowPosChanged @ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) macdrv_WindowPosChanging +# Desktop +@ cdecl wine_notify_activity() macdrv_notify_activity + # System tray @ cdecl wine_notify_icon(long ptr) -- 2.7.4
This prevents display sleep and/or wakes a sleeping display, but doesn't prevent the screensaver from kicking in. We don't know why and don't see any other suitable API, so: Signed-off-by: Ken Thomases <ken(a)codeweavers.com>
Zebediah Figura <zfigura(a)codeweavers.com> writes:
@@ -661,6 +665,11 @@ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPAR } return 0;
+ case WM_WINE_NOTIFY_ACTIVITY: + if (wine_notify_activity) + wine_notify_activity(); + return 0; + default: return DefWindowProcW( hwnd, message, wp, lp ); }
I think it would be cleaner to have the drivers wrap the desktop winproc so that we don't need to define new driver functions. The Android driver already does this. -- Alexandre Julliard julliard(a)winehq.org
On 27/06/18 19:43, Alexandre Julliard wrote:
Zebediah Figura <zfigura(a)codeweavers.com> writes:
@@ -661,6 +665,11 @@ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPAR } return 0;
+ case WM_WINE_NOTIFY_ACTIVITY: + if (wine_notify_activity) + wine_notify_activity(); + return 0; + default: return DefWindowProcW( hwnd, message, wp, lp ); }
I think it would be cleaner to have the drivers wrap the desktop winproc so that we don't need to define new driver functions. The Android driver already does this.
Thanks; I'll look into this.
participants (3)
-
Alexandre Julliard -
Ken Thomases -
Zebediah Figura