[PATCH weston v2 1/5] compositor-wayland: Change focus to a bool instead of an int
Bryce Harrington
bryce at osg.samsung.com
Mon Nov 16 13:02:18 PST 2015
On Fri, Nov 06, 2015 at 03:56:06PM -0600, Derek Foreman wrote:
> Also rename focus to has_focus to be slightly less confusing.
>
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>
Pushed:
remote: I: patch #64087 updated using rev 4bcc54d1a56057293d3a7a34e9592707406a6c9a
remote: I: 1 patch(es) updated to state Accepted.
To ssh://git.freedesktop.org/git/wayland/weston
1118952..4bcc54d master -> master
> ---
>
> Changes from v1:
> rename focus to has_focus
> src/compositor-wayland.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
> index a819867..0f3a1a7 100644
> --- a/src/compositor-wayland.c
> +++ b/src/compositor-wayland.c
> @@ -177,7 +177,8 @@ struct wayland_input {
> enum weston_key_state_update keyboard_state_update;
> uint32_t key_serial;
> uint32_t enter_serial;
> - int focus;
> + bool has_focus;
> +
> struct wayland_output *output;
> struct wayland_output *keyboard_focus;
> };
> @@ -1296,12 +1297,12 @@ input_handle_pointer_enter(void *data, struct wl_pointer *pointer,
> weston_output_transform_coordinate(&input->output->base, x, y, &x, &y);
>
> if (location == THEME_LOCATION_CLIENT_AREA) {
> - input->focus = 1;
> + input->has_focus = true;
> notify_pointer_focus(&input->base, &input->output->base, x, y);
> wl_pointer_set_cursor(input->parent.pointer,
> input->enter_serial, NULL, 0, 0);
> } else {
> - input->focus = 0;
> + input->has_focus = false;
> notify_pointer_focus(&input->base, NULL, 0, 0);
> input_set_cursor(input);
> }
> @@ -1325,7 +1326,7 @@ input_handle_pointer_leave(void *data, struct wl_pointer *pointer,
>
> notify_pointer_focus(&input->base, NULL, 0, 0);
> input->output = NULL;
> - input->focus = 0;
> + input->has_focus = false;
> }
>
> static void
> @@ -1355,15 +1356,16 @@ input_handle_motion(void *data, struct wl_pointer *pointer,
>
> weston_output_transform_coordinate(&input->output->base, x, y, &x, &y);
>
> - if (input->focus && location != THEME_LOCATION_CLIENT_AREA) {
> + if (input->has_focus && location != THEME_LOCATION_CLIENT_AREA) {
> input_set_cursor(input);
> notify_pointer_focus(&input->base, NULL, 0, 0);
> - input->focus = 0;
> - } else if (!input->focus && location == THEME_LOCATION_CLIENT_AREA) {
> + input->has_focus = false;
> + } else if (!input->has_focus &&
> + location == THEME_LOCATION_CLIENT_AREA) {
> wl_pointer_set_cursor(input->parent.pointer,
> input->enter_serial, NULL, 0, 0);
> notify_pointer_focus(&input->base, &input->output->base, x, y);
> - input->focus = 1;
> + input->has_focus = true;
> }
>
> if (location == THEME_LOCATION_CLIENT_AREA)
> --
> 2.6.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list