[PATCH weston v3 7/8] Convert internal input co-ordinates to double
Daniel Stone
daniel at fooishbar.org
Fri May 4 03:21:59 PDT 2012
Change all client motion handlers to take doubles for co-ordinates,
rather than int32_t.
Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
clients/desktop-shell.c | 4 ++--
clients/dnd.c | 10 +++++-----
clients/eventdemo.c | 4 ++--
clients/flower.c | 2 +-
clients/gears.c | 2 +-
clients/smoke.c | 2 +-
clients/terminal.c | 2 +-
clients/window.c | 12 ++++++------
clients/window.h | 6 +++---
src/compositor.c | 6 +++---
src/compositor.h | 6 +++---
tests/test-client.c | 2 +-
12 files changed, 29 insertions(+), 29 deletions(-)
v3: Split out from 8/8, extended a little.
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index f522478..abe3153 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -233,7 +233,7 @@ panel_redraw_handler(struct widget *widget, void *data)
static int
panel_launcher_enter_handler(struct widget *widget, struct input *input,
- int32_t x, int32_t y, void *data)
+ double x, double y, void *data)
{
struct panel_launcher *launcher = data;
@@ -504,7 +504,7 @@ unlock_dialog_keyboard_focus_handler(struct window *window,
static int
unlock_dialog_widget_enter_handler(struct widget *widget,
struct input *input,
- int32_t x, int32_t y, void *data)
+ double x, double y, void *data)
{
struct unlock_dialog *dialog = data;
diff --git a/clients/dnd.c b/clients/dnd.c
index af90ad1..f6942c3 100644
--- a/clients/dnd.c
+++ b/clients/dnd.c
@@ -218,7 +218,7 @@ dnd_add_item(struct dnd *dnd, struct item *item)
}
static struct item *
-dnd_get_item(struct dnd *dnd, int32_t x, int32_t y)
+dnd_get_item(struct dnd *dnd, double x, double y)
{
struct item *item;
struct rectangle allocation;
@@ -437,7 +437,7 @@ dnd_button_handler(struct widget *widget,
}
static int
-lookup_cursor(struct dnd *dnd, int x, int y)
+lookup_cursor(struct dnd *dnd, double x, double y)
{
struct item *item;
@@ -450,7 +450,7 @@ lookup_cursor(struct dnd *dnd, int x, int y)
static int
dnd_enter_handler(struct widget *widget,
- struct input *input, int32_t x, int32_t y, void *data)
+ struct input *input, double x, double y, void *data)
{
return lookup_cursor(data, x, y);
}
@@ -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);
}
@@ -466,7 +466,7 @@ dnd_motion_handler(struct widget *widget,
static void
dnd_data_handler(struct window *window,
struct input *input,
- int32_t x, int32_t y, const char **types, void *data)
+ double x, double y, const char **types, void *data)
{
struct dnd *dnd = data;
diff --git a/clients/eventdemo.c b/clients/eventdemo.c
index 3fe8ea7..89e6b9e 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 a91513f..061f237 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 4392b8b..dce0cf8 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/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 742525c..cb6fe40 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 d6a9284..0522af7 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -178,7 +178,7 @@ struct input {
int current_cursor;
uint32_t modifiers;
uint32_t pointer_enter_serial;
- int32_t sx, sy;
+ double sx, sy;
struct wl_list link;
struct widget *focus_widget;
@@ -1204,7 +1204,7 @@ window_show_frame_menu(struct window *window,
static int
frame_enter_handler(struct widget *widget,
- struct input *input, int32_t x, int32_t y, void *data)
+ struct input *input, double x, double y, void *data)
{
return frame_get_pointer_image_for_location(data, input);
}
@@ -1212,7 +1212,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);
}
@@ -1308,7 +1308,7 @@ frame_destroy(struct frame *frame)
static void
input_set_focus_widget(struct input *input, struct widget *focus,
- int32_t x, int32_t y)
+ double x, double y)
{
struct widget *old, *widget;
int pointer = POINTER_LEFT_PTR;
@@ -2328,7 +2328,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;
@@ -2340,7 +2340,7 @@ menu_motion_handler(struct widget *widget,
static int
menu_enter_handler(struct widget *widget,
- struct input *input, int32_t x, int32_t y, void *data)
+ struct input *input, double x, double y, void *data)
{
struct menu *menu = data;
diff --git a/clients/window.h b/clients/window.h
index eb44020..0b4f192 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -165,7 +165,7 @@ typedef void (*window_keyboard_focus_handler_t)(struct window *window,
typedef void (*window_data_handler_t)(struct window *window,
struct input *input,
- int32_t x, int32_t y,
+ double x, double y,
const char **types,
void *data);
@@ -182,12 +182,12 @@ typedef void (*widget_redraw_handler_t)(struct widget *widget, void *data);
typedef int (*widget_enter_handler_t)(struct widget *widget,
struct input *input,
- int32_t x, int32_t y, void *data);
+ double x, double y, void *data);
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,
uint32_t button, uint32_t is_down,
diff --git a/src/compositor.c b/src/compositor.c
index 484f9b6..190a585 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1553,7 +1553,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;
@@ -1769,7 +1769,7 @@ notify_key(struct wl_input_device *device,
WL_EXPORT void
notify_pointer_focus(struct wl_input_device *device,
- struct weston_output *output, int32_t x, int32_t y)
+ struct weston_output *output, double x, double y)
{
struct weston_input_device *wd = (struct weston_input_device *) device;
struct weston_compositor *compositor = wd->compositor;
@@ -1917,7 +1917,7 @@ touch_set_focus(struct weston_input_device *device,
*/
WL_EXPORT void
notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,
- int x, int y, int touch_type)
+ double x, double y, int touch_type)
{
struct weston_input_device *wd = (struct weston_input_device *) device;
struct weston_compositor *ec = wd->compositor;
diff --git a/src/compositor.h b/src/compositor.h
index d03b471..d3e7c4c 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -421,7 +421,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, uint32_t is_down);
@@ -435,14 +435,14 @@ notify_key(struct wl_input_device *device,
void
notify_pointer_focus(struct wl_input_device *device,
struct weston_output *output,
- int32_t x, int32_t y);
+ double x, double y);
void
notify_keyboard_focus(struct wl_input_device *device, struct wl_array *keys);
void
notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,
- int x, int y, int touch_type);
+ double x, double y, int touch_type);
void
weston_layer_init(struct weston_layer *layer, struct wl_list *below);
diff --git a/tests/test-client.c b/tests/test-client.c
index 106ed1e..4b03fa6 100644
--- a/tests/test-client.c
+++ b/tests/test-client.c
@@ -37,7 +37,7 @@ struct display {
struct input {
struct wl_input_device *input_device;
- int32_t x, y;
+ double x, y;
uint32_t button_mask;
struct surface *pointer_focus;
struct surface *keyboard_focus;
--
1.7.10
More information about the wayland-devel
mailing list