Spice protocol----Input Channel definition

Source: Internet
Author: User

1 Input Channel Definition

Spice input channels primarily control mouse and keyboard operation

1.1 Server---"Client

enum {    spice_msg_inputs_init = 101,    spice_msg_inputs_key_modifiers,    spice_msg_inputs_mouse_motion_ack = 111,    spice_msg_end_inputs};


1.2 Client---"Server

enum {    Spice_msgc_inputs_key_down = 101,    spice_msgc_inputs_key_up,    spice_msgc_inputs_key_modifiers,    Spice_msgc_inputs_key_scancode,    Spice_msgc_inputs_mouse_motion = 111,    spice_msgc_inputs_mouse_position,    spice_msgc_inputs_mouse_press,    Spice_msgc_inputs_mouse_release,    Spice_msgc_end_inputs};


1.3Keyboard message

The spice protocol supports sending keyboard events and synchronizing the keyboard LEDs feature. The client sends a keyboard event spice_msgc_inputs_key_up, Spice_msgc_inputs_key_down message. The key value is indicated by the PC at code. Keyboard indicator synchronization is the sending of spice_msgc_inputs_key_modifiers via the client or the server-side sending of spice_msg_inputs_key_modifiers messages. The status of the keyboard LEDs is saved in these messages. The server can also use Spice_msg_inputs_init messages to send keyboard modifications. This message must be the first received message, and subsequent messages should not be sent.

1.3.1 Keyboard Indicator macro

typedef enumspicekeyboardmodifierflags {    Spice_keyboard_modifier_flags_scroll_lock = (1 << 0),    spice_ Keyboard_modifier_flags_num_lock = (1<< 1),    Spice_keyboard_modifier_flags_caps_lock = (1 << 2),     Spice_keyboard_modifier_flags_mask = 0x7} spicekeyboardmodifierflags;


1.3.2 Client---"Server macro

enum {    Spice_msgc_inputs_key_down = 101,    spice_msgc_inputs_key_up,    spice_msgc_inputs_key_modifiers,    Spice_msgc_inputs_key_scancode,    Spice_msgc_inputs_mouse_motion = 111,    spice_msgc_inputs_mouse_position,    spice_msgc_inputs_mouse_press,    Spice_msgc_inputs_mouse_release,    Spice_msgc_end_inputs};


1.3.3 Server---Client macros

enum {    spice_msg_inputs_init = 101,    spice_msg_inputs_key_modifiers,    spice_msg_inputs_mouse_motion_ ACK = 111,     spice_msg_end_inputs};


1.3.4 Keyboard event-related structures

typedef structspicemsgckeydown {    uint32_t code;} Spicemsgckeydown; typedef structspicemsgckeyup {    uint32_t code;} Spicemsgckeyup; typedef structspicemsgckeymodifiers {    uint32_t modifiers;} Spicemsgckeymodifiers;


1.4 Mouse Messages

SPICE supports two modes of mouse operation: server and client mode. (see section 3.4 for more) in server mode, the client sends a mouse motion message (spice_msgc_inputs_mouse_motion), in client mode, sends a location message (spice_msgc_inputs_mouse_ POSITION). Location messages Save the display location of the client mouse and the ID of the display channel (in redlinkmess.channel_id). In order to prevent mouse movement, the location time is sent frequently, the client responds to Spice_msg_inputs_mouse_motion_ack after receiving each spice_msg_inputs_key_modifiers message. This mechanism allows the client to follow the information of the server and to change the push policy of the event. mouse button events are sent to the server using spice_msgc_inputs_mouse_press and spice_msgc_inputs_mouse_release messages.

1.4.1 mouse button ID

typedef Enumspicemousebutton {    spice_mouse_button_invalid,    spice_mouse_button_left,    spice_mouse_ Button_middle,    spice_mouse_button_right,    spice_mouse_button_up,    spice_mouse_button_down,     SPICE _mouse_button_enum_end}spicemousebutton;


1.4.2 Key Mask

typedef enumspicemousebuttonmask {    Spice_mouse_button_mask_left = (1 <<0),    spice_mouse_button_mask_ Middle = (1<< 1),    spice_mouse_button_mask_right = (1 <<2),     spice_mouse_button_mask_mask = 0x7} Spicemousebuttonmask;


1.4.3 Spicemsgcmousemotion

typedef structspicemsgcmousemotion {    int32_t dx;//mouse move to the x pixel point    int32_t dy;//mouse move moral y pixel point    uint32_t buttons_ state;//The mask for mouse operation. }spicemsgcmousemotion;


1.4.4SpiceMsgcMousePosition

typedef structspicemsgcmouseposition {    uint32_t x;//x coordinates location    uint32_t y;//y coordinates location    uint32_t buttons_state;// Mouse action Mask    uint8_t display_id;//client mouse display id}spicemsgcmouseposition;


1.4.5SpiceMsgcMousePress

typedef structspicemsgcmousepress {    int32_t button;//mouse button ID number    int32_t buttons_state;//Mask for mouse action} spicemsgcmousepress;


1.4.6SpiceMsgcMouseRelease

typedef structspicemsgcmouserelease {    int32_t button;//the ID number of the mouse button    int32_t buttons_state;//Mask for mouse action} Spicemsgcmouserelease;


Spice protocol----Input Channel definition

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.