mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-07 13:29:55 -05:00
Handle per-device keyboard focus.
This commit is contained in:
parent
f0c7b2083a
commit
a7700c8ff1
1 changed files with 8 additions and 9 deletions
|
|
@ -61,6 +61,7 @@ struct egl_input_device {
|
||||||
|
|
||||||
int grab;
|
int grab;
|
||||||
struct egl_surface *grab_surface;
|
struct egl_surface *grab_surface;
|
||||||
|
struct egl_surface *focus_surface;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct egl_compositor {
|
struct egl_compositor {
|
||||||
|
|
@ -813,8 +814,11 @@ notify_button(struct egl_input_device *device,
|
||||||
wl_list_insert(device->ec->surface_list.prev, &es->link);
|
wl_list_insert(device->ec->surface_list.prev, &es->link);
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
|
/* FIXME: We need callbacks when the surfaces
|
||||||
|
* we reference here go away. */
|
||||||
device->grab++;
|
device->grab++;
|
||||||
device->grab_surface = es;
|
device->grab_surface = es;
|
||||||
|
device->focus_surface = es;
|
||||||
} else {
|
} else {
|
||||||
device->grab--;
|
device->grab--;
|
||||||
}
|
}
|
||||||
|
|
@ -836,7 +840,6 @@ notify_key(struct egl_input_device *device,
|
||||||
uint32_t key, uint32_t state)
|
uint32_t key, uint32_t state)
|
||||||
{
|
{
|
||||||
struct egl_compositor *ec = device->ec;
|
struct egl_compositor *ec = device->ec;
|
||||||
struct egl_surface *es;
|
|
||||||
|
|
||||||
if (key == KEY_ESC && state == 1) {
|
if (key == KEY_ESC && state == 1) {
|
||||||
if (ec->overlay_target == ec->height)
|
if (ec->overlay_target == ec->height)
|
||||||
|
|
@ -845,14 +848,10 @@ notify_key(struct egl_input_device *device,
|
||||||
ec->overlay_target += 200;
|
ec->overlay_target += 200;
|
||||||
schedule_repaint(ec);
|
schedule_repaint(ec);
|
||||||
} else if (!wl_list_empty(&ec->surface_list)) {
|
} else if (!wl_list_empty(&ec->surface_list)) {
|
||||||
/* FIXME: The event source device should track which
|
if (device->focus_surface != NULL)
|
||||||
* surface has its key focus and send the event there.
|
wl_surface_post_event(device->focus_surface->wl_surface,
|
||||||
* For now, just send it to the top surface, which
|
&device->base,
|
||||||
* effectively gives us click to focus behavior. */
|
WL_INPUT_KEY, key, state);
|
||||||
es = container_of(ec->surface_list.prev,
|
|
||||||
struct egl_surface, link);
|
|
||||||
wl_surface_post_event(es->wl_surface, &device->base,
|
|
||||||
WL_INPUT_KEY, key, state);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue