mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-13 05:34:13 -04:00
Update wlr_seat and friends to new compositor
This commit is contained in:
parent
8630988eae
commit
841031031e
12 changed files with 159 additions and 142 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include <wlr/types/wlr_data_device.h>
|
||||
#include <wlr/types/wlr_gtk_primary_selection.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "types/wlr_data_device.h"
|
||||
#include "types/wlr_seat.h"
|
||||
|
|
@ -16,7 +17,7 @@
|
|||
#include "util/signal.h"
|
||||
|
||||
static void default_keyboard_enter(struct wlr_seat_keyboard_grab *grab,
|
||||
struct wlr_surface *surface, uint32_t keycodes[], size_t num_keycodes,
|
||||
struct wlr_surface_2 *surface, uint32_t keycodes[], size_t num_keycodes,
|
||||
struct wlr_keyboard_modifiers *modifiers) {
|
||||
wlr_seat_keyboard_enter(grab->seat, surface, keycodes, num_keycodes, modifiers);
|
||||
}
|
||||
|
|
@ -219,7 +220,7 @@ void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat,
|
|||
}
|
||||
|
||||
void wlr_seat_keyboard_enter(struct wlr_seat *seat,
|
||||
struct wlr_surface *surface, uint32_t keycodes[], size_t num_keycodes,
|
||||
struct wlr_surface_2 *surface, uint32_t keycodes[], size_t num_keycodes,
|
||||
struct wlr_keyboard_modifiers *modifiers) {
|
||||
if (seat->keyboard_state.focused_surface == surface) {
|
||||
// this surface already got an enter notify
|
||||
|
|
@ -235,7 +236,7 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
|
|||
|
||||
struct wlr_seat_client *focused_client =
|
||||
seat->keyboard_state.focused_client;
|
||||
struct wlr_surface *focused_surface =
|
||||
struct wlr_surface_2 *focused_surface =
|
||||
seat->keyboard_state.focused_surface;
|
||||
|
||||
// leave the previously entered surface
|
||||
|
|
@ -304,7 +305,7 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
|
|||
}
|
||||
|
||||
void wlr_seat_keyboard_notify_enter(struct wlr_seat *seat,
|
||||
struct wlr_surface *surface, uint32_t keycodes[], size_t num_keycodes,
|
||||
struct wlr_surface_2 *surface, uint32_t keycodes[], size_t num_keycodes,
|
||||
struct wlr_keyboard_modifiers *modifiers) {
|
||||
struct wlr_seat_keyboard_grab *grab = seat->keyboard_state.grab;
|
||||
grab->interface->enter(grab, surface, keycodes, num_keycodes, modifiers);
|
||||
|
|
|
|||
|
|
@ -5,12 +5,13 @@
|
|||
#include <time.h>
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "types/wlr_seat.h"
|
||||
#include "util/signal.h"
|
||||
|
||||
static void default_pointer_enter(struct wlr_seat_pointer_grab *grab,
|
||||
struct wlr_surface *surface, double sx, double sy) {
|
||||
struct wlr_surface_2 *surface, double sx, double sy) {
|
||||
wlr_seat_pointer_enter(grab->seat, surface, sx, sy);
|
||||
}
|
||||
|
||||
|
|
@ -65,10 +66,6 @@ struct wlr_seat_client *wlr_seat_client_from_pointer_resource(
|
|||
return wl_resource_get_user_data(resource);
|
||||
}
|
||||
|
||||
static const struct wlr_surface_role pointer_cursor_surface_role = {
|
||||
.name = "wl_pointer-cursor",
|
||||
};
|
||||
|
||||
static void pointer_set_cursor(struct wl_client *client,
|
||||
struct wl_resource *pointer_resource, uint32_t serial,
|
||||
struct wl_resource *surface_resource,
|
||||
|
|
@ -79,11 +76,12 @@ static void pointer_set_cursor(struct wl_client *client,
|
|||
return;
|
||||
}
|
||||
|
||||
struct wlr_surface *surface = NULL;
|
||||
struct wlr_surface_2 *surface = NULL;
|
||||
if (surface_resource != NULL) {
|
||||
surface = wlr_surface_from_resource(surface_resource);
|
||||
if (!wlr_surface_set_role(surface, &pointer_cursor_surface_role, NULL,
|
||||
surface_resource, WL_POINTER_ERROR_ROLE)) {
|
||||
surface = wlr_surface_from_resource_2(surface_resource);
|
||||
if (!wlr_surface_set_role_2(surface, "wl_pointer")) {
|
||||
wl_resource_post_error(surface_resource, WL_POINTER_ERROR_ROLE,
|
||||
"surface already has role");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -115,7 +113,7 @@ static void pointer_handle_resource_destroy(struct wl_resource *resource) {
|
|||
|
||||
|
||||
bool wlr_seat_pointer_surface_has_focus(struct wlr_seat *wlr_seat,
|
||||
struct wlr_surface *surface) {
|
||||
struct wlr_surface_2 *surface) {
|
||||
return surface == wlr_seat->pointer_state.focused_surface;
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +127,7 @@ static void seat_pointer_handle_surface_destroy(struct wl_listener *listener,
|
|||
}
|
||||
|
||||
void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
|
||||
struct wlr_surface *surface, double sx, double sy) {
|
||||
struct wlr_surface_2 *surface, double sx, double sy) {
|
||||
if (wlr_seat->pointer_state.focused_surface == surface) {
|
||||
// this surface already got an enter notify
|
||||
return;
|
||||
|
|
@ -143,7 +141,7 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
|
|||
|
||||
struct wlr_seat_client *focused_client =
|
||||
wlr_seat->pointer_state.focused_client;
|
||||
struct wlr_surface *focused_surface =
|
||||
struct wlr_surface_2 *focused_surface =
|
||||
wlr_seat->pointer_state.focused_surface;
|
||||
|
||||
// leave the previously entered surface
|
||||
|
|
@ -324,7 +322,7 @@ void wlr_seat_pointer_end_grab(struct wlr_seat *wlr_seat) {
|
|||
}
|
||||
|
||||
void wlr_seat_pointer_notify_enter(struct wlr_seat *wlr_seat,
|
||||
struct wlr_surface *surface, double sx, double sy) {
|
||||
struct wlr_surface_2 *surface, double sx, double sy) {
|
||||
struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab;
|
||||
grab->interface->enter(grab, surface, sx, sy);
|
||||
}
|
||||
|
|
@ -409,7 +407,7 @@ void seat_client_destroy_pointer(struct wl_resource *resource) {
|
|||
}
|
||||
|
||||
bool wlr_seat_validate_pointer_grab_serial(struct wlr_seat *seat,
|
||||
struct wlr_surface *origin, uint32_t serial) {
|
||||
struct wlr_surface_2 *origin, uint32_t serial) {
|
||||
if (seat->pointer_state.button_count != 1 ||
|
||||
seat->pointer_state.grab_serial != serial) {
|
||||
wlr_log(WLR_DEBUG, "Pointer grab serial validation failed: "
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <time.h>
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "types/wlr_seat.h"
|
||||
#include "util/signal.h"
|
||||
|
|
@ -114,7 +115,7 @@ static void touch_point_handle_surface_destroy(struct wl_listener *listener,
|
|||
|
||||
static struct wlr_touch_point *touch_point_create(
|
||||
struct wlr_seat *seat, int32_t touch_id,
|
||||
struct wlr_surface *surface, double sx, double sy) {
|
||||
struct wlr_surface_2 *surface, double sx, double sy) {
|
||||
struct wl_client *wl_client = wl_resource_get_client(surface->resource);
|
||||
struct wlr_seat_client *client =
|
||||
wlr_seat_client_for_wl_client(seat, wl_client);
|
||||
|
|
@ -159,7 +160,7 @@ struct wlr_touch_point *wlr_seat_touch_get_point(
|
|||
}
|
||||
|
||||
uint32_t wlr_seat_touch_notify_down(struct wlr_seat *seat,
|
||||
struct wlr_surface *surface, uint32_t time, int32_t touch_id, double sx,
|
||||
struct wlr_surface_2 *surface, uint32_t time, int32_t touch_id, double sx,
|
||||
double sy) {
|
||||
clock_gettime(CLOCK_MONOTONIC, &seat->last_event);
|
||||
struct wlr_seat_touch_grab *grab = seat->touch_state.grab;
|
||||
|
|
@ -217,7 +218,7 @@ static void handle_point_focus_destroy(struct wl_listener *listener,
|
|||
}
|
||||
|
||||
static void touch_point_set_focus(struct wlr_touch_point *point,
|
||||
struct wlr_surface *surface, double sx, double sy) {
|
||||
struct wlr_surface_2 *surface, double sx, double sy) {
|
||||
if (point->focus_surface == surface) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -241,7 +242,7 @@ static void touch_point_set_focus(struct wlr_touch_point *point,
|
|||
}
|
||||
|
||||
void wlr_seat_touch_point_focus(struct wlr_seat *seat,
|
||||
struct wlr_surface *surface, uint32_t time, int32_t touch_id, double sx,
|
||||
struct wlr_surface_2 *surface, uint32_t time, int32_t touch_id, double sx,
|
||||
double sy) {
|
||||
assert(surface);
|
||||
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
||||
|
|
@ -249,7 +250,7 @@ void wlr_seat_touch_point_focus(struct wlr_seat *seat,
|
|||
wlr_log(WLR_ERROR, "got touch point focus for unknown touch point");
|
||||
return;
|
||||
}
|
||||
struct wlr_surface *focus = point->focus_surface;
|
||||
struct wlr_surface_2 *focus = point->focus_surface;
|
||||
touch_point_set_focus(point, surface, sx, sy);
|
||||
|
||||
if (focus != point->focus_surface) {
|
||||
|
|
@ -270,7 +271,7 @@ void wlr_seat_touch_point_clear_focus(struct wlr_seat *seat, uint32_t time,
|
|||
}
|
||||
|
||||
uint32_t wlr_seat_touch_send_down(struct wlr_seat *seat,
|
||||
struct wlr_surface *surface, uint32_t time, int32_t touch_id, double sx,
|
||||
struct wlr_surface_2 *surface, uint32_t time, int32_t touch_id, double sx,
|
||||
double sy) {
|
||||
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
|
||||
if (!point) {
|
||||
|
|
@ -361,7 +362,7 @@ void seat_client_destroy_touch(struct wl_resource *resource) {
|
|||
}
|
||||
|
||||
bool wlr_seat_validate_touch_grab_serial(struct wlr_seat *seat,
|
||||
struct wlr_surface *origin, uint32_t serial,
|
||||
struct wlr_surface_2 *origin, uint32_t serial,
|
||||
struct wlr_touch_point **point_ptr) {
|
||||
if (wlr_seat_touch_num_points(seat) != 1 ||
|
||||
seat->touch_state.grab_serial != serial) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue