Merge pull request #574 from jsshandle/master

Improve code style in accordance with CONTRIBUTING.md
This commit is contained in:
emersion 2018-01-21 17:07:25 +01:00 committed by GitHub
commit 79f2c87193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 15 deletions

View File

@ -330,7 +330,9 @@ static bool add_signal_matches(struct logind_session *session) {
static int dbus_event(int fd, uint32_t mask, void *data) {
sd_bus *bus = data;
while (sd_bus_process(bus, NULL) > 0);
while (sd_bus_process(bus, NULL) > 0) {
// Do nothing.
}
return 1;
}

View File

@ -307,8 +307,9 @@ size_t wlr_session_find_gpus(struct wlr_session *session,
}
const char *seat = udev_device_get_property_value(dev, "ID_SEAT");
if (!seat)
if (!seat) {
seat = "seat0";
}
if (session->seat[0] && strcmp(session->seat, seat) != 0) {
udev_device_unref(dev);
continue;

View File

@ -85,12 +85,24 @@ static void wlr_wl_backend_destroy(struct wlr_backend *_backend) {
wl_event_source_remove(backend->remote_display_src);
wlr_egl_finish(&backend->egl);
if (backend->seat) wl_seat_destroy(backend->seat);
if (backend->shm) wl_shm_destroy(backend->shm);
if (backend->shell) zxdg_shell_v6_destroy(backend->shell);
if (backend->compositor) wl_compositor_destroy(backend->compositor);
if (backend->registry) wl_registry_destroy(backend->registry);
if (backend->remote_display) wl_display_disconnect(backend->remote_display);
if (backend->seat) {
wl_seat_destroy(backend->seat);
}
if (backend->shm) {
wl_shm_destroy(backend->shm);
}
if (backend->shell) {
zxdg_shell_v6_destroy(backend->shell);
}
if (backend->compositor) {
wl_compositor_destroy(backend->compositor);
}
if (backend->registry) {
wl_registry_destroy(backend->registry);
}
if (backend->remote_display) {
wl_display_disconnect(backend->remote_display);
}
free(backend);
}

View File

@ -64,8 +64,12 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts
odata->x_offs += odata->x_vel * seconds;
odata->y_offs += odata->y_vel * seconds;
if (odata->x_offs > 128) odata->x_offs = 0;
if (odata->y_offs > 128) odata->y_offs = 0;
if (odata->x_offs > 128) {
odata->x_offs = 0;
}
if (odata->y_offs > 128) {
odata->y_offs = 0;
}
}
static void handle_output_add(struct output_state *output) {

View File

@ -277,8 +277,9 @@ int main(int argc, char *argv[]) {
screenshooter, output->output, output->buffer);
orbital_screenshot_add_listener(screenshot, &screenshot_listener, screenshot);
buffer_copy_done = 0;
while (!buffer_copy_done)
while (!buffer_copy_done) {
wl_display_roundtrip(display);
}
}
write_image("wayland-screenshot.png", width, height);

View File

@ -720,8 +720,9 @@ static struct wlr_subsurface *subsurface_find_sibling(
struct wlr_subsurface *sibling;
wl_list_for_each(sibling, &parent->subsurface_list, parent_link) {
if (sibling->surface == surface && sibling != subsurface)
if (sibling->surface == surface && sibling != subsurface) {
return sibling;
}
}
return NULL;

View File

@ -480,12 +480,13 @@ static void read_surface_net_wm_state(struct wlr_xwm *xwm,
xsurface->fullscreen = 0;
xcb_atom_t *atom = xcb_get_property_value(reply);
for (uint32_t i = 0; i < reply->value_len; i++) {
if (atom[i] == xwm->atoms[_NET_WM_STATE_FULLSCREEN])
if (atom[i] == xwm->atoms[_NET_WM_STATE_FULLSCREEN]) {
xsurface->fullscreen = true;
if (atom[i] == xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT])
} else if (atom[i] == xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT]) {
xsurface->maximized_vert = true;
if (atom[i] == xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ])
} else if (atom[i] == xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ]) {
xsurface->maximized_horz = true;
}
}
}