On Fri, Jun 26, 2015 at 12:37:56PM +0800, Jonas Ådahl wrote: > 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 <[email protected]> > --- > > Changes since v2: > > * Removed redundant NULL check.
Might consider making it an assert. Regardless, this looks like a sane refactoring to me: Reviewed-by: Bryce Harrington <[email protected]> > 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 > > _______________________________________________ > wayland-devel mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/wayland-devel _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
