[PATCH weston 1/2] input: Rename weston_surface_activate to weston_seat_set_keyboard_focus

Bryce Harrington bryce at osg.samsung.com
Thu Jun 30 02:04:06 UTC 2016


The name suggests that it activates surfaces, but the code says it
rather just assigns keyboard focus.  Rename it for clarity, and so the
original function name could be used for something more appropriate
later.  Switch order of parameters since keyboard focus is a property of
the seat.  Update all callers as appropriate.

Change was asked for by pq, May 26, 2016:

 "This should be called weston_seat_set_keyboard_focus(seat, surface).
 Keyboard focus is a property of the seat."

Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
---
 desktop-shell/shell.c               | 2 +-
 fullscreen-shell/fullscreen-shell.c | 8 ++++----
 ivi-shell/ivi-shell.c               | 2 +-
 libweston/compositor.h              | 4 ++--
 libweston/input.c                   | 4 ++--
 tests/weston-test.c                 | 4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 825c6c3..c125d55 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5168,7 +5168,7 @@ activate(struct desktop_shell *shell, struct weston_surface *es,
 	 * Leave fullscreen surfaces on unrelated outputs alone. */
 	lower_fullscreen_layer(shell, shsurf->output);
 
-	weston_surface_activate(es, seat);
+	weston_seat_set_keyboard_focus(seat, es);
 
 	state = ensure_focus_state(shell, seat);
 	if (state == NULL)
diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
index ecaebfa..1489258 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -89,7 +89,7 @@ pointer_focus_changed(struct wl_listener *listener, void *data)
 	struct weston_pointer *pointer = data;
 
 	if (pointer->focus && pointer->focus->surface->resource)
-		weston_surface_activate(pointer->focus->surface, pointer->seat);
+		weston_seat_set_keyboard_focus(pointer->seat, pointer->focus->surface);
 }
 
 static void
@@ -118,7 +118,7 @@ seat_caps_changed(struct wl_listener *l, void *data)
 	if (keyboard && keyboard->focus != NULL) {
 		wl_list_for_each(fsout, &listener->shell->output_list, link) {
 			if (fsout->surface) {
-				weston_surface_activate(fsout->surface, seat);
+				weston_seat_set_keyboard_focus(seat, fsout->surface);
 				return;
 			}
 		}
@@ -704,7 +704,7 @@ fullscreen_shell_present_surface(struct wl_client *client,
 				weston_seat_get_keyboard(seat);
 
 			if (keyboard && !keyboard->focus)
-				weston_surface_activate(surface, seat);
+				weston_seat_set_keyboard_focus(seat, surface);
 		}
 	}
 }
@@ -755,7 +755,7 @@ fullscreen_shell_present_surface_for_mode(struct wl_client *client,
 			weston_seat_get_keyboard(seat);
 
 		if (keyboard && !keyboard->focus)
-			weston_surface_activate(surface, seat);
+			weston_seat_set_keyboard_focus(seat, surface);
 	}
 }
 
diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
index 8bf3e80..090ee4d 100644
--- a/ivi-shell/ivi-shell.c
+++ b/ivi-shell/ivi-shell.c
@@ -445,7 +445,7 @@ activate_binding(struct weston_seat *seat,
 	if (get_ivi_shell_surface(main_surface) == NULL)
 		return;
 
-	weston_surface_activate(focus, seat);
+	weston_seat_set_keyboard_focus(seat, focus);
 }
 
 static void
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 9e5155c..5701a05 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -1167,8 +1167,8 @@ int
 weston_spring_done(struct weston_spring *spring);
 
 void
-weston_surface_activate(struct weston_surface *surface,
-			struct weston_seat *seat);
+weston_seat_set_keyboard_focus(struct weston_seat *seat,
+			       struct weston_surface *surface);
 void
 notify_motion(struct weston_seat *seat, uint32_t time,
 	      struct weston_pointer_motion_event *event);
diff --git a/libweston/input.c b/libweston/input.c
index 08378d1..e8c060e 100644
--- a/libweston/input.c
+++ b/libweston/input.c
@@ -1297,8 +1297,8 @@ notify_motion_absolute(struct weston_seat *seat,
 }
 
 WL_EXPORT void
-weston_surface_activate(struct weston_surface *surface,
-			struct weston_seat *seat)
+weston_seat_set_keyboard_focus(struct weston_seat *seat,
+			       struct weston_surface *surface)
 {
 	struct weston_compositor *compositor = seat->compositor;
 	struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat);
diff --git a/tests/weston-test.c b/tests/weston-test.c
index 1793744..27d045d 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -182,13 +182,13 @@ activate_surface(struct wl_client *client, struct wl_resource *resource,
 	seat = get_seat(test);
 	keyboard = weston_seat_get_keyboard(seat);
 	if (surface) {
-		weston_surface_activate(surface, seat);
+		weston_seat_set_keyboard_focus(seat, surface);
 		notify_keyboard_focus_in(seat, &keyboard->keys,
 					 STATE_UPDATE_AUTOMATIC);
 	}
 	else {
 		notify_keyboard_focus_out(seat);
-		weston_surface_activate(surface, seat);
+		weston_seat_set_keyboard_focus(seat, surface);
 	}
 }
 
-- 
1.9.1



More information about the wayland-devel mailing list