Use wl_array_for_each() where possible

This commit is contained in:
Kristian Høgsberg 2012-03-04 22:35:47 -05:00
parent 4ac32ab669
commit d3c0275b14

View File

@ -1621,7 +1621,7 @@ notify_keyboard_focus(struct wl_input_device *device,
(struct weston_input_device *) device; (struct weston_input_device *) device;
struct weston_compositor *compositor = wd->compositor; struct weston_compositor *compositor = wd->compositor;
struct weston_surface *es; struct weston_surface *es;
uint32_t *k, *end; uint32_t *k;
if (!wl_list_empty(&compositor->surface_list)) if (!wl_list_empty(&compositor->surface_list))
es = container_of(compositor->surface_list.next, es = container_of(compositor->surface_list.next,
@ -1632,8 +1632,7 @@ notify_keyboard_focus(struct wl_input_device *device,
if (output) { if (output) {
wl_array_copy(&wd->input_device.keys, keys); wl_array_copy(&wd->input_device.keys, keys);
wd->modifier_state = 0; wd->modifier_state = 0;
end = device->keys.data + device->keys.size; wl_array_for_each(k, &device->keys) {
for (k = device->keys.data; k < end; k++) {
weston_compositor_idle_inhibit(compositor); weston_compositor_idle_inhibit(compositor);
update_modifier_state(wd, *k, 1); update_modifier_state(wd, *k, 1);
} }
@ -1642,8 +1641,7 @@ notify_keyboard_focus(struct wl_input_device *device,
wl_input_device_set_keyboard_focus(&wd->input_device, wl_input_device_set_keyboard_focus(&wd->input_device,
&es->surface, time); &es->surface, time);
} else { } else {
end = device->keys.data + device->keys.size; wl_array_for_each(k, &device->keys)
for (k = device->keys.data; k < end; k++)
weston_compositor_idle_release(compositor); weston_compositor_idle_release(compositor);
wd->modifier_state = 0; wd->modifier_state = 0;