keyboard/pointer: Calculate the serial once per event
Some applications, like totem, create keyboard/pointer objects from the same client, and expect it to work. We made this work a while ago, but due to an oversight in the code, we increment the serial on button press for every resource that we need to send events to. Since operations like move/resize use the grab serial of the devices to determine whether the operation is exact, we need to make sure the same serial goes to all devices. Restructure the code so that all that's in the resource loop is the sending of the event -- all the calculation that's needed happens outside. This fixes moving / resizing the Totem window not working sometimes. https://bugzilla.gnome.org/show_bug.cgi?id=736840
This commit is contained in:
parent
4a41d415f8
commit
48dfde2073
@ -273,14 +273,19 @@ notify_modifiers (MetaWaylandKeyboard *keyboard)
|
||||
state = keyboard->xkb_info.state;
|
||||
|
||||
l = &keyboard->focus_resource_list;
|
||||
wl_resource_for_each (resource, l)
|
||||
if (!wl_list_empty (l))
|
||||
{
|
||||
wl_keyboard_send_modifiers (resource,
|
||||
wl_display_next_serial (keyboard->display),
|
||||
xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED),
|
||||
xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED),
|
||||
xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED),
|
||||
xkb_state_serialize_layout (state, XKB_STATE_LAYOUT_EFFECTIVE));
|
||||
uint32_t serial = wl_display_next_serial (keyboard->display);
|
||||
|
||||
wl_resource_for_each (resource, l)
|
||||
{
|
||||
wl_keyboard_send_modifiers (resource,
|
||||
serial,
|
||||
xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED),
|
||||
xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED),
|
||||
xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED),
|
||||
xkb_state_serialize_layout (state, XKB_STATE_LAYOUT_EFFECTIVE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ default_grab_button (MetaWaylandPointerGrab *grab,
|
||||
event_type = clutter_event_type (event);
|
||||
|
||||
l = &grab->pointer->focus_resource_list;
|
||||
wl_resource_for_each(resource, l)
|
||||
if (!wl_list_empty (l))
|
||||
{
|
||||
struct wl_client *client = wl_resource_get_client (pointer->focus_surface->resource);
|
||||
struct wl_display *display = wl_client_get_display (client);
|
||||
@ -168,9 +168,13 @@ default_grab_button (MetaWaylandPointerGrab *grab,
|
||||
}
|
||||
|
||||
serial = wl_display_next_serial (display);
|
||||
wl_pointer_send_button (resource, serial,
|
||||
clutter_event_get_time (event), button,
|
||||
event_type == CLUTTER_BUTTON_PRESS ? 1 : 0);
|
||||
|
||||
wl_resource_for_each(resource, l)
|
||||
{
|
||||
wl_pointer_send_button (resource, serial,
|
||||
clutter_event_get_time (event), button,
|
||||
event_type == CLUTTER_BUTTON_PRESS ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (pointer->button_count == 0 && event_type == CLUTTER_BUTTON_RELEASE)
|
||||
|
Loading…
Reference in New Issue
Block a user