[Spice-devel] [PATCH spice-xpi] add support for DisableEffects and ColorDepth

Hans de Goede hdegoede at redhat.com
Mon Apr 2 01:40:56 PDT 2012


ACK.

On 04/02/2012 09:42 AM, Yonit Halperin wrote:
> rhbz #747313
>
> Signed-off-by: Yonit Halperin<yhalperi at redhat.com>
> ---
>   SpiceXPI/src/plugin/nsISpicec.idl        |    2 ++
>   SpiceXPI/src/plugin/nsScriptablePeer.cpp |   16 +++++++++++++++-
>   SpiceXPI/src/plugin/nsScriptablePeer.h   |    2 ++
>   SpiceXPI/src/plugin/plugin.cpp           |   26 ++++++++++++++++++++++++++
>   SpiceXPI/src/plugin/plugin.h             |   10 ++++++++++
>   data/test.html                           |   12 ++++++++++++
>   spice-protocol                           |    2 +-
>   7 files changed, 68 insertions(+), 2 deletions(-)
>
> diff --git a/SpiceXPI/src/plugin/nsISpicec.idl b/SpiceXPI/src/plugin/nsISpicec.idl
> index 5fc4a29..d3d0699 100644
> --- a/SpiceXPI/src/plugin/nsISpicec.idl
> +++ b/SpiceXPI/src/plugin/nsISpicec.idl
> @@ -61,6 +61,8 @@ interface nsISpicec : nsISupports {
>       attribute unsigned short UsbListenPort;
>       attribute boolean UsbAutoShare;
>       attribute boolean Smartcard;
> +    attribute string ColorDepth;
> +    attribute string DisableEffects;
>
>       void connect();
>       void show();
> diff --git a/SpiceXPI/src/plugin/nsScriptablePeer.cpp b/SpiceXPI/src/plugin/nsScriptablePeer.cpp
> index 394ced8..caab9b7 100644
> --- a/SpiceXPI/src/plugin/nsScriptablePeer.cpp
> +++ b/SpiceXPI/src/plugin/nsScriptablePeer.cpp
> @@ -79,6 +79,8 @@ NPIdentifier ScriptablePluginObject::m_id_no_taskmgr_execution;
>   NPIdentifier ScriptablePluginObject::m_id_send_ctrlaltdel;
>   NPIdentifier ScriptablePluginObject::m_id_usb_listen_port;
>   NPIdentifier ScriptablePluginObject::m_id_usb_auto_share;
> +NPIdentifier ScriptablePluginObject::m_id_color_depth;
> +NPIdentifier ScriptablePluginObject::m_id_disable_effects;
>   NPIdentifier ScriptablePluginObject::m_id_connect;
>   NPIdentifier ScriptablePluginObject::m_id_show;
>   NPIdentifier ScriptablePluginObject::m_id_disconnect;
> @@ -129,6 +131,8 @@ void ScriptablePluginObject::Init()
>       m_id_send_ctrlaltdel = NPN_GetStringIdentifier("SendCtrlAltDelete");
>       m_id_usb_listen_port = NPN_GetStringIdentifier("UsbListenPort");
>       m_id_usb_auto_share = NPN_GetStringIdentifier("UsbAutoShare");
> +    m_id_color_depth = NPN_GetStringIdentifier("ColorDepth");
> +    m_id_disable_effects = NPN_GetStringIdentifier("DisableEffects");
>       m_id_connect = NPN_GetStringIdentifier("connect");
>       m_id_show = NPN_GetStringIdentifier("show");
>       m_id_disconnect = NPN_GetStringIdentifier("disconnect");
> @@ -170,7 +174,9 @@ bool ScriptablePluginObject::HasProperty(NPIdentifier name)
>              name == m_id_no_taskmgr_execution ||
>              name == m_id_send_ctrlaltdel ||
>              name == m_id_usb_listen_port ||
> -           name == m_id_usb_auto_share);
> +           name == m_id_usb_auto_share ||
> +           name == m_id_color_depth ||
> +           name == m_id_disable_effects);
>   }
>
>   bool ScriptablePluginObject::GetProperty(NPIdentifier name, NPVariant *result)
> @@ -220,6 +226,10 @@ bool ScriptablePluginObject::GetProperty(NPIdentifier name, NPVariant *result)
>           INT32_TO_NPVARIANT(m_plugin->GetUsbListenPort(), *result);
>       else if (name == m_id_usb_auto_share)
>           BOOLEAN_TO_NPVARIANT(m_plugin->GetUsbAutoShare(), *result);
> +    else if (name == m_id_color_depth)
> +        STRINGZ_TO_NPVARIANT(m_plugin->GetColorDepth(), *result);
> +    else if (name == m_id_disable_effects)
> +        STRINGZ_TO_NPVARIANT(m_plugin->GetDisableEffects(), *result);
>       else
>           return false;
>
> @@ -296,6 +306,10 @@ bool ScriptablePluginObject::SetProperty(NPIdentifier name, const NPVariant *val
>           m_plugin->SetUsbListenPort(val);
>       else if (name == m_id_usb_auto_share)
>           m_plugin->SetUsbAutoShare(boolean);
> +    else if (name == m_id_color_depth)
> +        m_plugin->SetColorDepth(str.c_str());
> +    else if (name == m_id_disable_effects)
> +        m_plugin->SetDisableEffects(str.c_str());
>       else
>           return false;
>
> diff --git a/SpiceXPI/src/plugin/nsScriptablePeer.h b/SpiceXPI/src/plugin/nsScriptablePeer.h
> index 469a05e..44bd53c 100644
> --- a/SpiceXPI/src/plugin/nsScriptablePeer.h
> +++ b/SpiceXPI/src/plugin/nsScriptablePeer.h
> @@ -96,6 +96,8 @@ private:
>       static NPIdentifier m_id_send_ctrlaltdel;
>       static NPIdentifier m_id_usb_listen_port;
>       static NPIdentifier m_id_usb_auto_share;
> +    static NPIdentifier m_id_color_depth;
> +    static NPIdentifier m_id_disable_effects;
>       static NPIdentifier m_id_connect;
>       static NPIdentifier m_id_show;
>       static NPIdentifier m_id_disconnect;
> diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
> index 25a098b..5596609 100644
> --- a/SpiceXPI/src/plugin/plugin.cpp
> +++ b/SpiceXPI/src/plugin/plugin.cpp
> @@ -225,6 +225,8 @@ NPBool nsPluginInstance::init(NPWindow *aWindow)
>       m_dynamic_menu.clear();
>       m_number_of_monitors.clear();
>       m_guest_host_name.clear();
> +    m_color_depth.clear();
> +    m_disable_effects.clear();
>
>       m_fullscreen = PR_FALSE;
>       m_smartcard = PR_FALSE;
> @@ -482,6 +484,28 @@ void nsPluginInstance::SetUsbAutoShare(PRBool aUsbAutoShare)
>       // when fixed in RHEVM
>   }
>
> +/* attribute string ColorDepth; */
> +char *nsPluginInstance::GetColorDepth() const
> +{
> +    return stringCopy(m_color_depth);
> +}
> +
> +void nsPluginInstance::SetColorDepth(const char *aColorDepth)
> +{
> +    m_color_depth = aColorDepth;
> +}
> +
> +/* attribute string DisableEffects; */
> +char *nsPluginInstance::GetDisableEffects() const
> +{
> +    return stringCopy(m_disable_effects);
> +}
> +
> +void nsPluginInstance::SetDisableEffects(const char *aDisableEffects)
> +{
> +    m_disable_effects = aDisableEffects;
> +}
> +
>   void nsPluginInstance::WriteToPipe(const void *data, uint32_t size)
>   {
>       m_external_controller.Write(data, size);
> @@ -668,6 +692,8 @@ void nsPluginInstance::Connect()
>           SendStr(CONTROLLER_CA_FILE, m_trust_store_file.c_str());
>           SendStr(CONTROLLER_HOST_SUBJECT, m_host_subject.c_str());
>           SendStr(CONTROLLER_HOTKEYS, m_hot_keys.c_str());
> +        SendValue(CONTROLLER_COLOR_DEPTH, atoi(m_color_depth.c_str()));
> +        SendStr(CONTROLLER_DISABLE_EFFECTS, m_disable_effects.c_str());
>           SendMsg(CONTROLLER_CONNECT);
>           SendMsg(CONTROLLER_SHOW);
>
> diff --git a/SpiceXPI/src/plugin/plugin.h b/SpiceXPI/src/plugin/plugin.h
> index 42e2a2d..acba031 100644
> --- a/SpiceXPI/src/plugin/plugin.h
> +++ b/SpiceXPI/src/plugin/plugin.h
> @@ -159,7 +159,15 @@ public:
>       /* attribute boolean UsbAutoShare; */
>       PRBool GetUsbAutoShare() const;
>       void SetUsbAutoShare(PRBool aUsbAutoShare);
> +
> +    /* attribute ing color depth; */
> +    char *GetColorDepth() const;
> +    void SetColorDepth(const char *aColorDepth);
>
> +    /* attribute ing disable effects; */
> +    char *GetDisableEffects() const;
> +    void SetDisableEffects(const char *aDisableEffects);
> +
>       NPObject *GetScriptablePeer();
>
>   private:
> @@ -202,6 +210,8 @@ private:
>       PRBool m_no_taskmgr_execution;
>       PRBool m_send_ctrlaltdel;
>       std::map<std::string, std::string>  m_language;
> +    std::string m_color_depth;
> +    std::string m_disable_effects;
>
>       NPObject *m_scriptable_peer;
>       std::string m_tmp_dir;
> diff --git a/data/test.html b/data/test.html
> index 860851f..ff7743b 100644
> --- a/data/test.html
> +++ b/data/test.html
> @@ -114,6 +114,8 @@ function setConnectVars()
>   	if(document.getElementById("UsbListenPortToggled").checked == true) { embed.UsbListenPort = parseInt( document.getElementById("UsbListenPort").value ); } else { embed.UsbListenPort = ""; }
>   	if(document.getElementById("UsbAutoShareToggled").checked == true) { embed.UsbAutoShare = document.getElementById("UsbAutoShare").checked; } else { embed.UsbAutoShare = ""; }
>   	if(document.getElementById("SmartcardToggled").checked == true) { embed.Smartcard = document.getElementById("Smartcard").checked; } else { embed.Smartcard = ""; }
> +	if(document.getElementById("ColorDepthToggled").checked == true) { embed.ColorDepth = document.getElementById("ColorDepth").value; } else { embed.ColorDepth = ""; }
> +	if(document.getElementById("DisableEffectsToggled").checked == true) { embed.DisableEffects = document.getElementById("DisableEffects").value; } else { embed.DisableEffects = ""; }
>   }
>
>   function show()
> @@ -242,6 +244,16 @@ function toggle(checkboxID)
>   <td>  <input id="Smartcard" type="checkbox" /></td>
>   </tr>
>   <tr>
> +<td><input type="checkbox" id="ColorDepthToggled" onclick="toggle('ColorDepthToggled', 'ColorDepth')" /></td>
> +<td>Color Depth:</td>
> +<td>  <input id="ColorDepth" type="text" size="30" disabled /></td>
> +</tr>
> +<tr>
> +<td><input type="checkbox" id="DisableEffectsToggled" onclick="toggle('DisableEffectsToggled', 'DisableEffects')" /></td>
> +<td>Disable Effects:</td>
> +<td>  <input id="DisableEffects" type="text" size="30" disabled /></td>
> +</tr>
> +<tr>
>   <td><input type="checkbox" id="LanguageStringsSectionToggled" onclick="toggle('LanguageStringsSectionToggled', 'LanguageStringsSection')" checked /></td>
>   <td>*Language Strings - section:</td>
>   <td>  <input id="LanguageStringsSection" type="input" size="30" /></td>
> diff --git a/spice-protocol b/spice-protocol
> index d5edafd..8cf92f0 160000
> --- a/spice-protocol
> +++ b/spice-protocol
> @@ -1 +1 @@
> -Subproject commit d5edafd28ab762b1b5f663aec449d3e3743f1184
> +Subproject commit 8cf92f042312e50b2ff186b28356053aeac9e04c


More information about the Spice-devel mailing list