[vdagent-win PATCH v4 15/19] Avoids declaring _system_version member

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The check can be done a single time, no reason to cache
supported_system_version() value.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 vdagent/vdagent.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index f25f9f3..631f27c 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -127,7 +127,6 @@ private:
     HWND _hwnd_next_viewer;
     PCLIPBOARD_OP _add_clipboard_listener;
     PCLIPBOARD_OP _remove_clipboard_listener;
-    int _system_version;
     clipboard_owner_t _clipboard_owner;
     DWORD _clipboard_tick;
     VDAgentMouseState _new_mouse = {};
@@ -208,7 +207,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);
@@ -271,7 +269,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) {
         HMODULE _user_lib = GetModuleHandle(L"User32");
         if (!_user_lib) {
             vd_printf("GetModuleHandle failed %lu", GetLastError());
@@ -435,7 +433,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);
@@ -448,7 +446,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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]