aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cocoa.m2
-rw-r--r--sdl.c4
-rw-r--r--vl.c2
-rw-r--r--vnc.c4
4 files changed, 6 insertions, 6 deletions
diff --git a/cocoa.m b/cocoa.m
index 8d3633616..fe139526a 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -40,7 +40,7 @@
#define cgrect(nsrect) (*(CGRect *)&(nsrect))
#define COCOA_MOUSE_EVENT \
if (isTabletEnabled) { \
- kbd_mouse_event((int)(p.x * 0x7FFF / screen.width), (int)((screen.height - p.y) * 0x7FFF / screen.height), 0, buttons); \
+ kbd_mouse_event((int)(p.x * 0x7FFF / (screen.width - 1)), (int)((screen.height - p.y) * 0x7FFF / (screen.height - 1)), 0, buttons); \
} else if (isMouseGrabed) { \
kbd_mouse_event((int)[event deltaX], (int)[event deltaY], 0, buttons); \
} else { \
diff --git a/sdl.c b/sdl.c
index edd173e06..1509397f1 100644
--- a/sdl.c
+++ b/sdl.c
@@ -312,8 +312,8 @@ static void sdl_send_mouse_event(int dz)
}
SDL_GetMouseState(&dx, &dy);
- dx = dx * 0x7FFF / width;
- dy = dy * 0x7FFF / height;
+ dx = dx * 0x7FFF / (width - 1);
+ dy = dy * 0x7FFF / (height - 1);
} else if (absolute_enabled) {
sdl_show_cursor();
absolute_enabled = 0;
diff --git a/vl.c b/vl.c
index baa989144..5b9e4ce7a 100644
--- a/vl.c
+++ b/vl.c
@@ -588,7 +588,7 @@ void kbd_mouse_event(int dx, int dy, int dz, int buttons_state)
if (qemu_put_mouse_event_current->qemu_put_mouse_event_absolute)
width = 0x7fff;
else
- width = graphic_width;
+ width = graphic_width - 1;
mouse_event(mouse_event_opaque,
width - dy, dx, dz, buttons_state);
} else
diff --git a/vnc.c b/vnc.c
index 91c507e8a..2179d38d0 100644
--- a/vnc.c
+++ b/vnc.c
@@ -879,8 +879,8 @@ static void pointer_event(VncState *vs, int button_mask, int x, int y)
dz = 1;
if (vs->absolute) {
- kbd_mouse_event(x * 0x7FFF / vs->ds->width,
- y * 0x7FFF / vs->ds->height,
+ kbd_mouse_event(x * 0x7FFF / (vs->ds->width - 1),
+ y * 0x7FFF / (vs->ds->height - 1),
dz, buttons);
} else if (vs->has_pointer_type_change) {
x -= 0x7FFF;