mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-07 04:58:16 +02:00
compositor: Change notify_* function to take a weston_seat
Fewer indirections and derefs, and it's also more appropriate for a backend calling into weston core to pass a weston_seat.
This commit is contained in:
parent
05890dc621
commit
cb3eaae9ad
8 changed files with 193 additions and 202 deletions
|
|
@ -322,7 +322,7 @@ android_seat_destroy(struct android_seat *seat)
|
||||||
evdev_device_destroy(device);
|
evdev_device_destroy(device);
|
||||||
|
|
||||||
if (seat->base.seat.keyboard)
|
if (seat->base.seat.keyboard)
|
||||||
notify_keyboard_focus_out(&seat->base.seat);
|
notify_keyboard_focus_out(&seat->base);
|
||||||
|
|
||||||
weston_seat_release(&seat->base);
|
weston_seat_release(&seat->base);
|
||||||
free(seat);
|
free(seat);
|
||||||
|
|
|
||||||
|
|
@ -2049,7 +2049,7 @@ evdev_remove_devices(struct weston_seat *seat_base)
|
||||||
evdev_device_destroy(device);
|
evdev_device_destroy(device);
|
||||||
|
|
||||||
if (seat->base.seat.keyboard)
|
if (seat->base.seat.keyboard)
|
||||||
notify_keyboard_focus_out(&seat->base.seat);
|
notify_keyboard_focus_out(&seat->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -536,7 +536,7 @@ input_handle_pointer_enter(void *data, struct wl_pointer *pointer,
|
||||||
/* XXX: If we get a modifier event immediately before the focus,
|
/* XXX: If we get a modifier event immediately before the focus,
|
||||||
* we should try to keep the same serial. */
|
* we should try to keep the same serial. */
|
||||||
output = wl_surface_get_user_data(surface);
|
output = wl_surface_get_user_data(surface);
|
||||||
notify_pointer_focus(&input->base.seat, &output->base, x, y);
|
notify_pointer_focus(&input->base, &output->base, x, y);
|
||||||
wl_pointer_set_cursor(input->pointer, serial, NULL, 0, 0);
|
wl_pointer_set_cursor(input->pointer, serial, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -546,7 +546,7 @@ input_handle_pointer_leave(void *data, struct wl_pointer *pointer,
|
||||||
{
|
{
|
||||||
struct wayland_input *input = data;
|
struct wayland_input *input = data;
|
||||||
|
|
||||||
notify_pointer_focus(&input->base.seat, NULL, 0, 0);
|
notify_pointer_focus(&input->base, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -556,7 +556,7 @@ input_handle_motion(void *data, struct wl_pointer *pointer,
|
||||||
struct wayland_input *input = data;
|
struct wayland_input *input = data;
|
||||||
struct wayland_compositor *c = input->compositor;
|
struct wayland_compositor *c = input->compositor;
|
||||||
|
|
||||||
notify_motion(&input->base.seat, time,
|
notify_motion(&input->base, time,
|
||||||
x - wl_fixed_from_int(c->border.left),
|
x - wl_fixed_from_int(c->border.left),
|
||||||
y - wl_fixed_from_int(c->border.top));
|
y - wl_fixed_from_int(c->border.top));
|
||||||
}
|
}
|
||||||
|
|
@ -569,7 +569,7 @@ input_handle_button(void *data, struct wl_pointer *pointer,
|
||||||
struct wayland_input *input = data;
|
struct wayland_input *input = data;
|
||||||
enum wl_pointer_button_state state = state_w;
|
enum wl_pointer_button_state state = state_w;
|
||||||
|
|
||||||
notify_button(&input->base.seat, time, button, state);
|
notify_button(&input->base, time, button, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -578,7 +578,7 @@ input_handle_axis(void *data, struct wl_pointer *pointer,
|
||||||
{
|
{
|
||||||
struct wayland_input *input = data;
|
struct wayland_input *input = data;
|
||||||
|
|
||||||
notify_axis(&input->base.seat, time, axis, value);
|
notify_axis(&input->base, time, axis, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_pointer_listener pointer_listener = {
|
static const struct wl_pointer_listener pointer_listener = {
|
||||||
|
|
@ -640,7 +640,7 @@ input_handle_keyboard_enter(void *data,
|
||||||
|
|
||||||
/* XXX: If we get a modifier event immediately before the focus,
|
/* XXX: If we get a modifier event immediately before the focus,
|
||||||
* we should try to keep the same serial. */
|
* we should try to keep the same serial. */
|
||||||
notify_keyboard_focus_in(&input->base.seat, keys,
|
notify_keyboard_focus_in(&input->base, keys,
|
||||||
STATE_UPDATE_AUTOMATIC);
|
STATE_UPDATE_AUTOMATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -652,7 +652,7 @@ input_handle_keyboard_leave(void *data,
|
||||||
{
|
{
|
||||||
struct wayland_input *input = data;
|
struct wayland_input *input = data;
|
||||||
|
|
||||||
notify_keyboard_focus_out(&input->base.seat);
|
notify_keyboard_focus_out(&input->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -662,7 +662,7 @@ input_handle_key(void *data, struct wl_keyboard *keyboard,
|
||||||
struct wayland_input *input = data;
|
struct wayland_input *input = data;
|
||||||
|
|
||||||
input->key_serial = serial;
|
input->key_serial = serial;
|
||||||
notify_key(&input->base.seat, time, key,
|
notify_key(&input->base, time, key,
|
||||||
state ? WL_KEYBOARD_KEY_STATE_PRESSED :
|
state ? WL_KEYBOARD_KEY_STATE_PRESSED :
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED,
|
WL_KEYBOARD_KEY_STATE_RELEASED,
|
||||||
STATE_UPDATE_NONE);
|
STATE_UPDATE_NONE);
|
||||||
|
|
@ -689,7 +689,7 @@ input_handle_modifiers(void *data, struct wl_keyboard *keyboard,
|
||||||
xkb_state_update_mask(input->base.xkb_state.state,
|
xkb_state_update_mask(input->base.xkb_state.state,
|
||||||
mods_depressed, mods_latched,
|
mods_depressed, mods_latched,
|
||||||
mods_locked, 0, 0, group);
|
mods_locked, 0, 0, group);
|
||||||
notify_modifiers(&input->base.seat, serial_out);
|
notify_modifiers(&input->base, serial_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_keyboard_listener keyboard_listener = {
|
static const struct wl_keyboard_listener keyboard_listener = {
|
||||||
|
|
|
||||||
|
|
@ -641,8 +641,6 @@ get_xkb_mod_mask(struct x11_compositor *c, uint32_t in)
|
||||||
static void
|
static void
|
||||||
update_xkb_state(struct x11_compositor *c, xcb_xkb_state_notify_event_t *state)
|
update_xkb_state(struct x11_compositor *c, xcb_xkb_state_notify_event_t *state)
|
||||||
{
|
{
|
||||||
struct wl_seat *seat = &c->core_seat.seat;
|
|
||||||
|
|
||||||
xkb_state_update_mask(c->core_seat.xkb_state.state,
|
xkb_state_update_mask(c->core_seat.xkb_state.state,
|
||||||
get_xkb_mod_mask(c, state->baseMods),
|
get_xkb_mod_mask(c, state->baseMods),
|
||||||
get_xkb_mod_mask(c, state->latchedMods),
|
get_xkb_mod_mask(c, state->latchedMods),
|
||||||
|
|
@ -651,7 +649,8 @@ update_xkb_state(struct x11_compositor *c, xcb_xkb_state_notify_event_t *state)
|
||||||
0,
|
0,
|
||||||
state->group);
|
state->group);
|
||||||
|
|
||||||
notify_modifiers(seat, wl_display_next_serial(c->base.wl_display));
|
notify_modifiers(&c->core_seat,
|
||||||
|
wl_display_next_serial(c->base.wl_display));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -679,7 +678,7 @@ update_xkb_state_from_core(struct x11_compositor *c, uint16_t x11_mask)
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
(x11_mask >> 13) & 3);
|
(x11_mask >> 13) & 3);
|
||||||
notify_modifiers(&c->core_seat.seat,
|
notify_modifiers(&c->core_seat,
|
||||||
wl_display_next_serial(c->base.wl_display));
|
wl_display_next_serial(c->base.wl_display));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -706,35 +705,35 @@ x11_compositor_deliver_button_event(struct x11_compositor *c,
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (state)
|
if (state)
|
||||||
notify_axis(&c->core_seat.seat,
|
notify_axis(&c->core_seat,
|
||||||
weston_compositor_get_time(),
|
weston_compositor_get_time(),
|
||||||
WL_POINTER_AXIS_VERTICAL_SCROLL,
|
WL_POINTER_AXIS_VERTICAL_SCROLL,
|
||||||
wl_fixed_from_int(1));
|
wl_fixed_from_int(1));
|
||||||
return;
|
return;
|
||||||
case 5:
|
case 5:
|
||||||
if (state)
|
if (state)
|
||||||
notify_axis(&c->core_seat.seat,
|
notify_axis(&c->core_seat,
|
||||||
weston_compositor_get_time(),
|
weston_compositor_get_time(),
|
||||||
WL_POINTER_AXIS_VERTICAL_SCROLL,
|
WL_POINTER_AXIS_VERTICAL_SCROLL,
|
||||||
wl_fixed_from_int(-1));
|
wl_fixed_from_int(-1));
|
||||||
return;
|
return;
|
||||||
case 6:
|
case 6:
|
||||||
if (state)
|
if (state)
|
||||||
notify_axis(&c->core_seat.seat,
|
notify_axis(&c->core_seat,
|
||||||
weston_compositor_get_time(),
|
weston_compositor_get_time(),
|
||||||
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
||||||
wl_fixed_from_int(1));
|
wl_fixed_from_int(1));
|
||||||
return;
|
return;
|
||||||
case 7:
|
case 7:
|
||||||
if (state)
|
if (state)
|
||||||
notify_axis(&c->core_seat.seat,
|
notify_axis(&c->core_seat,
|
||||||
weston_compositor_get_time(),
|
weston_compositor_get_time(),
|
||||||
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
||||||
wl_fixed_from_int(-1));
|
wl_fixed_from_int(-1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
notify_button(&c->core_seat.seat,
|
notify_button(&c->core_seat,
|
||||||
weston_compositor_get_time(), button,
|
weston_compositor_get_time(), button,
|
||||||
state ? WL_POINTER_BUTTON_STATE_PRESSED :
|
state ? WL_POINTER_BUTTON_STATE_PRESSED :
|
||||||
WL_POINTER_BUTTON_STATE_RELEASED);
|
WL_POINTER_BUTTON_STATE_RELEASED);
|
||||||
|
|
@ -799,7 +798,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
||||||
* and fall through and handle the new
|
* and fall through and handle the new
|
||||||
* event below. */
|
* event below. */
|
||||||
update_xkb_state_from_core(c, key_release->state);
|
update_xkb_state_from_core(c, key_release->state);
|
||||||
notify_key(&c->core_seat.seat,
|
notify_key(&c->core_seat,
|
||||||
weston_compositor_get_time(),
|
weston_compositor_get_time(),
|
||||||
key_release->detail - 8,
|
key_release->detail - 8,
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED,
|
WL_KEYBOARD_KEY_STATE_RELEASED,
|
||||||
|
|
@ -828,7 +827,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
||||||
* event, rather than with the focus event. I'm not
|
* event, rather than with the focus event. I'm not
|
||||||
* sure of the exact semantics around it and whether
|
* sure of the exact semantics around it and whether
|
||||||
* we can ensure that we get both? */
|
* we can ensure that we get both? */
|
||||||
notify_keyboard_focus_in(&c->core_seat.seat, &c->keys,
|
notify_keyboard_focus_in(&c->core_seat, &c->keys,
|
||||||
STATE_UPDATE_AUTOMATIC);
|
STATE_UPDATE_AUTOMATIC);
|
||||||
|
|
||||||
free(prev);
|
free(prev);
|
||||||
|
|
@ -845,7 +844,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
||||||
key_press = (xcb_key_press_event_t *) event;
|
key_press = (xcb_key_press_event_t *) event;
|
||||||
if (!c->has_xkb)
|
if (!c->has_xkb)
|
||||||
update_xkb_state_from_core(c, key_press->state);
|
update_xkb_state_from_core(c, key_press->state);
|
||||||
notify_key(&c->core_seat.seat,
|
notify_key(&c->core_seat,
|
||||||
weston_compositor_get_time(),
|
weston_compositor_get_time(),
|
||||||
key_press->detail - 8,
|
key_press->detail - 8,
|
||||||
WL_KEYBOARD_KEY_STATE_PRESSED,
|
WL_KEYBOARD_KEY_STATE_PRESSED,
|
||||||
|
|
@ -860,7 +859,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
key_release = (xcb_key_press_event_t *) event;
|
key_release = (xcb_key_press_event_t *) event;
|
||||||
notify_key(&c->core_seat.seat,
|
notify_key(&c->core_seat,
|
||||||
weston_compositor_get_time(),
|
weston_compositor_get_time(),
|
||||||
key_release->detail - 8,
|
key_release->detail - 8,
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED,
|
WL_KEYBOARD_KEY_STATE_RELEASED,
|
||||||
|
|
@ -879,7 +878,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
||||||
output = x11_compositor_find_output(c, motion_notify->event);
|
output = x11_compositor_find_output(c, motion_notify->event);
|
||||||
x = wl_fixed_from_int(output->base.x + motion_notify->event_x);
|
x = wl_fixed_from_int(output->base.x + motion_notify->event_x);
|
||||||
y = wl_fixed_from_int(output->base.y + motion_notify->event_y);
|
y = wl_fixed_from_int(output->base.y + motion_notify->event_y);
|
||||||
notify_motion(&c->core_seat.seat,
|
notify_motion(&c->core_seat,
|
||||||
weston_compositor_get_time(), x, y);
|
weston_compositor_get_time(), x, y);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -899,7 +898,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
||||||
x = wl_fixed_from_int(output->base.x + enter_notify->event_x);
|
x = wl_fixed_from_int(output->base.x + enter_notify->event_x);
|
||||||
y = wl_fixed_from_int(output->base.y + enter_notify->event_y);
|
y = wl_fixed_from_int(output->base.y + enter_notify->event_y);
|
||||||
|
|
||||||
notify_pointer_focus(&c->core_seat.seat,
|
notify_pointer_focus(&c->core_seat,
|
||||||
&output->base, x, y);
|
&output->base, x, y);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -910,7 +909,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
||||||
if (!c->has_xkb)
|
if (!c->has_xkb)
|
||||||
update_xkb_state_from_core(c, enter_notify->state);
|
update_xkb_state_from_core(c, enter_notify->state);
|
||||||
output = x11_compositor_find_output(c, enter_notify->event);
|
output = x11_compositor_find_output(c, enter_notify->event);
|
||||||
notify_pointer_focus(&c->core_seat.seat, NULL, 0, 0);
|
notify_pointer_focus(&c->core_seat, NULL, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XCB_CLIENT_MESSAGE:
|
case XCB_CLIENT_MESSAGE:
|
||||||
|
|
@ -933,7 +932,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
||||||
if (focus_in->mode == XCB_NOTIFY_MODE_WHILE_GRABBED ||
|
if (focus_in->mode == XCB_NOTIFY_MODE_WHILE_GRABBED ||
|
||||||
focus_in->mode == XCB_NOTIFY_MODE_UNGRAB)
|
focus_in->mode == XCB_NOTIFY_MODE_UNGRAB)
|
||||||
break;
|
break;
|
||||||
notify_keyboard_focus_out(&c->core_seat.seat);
|
notify_keyboard_focus_out(&c->core_seat);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -959,7 +958,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
||||||
case XCB_KEY_RELEASE:
|
case XCB_KEY_RELEASE:
|
||||||
key_release = (xcb_key_press_event_t *) prev;
|
key_release = (xcb_key_press_event_t *) prev;
|
||||||
update_xkb_state_from_core(c, key_release->state);
|
update_xkb_state_from_core(c, key_release->state);
|
||||||
notify_key(&c->core_seat.seat,
|
notify_key(&c->core_seat,
|
||||||
weston_compositor_get_time(),
|
weston_compositor_get_time(),
|
||||||
key_release->detail - 8,
|
key_release->detail - 8,
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED,
|
WL_KEYBOARD_KEY_STATE_RELEASED,
|
||||||
|
|
|
||||||
298
src/compositor.c
298
src/compositor.c
|
|
@ -609,36 +609,36 @@ weston_compositor_pick_surface(struct weston_compositor *compositor,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
weston_device_repick(struct wl_seat *seat)
|
weston_device_repick(struct weston_seat *seat)
|
||||||
{
|
{
|
||||||
struct weston_seat *ws = (struct weston_seat *) seat;
|
|
||||||
const struct wl_pointer_grab_interface *interface;
|
const struct wl_pointer_grab_interface *interface;
|
||||||
struct weston_surface *surface, *focus;
|
struct weston_surface *surface, *focus;
|
||||||
|
struct wl_pointer *pointer = seat->seat.pointer;
|
||||||
|
|
||||||
if (!seat->pointer)
|
if (!pointer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
surface = weston_compositor_pick_surface(ws->compositor,
|
surface = weston_compositor_pick_surface(seat->compositor,
|
||||||
seat->pointer->x,
|
pointer->x,
|
||||||
seat->pointer->y,
|
pointer->y,
|
||||||
&seat->pointer->current_x,
|
&pointer->current_x,
|
||||||
&seat->pointer->current_y);
|
&pointer->current_y);
|
||||||
|
|
||||||
if (&surface->surface != seat->pointer->current) {
|
if (&surface->surface != pointer->current) {
|
||||||
interface = seat->pointer->grab->interface;
|
interface = pointer->grab->interface;
|
||||||
seat->pointer->current = &surface->surface;
|
pointer->current = &surface->surface;
|
||||||
interface->focus(seat->pointer->grab, &surface->surface,
|
interface->focus(pointer->grab, &surface->surface,
|
||||||
seat->pointer->current_x,
|
pointer->current_x,
|
||||||
seat->pointer->current_y);
|
pointer->current_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
focus = (struct weston_surface *) seat->pointer->grab->focus;
|
focus = (struct weston_surface *) pointer->grab->focus;
|
||||||
if (focus)
|
if (focus)
|
||||||
weston_surface_from_global_fixed(focus,
|
weston_surface_from_global_fixed(focus,
|
||||||
seat->pointer->x,
|
pointer->x,
|
||||||
seat->pointer->y,
|
pointer->y,
|
||||||
&seat->pointer->grab->x,
|
&pointer->grab->x,
|
||||||
&seat->pointer->grab->y);
|
&pointer->grab->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -650,7 +650,7 @@ weston_compositor_repick(struct weston_compositor *compositor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wl_list_for_each(seat, &compositor->seat_list, link)
|
wl_list_for_each(seat, &compositor->seat_list, link)
|
||||||
weston_device_repick(&seat->seat);
|
weston_device_repick(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
|
|
@ -1695,7 +1695,7 @@ weston_plane_release(struct weston_plane *plane)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
weston_seat_update_drag_surface(struct wl_seat *seat, int dx, int dy);
|
weston_seat_update_drag_surface(struct weston_seat *seat, int dx, int dy);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clip_pointer_motion(struct weston_seat *seat, wl_fixed_t *fx, wl_fixed_t *fy)
|
clip_pointer_motion(struct weston_seat *seat, wl_fixed_t *fx, wl_fixed_t *fy)
|
||||||
|
|
@ -1733,24 +1733,22 @@ clip_pointer_motion(struct weston_seat *seat, wl_fixed_t *fx, wl_fixed_t *fy)
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
notify_motion(struct wl_seat *seat, uint32_t time, wl_fixed_t x, wl_fixed_t y)
|
notify_motion(struct weston_seat *seat, uint32_t time, wl_fixed_t x, wl_fixed_t y)
|
||||||
{
|
{
|
||||||
const struct wl_pointer_grab_interface *interface;
|
const struct wl_pointer_grab_interface *interface;
|
||||||
struct weston_seat *ws = (struct weston_seat *) seat;
|
struct weston_compositor *ec = seat->compositor;
|
||||||
struct weston_compositor *ec = ws->compositor;
|
|
||||||
struct weston_output *output;
|
struct weston_output *output;
|
||||||
|
struct wl_pointer *pointer = seat->seat.pointer;
|
||||||
int32_t ix, iy;
|
int32_t ix, iy;
|
||||||
|
|
||||||
weston_compositor_activity(ec);
|
weston_compositor_activity(ec);
|
||||||
|
|
||||||
clip_pointer_motion(ws, &x, &y);
|
clip_pointer_motion(seat, &x, &y);
|
||||||
|
|
||||||
weston_seat_update_drag_surface(seat,
|
weston_seat_update_drag_surface(seat, x - pointer->x, y - pointer->y);
|
||||||
x - seat->pointer->x,
|
|
||||||
y - seat->pointer->y);
|
|
||||||
|
|
||||||
seat->pointer->x = x;
|
pointer->x = x;
|
||||||
seat->pointer->y = y;
|
pointer->y = y;
|
||||||
|
|
||||||
ix = wl_fixed_to_int(x);
|
ix = wl_fixed_to_int(x);
|
||||||
iy = wl_fixed_to_int(y);
|
iy = wl_fixed_to_int(y);
|
||||||
|
|
@ -1762,15 +1760,15 @@ notify_motion(struct wl_seat *seat, uint32_t time, wl_fixed_t x, wl_fixed_t y)
|
||||||
weston_output_update_zoom(output, ZOOM_FOCUS_POINTER);
|
weston_output_update_zoom(output, ZOOM_FOCUS_POINTER);
|
||||||
|
|
||||||
weston_device_repick(seat);
|
weston_device_repick(seat);
|
||||||
interface = seat->pointer->grab->interface;
|
interface = pointer->grab->interface;
|
||||||
interface->motion(seat->pointer->grab, time,
|
interface->motion(pointer->grab, time,
|
||||||
seat->pointer->grab->x, seat->pointer->grab->y);
|
pointer->grab->x, pointer->grab->y);
|
||||||
|
|
||||||
if (ws->sprite) {
|
if (seat->sprite) {
|
||||||
weston_surface_set_position(ws->sprite,
|
weston_surface_set_position(seat->sprite,
|
||||||
ix - ws->hotspot_x,
|
ix - seat->hotspot_x,
|
||||||
iy - ws->hotspot_y);
|
iy - seat->hotspot_y);
|
||||||
weston_surface_schedule_repaint(ws->sprite);
|
weston_surface_schedule_repaint(seat->sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1789,50 +1787,49 @@ weston_surface_activate(struct weston_surface *surface,
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
notify_button(struct wl_seat *seat, uint32_t time, int32_t button,
|
notify_button(struct weston_seat *seat, uint32_t time, int32_t button,
|
||||||
enum wl_pointer_button_state state)
|
enum wl_pointer_button_state state)
|
||||||
{
|
{
|
||||||
struct weston_seat *ws = (struct weston_seat *) seat;
|
struct weston_compositor *compositor = seat->compositor;
|
||||||
struct weston_compositor *compositor = ws->compositor;
|
struct wl_pointer *pointer = seat->seat.pointer;
|
||||||
struct weston_surface *focus =
|
struct weston_surface *focus =
|
||||||
(struct weston_surface *) seat->pointer->focus;
|
(struct weston_surface *) pointer->focus;
|
||||||
uint32_t serial = wl_display_next_serial(compositor->wl_display);
|
uint32_t serial = wl_display_next_serial(compositor->wl_display);
|
||||||
|
|
||||||
if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
||||||
if (compositor->ping_handler && focus)
|
if (compositor->ping_handler && focus)
|
||||||
compositor->ping_handler(focus, serial);
|
compositor->ping_handler(focus, serial);
|
||||||
weston_compositor_idle_inhibit(compositor);
|
weston_compositor_idle_inhibit(compositor);
|
||||||
if (seat->pointer->button_count == 0) {
|
if (pointer->button_count == 0) {
|
||||||
seat->pointer->grab_button = button;
|
pointer->grab_button = button;
|
||||||
seat->pointer->grab_time = time;
|
pointer->grab_time = time;
|
||||||
seat->pointer->grab_x = seat->pointer->x;
|
pointer->grab_x = pointer->x;
|
||||||
seat->pointer->grab_y = seat->pointer->y;
|
pointer->grab_y = pointer->y;
|
||||||
}
|
}
|
||||||
seat->pointer->button_count++;
|
pointer->button_count++;
|
||||||
} else {
|
} else {
|
||||||
weston_compositor_idle_release(compositor);
|
weston_compositor_idle_release(compositor);
|
||||||
seat->pointer->button_count--;
|
pointer->button_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
weston_compositor_run_button_binding(compositor, ws, time, button,
|
weston_compositor_run_button_binding(compositor, seat, time, button,
|
||||||
state);
|
state);
|
||||||
|
|
||||||
seat->pointer->grab->interface->button(seat->pointer->grab, time,
|
pointer->grab->interface->button(pointer->grab, time, button, state);
|
||||||
button, state);
|
|
||||||
|
|
||||||
if (seat->pointer->button_count == 1)
|
if (pointer->button_count == 1)
|
||||||
seat->pointer->grab_serial =
|
pointer->grab_serial =
|
||||||
wl_display_get_serial(compositor->wl_display);
|
wl_display_get_serial(compositor->wl_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
notify_axis(struct wl_seat *seat, uint32_t time, uint32_t axis,
|
notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
|
||||||
wl_fixed_t value)
|
wl_fixed_t value)
|
||||||
{
|
{
|
||||||
struct weston_seat *ws = (struct weston_seat *) seat;
|
struct weston_compositor *compositor = seat->compositor;
|
||||||
struct weston_compositor *compositor = ws->compositor;
|
struct wl_pointer *pointer = seat->seat.pointer;
|
||||||
struct weston_surface *focus =
|
struct weston_surface *focus =
|
||||||
(struct weston_surface *) seat->pointer->focus;
|
(struct weston_surface *) pointer->focus;
|
||||||
uint32_t serial = wl_display_next_serial(compositor->wl_display);
|
uint32_t serial = wl_display_next_serial(compositor->wl_display);
|
||||||
|
|
||||||
if (compositor->ping_handler && focus)
|
if (compositor->ping_handler && focus)
|
||||||
|
|
@ -1841,20 +1838,19 @@ notify_axis(struct wl_seat *seat, uint32_t time, uint32_t axis,
|
||||||
weston_compositor_activity(compositor);
|
weston_compositor_activity(compositor);
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
weston_compositor_run_axis_binding(compositor, ws, time, axis,
|
weston_compositor_run_axis_binding(compositor, seat,
|
||||||
value);
|
time, axis, value);
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (seat->pointer->focus_resource)
|
if (pointer->focus_resource)
|
||||||
wl_pointer_send_axis(seat->pointer->focus_resource, time, axis,
|
wl_pointer_send_axis(pointer->focus_resource, time, axis,
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
notify_modifiers(struct wl_seat *wl_seat, uint32_t serial)
|
notify_modifiers(struct weston_seat *seat, uint32_t serial)
|
||||||
{
|
{
|
||||||
struct weston_seat *seat = (struct weston_seat *) wl_seat;
|
|
||||||
struct wl_keyboard *keyboard = &seat->keyboard;
|
struct wl_keyboard *keyboard = &seat->keyboard;
|
||||||
struct wl_keyboard_grab *grab = keyboard->grab;
|
struct wl_keyboard_grab *grab = keyboard->grab;
|
||||||
uint32_t mods_depressed, mods_latched, mods_locked, group;
|
uint32_t mods_depressed, mods_latched, mods_locked, group;
|
||||||
|
|
@ -1935,19 +1931,19 @@ update_modifier_state(struct weston_seat *seat, uint32_t serial, uint32_t key,
|
||||||
* broken keycode system, which starts at 8. */
|
* broken keycode system, which starts at 8. */
|
||||||
xkb_state_update_key(seat->xkb_state.state, key + 8, direction);
|
xkb_state_update_key(seat->xkb_state.state, key + 8, direction);
|
||||||
|
|
||||||
notify_modifiers(&seat->seat, serial);
|
notify_modifiers(seat, serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
|
notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
|
||||||
enum wl_keyboard_key_state state,
|
enum wl_keyboard_key_state state,
|
||||||
enum weston_key_state_update update_state)
|
enum weston_key_state_update update_state)
|
||||||
{
|
{
|
||||||
struct weston_seat *ws = (struct weston_seat *) seat;
|
struct weston_compositor *compositor = seat->compositor;
|
||||||
struct weston_compositor *compositor = ws->compositor;
|
struct wl_keyboard *keyboard = seat->seat.keyboard;
|
||||||
struct weston_surface *focus =
|
struct weston_surface *focus =
|
||||||
(struct weston_surface *) seat->keyboard->focus;
|
(struct weston_surface *) keyboard->focus;
|
||||||
struct wl_keyboard_grab *grab = seat->keyboard->grab;
|
struct wl_keyboard_grab *grab = keyboard->grab;
|
||||||
uint32_t serial = wl_display_next_serial(compositor->wl_display);
|
uint32_t serial = wl_display_next_serial(compositor->wl_display);
|
||||||
uint32_t *k, *end;
|
uint32_t *k, *end;
|
||||||
|
|
||||||
|
|
@ -1956,14 +1952,14 @@ notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
|
||||||
compositor->ping_handler(focus, serial);
|
compositor->ping_handler(focus, serial);
|
||||||
|
|
||||||
weston_compositor_idle_inhibit(compositor);
|
weston_compositor_idle_inhibit(compositor);
|
||||||
seat->keyboard->grab_key = key;
|
keyboard->grab_key = key;
|
||||||
seat->keyboard->grab_time = time;
|
keyboard->grab_time = time;
|
||||||
} else {
|
} else {
|
||||||
weston_compositor_idle_release(compositor);
|
weston_compositor_idle_release(compositor);
|
||||||
}
|
}
|
||||||
|
|
||||||
end = seat->keyboard->keys.data + seat->keyboard->keys.size;
|
end = keyboard->keys.data + keyboard->keys.size;
|
||||||
for (k = seat->keyboard->keys.data; k < end; k++) {
|
for (k = keyboard->keys.data; k < end; k++) {
|
||||||
if (*k == key) {
|
if (*k == key) {
|
||||||
/* Ignore server-generated repeats. */
|
/* Ignore server-generated repeats. */
|
||||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
|
if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
|
||||||
|
|
@ -1971,22 +1967,22 @@ notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
|
||||||
*k = *--end;
|
*k = *--end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
seat->keyboard->keys.size = (void *) end - seat->keyboard->keys.data;
|
keyboard->keys.size = (void *) end - keyboard->keys.data;
|
||||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
k = wl_array_add(&seat->keyboard->keys, sizeof *k);
|
k = wl_array_add(&keyboard->keys, sizeof *k);
|
||||||
*k = key;
|
*k = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grab == &seat->keyboard->default_grab) {
|
if (grab == &keyboard->default_grab) {
|
||||||
weston_compositor_run_key_binding(compositor, ws, time, key,
|
weston_compositor_run_key_binding(compositor, seat, time, key,
|
||||||
state);
|
state);
|
||||||
grab = seat->keyboard->grab;
|
grab = keyboard->grab;
|
||||||
}
|
}
|
||||||
|
|
||||||
grab->interface->key(grab, time, key, state);
|
grab->interface->key(grab, time, key, state);
|
||||||
|
|
||||||
if (update_state == STATE_UPDATE_AUTOMATIC) {
|
if (update_state == STATE_UPDATE_AUTOMATIC) {
|
||||||
update_modifier_state(ws,
|
update_modifier_state(seat,
|
||||||
wl_display_get_serial(compositor->wl_display),
|
wl_display_get_serial(compositor->wl_display),
|
||||||
key,
|
key,
|
||||||
state);
|
state);
|
||||||
|
|
@ -1994,19 +1990,19 @@ notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
notify_pointer_focus(struct wl_seat *seat, struct weston_output *output,
|
notify_pointer_focus(struct weston_seat *seat, struct weston_output *output,
|
||||||
wl_fixed_t x, wl_fixed_t y)
|
wl_fixed_t x, wl_fixed_t y)
|
||||||
{
|
{
|
||||||
struct weston_seat *ws = (struct weston_seat *) seat;
|
struct weston_compositor *compositor = seat->compositor;
|
||||||
struct weston_compositor *compositor = ws->compositor;
|
struct wl_pointer *pointer = seat->seat.pointer;
|
||||||
|
|
||||||
if (output) {
|
if (output) {
|
||||||
weston_seat_update_drag_surface(seat,
|
weston_seat_update_drag_surface(seat,
|
||||||
x - seat->pointer->x,
|
x - pointer->x,
|
||||||
y - seat->pointer->y);
|
y - pointer->y);
|
||||||
|
|
||||||
seat->pointer->x = x;
|
pointer->x = x;
|
||||||
seat->pointer->y = y;
|
pointer->y = y;
|
||||||
compositor->focus = 1;
|
compositor->focus = 1;
|
||||||
weston_compositor_repick(compositor);
|
weston_compositor_repick(compositor);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2028,70 +2024,67 @@ destroy_device_saved_kbd_focus(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
notify_keyboard_focus_in(struct wl_seat *seat, struct wl_array *keys,
|
notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
|
||||||
enum weston_key_state_update update_state)
|
enum weston_key_state_update update_state)
|
||||||
{
|
{
|
||||||
struct weston_seat *ws = (struct weston_seat *) seat;
|
struct weston_compositor *compositor = seat->compositor;
|
||||||
struct weston_compositor *compositor = ws->compositor;
|
struct wl_keyboard *keyboard = seat->seat.keyboard;
|
||||||
struct wl_surface *surface;
|
struct wl_surface *surface;
|
||||||
uint32_t *k, serial;
|
uint32_t *k, serial;
|
||||||
|
|
||||||
serial = wl_display_next_serial(compositor->wl_display);
|
serial = wl_display_next_serial(compositor->wl_display);
|
||||||
wl_array_copy(&seat->keyboard->keys, keys);
|
wl_array_copy(&keyboard->keys, keys);
|
||||||
wl_array_for_each(k, &seat->keyboard->keys) {
|
wl_array_for_each(k, &keyboard->keys) {
|
||||||
weston_compositor_idle_inhibit(compositor);
|
weston_compositor_idle_inhibit(compositor);
|
||||||
if (update_state == STATE_UPDATE_AUTOMATIC)
|
if (update_state == STATE_UPDATE_AUTOMATIC)
|
||||||
update_modifier_state(ws, serial, *k,
|
update_modifier_state(seat, serial, *k,
|
||||||
WL_KEYBOARD_KEY_STATE_PRESSED);
|
WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run key bindings after we've updated the state. */
|
/* Run key bindings after we've updated the state. */
|
||||||
wl_array_for_each(k, &seat->keyboard->keys) {
|
wl_array_for_each(k, &keyboard->keys) {
|
||||||
weston_compositor_run_key_binding(compositor, ws, 0, *k,
|
weston_compositor_run_key_binding(compositor, seat, 0, *k,
|
||||||
WL_KEYBOARD_KEY_STATE_PRESSED);
|
WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
surface = ws->saved_kbd_focus;
|
surface = seat->saved_kbd_focus;
|
||||||
|
|
||||||
if (surface) {
|
if (surface) {
|
||||||
wl_list_remove(&ws->saved_kbd_focus_listener.link);
|
wl_list_remove(&seat->saved_kbd_focus_listener.link);
|
||||||
wl_keyboard_set_focus(ws->seat.keyboard, surface);
|
wl_keyboard_set_focus(keyboard, surface);
|
||||||
ws->saved_kbd_focus = NULL;
|
seat->saved_kbd_focus = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
notify_keyboard_focus_out(struct wl_seat *seat)
|
notify_keyboard_focus_out(struct weston_seat *seat)
|
||||||
{
|
{
|
||||||
struct weston_seat *ws = (struct weston_seat *) seat;
|
struct weston_compositor *compositor = seat->compositor;
|
||||||
struct weston_compositor *compositor = ws->compositor;
|
struct wl_keyboard *keyboard = seat->seat.keyboard;
|
||||||
struct wl_surface *surface;
|
|
||||||
uint32_t *k, serial;
|
uint32_t *k, serial;
|
||||||
|
|
||||||
serial = wl_display_next_serial(compositor->wl_display);
|
serial = wl_display_next_serial(compositor->wl_display);
|
||||||
wl_array_for_each(k, &seat->keyboard->keys) {
|
wl_array_for_each(k, &keyboard->keys) {
|
||||||
weston_compositor_idle_release(compositor);
|
weston_compositor_idle_release(compositor);
|
||||||
update_modifier_state(ws, serial, *k,
|
update_modifier_state(seat, serial, *k,
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED);
|
WL_KEYBOARD_KEY_STATE_RELEASED);
|
||||||
}
|
}
|
||||||
|
|
||||||
ws->modifier_state = 0;
|
seat->modifier_state = 0;
|
||||||
|
|
||||||
surface = ws->seat.keyboard->focus;
|
if (keyboard->focus) {
|
||||||
|
seat->saved_kbd_focus = keyboard->focus;
|
||||||
if (surface) {
|
seat->saved_kbd_focus_listener.notify =
|
||||||
ws->saved_kbd_focus = surface;
|
|
||||||
ws->saved_kbd_focus_listener.notify =
|
|
||||||
destroy_device_saved_kbd_focus;
|
destroy_device_saved_kbd_focus;
|
||||||
wl_signal_add(&surface->resource.destroy_signal,
|
wl_signal_add(&keyboard->focus->resource.destroy_signal,
|
||||||
&ws->saved_kbd_focus_listener);
|
&seat->saved_kbd_focus_listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_keyboard_set_focus(ws->seat.keyboard, NULL);
|
wl_keyboard_set_focus(keyboard, NULL);
|
||||||
/* FIXME: We really need keyboard grab cancel here to
|
/* FIXME: We really need keyboard grab cancel here to
|
||||||
* let the grab shut down properly. As it is we leak
|
* let the grab shut down properly. As it is we leak
|
||||||
* the grab data. */
|
* the grab data. */
|
||||||
wl_keyboard_end_grab(ws->seat.keyboard);
|
wl_keyboard_end_grab(keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -2133,11 +2126,11 @@ touch_set_focus(struct weston_seat *ws, struct wl_surface *surface)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
notify_touch(struct wl_seat *seat, uint32_t time, int touch_id,
|
notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
|
||||||
wl_fixed_t x, wl_fixed_t y, int touch_type)
|
wl_fixed_t x, wl_fixed_t y, int touch_type)
|
||||||
{
|
{
|
||||||
struct weston_seat *ws = (struct weston_seat *) seat;
|
struct weston_compositor *ec = seat->compositor;
|
||||||
struct weston_compositor *ec = ws->compositor;
|
struct wl_touch *touch = seat->seat.touch;
|
||||||
struct weston_surface *es;
|
struct weston_surface *es;
|
||||||
wl_fixed_t sx, sy;
|
wl_fixed_t sx, sy;
|
||||||
uint32_t serial = 0;
|
uint32_t serial = 0;
|
||||||
|
|
@ -2146,44 +2139,44 @@ notify_touch(struct wl_seat *seat, uint32_t time, int touch_id,
|
||||||
case WL_TOUCH_DOWN:
|
case WL_TOUCH_DOWN:
|
||||||
weston_compositor_idle_inhibit(ec);
|
weston_compositor_idle_inhibit(ec);
|
||||||
|
|
||||||
ws->num_tp++;
|
seat->num_tp++;
|
||||||
|
|
||||||
/* the first finger down picks the surface, and all further go
|
/* the first finger down picks the surface, and all further go
|
||||||
* to that surface for the remainder of the touch session i.e.
|
* to that surface for the remainder of the touch session i.e.
|
||||||
* until all touch points are up again. */
|
* until all touch points are up again. */
|
||||||
if (ws->num_tp == 1) {
|
if (seat->num_tp == 1) {
|
||||||
es = weston_compositor_pick_surface(ec, x, y, &sx, &sy);
|
es = weston_compositor_pick_surface(ec, x, y, &sx, &sy);
|
||||||
touch_set_focus(ws, &es->surface);
|
touch_set_focus(seat, &es->surface);
|
||||||
} else if (seat->touch->focus) {
|
} else if (touch->focus) {
|
||||||
es = (struct weston_surface *)seat->touch->focus;
|
es = (struct weston_surface *) touch->focus;
|
||||||
weston_surface_from_global_fixed(es, x, y, &sx, &sy);
|
weston_surface_from_global_fixed(es, x, y, &sx, &sy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seat->touch->focus_resource && seat->touch->focus)
|
if (touch->focus_resource && touch->focus)
|
||||||
wl_touch_send_down(seat->touch->focus_resource,
|
wl_touch_send_down(touch->focus_resource,
|
||||||
serial, time,
|
serial, time,
|
||||||
&seat->touch->focus->resource,
|
&touch->focus->resource,
|
||||||
touch_id, sx, sy);
|
touch_id, sx, sy);
|
||||||
break;
|
break;
|
||||||
case WL_TOUCH_MOTION:
|
case WL_TOUCH_MOTION:
|
||||||
es = (struct weston_surface *)seat->touch->focus;
|
es = (struct weston_surface *) touch->focus;
|
||||||
if (!es)
|
if (!es)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
weston_surface_from_global_fixed(es, x, y, &sx, &sy);
|
weston_surface_from_global_fixed(es, x, y, &sx, &sy);
|
||||||
if (seat->touch->focus_resource)
|
if (touch->focus_resource)
|
||||||
wl_touch_send_motion(seat->touch->focus_resource,
|
wl_touch_send_motion(touch->focus_resource,
|
||||||
time, touch_id, sx, sy);
|
time, touch_id, sx, sy);
|
||||||
break;
|
break;
|
||||||
case WL_TOUCH_UP:
|
case WL_TOUCH_UP:
|
||||||
weston_compositor_idle_release(ec);
|
weston_compositor_idle_release(ec);
|
||||||
ws->num_tp--;
|
seat->num_tp--;
|
||||||
|
|
||||||
if (seat->touch->focus_resource)
|
if (touch->focus_resource)
|
||||||
wl_touch_send_up(seat->touch->focus_resource,
|
wl_touch_send_up(touch->focus_resource,
|
||||||
serial, time, touch_id);
|
serial, time, touch_id);
|
||||||
if (ws->num_tp == 0)
|
if (seat->num_tp == 0)
|
||||||
touch_set_focus(ws, NULL);
|
touch_set_focus(seat, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2418,7 +2411,7 @@ device_handle_new_drag_icon(struct wl_listener *listener, void *data)
|
||||||
seat = container_of(listener, struct weston_seat,
|
seat = container_of(listener, struct weston_seat,
|
||||||
new_drag_icon_listener);
|
new_drag_icon_listener);
|
||||||
|
|
||||||
weston_seat_update_drag_surface(&seat->seat, 0, 0);
|
weston_seat_update_drag_surface(seat, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void weston_compositor_xkb_init(struct weston_compositor *ec,
|
static void weston_compositor_xkb_init(struct weston_compositor *ec,
|
||||||
|
|
@ -2714,49 +2707,48 @@ device_map_drag_surface(struct weston_seat *seat)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
weston_seat_update_drag_surface(struct wl_seat *seat,
|
weston_seat_update_drag_surface(struct weston_seat *seat,
|
||||||
int dx, int dy)
|
int dx, int dy)
|
||||||
{
|
{
|
||||||
int surface_changed = 0;
|
int surface_changed = 0;
|
||||||
struct weston_seat *ws = (struct weston_seat *) seat;
|
|
||||||
|
|
||||||
if (!ws->drag_surface && !seat->drag_surface)
|
if (!seat->drag_surface && !seat->seat.drag_surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ws->drag_surface && seat->drag_surface &&
|
if (seat->drag_surface && seat->seat.drag_surface &&
|
||||||
(&ws->drag_surface->surface.resource !=
|
(&seat->drag_surface->surface.resource !=
|
||||||
&seat->drag_surface->resource))
|
&seat->seat.drag_surface->resource))
|
||||||
/* between calls to this funcion we got a new drag_surface */
|
/* between calls to this funcion we got a new drag_surface */
|
||||||
surface_changed = 1;
|
surface_changed = 1;
|
||||||
|
|
||||||
if (!seat->drag_surface || surface_changed) {
|
if (!seat->seat.drag_surface || surface_changed) {
|
||||||
device_release_drag_surface(ws);
|
device_release_drag_surface(seat);
|
||||||
if (!surface_changed)
|
if (!surface_changed)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ws->drag_surface || surface_changed) {
|
if (!seat->drag_surface || surface_changed) {
|
||||||
struct weston_surface *surface = (struct weston_surface *)
|
struct weston_surface *surface = (struct weston_surface *)
|
||||||
seat->drag_surface;
|
seat->seat.drag_surface;
|
||||||
if (!device_setup_new_drag_surface(ws, surface))
|
if (!device_setup_new_drag_surface(seat, surface))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the client may not have attached a buffer to the drag surface
|
/* the client may not have attached a buffer to the drag surface
|
||||||
* when we setup it up, so check if map is needed on every update */
|
* when we setup it up, so check if map is needed on every update */
|
||||||
device_map_drag_surface(ws);
|
device_map_drag_surface(seat);
|
||||||
|
|
||||||
/* the client may have attached a buffer with a different size to
|
/* the client may have attached a buffer with a different size to
|
||||||
* the drag surface, causing the input region to be reset */
|
* the drag surface, causing the input region to be reset */
|
||||||
if (region_is_undefined(&ws->drag_surface->input))
|
if (region_is_undefined(&seat->drag_surface->input))
|
||||||
empty_region(&ws->drag_surface->input);
|
empty_region(&seat->drag_surface->input);
|
||||||
|
|
||||||
if (!dx && !dy)
|
if (!dx && !dy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
weston_surface_set_position(ws->drag_surface,
|
weston_surface_set_position(seat->drag_surface,
|
||||||
ws->drag_surface->geometry.x + wl_fixed_to_double(dx),
|
seat->drag_surface->geometry.x + wl_fixed_to_double(dx),
|
||||||
ws->drag_surface->geometry.y + wl_fixed_to_double(dy));
|
seat->drag_surface->geometry.y + wl_fixed_to_double(dy));
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
|
|
@ -2765,7 +2757,7 @@ weston_compositor_update_drag_surfaces(struct weston_compositor *compositor)
|
||||||
struct weston_seat *seat;
|
struct weston_seat *seat;
|
||||||
|
|
||||||
wl_list_for_each(seat, &compositor->seat_list, link)
|
wl_list_for_each(seat, &compositor->seat_list, link)
|
||||||
weston_seat_update_drag_surface(&seat->seat, 0, 0);
|
weston_seat_update_drag_surface(seat, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -502,33 +502,33 @@ weston_surface_draw(struct weston_surface *es,
|
||||||
struct weston_output *output, pixman_region32_t *damage);
|
struct weston_output *output, pixman_region32_t *damage);
|
||||||
|
|
||||||
void
|
void
|
||||||
notify_motion(struct wl_seat *seat, uint32_t time,
|
notify_motion(struct weston_seat *seat, uint32_t time,
|
||||||
wl_fixed_t x, wl_fixed_t y);
|
wl_fixed_t x, wl_fixed_t y);
|
||||||
void
|
void
|
||||||
notify_button(struct wl_seat *seat, uint32_t time, int32_t button,
|
notify_button(struct weston_seat *seat, uint32_t time, int32_t button,
|
||||||
enum wl_pointer_button_state state);
|
enum wl_pointer_button_state state);
|
||||||
void
|
void
|
||||||
notify_axis(struct wl_seat *seat, uint32_t time, uint32_t axis,
|
notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
|
||||||
wl_fixed_t value);
|
wl_fixed_t value);
|
||||||
void
|
void
|
||||||
notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
|
notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
|
||||||
enum wl_keyboard_key_state state,
|
enum wl_keyboard_key_state state,
|
||||||
enum weston_key_state_update update_state);
|
enum weston_key_state_update update_state);
|
||||||
void
|
void
|
||||||
notify_modifiers(struct wl_seat *seat, uint32_t serial);
|
notify_modifiers(struct weston_seat *seat, uint32_t serial);
|
||||||
|
|
||||||
void
|
void
|
||||||
notify_pointer_focus(struct wl_seat *seat, struct weston_output *output,
|
notify_pointer_focus(struct weston_seat *seat, struct weston_output *output,
|
||||||
wl_fixed_t x, wl_fixed_t y);
|
wl_fixed_t x, wl_fixed_t y);
|
||||||
|
|
||||||
void
|
void
|
||||||
notify_keyboard_focus_in(struct wl_seat *seat, struct wl_array *keys,
|
notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
|
||||||
enum weston_key_state_update update_state);
|
enum weston_key_state_update update_state);
|
||||||
void
|
void
|
||||||
notify_keyboard_focus_out(struct wl_seat *seat);
|
notify_keyboard_focus_out(struct weston_seat *seat);
|
||||||
|
|
||||||
void
|
void
|
||||||
notify_touch(struct wl_seat *seat, uint32_t time, int touch_id,
|
notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
|
||||||
wl_fixed_t x, wl_fixed_t y, int touch_type);
|
wl_fixed_t x, wl_fixed_t y, int touch_type);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,7 @@ process_key(struct touchpad_dispatch *touchpad,
|
||||||
case BTN_FORWARD:
|
case BTN_FORWARD:
|
||||||
case BTN_BACK:
|
case BTN_BACK:
|
||||||
case BTN_TASK:
|
case BTN_TASK:
|
||||||
notify_button(&device->seat->seat,
|
notify_button(device->seat,
|
||||||
time, e->code,
|
time, e->code,
|
||||||
e->value ? WL_POINTER_BUTTON_STATE_PRESSED :
|
e->value ? WL_POINTER_BUTTON_STATE_PRESSED :
|
||||||
WL_POINTER_BUTTON_STATE_RELEASED);
|
WL_POINTER_BUTTON_STATE_RELEASED);
|
||||||
|
|
|
||||||
20
src/evdev.c
20
src/evdev.c
|
|
@ -73,14 +73,14 @@ evdev_process_key(struct evdev_device *device, struct input_event *e, int time)
|
||||||
case BTN_FORWARD:
|
case BTN_FORWARD:
|
||||||
case BTN_BACK:
|
case BTN_BACK:
|
||||||
case BTN_TASK:
|
case BTN_TASK:
|
||||||
notify_button(&device->seat->seat,
|
notify_button(device->seat,
|
||||||
time, e->code,
|
time, e->code,
|
||||||
e->value ? WL_POINTER_BUTTON_STATE_PRESSED :
|
e->value ? WL_POINTER_BUTTON_STATE_PRESSED :
|
||||||
WL_POINTER_BUTTON_STATE_RELEASED);
|
WL_POINTER_BUTTON_STATE_RELEASED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
notify_key(&device->seat->seat,
|
notify_key(device->seat,
|
||||||
time, e->code,
|
time, e->code,
|
||||||
e->value ? WL_KEYBOARD_KEY_STATE_PRESSED :
|
e->value ? WL_KEYBOARD_KEY_STATE_PRESSED :
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED,
|
WL_KEYBOARD_KEY_STATE_RELEASED,
|
||||||
|
|
@ -161,13 +161,13 @@ evdev_process_relative(struct evdev_device *device,
|
||||||
device->pending_events |= EVDEV_RELATIVE_MOTION;
|
device->pending_events |= EVDEV_RELATIVE_MOTION;
|
||||||
break;
|
break;
|
||||||
case REL_WHEEL:
|
case REL_WHEEL:
|
||||||
notify_axis(&device->seat->seat,
|
notify_axis(device->seat,
|
||||||
time,
|
time,
|
||||||
WL_POINTER_AXIS_VERTICAL_SCROLL,
|
WL_POINTER_AXIS_VERTICAL_SCROLL,
|
||||||
wl_fixed_from_int(e->value));
|
wl_fixed_from_int(e->value));
|
||||||
break;
|
break;
|
||||||
case REL_HWHEEL:
|
case REL_HWHEEL:
|
||||||
notify_axis(&device->seat->seat,
|
notify_axis(device->seat,
|
||||||
time,
|
time,
|
||||||
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
||||||
wl_fixed_from_int(e->value));
|
wl_fixed_from_int(e->value));
|
||||||
|
|
@ -217,7 +217,7 @@ evdev_flush_motion(struct evdev_device *device, uint32_t time)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (device->pending_events & EVDEV_RELATIVE_MOTION) {
|
if (device->pending_events & EVDEV_RELATIVE_MOTION) {
|
||||||
notify_motion(&master->seat, time,
|
notify_motion(master, time,
|
||||||
master->seat.pointer->x + device->rel.dx,
|
master->seat.pointer->x + device->rel.dx,
|
||||||
master->seat.pointer->y + device->rel.dy);
|
master->seat.pointer->y + device->rel.dy);
|
||||||
device->pending_events &= ~EVDEV_RELATIVE_MOTION;
|
device->pending_events &= ~EVDEV_RELATIVE_MOTION;
|
||||||
|
|
@ -225,7 +225,7 @@ evdev_flush_motion(struct evdev_device *device, uint32_t time)
|
||||||
device->rel.dy = 0;
|
device->rel.dy = 0;
|
||||||
}
|
}
|
||||||
if (device->pending_events & EVDEV_ABSOLUTE_MT_DOWN) {
|
if (device->pending_events & EVDEV_ABSOLUTE_MT_DOWN) {
|
||||||
notify_touch(&master->seat, time,
|
notify_touch(master, time,
|
||||||
device->mt.slot,
|
device->mt.slot,
|
||||||
wl_fixed_from_int(device->mt.x[device->mt.slot]),
|
wl_fixed_from_int(device->mt.x[device->mt.slot]),
|
||||||
wl_fixed_from_int(device->mt.y[device->mt.slot]),
|
wl_fixed_from_int(device->mt.y[device->mt.slot]),
|
||||||
|
|
@ -234,7 +234,7 @@ evdev_flush_motion(struct evdev_device *device, uint32_t time)
|
||||||
device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION;
|
device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION;
|
||||||
}
|
}
|
||||||
if (device->pending_events & EVDEV_ABSOLUTE_MT_MOTION) {
|
if (device->pending_events & EVDEV_ABSOLUTE_MT_MOTION) {
|
||||||
notify_touch(&master->seat, time,
|
notify_touch(master, time,
|
||||||
device->mt.slot,
|
device->mt.slot,
|
||||||
wl_fixed_from_int(device->mt.x[device->mt.slot]),
|
wl_fixed_from_int(device->mt.x[device->mt.slot]),
|
||||||
wl_fixed_from_int(device->mt.y[device->mt.slot]),
|
wl_fixed_from_int(device->mt.y[device->mt.slot]),
|
||||||
|
|
@ -243,12 +243,12 @@ evdev_flush_motion(struct evdev_device *device, uint32_t time)
|
||||||
device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION;
|
device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION;
|
||||||
}
|
}
|
||||||
if (device->pending_events & EVDEV_ABSOLUTE_MT_UP) {
|
if (device->pending_events & EVDEV_ABSOLUTE_MT_UP) {
|
||||||
notify_touch(&master->seat, time, device->mt.slot, 0, 0,
|
notify_touch(master, time, device->mt.slot, 0, 0,
|
||||||
WL_TOUCH_UP);
|
WL_TOUCH_UP);
|
||||||
device->pending_events &= ~EVDEV_ABSOLUTE_MT_UP;
|
device->pending_events &= ~EVDEV_ABSOLUTE_MT_UP;
|
||||||
}
|
}
|
||||||
if (device->pending_events & EVDEV_ABSOLUTE_MOTION) {
|
if (device->pending_events & EVDEV_ABSOLUTE_MOTION) {
|
||||||
notify_motion(&master->seat, time,
|
notify_motion(master, time,
|
||||||
wl_fixed_from_int(device->abs.x),
|
wl_fixed_from_int(device->abs.x),
|
||||||
wl_fixed_from_int(device->abs.y));
|
wl_fixed_from_int(device->abs.y));
|
||||||
device->pending_events &= ~EVDEV_ABSOLUTE_MOTION;
|
device->pending_events &= ~EVDEV_ABSOLUTE_MOTION;
|
||||||
|
|
@ -588,7 +588,7 @@ evdev_notify_keyboard_focus(struct weston_seat *seat,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notify_keyboard_focus_in(&seat->seat, &keys, STATE_UPDATE_AUTOMATIC);
|
notify_keyboard_focus_in(seat, &keys, STATE_UPDATE_AUTOMATIC);
|
||||||
|
|
||||||
wl_array_release(&keys);
|
wl_array_release(&keys);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue