[PATCH weston] input: store the grab serial of the keyboard
Giulio Camuffo
giuliocamuffo at gmail.com
Fri Feb 6 12:55:36 PST 2015
2015-02-06 22:27 GMT+02:00 Bill Spitzak <spitzak at gmail.com>:
> Why did you move the code out of the first if statement and into a duplicate
> if statement? If this needs to be done later, could the whole if/else
> statement be moved down (ie move those idle_inhibit/release calls down to
> the same point).
Because the first if block is too early. It may be run even when the
event is a server generated autorepeat and anyway before we run the
grab handler, so the serial at that point is not the correct one, and
the time may be wrong too.
I'm not sure if we could move also the remaining code below.
>
>
> On 02/06/2015 09:06 AM, Giulio Camuffo wrote:
>>
>> The serial can be checked against the one passed to wl_shell.set_popup
>> or equivalent.
>> ---
>> src/input.c | 9 +++++++--
>> 1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/input.c b/src/input.c
>> index fa4fc4e..a0a817f 100644
>> --- a/src/input.c
>> +++ b/src/input.c
>> @@ -1321,8 +1321,6 @@ notify_key(struct weston_seat *seat, uint32_t time,
>> uint32_t key,
>>
>> if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
>> weston_compositor_idle_inhibit(compositor);
>> - keyboard->grab_key = key;
>> - keyboard->grab_time = time;
>> } else {
>> weston_compositor_idle_release(compositor);
>> }
>> @@ -1361,6 +1359,13 @@ notify_key(struct weston_seat *seat, uint32_t time,
>> uint32_t key,
>> key,
>> state);
>> }
>> +
>> + if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
>> + keyboard->grab_serial =
>> + wl_display_get_serial(compositor->wl_display);
>> + keyboard->grab_time = time;
>> + keyboard->grab_key = key;
>> + }
>> }
>>
>> WL_EXPORT void
>>
>
More information about the wayland-devel
mailing list