diff --git a/examples/output-layout.c b/examples/output-layout.c index 320d11f8..c16af634 100644 --- a/examples/output-layout.c +++ b/examples/output-layout.c @@ -127,9 +127,7 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts } static inline int max(int a, int b) { - if (a < b) - return b; - return a; + return a < b ? b : a; } static void configure_layout(struct sample_state *sample) { @@ -202,8 +200,8 @@ static void update_velocities(struct compositor_state *state, sample->y_vel += y_diff; } -static void handle_keyboard_key(struct keyboard_state *kbstate, - xkb_keysym_t sym, enum wlr_key_state key_state) { +static void handle_keyboard_key(struct keyboard_state *kbstate, uint32_t keycode, + xkb_keysym_t sym, enum wlr_key_state key_state) { // NOTE: It may be better to simply refer to our key state during each frame // and make this change in pixels/sec^2 // Also, key repeat diff --git a/include/wlr/types/wlr_output_layout.h b/include/wlr/types/wlr_output_layout.h index 1b83bfaf..f6a1efdd 100644 --- a/include/wlr/types/wlr_output_layout.h +++ b/include/wlr/types/wlr_output_layout.h @@ -22,28 +22,28 @@ struct wlr_output_layout_output *wlr_output_layout_get( struct wlr_output_layout *layout, struct wlr_output *reference); struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout, - double x, double y); + double x, double y); void wlr_output_layout_add(struct wlr_output_layout *layout, - struct wlr_output *output, int x, int y); + struct wlr_output *output, int x, int y); void wlr_output_layout_move(struct wlr_output_layout *layout, - struct wlr_output *output, int x, int y); + struct wlr_output *output, int x, int y); void wlr_output_layout_remove(struct wlr_output_layout *layout, - struct wlr_output *output); + struct wlr_output *output); /** * Given x and y as pointers to global coordinates, adjusts them to local output * coordinates relative to the given reference output. */ void wlr_output_layout_output_coords(struct wlr_output_layout *layout, - struct wlr_output *reference, int *x, int *y); + struct wlr_output *reference, int *x, int *y); bool wlr_output_layout_contains_point(struct wlr_output_layout *layout, - struct wlr_output *reference, int x, int y); + struct wlr_output *reference, int x, int y); bool wlr_output_layout_intersects(struct wlr_output_layout *layout, - struct wlr_output *reference, int x1, int y1, int x2, int y2); + struct wlr_output *reference, int x1, int y1, int x2, int y2); #endif diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c index ea93610d..2e2032b3 100644 --- a/types/wlr_output_layout.c +++ b/types/wlr_output_layout.c @@ -35,16 +35,13 @@ void wlr_output_layout_add(struct wlr_output_layout *layout, struct wlr_output_layout_output *wlr_output_layout_get( struct wlr_output_layout *layout, struct wlr_output *reference) { - struct wlr_output_layout_output *ret = NULL; struct wlr_output_layout_output *_output; wl_list_for_each(_output, &layout->outputs, link) { if (_output->output == reference) { - ret = _output; + return _output; } } - - return ret; - + return NULL; } static bool output_contains_point( struct wlr_output_layout_output *l_output, @@ -79,7 +76,6 @@ bool wlr_output_layout_intersects(struct wlr_output_layout *layout, struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout, double x, double y) { - struct wlr_output *ret = NULL; struct wlr_output_layout_output *_output; wl_list_for_each(_output, &layout->outputs, link) { if (_output->output) { @@ -88,13 +84,11 @@ struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout, bool has_x = x >= _output->x && x <= _output->x + width; bool has_y = y >= _output->y && y <= _output->y + height; if (has_x && has_y) { - ret = _output->output; - break; + return _output->output; } } } - - return ret; + return NULL; } void wlr_output_layout_move(struct wlr_output_layout *layout,