[Spice-devel] [PATCH v2] Remove global "allowed" variable
Jonathon Jongsma
jjongsma at redhat.com
Thu Jun 2 15:50:42 UTC 2016
This variable was always the same value as
dispatcher_allows_client_mouse.
---
Alternate proposal.
Within reds_update_client_mouse_allowed(), it's not obvious how
reds->dispatcher_allows_client is relevant, so move the check inside
reds_set_client_mouse_allowed() instead.
server/reds.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/server/reds.c b/server/reds.c
index 827ba2a..5e25d21 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1858,6 +1858,9 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
static void reds_set_client_mouse_allowed(RedsState *reds, int is_client_mouse_allowed, int x_res, int y_res)
{
+ if (!(is_client_mouse_allowed || is_client_mouse_allowed != reds->dispatcher_allows_client_mouse))
+ return;
+
reds->monitor_mode.x_res = x_res;
reds->monitor_mode.y_res = y_res;
reds->dispatcher_allows_client_mouse = is_client_mouse_allowed;
@@ -4193,7 +4196,6 @@ void reds_core_timer_remove(RedsState *reds,
void reds_update_client_mouse_allowed(RedsState *reds)
{
- static int allowed = FALSE;
int allow_now = FALSE;
int x_res = 0;
int y_res = 0;
@@ -4211,10 +4213,7 @@ void reds_update_client_mouse_allowed(RedsState *reds)
}
}
- if (allow_now || allow_now != allowed) {
- allowed = allow_now;
- reds_set_client_mouse_allowed(reds, allowed, x_res, y_res);
- }
+ reds_set_client_mouse_allowed(reds, allow_now, x_res, y_res);
}
static gboolean reds_use_client_monitors_config(RedsState *reds)
--
2.5.5
More information about the Spice-devel
mailing list