mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Merge pull request #574 from jsshandle/master
Improve code style in accordance with CONTRIBUTING.md
This commit is contained in:
		
						commit
						79f2c87193
					
				
					 7 changed files with 37 additions and 15 deletions
				
			
		| 
						 | 
					@ -330,7 +330,9 @@ static bool add_signal_matches(struct logind_session *session) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int dbus_event(int fd, uint32_t mask, void *data) {
 | 
					static int dbus_event(int fd, uint32_t mask, void *data) {
 | 
				
			||||||
	sd_bus *bus = data;
 | 
						sd_bus *bus = data;
 | 
				
			||||||
	while (sd_bus_process(bus, NULL) > 0);
 | 
						while (sd_bus_process(bus, NULL) > 0) {
 | 
				
			||||||
 | 
							// Do nothing.
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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");
 | 
							const char *seat = udev_device_get_property_value(dev, "ID_SEAT");
 | 
				
			||||||
		if (!seat)
 | 
							if (!seat) {
 | 
				
			||||||
			seat = "seat0";
 | 
								seat = "seat0";
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		if (session->seat[0] && strcmp(session->seat, seat) != 0) {
 | 
							if (session->seat[0] && strcmp(session->seat, seat) != 0) {
 | 
				
			||||||
			udev_device_unref(dev);
 | 
								udev_device_unref(dev);
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,12 +85,24 @@ static void wlr_wl_backend_destroy(struct wlr_backend *_backend) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_event_source_remove(backend->remote_display_src);
 | 
						wl_event_source_remove(backend->remote_display_src);
 | 
				
			||||||
	wlr_egl_finish(&backend->egl);
 | 
						wlr_egl_finish(&backend->egl);
 | 
				
			||||||
	if (backend->seat) wl_seat_destroy(backend->seat);
 | 
						if (backend->seat) {
 | 
				
			||||||
	if (backend->shm) wl_shm_destroy(backend->shm);
 | 
							wl_seat_destroy(backend->seat);
 | 
				
			||||||
	if (backend->shell) zxdg_shell_v6_destroy(backend->shell);
 | 
						}
 | 
				
			||||||
	if (backend->compositor) wl_compositor_destroy(backend->compositor);
 | 
						if (backend->shm) {
 | 
				
			||||||
	if (backend->registry) wl_registry_destroy(backend->registry);
 | 
							wl_shm_destroy(backend->shm);
 | 
				
			||||||
	if (backend->remote_display) wl_display_disconnect(backend->remote_display);
 | 
						}
 | 
				
			||||||
 | 
						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);
 | 
						free(backend);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,8 +64,12 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	odata->x_offs += odata->x_vel * seconds;
 | 
						odata->x_offs += odata->x_vel * seconds;
 | 
				
			||||||
	odata->y_offs += odata->y_vel * seconds;
 | 
						odata->y_offs += odata->y_vel * seconds;
 | 
				
			||||||
	if (odata->x_offs > 128) odata->x_offs = 0;
 | 
						if (odata->x_offs > 128) {
 | 
				
			||||||
	if (odata->y_offs > 128) odata->y_offs = 0;
 | 
							odata->x_offs = 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if (odata->y_offs > 128) {
 | 
				
			||||||
 | 
							odata->y_offs = 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_output_add(struct output_state *output) {
 | 
					static void handle_output_add(struct output_state *output) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -277,8 +277,9 @@ int main(int argc, char *argv[]) {
 | 
				
			||||||
			screenshooter, output->output, output->buffer);
 | 
								screenshooter, output->output, output->buffer);
 | 
				
			||||||
		orbital_screenshot_add_listener(screenshot, &screenshot_listener, screenshot);
 | 
							orbital_screenshot_add_listener(screenshot, &screenshot_listener, screenshot);
 | 
				
			||||||
		buffer_copy_done = 0;
 | 
							buffer_copy_done = 0;
 | 
				
			||||||
		while (!buffer_copy_done)
 | 
							while (!buffer_copy_done) {
 | 
				
			||||||
			wl_display_roundtrip(display);
 | 
								wl_display_roundtrip(display);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	write_image("wayland-screenshot.png", width, height);
 | 
						write_image("wayland-screenshot.png", width, height);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -720,8 +720,9 @@ static struct wlr_subsurface *subsurface_find_sibling(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_subsurface *sibling;
 | 
						struct wlr_subsurface *sibling;
 | 
				
			||||||
	wl_list_for_each(sibling, &parent->subsurface_list, parent_link) {
 | 
						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 sibling;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -480,12 +480,13 @@ static void read_surface_net_wm_state(struct wlr_xwm *xwm,
 | 
				
			||||||
	xsurface->fullscreen = 0;
 | 
						xsurface->fullscreen = 0;
 | 
				
			||||||
	xcb_atom_t *atom = xcb_get_property_value(reply);
 | 
						xcb_atom_t *atom = xcb_get_property_value(reply);
 | 
				
			||||||
	for (uint32_t i = 0; i < reply->value_len; i++) {
 | 
						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;
 | 
								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;
 | 
								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;
 | 
								xsurface->maximized_horz = true;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue