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>
This commit is contained in:
committed by
Kristian Høgsberg
parent
bd3489b6e1
commit
b230a7ee58
@@ -233,7 +233,7 @@ panel_redraw_handler(struct widget *widget, void *data)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
panel_launcher_enter_handler(struct widget *widget, struct input *input,
|
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;
|
struct panel_launcher *launcher = data;
|
||||||
|
|
||||||
@@ -504,7 +504,7 @@ unlock_dialog_keyboard_focus_handler(struct window *window,
|
|||||||
static int
|
static int
|
||||||
unlock_dialog_widget_enter_handler(struct widget *widget,
|
unlock_dialog_widget_enter_handler(struct widget *widget,
|
||||||
struct input *input,
|
struct input *input,
|
||||||
int32_t x, int32_t y, void *data)
|
GLfloat x, GLfloat y, void *data)
|
||||||
{
|
{
|
||||||
struct unlock_dialog *dialog = data;
|
struct unlock_dialog *dialog = data;
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -450,7 +450,7 @@ lookup_cursor(struct dnd *dnd, int x, int y)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
dnd_enter_handler(struct widget *widget,
|
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);
|
return lookup_cursor(data, x, y);
|
||||||
}
|
}
|
||||||
@@ -458,7 +458,7 @@ dnd_enter_handler(struct widget *widget,
|
|||||||
static int
|
static int
|
||||||
dnd_motion_handler(struct widget *widget,
|
dnd_motion_handler(struct widget *widget,
|
||||||
struct input *input, uint32_t time,
|
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);
|
return lookup_cursor(data, x, y);
|
||||||
}
|
}
|
||||||
@@ -466,7 +466,7 @@ dnd_motion_handler(struct widget *widget,
|
|||||||
static void
|
static void
|
||||||
dnd_data_handler(struct window *window,
|
dnd_data_handler(struct window *window,
|
||||||
struct input *input,
|
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;
|
struct dnd *dnd = data;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -238,12 +238,12 @@ button_handler(struct widget *widget, struct input *input, uint32_t time,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
motion_handler(struct widget *widget, struct input *input, uint32_t time,
|
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;
|
struct eventdemo *e = data;
|
||||||
|
|
||||||
if (log_motion) {
|
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)
|
if (x > e->x && x < e->x + e->w)
|
||||||
|
|||||||
+1
-1
@@ -134,7 +134,7 @@ redraw_handler(struct widget *widget, void *data)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
motion_handler(struct widget *widget, struct input *input,
|
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;
|
return POINTER_HAND1;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -223,7 +223,7 @@ static const struct wl_callback_listener listener = {
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
motion_handler(struct widget *widget, struct input *input,
|
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;
|
struct gears *gears = data;
|
||||||
int offset_x, offset_y;
|
int offset_x, offset_y;
|
||||||
|
|||||||
+1
-1
@@ -230,7 +230,7 @@ redraw_handler(struct widget *widget, void *data)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
smoke_motion_handler(struct widget *widget, struct input *input,
|
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;
|
struct smoke *smoke = data;
|
||||||
int i, i0, i1, j, j0, j1, k, d = 5;
|
int i, i0, i1, j, j0, j1, k, d = 5;
|
||||||
|
|||||||
+1
-1
@@ -2237,7 +2237,7 @@ button_handler(struct widget *widget,
|
|||||||
static int
|
static int
|
||||||
motion_handler(struct widget *widget,
|
motion_handler(struct widget *widget,
|
||||||
struct input *input, uint32_t time,
|
struct input *input, uint32_t time,
|
||||||
int32_t x, int32_t y, void *data)
|
GLfloat x, GLfloat y, void *data)
|
||||||
{
|
{
|
||||||
struct terminal *terminal = data;
|
struct terminal *terminal = data;
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -178,7 +178,7 @@ struct input {
|
|||||||
int current_cursor;
|
int current_cursor;
|
||||||
uint32_t modifiers;
|
uint32_t modifiers;
|
||||||
uint32_t pointer_enter_serial;
|
uint32_t pointer_enter_serial;
|
||||||
int32_t sx, sy;
|
GLfloat sx, sy;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
|
|
||||||
struct widget *focus_widget;
|
struct widget *focus_widget;
|
||||||
@@ -1336,7 +1336,7 @@ window_show_frame_menu(struct window *window,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
frame_enter_handler(struct widget *widget,
|
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);
|
return frame_get_pointer_image_for_location(data, input);
|
||||||
}
|
}
|
||||||
@@ -1344,7 +1344,7 @@ frame_enter_handler(struct widget *widget,
|
|||||||
static int
|
static int
|
||||||
frame_motion_handler(struct widget *widget,
|
frame_motion_handler(struct widget *widget,
|
||||||
struct input *input, uint32_t time,
|
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);
|
return frame_get_pointer_image_for_location(data, input);
|
||||||
}
|
}
|
||||||
@@ -1439,7 +1439,7 @@ frame_destroy(struct frame *frame)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
input_set_focus_widget(struct input *input, struct widget *focus,
|
input_set_focus_widget(struct input *input, struct widget *focus,
|
||||||
int32_t x, int32_t y)
|
GLfloat x, GLfloat y)
|
||||||
{
|
{
|
||||||
struct widget *old, *widget;
|
struct widget *old, *widget;
|
||||||
int pointer = POINTER_LEFT_PTR;
|
int pointer = POINTER_LEFT_PTR;
|
||||||
@@ -2458,7 +2458,7 @@ menu_set_item(struct menu *menu, int sy)
|
|||||||
static int
|
static int
|
||||||
menu_motion_handler(struct widget *widget,
|
menu_motion_handler(struct widget *widget,
|
||||||
struct input *input, uint32_t time,
|
struct input *input, uint32_t time,
|
||||||
int32_t x, int32_t y, void *data)
|
GLfloat x, GLfloat y, void *data)
|
||||||
{
|
{
|
||||||
struct menu *menu = data;
|
struct menu *menu = data;
|
||||||
|
|
||||||
@@ -2470,7 +2470,7 @@ menu_motion_handler(struct widget *widget,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
menu_enter_handler(struct widget *widget,
|
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;
|
struct menu *menu = data;
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -23,6 +23,7 @@
|
|||||||
#ifndef _WINDOW_H_
|
#ifndef _WINDOW_H_
|
||||||
#define _WINDOW_H_
|
#define _WINDOW_H_
|
||||||
|
|
||||||
|
#include <GLES2/gl2.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <cairo.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,
|
typedef void (*window_data_handler_t)(struct window *window,
|
||||||
struct input *input,
|
struct input *input,
|
||||||
int32_t x, int32_t y,
|
GLfloat x, GLfloat y,
|
||||||
const char **types,
|
const char **types,
|
||||||
void *data);
|
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,
|
typedef int (*widget_enter_handler_t)(struct widget *widget,
|
||||||
struct input *input,
|
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,
|
typedef void (*widget_leave_handler_t)(struct widget *widget,
|
||||||
struct input *input, void *data);
|
struct input *input, void *data);
|
||||||
typedef int (*widget_motion_handler_t)(struct widget *widget,
|
typedef int (*widget_motion_handler_t)(struct widget *widget,
|
||||||
struct input *input, uint32_t time,
|
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,
|
typedef void (*widget_button_handler_t)(struct widget *widget,
|
||||||
struct input *input, uint32_t time,
|
struct input *input, uint32_t time,
|
||||||
uint32_t button, uint32_t state,
|
uint32_t button, uint32_t state,
|
||||||
|
|||||||
+3
-3
@@ -1553,7 +1553,7 @@ weston_input_update_drag_surface(struct wl_input_device *input_device,
|
|||||||
int dx, int dy);
|
int dx, int dy);
|
||||||
|
|
||||||
WL_EXPORT void
|
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;
|
struct weston_output *output;
|
||||||
const struct wl_pointer_grab_interface *interface;
|
const struct wl_pointer_grab_interface *interface;
|
||||||
@@ -1769,7 +1769,7 @@ notify_key(struct wl_input_device *device,
|
|||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
notify_pointer_focus(struct wl_input_device *device,
|
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_input_device *wd = (struct weston_input_device *) device;
|
||||||
struct weston_compositor *compositor = wd->compositor;
|
struct weston_compositor *compositor = wd->compositor;
|
||||||
@@ -1917,7 +1917,7 @@ touch_set_focus(struct weston_input_device *device,
|
|||||||
*/
|
*/
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,
|
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_input_device *wd = (struct weston_input_device *) device;
|
||||||
struct weston_compositor *ec = wd->compositor;
|
struct weston_compositor *ec = wd->compositor;
|
||||||
|
|||||||
+3
-3
@@ -421,7 +421,7 @@ weston_surface_draw(struct weston_surface *es,
|
|||||||
|
|
||||||
void
|
void
|
||||||
notify_motion(struct wl_input_device *device,
|
notify_motion(struct wl_input_device *device,
|
||||||
uint32_t time, int x, int y);
|
uint32_t time, GLfloat x, GLfloat y);
|
||||||
void
|
void
|
||||||
notify_button(struct wl_input_device *device,
|
notify_button(struct wl_input_device *device,
|
||||||
uint32_t time, int32_t button, uint32_t state);
|
uint32_t time, int32_t button, uint32_t state);
|
||||||
@@ -435,14 +435,14 @@ notify_key(struct wl_input_device *device,
|
|||||||
void
|
void
|
||||||
notify_pointer_focus(struct wl_input_device *device,
|
notify_pointer_focus(struct wl_input_device *device,
|
||||||
struct weston_output *output,
|
struct weston_output *output,
|
||||||
int32_t x, int32_t y);
|
GLfloat x, GLfloat y);
|
||||||
|
|
||||||
void
|
void
|
||||||
notify_keyboard_focus(struct wl_input_device *device, struct wl_array *keys);
|
notify_keyboard_focus(struct wl_input_device *device, struct wl_array *keys);
|
||||||
|
|
||||||
void
|
void
|
||||||
notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,
|
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
|
void
|
||||||
weston_layer_init(struct weston_layer *layer, struct wl_list *below);
|
weston_layer_init(struct weston_layer *layer, struct wl_list *below);
|
||||||
|
|||||||
+2
-1
@@ -27,6 +27,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
|
#include <GLES2/gl2.h> /* needed for GLfloat */
|
||||||
|
|
||||||
struct display {
|
struct display {
|
||||||
struct wl_display *display;
|
struct wl_display *display;
|
||||||
@@ -37,7 +38,7 @@ struct display {
|
|||||||
|
|
||||||
struct input {
|
struct input {
|
||||||
struct wl_input_device *input_device;
|
struct wl_input_device *input_device;
|
||||||
int32_t x, y;
|
GLfloat x, y;
|
||||||
uint32_t button_mask;
|
uint32_t button_mask;
|
||||||
struct surface *pointer_focus;
|
struct surface *pointer_focus;
|
||||||
struct surface *keyboard_focus;
|
struct surface *keyboard_focus;
|
||||||
|
|||||||
Reference in New Issue
Block a user