wdi.InputProcess = $.spcExtend(wdi.EventObject.prototype, { clientGui: null, spiceConnection: null, init: function(c) { this.superInit(); this.clientGui = c.clientGui; this.spiceConnection = c.spiceConnection; }, process: function(spiceMessage) { switch (spiceMessage.messageType) { case wdi.SpiceVars.SPICE_MSG_INPUTS_MOUSE_MOTION_ACK: this.clientGui.motion_ack(); break; } }, send: function(data, type) { var packet, scanCodes, i; if(type == 'mousemove') { packet = new wdi.SpiceMessage({ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_POSITION, channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS, args: new wdi.RedcMousePosition({ x:data[1][0]+wdi.VirtualMouse.hotspot.x, y:data[1][1]+wdi.VirtualMouse.hotspot.y, buttons_state:data[1][2], display_id:0 }) }); this.spiceConnection.send(packet); } else if(type == 'mousedown') { packet = new wdi.SpiceMessage({ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_PRESS, channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS, args: new wdi.RedcMousePress({ button_id:data[1]+1, buttons_state:1<