[PATCH weston 3/3] Convert input co-ordinates from uint32 to signed_24_8
Daniel Stone
daniel at fooishbar.org
Tue May 1 12:30:40 PDT 2012
For greater precision.
Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
clients/dnd.c | 2 +-
clients/eventdemo.c | 4 ++--
clients/flower.c | 2 +-
clients/gears.c | 2 +-
clients/simple-touch.c | 8 ++++----
clients/smoke.c | 2 +-
clients/terminal.c | 2 +-
clients/window.c | 16 ++++++++--------
clients/window.h | 2 +-
src/compositor-wayland.c | 4 ++--
src/compositor.c | 3 +--
src/compositor.h | 2 +-
src/shell.c | 2 +-
src/util.c | 2 +-
tests/test-client.c | 8 ++++----
15 files changed, 30 insertions(+), 31 deletions(-)
diff --git a/clients/dnd.c b/clients/dnd.c
index 3e262ff..56ccf26 100644
--- a/clients/dnd.c
+++ b/clients/dnd.c
@@ -458,7 +458,7 @@ dnd_enter_handler(struct widget *widget,
static int
dnd_motion_handler(struct widget *widget,
struct input *input, uint32_t time,
- int32_t x, int32_t y, void *data)
+ double x, double y, void *data)
{
return lookup_cursor(data, x, y);
}
diff --git a/clients/eventdemo.c b/clients/eventdemo.c
index 6755b16..e7904e6 100644
--- a/clients/eventdemo.c
+++ b/clients/eventdemo.c
@@ -238,12 +238,12 @@ button_handler(struct widget *widget, struct input *input, uint32_t time,
*/
static int
motion_handler(struct widget *widget, struct input *input, uint32_t time,
- int32_t x, int32_t y, void *data)
+ double x, double y, void *data)
{
struct eventdemo *e = data;
if (log_motion) {
- printf("motion time: %d, x: %d, y: %d\n", time, x, y);
+ printf("motion time: %d, x: %f, y: %f\n", time, x, y);
}
if (x > e->x && x < e->x + e->w)
diff --git a/clients/flower.c b/clients/flower.c
index 6409acf..afebc9e 100644
--- a/clients/flower.c
+++ b/clients/flower.c
@@ -134,7 +134,7 @@ redraw_handler(struct widget *widget, void *data)
static int
motion_handler(struct widget *widget, struct input *input,
- uint32_t time, int32_t x, int32_t y, void *data)
+ uint32_t time, double x, double y, void *data)
{
return POINTER_HAND1;
}
diff --git a/clients/gears.c b/clients/gears.c
index c432bc5..66f55cf 100644
--- a/clients/gears.c
+++ b/clients/gears.c
@@ -223,7 +223,7 @@ static const struct wl_callback_listener listener = {
static int
motion_handler(struct widget *widget, struct input *input,
- uint32_t time, int32_t x, int32_t y, void *data)
+ uint32_t time, double x, double y, void *data)
{
struct gears *gears = data;
int offset_x, offset_y;
diff --git a/clients/simple-touch.c b/clients/simple-touch.c
index 6da8aa6..4e24538 100644
--- a/clients/simple-touch.c
+++ b/clients/simple-touch.c
@@ -103,7 +103,7 @@ struct wl_shm_listener shm_listenter = {
static void
input_device_handle_motion(void *data, struct wl_input_device *input_device,
- uint32_t time, int32_t sx, int32_t sy)
+ uint32_t time, double sx, double sy)
{
}
@@ -132,7 +132,7 @@ static void
input_device_handle_pointer_enter(void *data,
struct wl_input_device *input_device,
uint32_t serial, struct wl_surface *surface,
- int32_t sx, int32_t sy)
+ double sx, double sy)
{
}
@@ -197,7 +197,7 @@ input_device_handle_touch_down(void *data,
struct wl_input_device *wl_input_device,
uint32_t serial, uint32_t time,
struct wl_surface *surface,
- int32_t id, int32_t x, int32_t y)
+ int32_t id, double x, double y)
{
struct touch *touch = data;
@@ -215,7 +215,7 @@ static void
input_device_handle_touch_motion(void *data,
struct wl_input_device *wl_input_device,
uint32_t time,
- int32_t id, int32_t x, int32_t y)
+ int32_t id, double x, double y)
{
struct touch *touch = data;
diff --git a/clients/smoke.c b/clients/smoke.c
index 2ab171f..ae54022 100644
--- a/clients/smoke.c
+++ b/clients/smoke.c
@@ -230,7 +230,7 @@ redraw_handler(struct widget *widget, void *data)
static int
smoke_motion_handler(struct widget *widget, struct input *input,
- uint32_t time, int32_t x, int32_t y, void *data)
+ uint32_t time, double x, double y, void *data)
{
struct smoke *smoke = data;
int i, i0, i1, j, j0, j1, k, d = 5;
diff --git a/clients/terminal.c b/clients/terminal.c
index b8d3740..57e8030 100644
--- a/clients/terminal.c
+++ b/clients/terminal.c
@@ -2237,7 +2237,7 @@ button_handler(struct widget *widget,
static int
motion_handler(struct widget *widget,
struct input *input, uint32_t time,
- int32_t x, int32_t y, void *data)
+ double x, double y, void *data)
{
struct terminal *terminal = data;
diff --git a/clients/window.c b/clients/window.c
index 2d6b364..831f061 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1187,7 +1187,7 @@ frame_enter_handler(struct widget *widget,
static int
frame_motion_handler(struct widget *widget,
struct input *input, uint32_t time,
- int32_t x, int32_t y, void *data)
+ double x, double y, void *data)
{
return frame_get_pointer_image_for_location(data, input);
}
@@ -1318,7 +1318,7 @@ input_set_focus_widget(struct input *input, struct widget *focus,
static void
input_handle_motion(void *data, struct wl_input_device *input_device,
- uint32_t time, int32_t sx, int32_t sy)
+ uint32_t time, double sx, double sy)
{
struct input *input = data;
struct window *window = input->pointer_focus;
@@ -1449,7 +1449,7 @@ static void
input_handle_pointer_enter(void *data,
struct wl_input_device *input_device,
uint32_t serial, struct wl_surface *surface,
- int32_t sx, int32_t sy)
+ double sx, double sy)
{
struct input *input = data;
struct window *window;
@@ -1547,7 +1547,7 @@ input_handle_touch_down(void *data,
struct wl_input_device *wl_input_device,
uint32_t serial, uint32_t time,
struct wl_surface *surface,
- int32_t id, int32_t x, int32_t y)
+ int32_t id, double x, double y)
{
}
@@ -1561,7 +1561,7 @@ input_handle_touch_up(void *data,
static void
input_handle_touch_motion(void *data,
struct wl_input_device *wl_input_device,
- uint32_t time, int32_t id, int32_t x, int32_t y)
+ uint32_t time, int32_t id, double x, double y)
{
}
@@ -1684,7 +1684,7 @@ data_device_data_offer(void *data,
static void
data_device_enter(void *data, struct wl_data_device *data_device,
uint32_t serial, struct wl_surface *surface,
- int32_t x, int32_t y, struct wl_data_offer *offer)
+ double x, double y, struct wl_data_offer *offer)
{
struct input *input = data;
struct window *window;
@@ -1716,7 +1716,7 @@ data_device_leave(void *data, struct wl_data_device *data_device)
static void
data_device_motion(void *data, struct wl_data_device *data_device,
- uint32_t time, int32_t x, int32_t y)
+ uint32_t time, double x, double y)
{
struct input *input = data;
struct window *window = input->pointer_focus;
@@ -2300,7 +2300,7 @@ menu_set_item(struct menu *menu, int sy)
static int
menu_motion_handler(struct widget *widget,
struct input *input, uint32_t time,
- int32_t x, int32_t y, void *data)
+ double x, double y, void *data)
{
struct menu *menu = data;
diff --git a/clients/window.h b/clients/window.h
index 8126867..6bdffce 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -187,7 +187,7 @@ typedef void (*widget_leave_handler_t)(struct widget *widget,
struct input *input, void *data);
typedef int (*widget_motion_handler_t)(struct widget *widget,
struct input *input, uint32_t time,
- int32_t x, int32_t y, void *data);
+ double x, double y, void *data);
typedef void (*widget_button_handler_t)(struct widget *widget,
struct input *input, uint32_t time,
int button, int is_down, void *data);
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 6b804f3..203b829 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -508,7 +508,7 @@ static const struct wl_output_listener output_listener = {
/* parent input interface */
static void
input_handle_motion(void *data, struct wl_input_device *input_device,
- uint32_t time, int32_t sx, int32_t sy)
+ uint32_t time, double sx, double sy)
{
struct wayland_input *input = data;
struct wayland_compositor *c = input->compositor;
@@ -553,7 +553,7 @@ static void
input_handle_pointer_enter(void *data,
struct wl_input_device *input_device,
uint32_t time, struct wl_surface *surface,
- int32_t sx, int32_t sy)
+ double sx, double sy)
{
struct wayland_input *input = data;
struct wayland_output *output;
diff --git a/src/compositor.c b/src/compositor.c
index efde5b9..1646905 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -593,7 +593,6 @@ weston_device_repick(struct wl_input_device *device)
device->x, device->y,
&device->current_x,
&device->current_y);
-
if (&surface->surface != device->current) {
interface = device->pointer_grab->interface;
interface->focus(device->pointer_grab, &surface->surface,
@@ -1521,7 +1520,7 @@ weston_input_update_drag_surface(struct wl_input_device *input_device,
int dx, int dy);
WL_EXPORT void
-notify_motion(struct wl_input_device *device, uint32_t time, int x, int y)
+notify_motion(struct wl_input_device *device, uint32_t time, double x, double y)
{
struct weston_output *output;
const struct wl_pointer_grab_interface *interface;
diff --git a/src/compositor.h b/src/compositor.h
index b4d648d..a548f18 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -413,7 +413,7 @@ weston_surface_draw(struct weston_surface *es,
void
notify_motion(struct wl_input_device *device,
- uint32_t time, int x, int y);
+ uint32_t time, double x, double y);
void
notify_button(struct wl_input_device *device,
uint32_t time, int32_t button, int32_t is_down);
diff --git a/src/shell.c b/src/shell.c
index c9898fc..b531917 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -2380,7 +2380,7 @@ switcher_destroy(struct switcher *switcher, uint32_t time)
static void
switcher_key(struct wl_keyboard_grab *grab,
- uint32_t time, uint32_t key, uint32_t is_down)
+ uint32_t time, uint32_t key, int32_t is_down)
{
struct switcher *switcher = container_of(grab, struct switcher, grab);
struct weston_input_device *device =
diff --git a/src/util.c b/src/util.c
index 711c04a..f459094 100644
--- a/src/util.c
+++ b/src/util.c
@@ -249,7 +249,7 @@ struct binding_keyboard_grab {
static void
binding_key(struct wl_keyboard_grab *grab,
- uint32_t time, uint32_t key, uint32_t is_down)
+ uint32_t time, uint32_t key, int32_t is_down)
{
struct binding_keyboard_grab *b =
container_of(grab, struct binding_keyboard_grab, grab);
diff --git a/tests/test-client.c b/tests/test-client.c
index 30668ac..979ba34 100644
--- a/tests/test-client.c
+++ b/tests/test-client.c
@@ -55,7 +55,7 @@ struct surface {
static void
input_handle_motion(void *data, struct wl_input_device *input_device,
- uint32_t time, int32_t x, int32_t y)
+ uint32_t time, double x, double y)
{
struct input *input = data;
@@ -95,7 +95,7 @@ static void
input_handle_pointer_enter(void *data,
struct wl_input_device *input_device,
uint32_t serial, struct wl_surface *surface,
- int32_t x, int32_t y)
+ double x, double y)
{
struct input *input = data;
@@ -142,7 +142,7 @@ input_handle_touch_down(void *data,
struct wl_input_device *wl_input_device,
uint32_t serial, uint32_t time,
struct wl_surface *surface,
- int32_t id, int32_t x, int32_t y)
+ int32_t id, double x, double y)
{
}
@@ -156,7 +156,7 @@ input_handle_touch_up(void *data,
static void
input_handle_touch_motion(void *data,
struct wl_input_device *wl_input_device,
- uint32_t time, int32_t id, int32_t x, int32_t y)
+ uint32_t time, int32_t id, double x, double y)
{
}
--
1.7.10
More information about the wayland-devel
mailing list