Convert internal input co-ordinates to GLfloat

Change all client motion handlers to take GLfloat for co-ordinates,
rather than int32_t.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
dev
Daniel Stone 13 years ago committed by Kristian Høgsberg
parent bd3489b6e1
commit b230a7ee58
  1. 4
      clients/desktop-shell.c
  2. 6
      clients/dnd.c
  3. 4
      clients/eventdemo.c
  4. 2
      clients/flower.c
  5. 2
      clients/gears.c
  6. 2
      clients/smoke.c
  7. 2
      clients/terminal.c
  8. 12
      clients/window.c
  9. 7
      clients/window.h
  10. 6
      src/compositor.c
  11. 6
      src/compositor.h
  12. 3
      tests/test-client.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)
GLfloat x, GLfloat 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)
GLfloat x, GLfloat y, void *data)
{
struct unlock_dialog *dialog = data;

@ -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, GLfloat x, GLfloat 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)
GLfloat x, GLfloat 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)
GLfloat x, GLfloat y, const char **types, void *data)
{
struct dnd *dnd = data;

@ -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)
GLfloat x, GLfloat 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)

@ -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, GLfloat x, GLfloat y, void *data)
{
return POINTER_HAND1;
}

@ -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, GLfloat x, GLfloat y, void *data)
{
struct gears *gears = data;
int offset_x, offset_y;

@ -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, GLfloat x, GLfloat y, void *data)
{
struct smoke *smoke = data;
int i, i0, i1, j, j0, j1, k, d = 5;

@ -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)
GLfloat x, GLfloat y, void *data)
{
struct terminal *terminal = data;

@ -178,7 +178,7 @@ struct input {
int current_cursor;
uint32_t modifiers;
uint32_t pointer_enter_serial;
int32_t sx, sy;
GLfloat sx, sy;
struct wl_list link;
struct widget *focus_widget;
@ -1336,7 +1336,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, GLfloat x, GLfloat y, void *data)
{
return frame_get_pointer_image_for_location(data, input);
}
@ -1344,7 +1344,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)
GLfloat x, GLfloat y, void *data)
{
return frame_get_pointer_image_for_location(data, input);
}
@ -1439,7 +1439,7 @@ frame_destroy(struct frame *frame)
static void
input_set_focus_widget(struct input *input, struct widget *focus,
int32_t x, int32_t y)
GLfloat x, GLfloat y)
{
struct widget *old, *widget;
int pointer = POINTER_LEFT_PTR;
@ -2458,7 +2458,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)
GLfloat x, GLfloat y, void *data)
{
struct menu *menu = data;
@ -2470,7 +2470,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, GLfloat x, GLfloat y, void *data)
{
struct menu *menu = data;

@ -23,6 +23,7 @@
#ifndef _WINDOW_H_
#define _WINDOW_H_
#include <GLES2/gl2.h>
#include <xkbcommon/xkbcommon.h>
#include <wayland-client.h>
#include <cairo.h>
@ -165,7 +166,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,
GLfloat x, GLfloat y,
const char **types,
void *data);
@ -182,12 +183,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);
GLfloat x, GLfloat 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);
GLfloat x, GLfloat y, void *data);
typedef void (*widget_button_handler_t)(struct widget *widget,
struct input *input, uint32_t time,
uint32_t button, uint32_t state,

@ -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, GLfloat x, GLfloat 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, GLfloat x, GLfloat 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)
GLfloat x, GLfloat y, int touch_type)
{
struct weston_input_device *wd = (struct weston_input_device *) device;
struct weston_compositor *ec = wd->compositor;

@ -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, GLfloat x, GLfloat y);
void
notify_button(struct wl_input_device *device,
uint32_t time, int32_t button, uint32_t state);
@ -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);
GLfloat x, GLfloat 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);
GLfloat x, GLfloat y, int touch_type);
void
weston_layer_init(struct weston_layer *layer, struct wl_list *below);

@ -27,6 +27,7 @@
#include <assert.h>
#include <poll.h>
#include <wayland-client.h>
#include <GLES2/gl2.h> /* needed for GLfloat */
struct display {
struct wl_display *display;
@ -37,7 +38,7 @@ struct display {
struct input {
struct wl_input_device *input_device;
int32_t x, y;
GLfloat x, y;
uint32_t button_mask;
struct surface *pointer_focus;
struct surface *keyboard_focus;

Loading…
Cancel
Save