Clean up wlr_output_layout

This commit is contained in:
Drew DeVault 2017-08-17 21:04:05 -04:00
parent 854a9381ca
commit 3138c5ddf0
3 changed files with 14 additions and 22 deletions

View File

@ -127,9 +127,7 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts
} }
static inline int max(int a, int b) { static inline int max(int a, int b) {
if (a < b) return a < b ? b : a;
return b;
return a;
} }
static void configure_layout(struct sample_state *sample) { static void configure_layout(struct sample_state *sample) {
@ -202,7 +200,7 @@ static void update_velocities(struct compositor_state *state,
sample->y_vel += y_diff; sample->y_vel += y_diff;
} }
static void handle_keyboard_key(struct keyboard_state *kbstate, static void handle_keyboard_key(struct keyboard_state *kbstate, uint32_t keycode,
xkb_keysym_t sym, enum wlr_key_state key_state) { 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 // NOTE: It may be better to simply refer to our key state during each frame
// and make this change in pixels/sec^2 // and make this change in pixels/sec^2

View File

@ -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_output *wlr_output_layout_get(
struct wlr_output_layout *layout, struct wlr_output *reference) { struct wlr_output_layout *layout, struct wlr_output *reference) {
struct wlr_output_layout_output *ret = NULL;
struct wlr_output_layout_output *_output; struct wlr_output_layout_output *_output;
wl_list_for_each(_output, &layout->outputs, link) { wl_list_for_each(_output, &layout->outputs, link) {
if (_output->output == reference) { if (_output->output == reference) {
ret = _output; return _output;
} }
} }
return NULL;
return ret;
} }
static bool output_contains_point( struct wlr_output_layout_output *l_output, 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, struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout,
double x, double y) { double x, double y) {
struct wlr_output *ret = NULL;
struct wlr_output_layout_output *_output; struct wlr_output_layout_output *_output;
wl_list_for_each(_output, &layout->outputs, link) { wl_list_for_each(_output, &layout->outputs, link) {
if (_output->output) { 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_x = x >= _output->x && x <= _output->x + width;
bool has_y = y >= _output->y && y <= _output->y + height; bool has_y = y >= _output->y && y <= _output->y + height;
if (has_x && has_y) { if (has_x && has_y) {
ret = _output->output; return _output->output;
break;
} }
} }
} }
return NULL;
return ret;
} }
void wlr_output_layout_move(struct wlr_output_layout *layout, void wlr_output_layout_move(struct wlr_output_layout *layout,