[Spice-devel] [spice-xpi 1/4] Add nsPluginInstance::SendBool

Christophe Fergeau cfergeau at redhat.com
Mon Mar 5 05:33:33 PST 2012


::SendVal will not send messages when the value is 0, which is not
what is expected when sending a boolean value.
---
 SpiceXPI/src/plugin/plugin.cpp |    6 ++++++
 SpiceXPI/src/plugin/plugin.h   |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
index 2860d5e..cfa70cd 100644
--- a/SpiceXPI/src/plugin/plugin.cpp
+++ b/SpiceXPI/src/plugin/plugin.cpp
@@ -515,6 +515,12 @@ void nsPluginInstance::SendValue(uint32_t id, uint32_t value)
     WriteToPipe(&msg, sizeof(msg));
 }
 
+void nsPluginInstance::SendBool(uint32_t id, bool value)
+{
+    ControllerValue msg = { {id, sizeof(msg)}, value };
+    WriteToPipe(&msg, sizeof(msg));
+}
+
 void nsPluginInstance::SendStr(uint32_t id, const char *str)
 {
     if (!strlen(str))
diff --git a/SpiceXPI/src/plugin/plugin.h b/SpiceXPI/src/plugin/plugin.h
index 7bd1e44..3b17a98 100644
--- a/SpiceXPI/src/plugin/plugin.h
+++ b/SpiceXPI/src/plugin/plugin.h
@@ -170,6 +170,7 @@ private:
     void SendValue(uint32_t id, uint32_t value);
     void SendStr(uint32_t id, const char *str);
     void SendWStr(uint32_t id, const wchar_t *str);
+    void SendBool(uint32_t id, bool value);
     void CallOnDisconnected(int code);
   
 private:
-- 
1.7.7.6



More information about the Spice-devel mailing list