[PATCH v3 weston] desktop-shell: Make activate_binding take a view instead of surface

Jonas Ådahl jadahl at gmail.com
Thu Jun 25 21:37:56 PDT 2015


In preparation for further refactoring. This patch also removes a
redundant NULL check. Since we pass views, and views will always have an
associated surface, there is no point of checking if it has.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---

Changes since v2:

* Removed redundant NULL check.


 desktop-shell/shell.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index ff17b04..d7c6cdc 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5153,12 +5153,12 @@ is_black_surface (struct weston_surface *es, struct weston_surface **fs_surface)
 static void
 activate_binding(struct weston_seat *seat,
 		 struct desktop_shell *shell,
-		 struct weston_surface *focus)
+		 struct weston_view *focus_view)
 {
+	struct weston_surface *focus;
 	struct weston_surface *main_surface;
 
-	if (!focus)
-		return;
+	focus = focus_view->surface;
 
 	if (is_black_surface(focus, &main_surface))
 		focus = main_surface;
@@ -5171,7 +5171,8 @@ activate_binding(struct weston_seat *seat,
 }
 
 static void
-click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t button,
+click_to_activate_binding(struct weston_seat *seat,
+			  uint32_t time, uint32_t button,
 			  void *data)
 {
 	if (seat->pointer->grab != &seat->pointer->default_grab)
@@ -5179,7 +5180,7 @@ click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t butt
 	if (seat->pointer->focus == NULL)
 		return;
 
-	activate_binding(seat, data, seat->pointer->focus->surface);
+	activate_binding(seat, data, seat->pointer->focus);
 }
 
 static void
@@ -5190,7 +5191,7 @@ touch_to_activate_binding(struct weston_seat *seat, uint32_t time, void *data)
 	if (seat->touch->focus == NULL)
 		return;
 
-	activate_binding(seat, data, seat->touch->focus->surface);
+	activate_binding(seat, data, seat->touch->focus);
 }
 
 static void
-- 
2.1.4



More information about the wayland-devel mailing list