[Spice-devel] [vdagent-win PATCH v6] vdagent: Add a comment around WinSta0_DesktopSwitch event usage

Christophe Fergeau cfergeau at redhat.com
Thu Jul 19 09:37:16 UTC 2018


Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Wed, Jul 18, 2018 at 11:52:46AM +0100, Frediano Ziglio wrote:
> Multiple times while I was reading this code was not clear why the
> synchronization of this event was not done in the main event loop.
> Also document why we want to use it not relying just on
> WTSRegisterSessionNotification and WM_WTSSESSION_CHANGE.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  vdagent/vdagent.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> Changes since previous version:
> - fixed some typos.
> 
> diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
> index f3d60c7..89019bb 100644
> --- a/vdagent/vdagent.cpp
> +++ b/vdagent/vdagent.cpp
> @@ -229,6 +229,11 @@ VDAgent::~VDAgent()
>  DWORD WINAPI VDAgent::event_thread_proc(LPVOID param)
>  {
>      VDAgent *agent = static_cast<VDAgent *>(param);
> +    // This event is monitored in a separate thread to avoid losing
> +    // events as the event is signaled with PulseEvent to wake up all
> +    // thread waiting for it.
> +    // This event allows to detect desktop switches which do not
> +    // change sessions like pressing Ctrl-Alt-Delete.
>      HANDLE desktop_event = OpenEvent(SYNCHRONIZE, FALSE, L"WinSta0_DesktopSwitch");
>      if (!desktop_event) {
>          vd_printf("OpenEvent() failed: %lu", GetLastError());
> -- 
> 2.17.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180719/58598c8e/attachment.sig>


More information about the Spice-devel mailing list