summaryrefslogtreecommitdiff
path: root/src/wayland/pointer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wayland/pointer.c')
-rw-r--r--src/wayland/pointer.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/src/wayland/pointer.c b/src/wayland/pointer.c
index 37e72f3..f2902b4 100644
--- a/src/wayland/pointer.c
+++ b/src/wayland/pointer.c
@@ -30,7 +30,7 @@ static int device_px_round(double v)
return (int)(v < 0 ? v - 0.5 : v + 0.5);
}
-static struct yasl_vector2i device_from_fixed(const struct yasl_surface *w,
+static struct yasl_vector2i device_from_fixed(const struct wayland_surface *w,
wl_fixed_t x, wl_fixed_t y)
{
return (struct yasl_vector2i){
@@ -53,23 +53,23 @@ void seat_note_input(struct seat *s, uint32_t serial)
s->conn->active_seat = s;
}
-struct seat *conn_active_seat(const struct yasl_display *c)
+struct seat *conn_active_seat(const struct wayland_display *c)
{
return c->active_seat ? c->active_seat : c->seats;
}
-static void push_mouse(struct seat *s, struct yasl_surface *w, struct yasl_mouse_event ev)
+static void push_mouse(struct seat *s, struct wayland_surface *w, struct yasl_mouse_event ev)
{
ev.mods = (unsigned)seat_modifiers(s);
struct yasl_input_event input_ev = {
.kind = YASL_INPUT_MOUSE,
- .surface = w,
+ .surface = &w->base,
.mouse = ev,
};
input_queue_push(&surface_root(w)->input, &input_ev);
}
-static void report_mouse(struct seat *s, struct yasl_surface *w, struct yasl_vector2i pos,
+static void report_mouse(struct seat *s, struct wayland_surface *w, struct yasl_vector2i pos,
int button, enum yasl_pointer_kind kind)
{
push_mouse(s, w, (struct yasl_mouse_event){
@@ -77,7 +77,7 @@ static void report_mouse(struct seat *s, struct yasl_surface *w, struct yasl_vec
});
}
-static void report_wheel(struct seat *s, struct yasl_surface *w, struct yasl_vector2i pos,
+static void report_wheel(struct seat *s, struct wayland_surface *w, struct yasl_vector2i pos,
int button, int lines, float delta)
{
push_mouse(s, w, (struct yasl_mouse_event){
@@ -86,7 +86,7 @@ static void report_wheel(struct seat *s, struct yasl_surface *w, struct yasl_vec
});
}
-static bool cursor_theme_for(struct yasl_display *c, int scale)
+static bool cursor_theme_for(struct wayland_display *c, int scale)
{
if (c->cursor_theme && c->cursor_theme_scale == scale)
return true;
@@ -103,7 +103,7 @@ static bool cursor_theme_for(struct yasl_display *c, int scale)
static bool seat_cursor_surface(struct seat *s)
{
- struct yasl_display *c = s->conn;
+ struct wayland_display *c = s->conn;
if (s->cursor_surface)
return true;
s->cursor_surface = wl_compositor_create_surface(c->compositor);
@@ -114,10 +114,10 @@ static bool seat_cursor_surface(struct seat *s)
return true;
}
-static void set_cursor_theme_fallback(struct seat *s, struct yasl_surface *w,
+static void set_cursor_theme_fallback(struct seat *s, struct wayland_surface *w,
enum yasl_cursor shape)
{
- struct yasl_display *c = s->conn;
+ struct wayland_display *c = s->conn;
int scale = (int)((w->scale_120 + YASL_SCALE_UNIT - 1) / YASL_SCALE_UNIT);
if (scale < 1) scale = 1;
if (!seat_cursor_surface(s) || !cursor_theme_for(c, scale)) return;
@@ -174,7 +174,7 @@ static uint32_t cursor_shape_of(enum yasl_cursor shape)
}
}
-static void seat_set_cursor(struct seat *s, struct yasl_surface *w, enum yasl_cursor shape)
+static void seat_set_cursor(struct seat *s, struct wayland_surface *w, enum yasl_cursor shape)
{
if (!s->pointer || !s->pointer_serial || s->pointer_focus != w ||
s->cursor_shape == (int)shape)
@@ -200,7 +200,7 @@ static void tool_set_cursor(struct tablet_tool *t, enum yasl_cursor shape)
cursor_shape_of(shape));
}
-void yasl_surface_set_cursor(struct yasl_surface *w, enum yasl_cursor shape)
+void wayland_surface_set_cursor(struct wayland_surface *w, enum yasl_cursor shape)
{
if (!w || !w->conn) return;
for (struct seat *s = w->conn->seats; s; s = s->next) {
@@ -211,7 +211,7 @@ void yasl_surface_set_cursor(struct yasl_surface *w, enum yasl_cursor shape)
}
static void press_queue_flush(struct seat *s, struct press_queue *q,
- struct yasl_surface *only, uint64_t *buttons,
+ struct wayland_surface *only, uint64_t *buttons,
struct yasl_mouse_event like)
{
int kept = 0;
@@ -233,7 +233,7 @@ static void press_queue_flush(struct seat *s, struct press_queue *q,
q->n = kept;
}
-static void press_queue_push(struct press_queue *q, struct yasl_surface *w,
+static void press_queue_push(struct press_queue *q, struct wayland_surface *w,
struct yasl_vector2i pos, int button, bool release)
{
if (q->n == (int)(sizeof(q->ev) / sizeof(q->ev[0]))) {
@@ -245,7 +245,7 @@ static void press_queue_push(struct press_queue *q, struct yasl_surface *w,
};
}
-static void press_queue_forget(struct press_queue *q, struct yasl_surface *w)
+static void press_queue_forget(struct press_queue *q, struct wayland_surface *w)
{
for (int i = 0; i < q->n; i++)
if (q->ev[i].surface == w)
@@ -274,7 +274,7 @@ static void pointer_event_done(struct seat *s)
pointer_frame(s, s->pointer);
}
-static void flush_pending_motion(struct seat *s, struct yasl_surface *w)
+static void flush_pending_motion(struct seat *s, struct wayland_surface *w)
{
if (!s->motion_pending) return;
s->motion_pending = false;
@@ -287,7 +287,7 @@ static void pointer_enter(void *data, struct wl_pointer *pointer,
{
(void)pointer;
struct seat *s = data;
- struct yasl_surface *w = conn_surface_for(s->conn, surface);
+ struct wayland_surface *w = conn_surface_for(s->conn, surface);
s->pointer_focus = w;
if (!w) return;
s->pointer_pos = device_from_fixed(w, surface_x, surface_y);
@@ -303,7 +303,7 @@ static void pointer_leave(void *data, struct wl_pointer *pointer,
{
(void)pointer; (void)serial; (void)surface;
struct seat *s = data;
- struct yasl_surface *w = s->pointer_focus;
+ struct wayland_surface *w = s->pointer_focus;
s->pointer_focus = NULL;
if (!w) return;
if (s->ptr_left)
@@ -320,7 +320,7 @@ static void pointer_motion(void *data, struct wl_pointer *pointer,
{
(void)pointer; (void)time;
struct seat *s = data;
- struct yasl_surface *w = s->pointer_focus;
+ struct wayland_surface *w = s->pointer_focus;
if (!w) return;
s->pointer_pos = device_from_fixed(w, surface_x, surface_y);
s->motion_pending = true;
@@ -332,7 +332,7 @@ static void pointer_button(void *data, struct wl_pointer *pointer,
{
(void)pointer; (void)time;
struct seat *s = data;
- struct yasl_surface *w = s->pointer_focus;
+ struct wayland_surface *w = s->pointer_focus;
if (!w) return;
int b;
switch (button) {
@@ -415,7 +415,7 @@ static void pointer_axis_value120(void *data, struct wl_pointer *pointer, uint32
}
}
-static void pointer_frame_vertical(struct seat *s, struct yasl_surface *w)
+static void pointer_frame_vertical(struct seat *s, struct wayland_surface *w)
{
if (s->axis_has_v120_v) {
int discrete = s->axis_value120_v / 120;
@@ -438,7 +438,7 @@ static void pointer_frame_vertical(struct seat *s, struct yasl_surface *w)
s->frame_v120 = 0;
}
-static void pointer_frame_horizontal(struct seat *s, struct yasl_surface *w)
+static void pointer_frame_horizontal(struct seat *s, struct wayland_surface *w)
{
if (s->axis_has_v120_h) {
int discrete = s->axis_value120_h / 120;
@@ -462,7 +462,7 @@ static void pointer_frame(void *data, struct wl_pointer *pointer)
{
(void)pointer;
struct seat *s = data;
- struct yasl_surface *left = s->ptr_left;
+ struct wayland_surface *left = s->ptr_left;
if (left) {
s->ptr_left = NULL;
if (s->ptr_left_motion)
@@ -479,7 +479,7 @@ static void pointer_frame(void *data, struct wl_pointer *pointer)
s->pointer_serial = serial;
s->cursor_shape = shape;
}
- struct yasl_surface *w = s->pointer_focus;
+ struct wayland_surface *w = s->pointer_focus;
if (!w) {
s->ptr_presses.n = 0;
return;
@@ -547,7 +547,7 @@ static int touch_count(const struct seat *s)
return n;
}
-static double touch_centroid_y(const struct seat *s, const struct yasl_surface *on)
+static double touch_centroid_y(const struct seat *s, const struct wayland_surface *on)
{
double sum = 0;
int n = 0;
@@ -576,7 +576,7 @@ static void touch_down(void *data, struct wl_touch *touch,
{
(void)touch; (void)time;
struct seat *s = data;
- struct yasl_surface *w = conn_surface_for(s->conn, surface);
+ struct wayland_surface *w = conn_surface_for(s->conn, surface);
if (!w || touch_find(s, id)) return;
struct touch_point *p = NULL;
for (int i = 0; i < SEAT_TOUCH_POINTS && !p; i++)
@@ -704,7 +704,7 @@ static void tablet_tool_proximity_in(void *data,
(void)tool; (void)tablet;
struct tablet_tool *t = data;
struct seat *s = t->seat;
- struct yasl_surface *w = conn_surface_for(s->conn, surface);
+ struct wayland_surface *w = conn_surface_for(s->conn, surface);
s->tablet_focus = w;
s->tool = t;
s->tool_buttons = 0;
@@ -723,7 +723,7 @@ static void tablet_tool_proximity_out(void *data, struct zwp_tablet_tool_v2 *too
(void)tool;
struct tablet_tool *t = data;
struct seat *s = t->seat;
- struct yasl_surface *w = s->tablet_focus;
+ struct wayland_surface *w = s->tablet_focus;
if (w) {
press_queue_flush(s, &s->tool_presses, NULL, &s->tool_buttons, tool_event(s));
struct yasl_mouse_event ev = tool_event(s);
@@ -743,7 +743,7 @@ static void tablet_tool_down(void *data, struct zwp_tablet_tool_v2 *tool, uint32
{
(void)tool;
struct seat *s = ((struct tablet_tool *)data)->seat;
- struct yasl_surface *w = s->tablet_focus;
+ struct wayland_surface *w = s->tablet_focus;
if (!w) return;
seat_note_input(s, serial);
s->press_serial = serial;
@@ -755,7 +755,7 @@ static void tablet_tool_up(void *data, struct zwp_tablet_tool_v2 *tool)
{
(void)tool;
struct seat *s = ((struct tablet_tool *)data)->seat;
- struct yasl_surface *w = s->tablet_focus;
+ struct wayland_surface *w = s->tablet_focus;
if (!w) return;
press_queue_push(&s->tool_presses, w, s->tool_pos, 0, true);
}
@@ -764,7 +764,7 @@ static void tablet_tool_motion(void *data, struct zwp_tablet_tool_v2 *tool, wl_f
{
(void)tool;
struct seat *s = ((struct tablet_tool *)data)->seat;
- struct yasl_surface *w = s->tablet_focus;
+ struct wayland_surface *w = s->tablet_focus;
if (!w) return;
s->tool_pos = device_from_fixed(w, x, y);
s->tool_motion = true;
@@ -775,7 +775,7 @@ static void tablet_tool_button(void *data, struct zwp_tablet_tool_v2 *tool,
{
(void)tool;
struct seat *s = ((struct tablet_tool *)data)->seat;
- struct yasl_surface *w = s->tablet_focus;
+ struct wayland_surface *w = s->tablet_focus;
if (!w) return;
seat_note_input(s, serial);
int b;
@@ -822,7 +822,7 @@ static void tool_frame(void *d, struct zwp_tablet_tool_v2 *t, uint32_t time)
{
(void)t; (void)time;
struct seat *s = ((struct tablet_tool *)d)->seat;
- struct yasl_surface *w = s->tablet_focus;
+ struct wayland_surface *w = s->tablet_focus;
if (!w) {
s->tool_presses.n = 0;
s->tool_wheel = 0;
@@ -1003,13 +1003,13 @@ static void clipboard_received(const char *text, size_t len, bool uri_list,
struct wl_surface *on, void *ud)
{
struct seat *s = ud;
- struct yasl_display *c = s->conn;
- struct yasl_surface *w = on ? surface_root(conn_surface_for(c, on)) : NULL;
+ struct wayland_display *c = s->conn;
+ struct wayland_surface *w = on ? surface_root(conn_surface_for(c, on)) : NULL;
if (!w)
w = c->paste_target ? c->paste_target : s->keyboard_focus;
if (!len || !w) return;
struct yasl_input_event ev = {
- .surface = w,
+ .surface = &w->base,
.kind = uri_list ? YASL_INPUT_DROP_FILES : YASL_INPUT_PASTE,
};
if (uri_list) {
@@ -1038,7 +1038,7 @@ static void clipboard_drop_hover(enum yasl_drop_event ev, struct wl_surface *on,
void seat_clipboard_ensure(struct seat *s)
{
- struct yasl_display *c = s->conn;
+ struct wayland_display *c = s->conn;
if (!c->data_manager || !s->proxy)
return;
if (!s->clipboard) {
@@ -1082,7 +1082,7 @@ static void seat_drop_keyboard(struct seat *s)
s->keyboard = NULL;
}
s->repeat_rate = 0;
- struct yasl_surface *w = s->keyboard_focus;
+ struct wayland_surface *w = s->keyboard_focus;
s->keyboard_focus = NULL;
if (w && !s->focus_leaving)
s->focus_leaving = w;
@@ -1103,7 +1103,7 @@ static void seat_drop_touch(struct seat *s)
static void seat_capabilities(void *data, struct wl_seat *proxy, uint32_t caps)
{
struct seat *s = data;
- struct yasl_display *c = s->conn;
+ struct wayland_display *c = s->conn;
if (caps & WL_SEAT_CAPABILITY_KEYBOARD) {
if (!s->keyboard) {
s->keyboard = wl_seat_get_keyboard(proxy);
@@ -1165,7 +1165,7 @@ const struct wl_seat_listener seat_listener = {
.name = seat_name,
};
-void seat_bind(struct yasl_display *c, struct wl_registry *registry,
+void seat_bind(struct wayland_display *c, struct wl_registry *registry,
uint32_t name, uint32_t version)
{
struct seat *s = calloc(1, sizeof(*s));
@@ -1186,9 +1186,9 @@ void seat_bind(struct yasl_display *c, struct wl_registry *registry,
keyboard_repeat_init(s);
}
-void seat_forget_surface(struct seat *s, struct yasl_surface *w)
+void seat_forget_surface(struct seat *s, struct wayland_surface *w)
{
- struct yasl_surface **refs[] = {
+ struct wayland_surface **refs[] = {
&s->pointer_focus, &s->keyboard_focus,
&s->tablet_focus, &s->ime_focus, &s->focus_leaving, &s->ptr_left,
&s->press_surface,
@@ -1211,7 +1211,7 @@ void seat_forget_surface(struct seat *s, struct yasl_surface *w)
void seat_destroy(struct seat *s)
{
- struct yasl_display *c = s->conn;
+ struct wayland_display *c = s->conn;
for (struct seat **link = &c->seats; *link; link = &(*link)->next) {
if (*link == s) {
*link = s->next;
@@ -1220,7 +1220,7 @@ void seat_destroy(struct seat *s)
}
if (c->active_seat == s)
c->active_seat = NULL;
- for (struct yasl_surface *w = c->surfaces; w; w = w->conn_next) {
+ for (struct wayland_surface *w = c->surfaces; w; w = w->conn_next) {
if (w->ime_seat == s) {
w->ime_seat = NULL;
ime_reset(w);
@@ -1233,11 +1233,11 @@ void seat_destroy(struct seat *s)
seat_destroy_tablet(s);
seat_drop_pointer(s);
seat_drop_keyboard(s);
- struct yasl_surface *left = s->focus_leaving;
+ struct wayland_surface *left = s->focus_leaving;
if (left && !conn_keyboard_on(c, left, NULL)) {
struct yasl_input_event ev = {
.kind = YASL_INPUT_FOCUS,
- .surface = left,
+ .surface = &left->base,
.focus = { .focused = false },
};
input_queue_push(&left->input, &ev);
@@ -1259,7 +1259,7 @@ void seat_destroy(struct seat *s)
free(s);
}
-bool seat_remove(struct yasl_display *c, uint32_t name)
+bool seat_remove(struct wayland_display *c, uint32_t name)
{
for (struct seat *s = c->seats; s; s = s->next) {
if (s->name == name) {
@@ -1270,7 +1270,7 @@ bool seat_remove(struct yasl_display *c, uint32_t name)
return false;
}
-int display_input_init(struct yasl_display *c)
+int display_input_init(struct wayland_display *c)
{
for (struct seat *s = c->seats; s; s = s->next) {
keyboard_repeat_init(s);
@@ -1279,7 +1279,7 @@ int display_input_init(struct yasl_display *c)
return 0;
}
-void surface_init_cursor(struct yasl_display *c)
+void surface_init_cursor(struct wayland_display *c)
{
if (c->cursor_shape_mgr)
return;