diff options
author | Jonathon Jongsma <jjongsma@redhat.com> | 2015-01-27 14:20:08 -0600 |
---|---|---|
committer | Fabiano FidĂȘncio <fidencio@redhat.com> | 2015-02-23 23:00:45 +0100 |
commit | a431c0aca3cc2d295404c9aa94b1e788ee2b563f (patch) | |
tree | 5228f673a34c76ece3935c985d41911c33ffecd0 | |
parent | aa3ea9592fd9d2a72cf1367f38725d5ac35c6aca (diff) | |
download | spice-a431c0aca3cc2d295404c9aa94b1e788ee2b563f.tar.gz spice-a431c0aca3cc2d295404c9aa94b1e788ee2b563f.tar.xz spice-a431c0aca3cc2d295404c9aa94b1e788ee2b563f.zip |
Move agent_mouse to RedsState struct
Required adding a RedsState arg to reds_get_agent_mouse()
-rw-r--r-- | server/inputs-channel.c | 8 | ||||
-rw-r--r-- | server/reds-private.h | 2 | ||||
-rw-r--r-- | server/reds.c | 10 | ||||
-rw-r--r-- | server/reds.h | 2 |
4 files changed, 12 insertions, 10 deletions
diff --git a/server/inputs-channel.c b/server/inputs-channel.c index b0beb4f5..fd6a3ecd 100644 --- a/server/inputs-channel.c +++ b/server/inputs-channel.c @@ -360,8 +360,8 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui if (reds_get_mouse_mode(reds) != SPICE_MOUSE_MODE_CLIENT) { break; } - spice_assert((reds_get_agent_mouse() && reds_has_vdagent(reds)) || tablet); - if (!reds_get_agent_mouse() || !reds_has_vdagent(reds)) { + spice_assert((reds_get_agent_mouse(reds) && reds_has_vdagent(reds)) || tablet); + if (!reds_get_agent_mouse(reds) || !reds_has_vdagent(reds)) { SpiceTabletInterface *sif; sif = SPICE_CONTAINEROF(tablet->base.sif, SpiceTabletInterface, base); sif->position(tablet, pos->x, pos->y, RED_MOUSE_STATE_TO_LOCAL(pos->buttons_state)); @@ -384,7 +384,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui dz = 1; } if (reds_get_mouse_mode(reds) == SPICE_MOUSE_MODE_CLIENT) { - if (reds_get_agent_mouse() && reds_has_vdagent(reds)) { + if (reds_get_agent_mouse(reds) && reds_has_vdagent(reds)) { inputs_channel->mouse_state.buttons = RED_MOUSE_BUTTON_STATE_TO_AGENT(mouse_press->buttons_state) | (dz == -1 ? VD_AGENT_UBUTTON_MASK : 0) | @@ -406,7 +406,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui case SPICE_MSGC_INPUTS_MOUSE_RELEASE: { SpiceMsgcMouseRelease *mouse_release = message; if (reds_get_mouse_mode(reds) == SPICE_MOUSE_MODE_CLIENT) { - if (reds_get_agent_mouse() && reds_has_vdagent(reds)) { + if (reds_get_agent_mouse(reds) && reds_has_vdagent(reds)) { inputs_channel->mouse_state.buttons = RED_MOUSE_BUTTON_STATE_TO_AGENT(mouse_release->buttons_state); reds_handle_agent_mouse_event(reds, &inputs_channel->mouse_state); diff --git a/server/reds-private.h b/server/reds-private.h index 115719e2..58342c7d 100644 --- a/server/reds-private.h +++ b/server/reds-private.h @@ -205,6 +205,8 @@ struct RedsState { spice_image_compression_t image_compression; spice_wan_compression_t jpeg_state; spice_wan_compression_t zlib_glz_state; + + gboolean agent_mouse; }; #endif diff --git a/server/reds.c b/server/reds.c index 6b72701f..9e4cbc3b 100644 --- a/server/reds.c +++ b/server/reds.c @@ -91,7 +91,6 @@ SpiceCoreInterface *core = NULL; static pthread_mutex_t *lock_cs; static long *lock_count; -int agent_mouse = TRUE; int agent_copypaste = TRUE; int agent_file_xfer = TRUE; static bool exit_on_disconnect = FALSE; @@ -526,9 +525,9 @@ static void reds_set_mouse_mode(RedsState *reds, uint32_t mode) main_channel_push_mouse_mode(reds->main_channel, reds->mouse_mode, reds->is_client_mouse_allowed); } -int reds_get_agent_mouse(void) +int reds_get_agent_mouse(RedsState *reds) { - return agent_mouse; + return reds->agent_mouse; } static void reds_update_mouse_mode(RedsState *reds) @@ -536,7 +535,7 @@ static void reds_update_mouse_mode(RedsState *reds) int allowed = 0; int qxl_count = red_dispatcher_qxl_count(); - if ((agent_mouse && reds->vdagent) || + if ((reds->agent_mouse && reds->vdagent) || ((reds->inputs_channel && inputs_channel_has_tablet(reds->inputs_channel)) && qxl_count == 1)) { allowed = reds->dispatcher_allows_client_mouse; @@ -3319,6 +3318,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void) reds->image_compression = SPICE_IMAGE_COMPRESS_AUTO_GLZ; reds->jpeg_state = SPICE_WAN_COMPRESSION_AUTO; reds->zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO; + reds->agent_mouse = TRUE; return reds; } @@ -3681,7 +3681,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_playback_compression(SpiceServer *s, int SPICE_GNUC_VISIBLE int spice_server_set_agent_mouse(SpiceServer *s, int enable) { spice_assert(reds == s); - agent_mouse = enable; + s->agent_mouse = enable; reds_update_mouse_mode(reds); return 0; } diff --git a/server/reds.h b/server/reds.h index c9ffa30d..da305017 100644 --- a/server/reds.h +++ b/server/reds.h @@ -61,7 +61,7 @@ void reds_set_client_mouse_allowed(RedsState *reds, void reds_register_channel(RedsState *reds, RedChannel *channel); void reds_unregister_channel(RedsState *reds, RedChannel *channel); int reds_get_mouse_mode(RedsState *reds); // used by inputs_channel -int reds_get_agent_mouse(void); // used by inputs_channel +int reds_get_agent_mouse(RedsState *reds); // used by inputs_channel int reds_has_vdagent(RedsState *reds); // used by inputs channel void reds_handle_agent_mouse_event(RedsState *reds, const VDAgentMouseState *mouse_state); // used by inputs_channel |