rename wlr_seat to seat on seat structs

This commit is contained in:
Tony Crisci 2017-10-30 08:44:39 -04:00
parent fddef4d58e
commit 74bca7251b
6 changed files with 43 additions and 43 deletions

View File

@ -14,7 +14,7 @@
struct wlr_seat_client { struct wlr_seat_client {
struct wl_resource *wl_resource; struct wl_resource *wl_resource;
struct wl_client *client; struct wl_client *client;
struct wlr_seat *wlr_seat; struct wlr_seat *seat;
struct wl_resource *pointer; struct wl_resource *pointer;
struct wl_resource *keyboard; struct wl_resource *keyboard;
@ -72,7 +72,7 @@ struct wlr_seat_pointer_grab {
}; };
struct wlr_seat_pointer_state { struct wlr_seat_pointer_state {
struct wlr_seat *wlr_seat; struct wlr_seat *seat;
struct wlr_seat_client *focused_client; struct wlr_seat_client *focused_client;
struct wlr_surface *focused_surface; struct wlr_surface *focused_surface;
@ -89,7 +89,7 @@ struct wlr_seat_pointer_state {
}; };
struct wlr_seat_keyboard_state { struct wlr_seat_keyboard_state {
struct wlr_seat *wlr_seat; struct wlr_seat *seat;
struct wlr_keyboard *keyboard; struct wlr_keyboard *keyboard;
struct wlr_seat_client *focused_client; struct wlr_seat_client *focused_client;

View File

@ -475,7 +475,7 @@ static void handle_request_set_cursor(struct wl_listener *listener,
struct wlr_seat_pointer_request_set_cursor_event *event = data; struct wlr_seat_pointer_request_set_cursor_event *event = data;
struct wlr_surface *focused_surface = struct wlr_surface *focused_surface =
event->seat_client->wlr_seat->pointer_state.focused_surface; event->seat_client->seat->pointer_state.focused_surface;
bool ok = focused_surface != NULL && focused_surface->resource != NULL; bool ok = focused_surface != NULL && focused_surface->resource != NULL;
if (ok) { if (ok) {
struct wl_client *focused_client = struct wl_client *focused_client =

View File

@ -263,18 +263,18 @@ static struct wlr_data_offer *wlr_data_source_send_offer(
} }
void wlr_seat_client_send_selection(struct wlr_seat_client *client) { void wlr_seat_client_send_selection(struct wlr_seat_client *seat_client) {
if (!client->data_device) { if (!seat_client->data_device) {
return; return;
} }
if (client->wlr_seat->selection_source) { if (seat_client->seat->selection_source) {
struct wlr_data_offer *offer = struct wlr_data_offer *offer =
wlr_data_source_send_offer(client->wlr_seat->selection_source, wlr_data_source_send_offer(seat_client->seat->selection_source,
client->data_device); seat_client->data_device);
wl_data_device_send_selection(client->data_device, offer->resource); wl_data_device_send_selection(seat_client->data_device, offer->resource);
} else { } else {
wl_data_device_send_selection(client->data_device, NULL); wl_data_device_send_selection(seat_client->data_device, NULL);
} }
} }
@ -340,7 +340,7 @@ static void data_device_set_selection(struct wl_client *client,
wl_resource_get_user_data(dd_resource); wl_resource_get_user_data(dd_resource);
// TODO: store serial and check against incoming serial here // TODO: store serial and check against incoming serial here
wlr_seat_set_selection(seat_client->wlr_seat, source, serial); wlr_seat_set_selection(seat_client->seat, source, serial);
} }
static void data_device_release(struct wl_client *client, static void data_device_release(struct wl_client *client,
@ -390,7 +390,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
} }
struct wlr_seat_client *focus_client = struct wlr_seat_client *focus_client =
wlr_seat_client_for_wl_client(drag->seat_client->wlr_seat, wlr_seat_client_for_wl_client(drag->seat_client->seat,
wl_resource_get_client(surface->resource)); wl_resource_get_client(surface->resource));
if (!focus_client || !focus_client->data_device) { if (!focus_client || !focus_client->data_device) {
@ -418,7 +418,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
} }
uint32_t serial = uint32_t serial =
wl_display_next_serial(drag->seat_client->wlr_seat->display); wl_display_next_serial(drag->seat_client->seat->display);
wl_data_device_send_enter(focus_client->data_device, serial, wl_data_device_send_enter(focus_client->data_device, serial,
surface->resource, wl_fixed_from_double(sx), surface->resource, wl_fixed_from_double(sx),
@ -427,7 +427,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
drag->focus = surface; drag->focus = surface;
drag->focus_client = focus_client; drag->focus_client = focus_client;
drag->seat_client_unbound.notify = drag_client_seat_unbound; drag->seat_client_unbound.notify = drag_client_seat_unbound;
wl_signal_add(&focus_client->wlr_seat->events.client_unbound, wl_signal_add(&focus_client->seat->events.client_unbound,
&drag->seat_client_unbound); &drag->seat_client_unbound);
} }
@ -561,7 +561,7 @@ static bool seat_client_start_drag(struct wlr_seat_client *client,
return false; return false;
} }
struct wlr_seat *seat = client->wlr_seat; struct wlr_seat *seat = client->seat;
if (icon) { if (icon) {
drag->icon = icon; drag->icon = icon;
@ -599,7 +599,7 @@ static void data_device_start_drag(struct wl_client *client,
struct wl_resource *origin_resource, struct wl_resource *icon_resource, struct wl_resource *origin_resource, struct wl_resource *icon_resource,
uint32_t serial) { uint32_t serial) {
struct wlr_seat_client *seat_client = wl_resource_get_user_data(device_resource); struct wlr_seat_client *seat_client = wl_resource_get_user_data(device_resource);
struct wlr_seat *seat = seat_client->wlr_seat; struct wlr_seat *seat = seat_client->seat;
struct wlr_surface *origin = wl_resource_get_user_data(origin_resource); struct wlr_surface *origin = wl_resource_get_user_data(origin_resource);
struct wlr_data_source *source = NULL; struct wlr_data_source *source = NULL;
struct wlr_surface *icon = NULL; struct wlr_surface *icon = NULL;

View File

@ -46,7 +46,7 @@ static void wl_pointer_set_cursor(struct wl_client *client,
event->hotspot_x = hotspot_x; event->hotspot_x = hotspot_x;
event->hotspot_y = hotspot_y; event->hotspot_y = hotspot_y;
wl_signal_emit(&seat_client->wlr_seat->events.request_set_cursor, event); wl_signal_emit(&seat_client->seat->events.request_set_cursor, event);
free(event); free(event);
} }
@ -67,7 +67,7 @@ static void wl_seat_get_pointer(struct wl_client *client,
struct wl_resource *pointer_resource, uint32_t id) { struct wl_resource *pointer_resource, uint32_t id) {
struct wlr_seat_client *seat_client = struct wlr_seat_client *seat_client =
wl_resource_get_user_data(pointer_resource); wl_resource_get_user_data(pointer_resource);
if (!(seat_client->wlr_seat->capabilities & WL_SEAT_CAPABILITY_POINTER)) { if (!(seat_client->seat->capabilities & WL_SEAT_CAPABILITY_POINTER)) {
return; return;
} }
if (seat_client->pointer) { if (seat_client->pointer) {
@ -114,7 +114,7 @@ static void wl_seat_get_keyboard(struct wl_client *client,
struct wl_resource *seat_resource, uint32_t id) { struct wl_resource *seat_resource, uint32_t id) {
struct wlr_seat_client *seat_client = struct wlr_seat_client *seat_client =
wl_resource_get_user_data(seat_resource); wl_resource_get_user_data(seat_resource);
if (!(seat_client->wlr_seat->capabilities & WL_SEAT_CAPABILITY_KEYBOARD)) { if (!(seat_client->seat->capabilities & WL_SEAT_CAPABILITY_KEYBOARD)) {
return; return;
} }
if (seat_client->keyboard) { if (seat_client->keyboard) {
@ -129,7 +129,7 @@ static void wl_seat_get_keyboard(struct wl_client *client,
seat_client, &wl_keyboard_destroy); seat_client, &wl_keyboard_destroy);
seat_client_send_keymap(seat_client, seat_client_send_keymap(seat_client,
seat_client->wlr_seat->keyboard_state.keyboard); seat_client->seat->keyboard_state.keyboard);
// TODO possibly handle the case where this keyboard needs an enter // TODO possibly handle the case where this keyboard needs an enter
// right away // right away
@ -150,7 +150,7 @@ static void wl_seat_get_touch(struct wl_client *client,
struct wl_resource *seat_resource, uint32_t id) { struct wl_resource *seat_resource, uint32_t id) {
struct wlr_seat_client *seat_client = struct wlr_seat_client *seat_client =
wl_resource_get_user_data(seat_resource); wl_resource_get_user_data(seat_resource);
if (!(seat_client->wlr_seat->capabilities & WL_SEAT_CAPABILITY_TOUCH)) { if (!(seat_client->seat->capabilities & WL_SEAT_CAPABILITY_TOUCH)) {
return; return;
} }
if (seat_client->touch) { if (seat_client->touch) {
@ -167,13 +167,13 @@ static void wl_seat_get_touch(struct wl_client *client,
static void wlr_seat_client_resource_destroy(struct wl_resource *resource) { static void wlr_seat_client_resource_destroy(struct wl_resource *resource) {
struct wlr_seat_client *client = wl_resource_get_user_data(resource); struct wlr_seat_client *client = wl_resource_get_user_data(resource);
wl_signal_emit(&client->wlr_seat->events.client_unbound, client); wl_signal_emit(&client->seat->events.client_unbound, client);
if (client == client->wlr_seat->pointer_state.focused_client) { if (client == client->seat->pointer_state.focused_client) {
client->wlr_seat->pointer_state.focused_client = NULL; client->seat->pointer_state.focused_client = NULL;
} }
if (client == client->wlr_seat->keyboard_state.focused_client) { if (client == client->seat->keyboard_state.focused_client) {
client->wlr_seat->keyboard_state.focused_client = NULL; client->seat->keyboard_state.focused_client = NULL;
} }
if (client->pointer) { if (client->pointer) {
@ -209,7 +209,7 @@ static void wl_seat_bind(struct wl_client *client, void *_wlr_seat,
seat_client->wl_resource = seat_client->wl_resource =
wl_resource_create(client, &wl_seat_interface, version, id); wl_resource_create(client, &wl_seat_interface, version, id);
seat_client->client = client; seat_client->client = client;
seat_client->wlr_seat = wlr_seat; seat_client->seat = wlr_seat;
wl_resource_set_implementation(seat_client->wl_resource, &wl_seat_impl, wl_resource_set_implementation(seat_client->wl_resource, &wl_seat_impl,
seat_client, wlr_seat_client_resource_destroy); seat_client, wlr_seat_client_resource_destroy);
wl_list_insert(&wlr_seat->clients, &seat_client->link); wl_list_insert(&wlr_seat->clients, &seat_client->link);
@ -286,7 +286,7 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
return NULL; return NULL;
} }
wlr_seat->pointer_state.wlr_seat = wlr_seat; wlr_seat->pointer_state.seat = wlr_seat;
wl_list_init(&wlr_seat->pointer_state.surface_destroy.link); wl_list_init(&wlr_seat->pointer_state.surface_destroy.link);
wl_list_init(&wlr_seat->pointer_state.resource_destroy.link); wl_list_init(&wlr_seat->pointer_state.resource_destroy.link);
@ -313,7 +313,7 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
wlr_seat->keyboard_state.default_grab = keyboard_grab; wlr_seat->keyboard_state.default_grab = keyboard_grab;
wlr_seat->keyboard_state.grab = keyboard_grab; wlr_seat->keyboard_state.grab = keyboard_grab;
wlr_seat->keyboard_state.wlr_seat = wlr_seat; wlr_seat->keyboard_state.seat = wlr_seat;
wl_list_init(&wlr_seat->keyboard_state.resource_destroy.link); wl_list_init(&wlr_seat->keyboard_state.resource_destroy.link);
wl_list_init( wl_list_init(
&wlr_seat->keyboard_state.surface_destroy.link); &wlr_seat->keyboard_state.surface_destroy.link);
@ -405,7 +405,7 @@ static void pointer_surface_destroy_notify(struct wl_listener *listener,
wl_list_remove(&state->surface_destroy.link); wl_list_remove(&state->surface_destroy.link);
wl_list_init(&state->surface_destroy.link); wl_list_init(&state->surface_destroy.link);
state->focused_surface = NULL; state->focused_surface = NULL;
wlr_seat_pointer_clear_focus(state->wlr_seat); wlr_seat_pointer_clear_focus(state->seat);
} }
static void pointer_resource_destroy_notify(struct wl_listener *listener, static void pointer_resource_destroy_notify(struct wl_listener *listener,
@ -415,7 +415,7 @@ static void pointer_resource_destroy_notify(struct wl_listener *listener,
wl_list_remove(&state->resource_destroy.link); wl_list_remove(&state->resource_destroy.link);
wl_list_init(&state->resource_destroy.link); wl_list_init(&state->resource_destroy.link);
state->focused_surface = NULL; state->focused_surface = NULL;
wlr_seat_pointer_clear_focus(state->wlr_seat); wlr_seat_pointer_clear_focus(state->seat);
} }
static bool wlr_seat_pointer_has_focus_resource(struct wlr_seat *wlr_seat) { static bool wlr_seat_pointer_has_focus_resource(struct wlr_seat *wlr_seat) {
@ -602,7 +602,7 @@ static void handle_keyboard_keymap(struct wl_listener *listener, void *data) {
struct wlr_seat_keyboard_state *state = struct wlr_seat_keyboard_state *state =
wl_container_of(listener, state, keyboard_keymap); wl_container_of(listener, state, keyboard_keymap);
struct wlr_seat_client *client; struct wlr_seat_client *client;
wl_list_for_each(client, &state->wlr_seat->clients, link) { wl_list_for_each(client, &state->seat->clients, link) {
seat_client_send_keymap(client, state->keyboard); seat_client_send_keymap(client, state->keyboard);
} }
} }
@ -671,7 +671,7 @@ static void keyboard_surface_destroy_notify(struct wl_listener *listener,
wl_list_remove(&state->surface_destroy.link); wl_list_remove(&state->surface_destroy.link);
wl_list_init(&state->surface_destroy.link); wl_list_init(&state->surface_destroy.link);
state->focused_surface = NULL; state->focused_surface = NULL;
wlr_seat_keyboard_clear_focus(state->wlr_seat); wlr_seat_keyboard_clear_focus(state->seat);
} }
static void keyboard_resource_destroy_notify(struct wl_listener *listener, static void keyboard_resource_destroy_notify(struct wl_listener *listener,
@ -681,7 +681,7 @@ static void keyboard_resource_destroy_notify(struct wl_listener *listener,
wl_list_remove(&state->resource_destroy.link); wl_list_remove(&state->resource_destroy.link);
wl_list_init(&state->resource_destroy.link); wl_list_init(&state->resource_destroy.link);
state->focused_surface = NULL; state->focused_surface = NULL;
wlr_seat_keyboard_clear_focus(state->wlr_seat); wlr_seat_keyboard_clear_focus(state->seat);
} }
void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat, void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat,

View File

@ -320,7 +320,7 @@ static void shell_surface_protocol_set_popup(struct wl_client *client,
struct wlr_surface *parent = struct wlr_surface *parent =
wl_resource_get_user_data(parent_resource); wl_resource_get_user_data(parent_resource);
struct wlr_wl_shell_popup_grab *grab = struct wlr_wl_shell_popup_grab *grab =
shell_popup_grab_from_seat(surface->shell, seat_client->wlr_seat); shell_popup_grab_from_seat(surface->shell, seat_client->seat);
if (!grab) { if (!grab) {
wl_client_post_no_memory(client); wl_client_post_no_memory(client);
return; return;
@ -335,7 +335,7 @@ static void shell_surface_protocol_set_popup(struct wl_client *client,
shell_surface_popup_set_parent(surface, wl_parent); shell_surface_popup_set_parent(surface, wl_parent);
grab->client = surface->client; grab->client = surface->client;
surface->popup_mapped = true; surface->popup_mapped = true;
wlr_seat_pointer_start_grab(seat_client->wlr_seat, &grab->pointer_grab); wlr_seat_pointer_start_grab(seat_client->seat, &grab->pointer_grab);
return; return;
} }
@ -356,7 +356,7 @@ static void shell_surface_protocol_set_popup(struct wl_client *client,
wl_client_post_no_memory(client); wl_client_post_no_memory(client);
return; return;
} }
popup_state->seat = seat_client->wlr_seat; popup_state->seat = seat_client->seat;
popup_state->serial = serial; popup_state->serial = serial;
shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_POPUP, shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_POPUP,
@ -366,7 +366,7 @@ static void shell_surface_protocol_set_popup(struct wl_client *client,
grab->client = surface->client; grab->client = surface->client;
wl_list_insert(&grab->popups, &surface->grab_link); wl_list_insert(&grab->popups, &surface->grab_link);
surface->popup_mapped = true; surface->popup_mapped = true;
wlr_seat_pointer_start_grab(seat_client->wlr_seat, &grab->pointer_grab); wlr_seat_pointer_start_grab(seat_client->seat, &grab->pointer_grab);
} }
static void shell_surface_protocol_set_maximized(struct wl_client *client, static void shell_surface_protocol_set_maximized(struct wl_client *client,

View File

@ -368,7 +368,7 @@ static void xdg_popup_protocol_grab(struct wl_client *client,
struct wlr_xdg_popup_grab_v6 *popup_grab = struct wlr_xdg_popup_grab_v6 *popup_grab =
xdg_shell_popup_grab_from_seat(surface->client->shell, xdg_shell_popup_grab_from_seat(surface->client->shell,
seat_client->wlr_seat); seat_client->seat);
struct wlr_xdg_surface_v6 *topmost = xdg_popup_grab_get_topmost(popup_grab); struct wlr_xdg_surface_v6 *topmost = xdg_popup_grab_get_topmost(popup_grab);
bool parent_is_toplevel = bool parent_is_toplevel =
@ -383,13 +383,13 @@ static void xdg_popup_protocol_grab(struct wl_client *client,
} }
popup_grab->client = surface->client->client; popup_grab->client = surface->client->client;
surface->popup_state->seat = seat_client->wlr_seat; surface->popup_state->seat = seat_client->seat;
wl_list_insert(&popup_grab->popups, &surface->popup_state->grab_link); wl_list_insert(&popup_grab->popups, &surface->popup_state->grab_link);
wlr_seat_pointer_start_grab(seat_client->wlr_seat, wlr_seat_pointer_start_grab(seat_client->seat,
&popup_grab->pointer_grab); &popup_grab->pointer_grab);
wlr_seat_keyboard_start_grab(seat_client->wlr_seat, wlr_seat_keyboard_start_grab(seat_client->seat,
&popup_grab->keyboard_grab); &popup_grab->keyboard_grab);
} }