[Spice-devel] [vdagent-win PATCH v3 09/10] Use enumeration types
Frediano Ziglio
fziglio at redhat.com
Fri Jun 29 07:11:49 UTC 2018
No reasons to allow any possible number.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
vdagent/vdagent.cpp | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index b3e18d9..5462d2d 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -100,10 +100,10 @@ private:
void dispatch_message(VDAgentMessage* msg, uint32_t port);
uint32_t get_clipboard_format(uint32_t type) const;
uint32_t get_clipboard_type(uint32_t format) const;
- enum { owner_none, owner_guest, owner_client };
- void set_clipboard_owner(int new_owner);
- enum { CONTROL_STOP, CONTROL_RESET, CONTROL_DESKTOP_SWITCH, CONTROL_LOGON, CONTROL_CLIPBOARD };
- void set_control_event(int control_command);
+ enum clipboard_owner_t { owner_none, owner_guest, owner_client };
+ void set_clipboard_owner(clipboard_owner_t new_owner);
+ enum control_command_t { CONTROL_STOP, CONTROL_RESET, CONTROL_DESKTOP_SWITCH, CONTROL_LOGON, CONTROL_CLIPBOARD };
+ void set_control_event(control_command_t control_command);
void handle_control_event();
VDIChunk* new_chunk(DWORD bytes = 0);
void enqueue_chunk(VDIChunk* msg);
@@ -334,7 +334,7 @@ bool VDAgent::run()
return true;
}
-void VDAgent::set_control_event(int control_command)
+void VDAgent::set_control_event(control_command_t control_command)
{
MutexLocker lock(_control_mutex);
_control_queue.push(control_command);
@@ -1195,7 +1195,7 @@ uint32_t VDAgent::get_clipboard_type(uint32_t format) const
return 0;
}
-void VDAgent::set_clipboard_owner(int new_owner)
+void VDAgent::set_clipboard_owner(clipboard_owner_t new_owner)
{
// FIXME: Clear requests, clipboard data and state
if (new_owner == owner_none) {
@@ -1460,7 +1460,7 @@ LRESULT CALLBACK VDAgent::wnd_proc(HWND hwnd, UINT message, WPARAM wparam, LPARA
case WM_CLIPBOARDUPDATE:
case WM_DRAWCLIPBOARD:
if (a->_hwnd != GetClipboardOwner()) {
- a->set_clipboard_owner(a->owner_none);
+ a->set_clipboard_owner(owner_none);
a->on_clipboard_grab();
}
if (a->_hwnd_next_viewer) {
--
2.17.1
More information about the Spice-devel
mailing list