mingw-spice-vdagent/0033-Avoid-declaring-_system_version-member.patch
2023-04-04 16:01:10 +00:00

65 lines
2.4 KiB
Diff

From e9421d09b82c7c1ff284175d335b23303ac80e69 Mon Sep 17 00:00:00 2001
From: Frediano Ziglio <fziglio@redhat.com>
Date: Sat, 30 Jun 2018 09:05:40 +0100
Subject: [PATCH 33/43] Avoid declaring _system_version member
The check can be done a single time, no reason to cache
supported_system_version() value.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
---
vdagent/vdagent.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index fc8e727..95783c1 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -128,7 +128,6 @@ private:
HMODULE _user_lib;
PCLIPBOARD_OP _add_clipboard_listener;
PCLIPBOARD_OP _remove_clipboard_listener;
- int _system_version;
clipboard_owner_t _clipboard_owner;
DWORD _clipboard_tick;
VDAgentMouseState _new_mouse = {};
@@ -210,7 +209,6 @@ VDAgent::VDAgent()
TCHAR log_path[MAX_PATH];
TCHAR temp_path[MAX_PATH];
- _system_version = supported_system_version();
if (GetTempPath(MAX_PATH, temp_path)) {
swprintf_s(log_path, MAX_PATH, VD_AGENT_LOG_PATH, temp_path);
_log = VDLog::get(log_path);
@@ -270,7 +268,7 @@ bool VDAgent::run()
if (!SetProcessShutdownParameters(0x100, 0)) {
vd_printf("SetProcessShutdownParameters failed %lu", GetLastError());
}
- if (_system_version == SYS_VER_WIN_7_CLASS) {
+ if (supported_system_version() == SYS_VER_WIN_7_CLASS) {
_user_lib = LoadLibrary(L"User32.dll");
if (!_user_lib) {
vd_printf("LoadLibrary failed %lu", GetLastError());
@@ -447,7 +445,7 @@ void VDAgent::input_desktop_message_loop()
if (!WTSRegisterSessionNotification(_hwnd, NOTIFY_FOR_ALL_SESSIONS)) {
vd_printf("WTSRegisterSessionNotification() failed: %lu", GetLastError());
}
- if (_system_version == SYS_VER_WIN_7_CLASS) {
+ if (_add_clipboard_listener) {
_add_clipboard_listener(_hwnd);
} else {
_hwnd_next_viewer = SetClipboardViewer(_hwnd);
@@ -460,7 +458,7 @@ void VDAgent::input_desktop_message_loop()
KillTimer(_hwnd, VD_TIMER_ID);
_pending_input = false;
}
- if (_system_version == SYS_VER_WIN_7_CLASS) {
+ if (_remove_clipboard_listener) {
_remove_clipboard_listener(_hwnd);
} else {
ChangeClipboardChain(_hwnd, _hwnd_next_viewer);
--
2.17.1