diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c index 579a11cfa..0642f9250 100644 --- a/backend/libinput/tablet_pad.c +++ b/backend/libinput/tablet_pad.c @@ -28,7 +28,7 @@ static void add_pad_group_from_libinput(struct wlr_tablet_pad *pad, ++group->ring_count; } } - group->rings = calloc(sizeof(int), group->ring_count); + group->rings = calloc(sizeof(unsigned int), group->ring_count); size_t ring = 0; for (size_t i = 0; i < pad->ring_count; ++i) { if (libinput_tablet_pad_mode_group_has_ring(li_group, i)) { @@ -41,7 +41,7 @@ static void add_pad_group_from_libinput(struct wlr_tablet_pad *pad, ++group->strip_count; } } - group->strips = calloc(sizeof(int), group->strip_count); + group->strips = calloc(sizeof(unsigned int), group->strip_count); size_t strip = 0; for (size_t i = 0; i < pad->strip_count; ++i) { if (libinput_tablet_pad_mode_group_has_strip(li_group, i)) { @@ -54,7 +54,7 @@ static void add_pad_group_from_libinput(struct wlr_tablet_pad *pad, ++group->button_count; } } - group->buttons = calloc(sizeof(int), group->button_count); + group->buttons = calloc(sizeof(unsigned int), group->button_count); size_t button = 0; for (size_t i = 0; i < pad->button_count; ++i) { if (libinput_tablet_pad_mode_group_has_button(li_group, i)) { diff --git a/examples/idle.c b/examples/idle.c index 30e106db2..87a039247 100644 --- a/examples/idle.c +++ b/examples/idle.c @@ -152,14 +152,20 @@ int main(int argc, char *argv[]) { .display = display, }; - if (simulate_activity_timeout != 0 && simulate_activity_timeout < close_timeout) { + bool create_t1 = (simulate_activity_timeout != 0) && + (simulate_activity_timeout < close_timeout); + + if (create_t1) { if (pthread_create(&t1, NULL, &simulate_activity, (void *)&arg) != 0) { return -1; } } - if (close_timeout != 0) { + + bool create_t2 = (close_timeout != 0); + + if (create_t2) { if (pthread_create(&t2, NULL, &close_program, (void *)&arg) != 0) { - if (simulate_activity_timeout != 0) { + if (create_t1) { pthread_cancel(t1); } return -1; @@ -170,18 +176,19 @@ int main(int argc, char *argv[]) { fprintf(stdout, "waiting\n"); if (pthread_create(&t3, NULL, &main_loop, (void *)display) != 0) { - if (simulate_activity_timeout != 0) { + if (create_t1) { pthread_cancel(t1); } - if (close_timeout != 0 ) { + if (create_t2) { pthread_cancel(t2); } + return -1; } - if (simulate_activity_timeout != 0) { + if (create_t1) { pthread_join(t1, NULL); } - if (close_timeout != 0) { + if (create_t2) { pthread_join(t2, NULL); } pthread_cancel(t3); diff --git a/rootston/xdg_shell.c b/rootston/xdg_shell.c index fed9afcd8..2cf2081eb 100644 --- a/rootston/xdg_shell.c +++ b/rootston/xdg_shell.c @@ -507,8 +507,6 @@ static void decoration_handle_surface_commit(struct wl_listener *listener, } void handle_xdg_toplevel_decoration(struct wl_listener *listener, void *data) { - struct roots_desktop *desktop = - wl_container_of(listener, desktop, xdg_toplevel_decoration); struct wlr_xdg_toplevel_decoration_v1 *wlr_decoration = data; wlr_log(WLR_DEBUG, "new xdg toplevel decoration"); diff --git a/types/tablet_v2/wlr_tablet_v2_pad.c b/types/tablet_v2/wlr_tablet_v2_pad.c index 1fcfa38e2..a1672d282 100644 --- a/types/tablet_v2/wlr_tablet_v2_pad.c +++ b/types/tablet_v2/wlr_tablet_v2_pad.c @@ -368,7 +368,7 @@ struct wlr_tablet_v2_tablet_pad *wlr_tablet_pad_create( } pad->group_count = wl_list_length(&wlr_pad->groups); - pad->groups = calloc(pad->group_count, sizeof(int)); + pad->groups = calloc(pad->group_count, sizeof(uint32_t)); if (!pad->groups) { free(pad); return NULL; @@ -471,9 +471,9 @@ void wlr_send_tablet_v2_tablet_pad_button( void wlr_send_tablet_v2_tablet_pad_strip(struct wlr_tablet_v2_tablet_pad *pad, uint32_t strip, double position, bool finger, uint32_t time) { - if (!pad->current_client && - pad->current_client->strips && - pad->current_client->strips[strip]) { + if (!pad->current_client || + !pad->current_client->strips || + !pad->current_client->strips[strip]) { return; } struct wl_resource *resource = pad->current_client->strips[strip]; diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c index 82ad1a4a2..19b3a51aa 100644 --- a/types/wlr_cursor.c +++ b/types/wlr_cursor.c @@ -332,7 +332,7 @@ static void handle_pointer_motion(struct wl_listener *listener, void *data) { static void apply_output_transform(double *x, double *y, enum wl_output_transform transform) { - double dx = *x, dy = *y; + double dx, dy; double width = 1.0, height = 1.0; switch (transform) {