<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 31, 2013 at 12:51 AM, Kristian Høgsberg <span dir="ltr"><<a href="mailto:hoegsberg@gmail.com" target="_blank">hoegsberg@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Sun, Oct 27, 2013 at 10:24:53PM -0500, Jason Ekstrand wrote:<br>
> Signed-off-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> ---<br>
> src/compositor-wayland.c | 76 ++++++++++++++++++++++++++----------------------<br>
> 1 file changed, 41 insertions(+), 35 deletions(-)<br>
><br>
> diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c<br>
> index 21ce5cb..f4cc7d7 100644<br>
> --- a/src/compositor-wayland.c<br>
> +++ b/src/compositor-wayland.c<br>
> @@ -39,7 +39,7 @@<br>
> #include "../shared/os-compatibility.h"<br>
><br>
> struct wayland_compositor {<br>
> - struct weston_compositor base;<br>
> + struct weston_compositor base;<br>
><br>
> struct {<br>
> struct wl_display *wl_display;<br>
> @@ -61,28 +61,34 @@ struct wayland_compositor {<br>
> int32_t top, bottom, left, right;<br>
> } border;<br>
><br>
> - struct wl_list input_list;<br>
> + struct wl_list inputs;<br>
<br>
</div>If we're aiming for consistency, then don't rename this. We very<br>
consistently call lists something_list and the links in the element<br>
something_link or just link. As a more general rule of thumb, I try<br>
to avoid plural forms in variable names.<br></blockquote><div><br></div><div>Yeah, I'm pretty sure I've seen both, but I'm ok with input_list. And you're right, it's better than plural (that just gets confusing). Fixed locally.<br>
</div><div>--Jason Ekstrand<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
> };<br>
><br>
> struct wayland_output {<br>
> - struct weston_output base;<br>
> + struct weston_output base;<br>
> +<br>
> struct {<br>
> - int draw_initial_frame;<br>
> - struct wl_surface *surface;<br>
> - struct wl_shell_surface *shell_surface;<br>
> - struct wl_egl_window *egl_window;<br>
> + int draw_initial_frame;<br>
> + struct wl_surface *surface;<br>
> + struct wl_shell_surface *shell_surface;<br>
> + struct wl_egl_window *egl_window;<br>
> } parent;<br>
> - struct weston_mode mode;<br>
> +<br>
> + struct weston_mode mode;<br>
> };<br>
><br>
> struct wayland_input {<br>
> struct weston_seat base;<br>
> struct wayland_compositor *compositor;<br>
> - struct wl_seat *seat;<br>
> - struct wl_pointer *pointer;<br>
> - struct wl_keyboard *keyboard;<br>
> - struct wl_touch *touch;<br>
> struct wl_list link;<br>
> +<br>
> + struct {<br>
> + struct wl_seat *seat;<br>
> + struct wl_pointer *pointer;<br>
> + struct wl_keyboard *keyboard;<br>
> + struct wl_touch *touch;<br>
> + } parent;<br>
> +<br>
> uint32_t key_serial;<br>
> uint32_t enter_serial;<br>
> int focus;<br>
> @@ -401,7 +407,7 @@ check_focus(struct wayland_input *input, wl_fixed_t x, wl_fixed_t y)<br>
> notify_pointer_focus(&input->base, &input->output->base,<br>
> x - wl_fixed_from_int(c->border.left),<br>
> y = wl_fixed_from_int(c->border.top));<br>
> - wl_pointer_set_cursor(input->pointer,<br>
> + wl_pointer_set_cursor(input->parent.pointer,<br>
> input->enter_serial, NULL, 0, 0);<br>
> } else if (input->focus && !inside) {<br>
> notify_pointer_focus(&input->base, NULL, 0, 0);<br>
> @@ -602,25 +608,25 @@ input_handle_capabilities(void *data, struct wl_seat *seat,<br>
> {<br>
> struct wayland_input *input = data;<br>
><br>
> - if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) {<br>
> - input->pointer = wl_seat_get_pointer(seat);<br>
> - wl_pointer_set_user_data(input->pointer, input);<br>
> - wl_pointer_add_listener(input->pointer, &pointer_listener,<br>
> - input);<br>
> + if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->parent.pointer) {<br>
> + input->parent.pointer = wl_seat_get_pointer(seat);<br>
> + wl_pointer_set_user_data(input->parent.pointer, input);<br>
> + wl_pointer_add_listener(input->parent.pointer,<br>
> + &pointer_listener, input);<br>
> weston_seat_init_pointer(&input->base);<br>
> - } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) {<br>
> - wl_pointer_destroy(input->pointer);<br>
> - input->pointer = NULL;<br>
> + } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->parent.pointer) {<br>
> + wl_pointer_destroy(input->parent.pointer);<br>
> + input->parent.pointer = NULL;<br>
> }<br>
><br>
> - if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) {<br>
> - input->keyboard = wl_seat_get_keyboard(seat);<br>
> - wl_keyboard_set_user_data(input->keyboard, input);<br>
> - wl_keyboard_add_listener(input->keyboard, &keyboard_listener,<br>
> - input);<br>
> - } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) {<br>
> - wl_keyboard_destroy(input->keyboard);<br>
> - input->keyboard = NULL;<br>
> + if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->parent.keyboard) {<br>
> + input->parent.keyboard = wl_seat_get_keyboard(seat);<br>
> + wl_keyboard_set_user_data(input->parent.keyboard, input);<br>
> + wl_keyboard_add_listener(input->parent.keyboard,<br>
> + &keyboard_listener, input);<br>
> + } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->parent.keyboard) {<br>
> + wl_keyboard_destroy(input->parent.keyboard);<br>
> + input->parent.keyboard = NULL;<br>
> }<br>
> }<br>
><br>
> @@ -639,12 +645,12 @@ display_add_seat(struct wayland_compositor *c, uint32_t id)<br>
><br>
> weston_seat_init(&input->base, &c->base, "default");<br>
> input->compositor = c;<br>
> - input->seat = wl_registry_bind(c->parent.registry, id,<br>
> - &wl_seat_interface, 1);<br>
> - wl_list_insert(c->input_list.prev, &input->link);<br>
> + input->parent.seat = wl_registry_bind(c->parent.registry, id,<br>
> + &wl_seat_interface, 1);<br>
> + wl_list_insert(c->inputs.prev, &input->link);<br>
><br>
> - wl_seat_add_listener(input->seat, &seat_listener, input);<br>
> - wl_seat_set_user_data(input->seat, input);<br>
> + wl_seat_add_listener(input->parent.seat, &seat_listener, input);<br>
> + wl_seat_set_user_data(input->parent.seat, input);<br>
> }<br>
><br>
> static void<br>
> @@ -742,7 +748,7 @@ wayland_compositor_create(struct wl_display *display,<br>
> goto err_compositor;<br>
> }<br>
><br>
> - wl_list_init(&c->input_list);<br>
> + wl_list_init(&c->inputs);<br>
> c->parent.registry = wl_display_get_registry(c->parent.wl_display);<br>
> wl_registry_add_listener(c->parent.registry, ®istry_listener, c);<br>
> wl_display_dispatch(c->parent.wl_display);<br>
> --<br>
> 1.8.3.1<br>
><br>
</div></div>> _______________________________________________<br>
> wayland-devel mailing list<br>
> <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</blockquote></div><br></div></div>