fold wl_keyboard into weston_keyboard
This commit is contained in:
parent
2158a889a1
commit
29139d4a45
@ -143,11 +143,11 @@ weston_binding_list_destroy_all(struct wl_list *list)
|
||||
|
||||
struct binding_keyboard_grab {
|
||||
uint32_t key;
|
||||
struct wl_keyboard_grab grab;
|
||||
struct weston_keyboard_grab grab;
|
||||
};
|
||||
|
||||
static void
|
||||
binding_key(struct wl_keyboard_grab *grab,
|
||||
binding_key(struct weston_keyboard_grab *grab,
|
||||
uint32_t time, uint32_t key, uint32_t state_w)
|
||||
{
|
||||
struct binding_keyboard_grab *b =
|
||||
@ -156,14 +156,14 @@ binding_key(struct wl_keyboard_grab *grab,
|
||||
struct wl_display *display;
|
||||
enum wl_keyboard_key_state state = state_w;
|
||||
uint32_t serial;
|
||||
struct weston_keyboard *keyboard = (struct weston_keyboard *)grab->keyboard;
|
||||
struct weston_keyboard *keyboard = grab->keyboard;
|
||||
|
||||
resource = grab->keyboard->focus_resource;
|
||||
if (key == b->key) {
|
||||
if (state == WL_KEYBOARD_KEY_STATE_RELEASED) {
|
||||
wl_keyboard_end_grab(grab->keyboard);
|
||||
weston_keyboard_end_grab(grab->keyboard);
|
||||
if (keyboard->input_method_resource)
|
||||
keyboard->keyboard.grab = &keyboard->input_method_grab;
|
||||
keyboard->grab = &keyboard->input_method_grab;
|
||||
free(b);
|
||||
}
|
||||
} else if (resource) {
|
||||
@ -174,7 +174,7 @@ binding_key(struct wl_keyboard_grab *grab,
|
||||
}
|
||||
|
||||
static void
|
||||
binding_modifiers(struct wl_keyboard_grab *grab, uint32_t serial,
|
||||
binding_modifiers(struct weston_keyboard_grab *grab, uint32_t serial,
|
||||
uint32_t mods_depressed, uint32_t mods_latched,
|
||||
uint32_t mods_locked, uint32_t group)
|
||||
{
|
||||
@ -188,7 +188,7 @@ binding_modifiers(struct wl_keyboard_grab *grab, uint32_t serial,
|
||||
mods_latched, mods_locked, group);
|
||||
}
|
||||
|
||||
static const struct wl_keyboard_grab_interface binding_grab = {
|
||||
static const struct weston_keyboard_grab_interface binding_grab = {
|
||||
binding_key,
|
||||
binding_modifiers,
|
||||
};
|
||||
@ -202,7 +202,7 @@ install_binding_grab(struct wl_seat *seat,
|
||||
grab = malloc(sizeof *grab);
|
||||
grab->key = key;
|
||||
grab->grab.interface = &binding_grab;
|
||||
wl_keyboard_start_grab(seat->keyboard, &grab->grab);
|
||||
weston_keyboard_start_grab(seat->keyboard, &grab->grab);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
|
@ -865,7 +865,7 @@ static void
|
||||
update_xkb_state_from_core(struct x11_compositor *c, uint16_t x11_mask)
|
||||
{
|
||||
uint32_t mask = get_xkb_mod_mask(c, x11_mask);
|
||||
struct wl_keyboard *keyboard = &c->core_seat.keyboard.keyboard;
|
||||
struct weston_keyboard *keyboard = &c->core_seat.keyboard;
|
||||
|
||||
xkb_state_update_mask(c->core_seat.xkb_state.state,
|
||||
keyboard->modifiers.mods_depressed & mask,
|
||||
|
@ -981,7 +981,7 @@ weston_surface_unmap(struct weston_surface *surface)
|
||||
wl_list_for_each(seat, &surface->compositor->seat_list, link) {
|
||||
if (seat->seat.keyboard &&
|
||||
seat->seat.keyboard->focus == &surface->surface)
|
||||
wl_keyboard_set_focus(seat->seat.keyboard, NULL);
|
||||
weston_keyboard_set_focus(seat->seat.keyboard, NULL);
|
||||
if (seat->seat.pointer &&
|
||||
seat->seat.pointer->focus == &surface->surface)
|
||||
wl_pointer_set_focus(seat->seat.pointer,
|
||||
@ -1876,7 +1876,7 @@ weston_surface_activate(struct weston_surface *surface,
|
||||
struct weston_compositor *compositor = seat->compositor;
|
||||
|
||||
if (seat->seat.keyboard) {
|
||||
wl_keyboard_set_focus(seat->seat.keyboard, &surface->surface);
|
||||
weston_keyboard_set_focus(seat->seat.keyboard, &surface->surface);
|
||||
wl_data_device_set_keyboard_focus(&seat->seat);
|
||||
}
|
||||
|
||||
@ -1949,8 +1949,8 @@ notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
|
||||
WL_EXPORT void
|
||||
notify_modifiers(struct weston_seat *seat, uint32_t serial)
|
||||
{
|
||||
struct wl_keyboard *keyboard = &seat->keyboard.keyboard;
|
||||
struct wl_keyboard_grab *grab = keyboard->grab;
|
||||
struct weston_keyboard *keyboard = &seat->keyboard;
|
||||
struct weston_keyboard_grab *grab = keyboard->grab;
|
||||
uint32_t mods_depressed, mods_latched, mods_locked, group;
|
||||
uint32_t mods_lookup;
|
||||
enum weston_led leds = 0;
|
||||
@ -2040,8 +2040,8 @@ notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
|
||||
struct weston_compositor *compositor = seat->compositor;
|
||||
struct weston_keyboard *keyboard = &seat->keyboard;
|
||||
struct weston_surface *focus =
|
||||
(struct weston_surface *) keyboard->keyboard.focus;
|
||||
struct wl_keyboard_grab *grab = keyboard->keyboard.grab;
|
||||
(struct weston_surface *) keyboard->focus;
|
||||
struct weston_keyboard_grab *grab = keyboard->grab;
|
||||
uint32_t serial = wl_display_next_serial(compositor->wl_display);
|
||||
uint32_t *k, *end;
|
||||
|
||||
@ -2050,14 +2050,14 @@ notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
|
||||
compositor->ping_handler(focus, serial);
|
||||
|
||||
weston_compositor_idle_inhibit(compositor);
|
||||
keyboard->keyboard.grab_key = key;
|
||||
keyboard->keyboard.grab_time = time;
|
||||
keyboard->grab_key = key;
|
||||
keyboard->grab_time = time;
|
||||
} else {
|
||||
weston_compositor_idle_release(compositor);
|
||||
}
|
||||
|
||||
end = keyboard->keyboard.keys.data + keyboard->keyboard.keys.size;
|
||||
for (k = keyboard->keyboard.keys.data; k < end; k++) {
|
||||
end = keyboard->keys.data + keyboard->keys.size;
|
||||
for (k = keyboard->keys.data; k < end; k++) {
|
||||
if (*k == key) {
|
||||
/* Ignore server-generated repeats. */
|
||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
|
||||
@ -2065,17 +2065,17 @@ notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
|
||||
*k = *--end;
|
||||
}
|
||||
}
|
||||
keyboard->keyboard.keys.size = (void *) end - keyboard->keyboard.keys.data;
|
||||
keyboard->keys.size = (void *) end - keyboard->keys.data;
|
||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||
k = wl_array_add(&keyboard->keyboard.keys, sizeof *k);
|
||||
k = wl_array_add(&keyboard->keys, sizeof *k);
|
||||
*k = key;
|
||||
}
|
||||
|
||||
if (grab == &keyboard->keyboard.default_grab ||
|
||||
if (grab == &keyboard->default_grab ||
|
||||
grab == &keyboard->input_method_grab) {
|
||||
weston_compositor_run_key_binding(compositor, seat, time, key,
|
||||
state);
|
||||
grab = keyboard->keyboard.grab;
|
||||
grab = keyboard->grab;
|
||||
}
|
||||
|
||||
grab->interface->key(grab, time, key, state);
|
||||
@ -2120,7 +2120,7 @@ notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
|
||||
enum weston_key_state_update update_state)
|
||||
{
|
||||
struct weston_compositor *compositor = seat->compositor;
|
||||
struct wl_keyboard *keyboard = seat->seat.keyboard;
|
||||
struct weston_keyboard *keyboard = seat->seat.keyboard;
|
||||
struct wl_surface *surface;
|
||||
uint32_t *k, serial;
|
||||
|
||||
@ -2143,7 +2143,7 @@ notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
|
||||
|
||||
if (surface) {
|
||||
wl_list_remove(&seat->saved_kbd_focus_listener.link);
|
||||
wl_keyboard_set_focus(keyboard, surface);
|
||||
weston_keyboard_set_focus(keyboard, surface);
|
||||
seat->saved_kbd_focus = NULL;
|
||||
}
|
||||
}
|
||||
@ -2152,7 +2152,7 @@ WL_EXPORT void
|
||||
notify_keyboard_focus_out(struct weston_seat *seat)
|
||||
{
|
||||
struct weston_compositor *compositor = seat->compositor;
|
||||
struct wl_keyboard *keyboard = seat->seat.keyboard;
|
||||
struct weston_keyboard *keyboard = seat->seat.keyboard;
|
||||
uint32_t *k, serial;
|
||||
|
||||
serial = wl_display_next_serial(compositor->wl_display);
|
||||
@ -2172,11 +2172,11 @@ notify_keyboard_focus_out(struct weston_seat *seat)
|
||||
&seat->saved_kbd_focus_listener);
|
||||
}
|
||||
|
||||
wl_keyboard_set_focus(keyboard, NULL);
|
||||
weston_keyboard_set_focus(keyboard, NULL);
|
||||
/* FIXME: We really need keyboard grab cancel here to
|
||||
* let the grab shut down properly. As it is we leak
|
||||
* the grab data. */
|
||||
wl_keyboard_end_grab(keyboard);
|
||||
weston_keyboard_end_grab(keyboard);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2450,8 +2450,8 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
|
||||
|
||||
if (seat->seat.keyboard->focus &&
|
||||
seat->seat.keyboard->focus->resource.client == client) {
|
||||
wl_keyboard_set_focus(seat->seat.keyboard,
|
||||
seat->seat.keyboard->focus);
|
||||
weston_keyboard_set_focus(seat->seat.keyboard,
|
||||
seat->seat.keyboard->focus);
|
||||
wl_data_device_set_keyboard_focus(&seat->seat);
|
||||
}
|
||||
}
|
||||
@ -2668,8 +2668,8 @@ weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap)
|
||||
|
||||
seat->xkb_state.leds = 0;
|
||||
|
||||
wl_keyboard_init(&seat->keyboard.keyboard);
|
||||
wl_seat_set_keyboard(&seat->seat, &seat->keyboard.keyboard);
|
||||
weston_keyboard_init(&seat->keyboard);
|
||||
wl_seat_set_keyboard(&seat->seat, &seat->keyboard);
|
||||
|
||||
seat->has_keyboard = 1;
|
||||
|
||||
|
@ -229,18 +229,18 @@ struct wl_pointer_grab {
|
||||
wl_fixed_t x, y;
|
||||
};
|
||||
|
||||
struct wl_keyboard_grab;
|
||||
struct wl_keyboard_grab_interface {
|
||||
void (*key)(struct wl_keyboard_grab *grab, uint32_t time,
|
||||
struct weston_keyboard_grab;
|
||||
struct weston_keyboard_grab_interface {
|
||||
void (*key)(struct weston_keyboard_grab *grab, uint32_t time,
|
||||
uint32_t key, uint32_t state);
|
||||
void (*modifiers)(struct wl_keyboard_grab *grab, uint32_t serial,
|
||||
void (*modifiers)(struct weston_keyboard_grab *grab, uint32_t serial,
|
||||
uint32_t mods_depressed, uint32_t mods_latched,
|
||||
uint32_t mods_locked, uint32_t group);
|
||||
};
|
||||
|
||||
struct wl_keyboard_grab {
|
||||
const struct wl_keyboard_grab_interface *interface;
|
||||
struct wl_keyboard *keyboard;
|
||||
struct weston_keyboard_grab {
|
||||
const struct weston_keyboard_grab_interface *interface;
|
||||
struct weston_keyboard *keyboard;
|
||||
struct wl_surface *focus;
|
||||
uint32_t key;
|
||||
};
|
||||
@ -310,31 +310,6 @@ struct wl_pointer {
|
||||
uint32_t button_count;
|
||||
};
|
||||
|
||||
struct wl_keyboard {
|
||||
struct wl_seat *seat;
|
||||
|
||||
struct wl_list resource_list;
|
||||
struct wl_surface *focus;
|
||||
struct wl_resource *focus_resource;
|
||||
struct wl_listener focus_listener;
|
||||
uint32_t focus_serial;
|
||||
struct wl_signal focus_signal;
|
||||
|
||||
struct wl_keyboard_grab *grab;
|
||||
struct wl_keyboard_grab default_grab;
|
||||
uint32_t grab_key;
|
||||
uint32_t grab_serial;
|
||||
uint32_t grab_time;
|
||||
|
||||
struct wl_array keys;
|
||||
|
||||
struct {
|
||||
uint32_t mods_depressed;
|
||||
uint32_t mods_latched;
|
||||
uint32_t mods_locked;
|
||||
uint32_t group;
|
||||
} modifiers;
|
||||
};
|
||||
|
||||
struct wl_touch {
|
||||
struct wl_seat *seat;
|
||||
@ -358,7 +333,7 @@ struct wl_seat {
|
||||
struct wl_signal destroy_signal;
|
||||
|
||||
struct wl_pointer *pointer;
|
||||
struct wl_keyboard *keyboard;
|
||||
struct weston_keyboard *keyboard;
|
||||
struct wl_touch *touch;
|
||||
|
||||
uint32_t selection_serial;
|
||||
@ -388,7 +363,7 @@ wl_seat_release(struct wl_seat *seat);
|
||||
void
|
||||
wl_seat_set_pointer(struct wl_seat *seat, struct wl_pointer *pointer);
|
||||
void
|
||||
wl_seat_set_keyboard(struct wl_seat *seat, struct wl_keyboard *keyboard);
|
||||
wl_seat_set_keyboard(struct wl_seat *seat, struct weston_keyboard *keyboard);
|
||||
void
|
||||
wl_seat_set_touch(struct wl_seat *seat, struct wl_touch *touch);
|
||||
|
||||
@ -408,16 +383,17 @@ void
|
||||
wl_pointer_set_current(struct wl_pointer *pointer, struct wl_surface *surface);
|
||||
|
||||
void
|
||||
wl_keyboard_init(struct wl_keyboard *keyboard);
|
||||
weston_keyboard_init(struct weston_keyboard *keyboard);
|
||||
void
|
||||
wl_keyboard_release(struct wl_keyboard *keyboard);
|
||||
weston_keyboard_release(struct weston_keyboard *keyboard);
|
||||
void
|
||||
wl_keyboard_set_focus(struct wl_keyboard *keyboard, struct wl_surface *surface);
|
||||
weston_keyboard_set_focus(struct weston_keyboard *keyboard,
|
||||
struct wl_surface *surface);
|
||||
void
|
||||
wl_keyboard_start_grab(struct wl_keyboard *device,
|
||||
struct wl_keyboard_grab *grab);
|
||||
weston_keyboard_start_grab(struct weston_keyboard *device,
|
||||
struct weston_keyboard_grab *grab);
|
||||
void
|
||||
wl_keyboard_end_grab(struct wl_keyboard *keyboard);
|
||||
weston_keyboard_end_grab(struct weston_keyboard *keyboard);
|
||||
|
||||
void
|
||||
wl_touch_init(struct wl_touch *touch);
|
||||
@ -459,9 +435,31 @@ struct weston_xkb_info {
|
||||
};
|
||||
|
||||
struct weston_keyboard {
|
||||
struct wl_keyboard keyboard;
|
||||
struct wl_seat *seat;
|
||||
|
||||
struct wl_keyboard_grab input_method_grab;
|
||||
struct wl_list resource_list;
|
||||
struct wl_surface *focus;
|
||||
struct wl_resource *focus_resource;
|
||||
struct wl_listener focus_listener;
|
||||
uint32_t focus_serial;
|
||||
struct wl_signal focus_signal;
|
||||
|
||||
struct weston_keyboard_grab *grab;
|
||||
struct weston_keyboard_grab default_grab;
|
||||
uint32_t grab_key;
|
||||
uint32_t grab_serial;
|
||||
uint32_t grab_time;
|
||||
|
||||
struct wl_array keys;
|
||||
|
||||
struct {
|
||||
uint32_t mods_depressed;
|
||||
uint32_t mods_latched;
|
||||
uint32_t mods_locked;
|
||||
uint32_t group;
|
||||
} modifiers;
|
||||
|
||||
struct weston_keyboard_grab input_method_grab;
|
||||
struct wl_resource *input_method_resource;
|
||||
};
|
||||
|
||||
|
33
src/input.c
33
src/input.c
@ -38,8 +38,8 @@ lose_pointer_focus(struct wl_listener *listener, void *data)
|
||||
static void
|
||||
lose_keyboard_focus(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct wl_keyboard *keyboard =
|
||||
container_of(listener, struct wl_keyboard, focus_listener);
|
||||
struct weston_keyboard *keyboard =
|
||||
container_of(listener, struct weston_keyboard, focus_listener);
|
||||
|
||||
keyboard->focus_resource = NULL;
|
||||
}
|
||||
@ -160,10 +160,10 @@ static const struct wl_touch_grab_interface default_touch_grab_interface = {
|
||||
};
|
||||
|
||||
static void
|
||||
default_grab_key(struct wl_keyboard_grab *grab,
|
||||
default_grab_key(struct weston_keyboard_grab *grab,
|
||||
uint32_t time, uint32_t key, uint32_t state)
|
||||
{
|
||||
struct wl_keyboard *keyboard = grab->keyboard;
|
||||
struct weston_keyboard *keyboard = grab->keyboard;
|
||||
struct wl_resource *resource;
|
||||
struct wl_display *display;
|
||||
uint32_t serial;
|
||||
@ -193,11 +193,11 @@ find_resource_for_surface(struct wl_list *list, struct wl_surface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
default_grab_modifiers(struct wl_keyboard_grab *grab, uint32_t serial,
|
||||
default_grab_modifiers(struct weston_keyboard_grab *grab, uint32_t serial,
|
||||
uint32_t mods_depressed, uint32_t mods_latched,
|
||||
uint32_t mods_locked, uint32_t group)
|
||||
{
|
||||
struct wl_keyboard *keyboard = grab->keyboard;
|
||||
struct weston_keyboard *keyboard = grab->keyboard;
|
||||
struct wl_pointer *pointer = keyboard->seat->pointer;
|
||||
struct wl_resource *resource, *pr;
|
||||
|
||||
@ -222,7 +222,7 @@ default_grab_modifiers(struct wl_keyboard_grab *grab, uint32_t serial,
|
||||
}
|
||||
}
|
||||
|
||||
static const struct wl_keyboard_grab_interface
|
||||
static const struct weston_keyboard_grab_interface
|
||||
default_keyboard_grab_interface = {
|
||||
default_grab_key,
|
||||
default_grab_modifiers,
|
||||
@ -253,7 +253,7 @@ wl_pointer_release(struct wl_pointer *pointer)
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_keyboard_init(struct wl_keyboard *keyboard)
|
||||
weston_keyboard_init(struct weston_keyboard *keyboard)
|
||||
{
|
||||
memset(keyboard, 0, sizeof *keyboard);
|
||||
wl_list_init(&keyboard->resource_list);
|
||||
@ -266,7 +266,7 @@ wl_keyboard_init(struct wl_keyboard *keyboard)
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_keyboard_release(struct wl_keyboard *keyboard)
|
||||
weston_keyboard_release(struct weston_keyboard *keyboard)
|
||||
{
|
||||
/* XXX: What about keyboard->resource_list? */
|
||||
if (keyboard->focus_resource)
|
||||
@ -316,7 +316,7 @@ wl_seat_release(struct wl_seat *seat)
|
||||
if (seat->pointer)
|
||||
wl_pointer_release(seat->pointer);
|
||||
if (seat->keyboard)
|
||||
wl_keyboard_release(seat->keyboard);
|
||||
weston_keyboard_release(seat->keyboard);
|
||||
if (seat->touch)
|
||||
wl_touch_release(seat->touch);
|
||||
}
|
||||
@ -354,7 +354,7 @@ wl_seat_set_pointer(struct wl_seat *seat, struct wl_pointer *pointer)
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_seat_set_keyboard(struct wl_seat *seat, struct wl_keyboard *keyboard)
|
||||
wl_seat_set_keyboard(struct wl_seat *seat, struct weston_keyboard *keyboard)
|
||||
{
|
||||
if (keyboard && (seat->keyboard || keyboard->seat))
|
||||
return; /* XXX: error? */
|
||||
@ -387,7 +387,7 @@ WL_EXPORT void
|
||||
wl_pointer_set_focus(struct wl_pointer *pointer, struct wl_surface *surface,
|
||||
wl_fixed_t sx, wl_fixed_t sy)
|
||||
{
|
||||
struct wl_keyboard *kbd = pointer->seat->keyboard;
|
||||
struct weston_keyboard *kbd = pointer->seat->keyboard;
|
||||
struct wl_resource *resource, *kr;
|
||||
struct wl_display *display;
|
||||
uint32_t serial;
|
||||
@ -434,7 +434,8 @@ wl_pointer_set_focus(struct wl_pointer *pointer, struct wl_surface *surface,
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_keyboard_set_focus(struct wl_keyboard *keyboard, struct wl_surface *surface)
|
||||
weston_keyboard_set_focus(struct weston_keyboard *keyboard,
|
||||
struct wl_surface *surface)
|
||||
{
|
||||
struct wl_resource *resource;
|
||||
struct wl_display *display;
|
||||
@ -474,8 +475,8 @@ wl_keyboard_set_focus(struct wl_keyboard *keyboard, struct wl_surface *surface)
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_keyboard_start_grab(struct wl_keyboard *keyboard,
|
||||
struct wl_keyboard_grab *grab)
|
||||
weston_keyboard_start_grab(struct weston_keyboard *keyboard,
|
||||
struct weston_keyboard_grab *grab)
|
||||
{
|
||||
keyboard->grab = grab;
|
||||
grab->keyboard = keyboard;
|
||||
@ -484,7 +485,7 @@ wl_keyboard_start_grab(struct wl_keyboard *keyboard,
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_keyboard_end_grab(struct wl_keyboard *keyboard)
|
||||
weston_keyboard_end_grab(struct weston_keyboard *keyboard)
|
||||
{
|
||||
keyboard->grab = &keyboard->default_grab;
|
||||
}
|
||||
|
44
src/shell.c
44
src/shell.c
@ -504,7 +504,7 @@ restore_focus_state(struct desktop_shell *shell, struct workspace *ws)
|
||||
surface = state->keyboard_focus ?
|
||||
&state->keyboard_focus->surface : NULL;
|
||||
|
||||
wl_keyboard_set_focus(state->seat->seat.keyboard, surface);
|
||||
weston_keyboard_set_focus(state->seat->seat.keyboard, surface);
|
||||
}
|
||||
}
|
||||
|
||||
@ -901,8 +901,8 @@ move_surface_to_workspace(struct desktop_shell *shell,
|
||||
drop_focus_state(shell, from, surface);
|
||||
wl_list_for_each(seat, &shell->compositor->seat_list, link)
|
||||
if (seat->has_keyboard &&
|
||||
seat->keyboard.keyboard.focus == &surface->surface)
|
||||
wl_keyboard_set_focus(&seat->keyboard.keyboard, NULL);
|
||||
seat->keyboard.focus == &surface->surface)
|
||||
weston_keyboard_set_focus(&seat->keyboard, NULL);
|
||||
|
||||
weston_surface_damage_below(surface);
|
||||
}
|
||||
@ -3737,7 +3737,7 @@ struct switcher {
|
||||
struct desktop_shell *shell;
|
||||
struct weston_surface *current;
|
||||
struct wl_listener listener;
|
||||
struct wl_keyboard_grab grab;
|
||||
struct weston_keyboard_grab grab;
|
||||
};
|
||||
|
||||
static void
|
||||
@ -3804,8 +3804,7 @@ static void
|
||||
switcher_destroy(struct switcher *switcher)
|
||||
{
|
||||
struct weston_surface *surface;
|
||||
struct wl_keyboard *keyboard = switcher->grab.keyboard;
|
||||
struct weston_keyboard *weston_keyboard = (struct weston_keyboard *)keyboard;
|
||||
struct weston_keyboard *keyboard = switcher->grab.keyboard;
|
||||
struct workspace *ws = get_current_workspace(switcher->shell);
|
||||
|
||||
wl_list_for_each(surface, &ws->layer.surface_list, layer_link) {
|
||||
@ -3817,14 +3816,14 @@ switcher_destroy(struct switcher *switcher)
|
||||
activate(switcher->shell, switcher->current,
|
||||
(struct weston_seat *) keyboard->seat);
|
||||
wl_list_remove(&switcher->listener.link);
|
||||
wl_keyboard_end_grab(keyboard);
|
||||
if (weston_keyboard->input_method_resource)
|
||||
keyboard->grab = &weston_keyboard->input_method_grab;
|
||||
weston_keyboard_end_grab(keyboard);
|
||||
if (keyboard->input_method_resource)
|
||||
keyboard->grab = &keyboard->input_method_grab;
|
||||
free(switcher);
|
||||
}
|
||||
|
||||
static void
|
||||
switcher_key(struct wl_keyboard_grab *grab,
|
||||
switcher_key(struct weston_keyboard_grab *grab,
|
||||
uint32_t time, uint32_t key, uint32_t state_w)
|
||||
{
|
||||
struct switcher *switcher = container_of(grab, struct switcher, grab);
|
||||
@ -3835,7 +3834,7 @@ switcher_key(struct wl_keyboard_grab *grab,
|
||||
}
|
||||
|
||||
static void
|
||||
switcher_modifier(struct wl_keyboard_grab *grab, uint32_t serial,
|
||||
switcher_modifier(struct weston_keyboard_grab *grab, uint32_t serial,
|
||||
uint32_t mods_depressed, uint32_t mods_latched,
|
||||
uint32_t mods_locked, uint32_t group)
|
||||
{
|
||||
@ -3846,7 +3845,7 @@ switcher_modifier(struct wl_keyboard_grab *grab, uint32_t serial,
|
||||
switcher_destroy(switcher);
|
||||
}
|
||||
|
||||
static const struct wl_keyboard_grab_interface switcher_grab = {
|
||||
static const struct weston_keyboard_grab_interface switcher_grab = {
|
||||
switcher_key,
|
||||
switcher_modifier,
|
||||
};
|
||||
@ -3866,8 +3865,8 @@ switcher_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
|
||||
|
||||
lower_fullscreen_layer(switcher->shell);
|
||||
switcher->grab.interface = &switcher_grab;
|
||||
wl_keyboard_start_grab(seat->keyboard, &switcher->grab);
|
||||
wl_keyboard_set_focus(seat->keyboard, NULL);
|
||||
weston_keyboard_start_grab(seat->keyboard, &switcher->grab);
|
||||
weston_keyboard_set_focus(seat->keyboard, NULL);
|
||||
switcher_next(switcher);
|
||||
}
|
||||
|
||||
@ -3915,14 +3914,14 @@ fan_debug_repaint_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
|
||||
}
|
||||
|
||||
struct debug_binding_grab {
|
||||
struct wl_keyboard_grab grab;
|
||||
struct weston_keyboard_grab grab;
|
||||
struct weston_seat *seat;
|
||||
uint32_t key[2];
|
||||
int key_released[2];
|
||||
};
|
||||
|
||||
static void
|
||||
debug_binding_key(struct wl_keyboard_grab *grab, uint32_t time,
|
||||
debug_binding_key(struct weston_keyboard_grab *grab, uint32_t time,
|
||||
uint32_t key, uint32_t state)
|
||||
{
|
||||
struct debug_binding_grab *db = (struct debug_binding_grab *) grab;
|
||||
@ -3990,16 +3989,15 @@ debug_binding_key(struct wl_keyboard_grab *grab, uint32_t time,
|
||||
}
|
||||
|
||||
if (terminate) {
|
||||
struct weston_keyboard *weston_keyboard = (struct weston_keyboard *) grab->keyboard;
|
||||
wl_keyboard_end_grab(grab->keyboard);
|
||||
if (weston_keyboard->input_method_resource)
|
||||
grab->keyboard->grab = &weston_keyboard->input_method_grab;
|
||||
weston_keyboard_end_grab(grab->keyboard);
|
||||
if (grab->keyboard->input_method_resource)
|
||||
grab->keyboard->grab = &grab->keyboard->input_method_grab;
|
||||
free(db);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
debug_binding_modifiers(struct wl_keyboard_grab *grab, uint32_t serial,
|
||||
debug_binding_modifiers(struct weston_keyboard_grab *grab, uint32_t serial,
|
||||
uint32_t mods_depressed, uint32_t mods_latched,
|
||||
uint32_t mods_locked, uint32_t group)
|
||||
{
|
||||
@ -4013,7 +4011,7 @@ debug_binding_modifiers(struct wl_keyboard_grab *grab, uint32_t serial,
|
||||
mods_latched, mods_locked, group);
|
||||
}
|
||||
|
||||
struct wl_keyboard_grab_interface debug_binding_keyboard_grab = {
|
||||
struct weston_keyboard_grab_interface debug_binding_keyboard_grab = {
|
||||
debug_binding_key,
|
||||
debug_binding_modifiers
|
||||
};
|
||||
@ -4030,7 +4028,7 @@ debug_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data)
|
||||
grab->seat = (struct weston_seat *) seat;
|
||||
grab->key[0] = key;
|
||||
grab->grab.interface = &debug_binding_keyboard_grab;
|
||||
wl_keyboard_start_grab(seat->keyboard, &grab->grab);
|
||||
weston_keyboard_start_grab(seat->keyboard, &grab->grab);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -527,10 +527,10 @@ unbind_keyboard(struct wl_resource *resource)
|
||||
}
|
||||
|
||||
static void
|
||||
input_method_context_grab_key(struct wl_keyboard_grab *grab,
|
||||
input_method_context_grab_key(struct weston_keyboard_grab *grab,
|
||||
uint32_t time, uint32_t key, uint32_t state_w)
|
||||
{
|
||||
struct weston_keyboard *keyboard = (struct weston_keyboard *)grab->keyboard;
|
||||
struct weston_keyboard *keyboard = grab->keyboard;
|
||||
struct wl_display *display;
|
||||
uint32_t serial;
|
||||
|
||||
@ -544,11 +544,11 @@ input_method_context_grab_key(struct wl_keyboard_grab *grab,
|
||||
}
|
||||
|
||||
static void
|
||||
input_method_context_grab_modifier(struct wl_keyboard_grab *grab, uint32_t serial,
|
||||
input_method_context_grab_modifier(struct weston_keyboard_grab *grab, uint32_t serial,
|
||||
uint32_t mods_depressed, uint32_t mods_latched,
|
||||
uint32_t mods_locked, uint32_t group)
|
||||
{
|
||||
struct weston_keyboard *keyboard = (struct weston_keyboard *)grab->keyboard;
|
||||
struct weston_keyboard *keyboard = grab->keyboard;
|
||||
|
||||
if (!keyboard->input_method_resource)
|
||||
return;
|
||||
@ -558,7 +558,7 @@ input_method_context_grab_modifier(struct wl_keyboard_grab *grab, uint32_t seria
|
||||
mods_locked, group);
|
||||
}
|
||||
|
||||
static const struct wl_keyboard_grab_interface input_method_context_grab = {
|
||||
static const struct weston_keyboard_grab_interface input_method_context_grab = {
|
||||
input_method_context_grab_key,
|
||||
input_method_context_grab_modifier,
|
||||
};
|
||||
@ -583,10 +583,10 @@ input_method_context_grab_keyboard(struct wl_client *client,
|
||||
seat->xkb_info.keymap_fd,
|
||||
seat->xkb_info.keymap_size);
|
||||
|
||||
if (keyboard->keyboard.grab != &keyboard->keyboard.default_grab) {
|
||||
wl_keyboard_end_grab(&keyboard->keyboard);
|
||||
if (keyboard->grab != &keyboard->default_grab) {
|
||||
weston_keyboard_end_grab(keyboard);
|
||||
}
|
||||
wl_keyboard_start_grab(&keyboard->keyboard, &keyboard->input_method_grab);
|
||||
weston_keyboard_start_grab(keyboard, &keyboard->input_method_grab);
|
||||
keyboard->input_method_resource = cr;
|
||||
}
|
||||
|
||||
@ -600,8 +600,8 @@ input_method_context_key(struct wl_client *client,
|
||||
{
|
||||
struct input_method_context *context = resource->data;
|
||||
struct weston_seat *seat = context->input_method->seat;
|
||||
struct wl_keyboard *keyboard = seat->seat.keyboard;
|
||||
struct wl_keyboard_grab *default_grab = &keyboard->default_grab;
|
||||
struct weston_keyboard *keyboard = seat->seat.keyboard;
|
||||
struct weston_keyboard_grab *default_grab = &keyboard->default_grab;
|
||||
|
||||
default_grab->interface->key(default_grab, time, key, state_w);
|
||||
}
|
||||
@ -618,8 +618,8 @@ input_method_context_modifiers(struct wl_client *client,
|
||||
struct input_method_context *context = resource->data;
|
||||
|
||||
struct weston_seat *seat = context->input_method->seat;
|
||||
struct wl_keyboard *keyboard = seat->seat.keyboard;
|
||||
struct wl_keyboard_grab *default_grab = &keyboard->default_grab;
|
||||
struct weston_keyboard *keyboard = seat->seat.keyboard;
|
||||
struct weston_keyboard_grab *default_grab = &keyboard->default_grab;
|
||||
|
||||
default_grab->interface->modifiers(default_grab,
|
||||
serial, mods_depressed,
|
||||
@ -712,14 +712,14 @@ input_method_context_create(struct text_input *model,
|
||||
static void
|
||||
input_method_context_end_keyboard_grab(struct input_method_context *context)
|
||||
{
|
||||
struct wl_keyboard_grab *grab = &context->input_method->seat->keyboard.input_method_grab;
|
||||
struct weston_keyboard *keyboard = (struct weston_keyboard *)grab->keyboard;
|
||||
struct weston_keyboard_grab *grab = &context->input_method->seat->keyboard.input_method_grab;
|
||||
struct weston_keyboard *keyboard = grab->keyboard;
|
||||
|
||||
if (!grab->keyboard)
|
||||
return;
|
||||
|
||||
if (grab->keyboard->grab == grab)
|
||||
wl_keyboard_end_grab(grab->keyboard);
|
||||
weston_keyboard_end_grab(grab->keyboard);
|
||||
|
||||
keyboard->input_method_resource = NULL;
|
||||
}
|
||||
@ -790,7 +790,7 @@ input_method_notifier_destroy(struct wl_listener *listener, void *data)
|
||||
static void
|
||||
handle_keyboard_focus(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct wl_keyboard *keyboard = data;
|
||||
struct weston_keyboard *keyboard = data;
|
||||
struct input_method *input_method =
|
||||
container_of(listener, struct input_method, keyboard_focus_listener);
|
||||
struct wl_surface *surface = keyboard->focus;
|
||||
|
@ -155,7 +155,7 @@ activate_surface(struct wl_client *client, struct wl_resource *resource,
|
||||
|
||||
if (surface) {
|
||||
weston_surface_activate(surface, seat);
|
||||
notify_keyboard_focus_in(seat, &seat->keyboard.keyboard.keys,
|
||||
notify_keyboard_focus_in(seat, &seat->keyboard.keys,
|
||||
STATE_UPDATE_AUTOMATIC);
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user