mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Merge pull request #882 from emersion/unprefix-local-symbols
Remove wlr_ prefix from local symbols
This commit is contained in:
		
						commit
						fac2c3e25f
					
				
					 52 changed files with 561 additions and 588 deletions
				
			
		| 
						 | 
					@ -139,9 +139,10 @@ breaking points so your code is easy to read.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Names
 | 
					### Names
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Function and type names should be prefixed with `wlr_submodule_` (e.g. `struct
 | 
					Global function and type names should be prefixed with `wlr_submodule_` (e.g.
 | 
				
			||||||
wlr_drm_plane`, `wlr_output_set_cursor`).  For static functions and types local
 | 
					`struct wlr_output`, `wlr_output_set_cursor`).  For static functions and
 | 
				
			||||||
to a file, the names chosen aren't as important.
 | 
					types local to a file, the names chosen aren't as important.  Local function
 | 
				
			||||||
 | 
					names shouldn't have a `wlr_` prefix.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
For include guards, use the header's filename relative to include.  Uppercase
 | 
					For include guards, use the header's filename relative to include.  Uppercase
 | 
				
			||||||
all of the characters, and replace any invalid characters with an underscore.
 | 
					all of the characters, and replace any invalid characters with an underscore.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -237,7 +237,7 @@ static uint32_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm,
 | 
				
			||||||
		return legacy_iface.crtc_get_gamma_size(drm, crtc);
 | 
							return legacy_iface.crtc_get_gamma_size(drm, crtc);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!wlr_drm_get_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size,
 | 
						if (!get_drm_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size,
 | 
				
			||||||
			   &gamma_lut_size)) {
 | 
								   &gamma_lut_size)) {
 | 
				
			||||||
		wlr_log(L_ERROR, "Unable to get gamma lut size");
 | 
							wlr_log(L_ERROR, "Unable to get gamma lut size");
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,20 +15,20 @@
 | 
				
			||||||
#include "backend/drm/drm.h"
 | 
					#include "backend/drm/drm.h"
 | 
				
			||||||
#include "util/signal.h"
 | 
					#include "util/signal.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_drm_backend_start(struct wlr_backend *backend) {
 | 
					static bool backend_start(struct wlr_backend *backend) {
 | 
				
			||||||
	struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
 | 
						struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
 | 
				
			||||||
	wlr_drm_scan_connectors(drm);
 | 
						scan_drm_connectors(drm);
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_drm_backend_destroy(struct wlr_backend *backend) {
 | 
					static void backend_destroy(struct wlr_backend *backend) {
 | 
				
			||||||
	if (!backend) {
 | 
						if (!backend) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
 | 
						struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_drm_restore_outputs(drm);
 | 
						restore_drm_outputs(drm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_drm_connector *conn, *next;
 | 
						struct wlr_drm_connector *conn, *next;
 | 
				
			||||||
	wl_list_for_each_safe(conn, next, &drm->outputs, link) {
 | 
						wl_list_for_each_safe(conn, next, &drm->outputs, link) {
 | 
				
			||||||
| 
						 | 
					@ -41,23 +41,23 @@ static void wlr_drm_backend_destroy(struct wlr_backend *backend) {
 | 
				
			||||||
	wl_list_remove(&drm->session_signal.link);
 | 
						wl_list_remove(&drm->session_signal.link);
 | 
				
			||||||
	wl_list_remove(&drm->drm_invalidated.link);
 | 
						wl_list_remove(&drm->drm_invalidated.link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_drm_resources_free(drm);
 | 
						finish_drm_resources(drm);
 | 
				
			||||||
	wlr_drm_renderer_finish(&drm->renderer);
 | 
						finish_drm_renderer(&drm->renderer);
 | 
				
			||||||
	wlr_session_close_file(drm->session, drm->fd);
 | 
						wlr_session_close_file(drm->session, drm->fd);
 | 
				
			||||||
	wl_event_source_remove(drm->drm_event);
 | 
						wl_event_source_remove(drm->drm_event);
 | 
				
			||||||
	free(drm);
 | 
						free(drm);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_renderer *wlr_drm_backend_get_renderer(
 | 
					static struct wlr_renderer *backend_get_renderer(
 | 
				
			||||||
		struct wlr_backend *backend) {
 | 
							struct wlr_backend *backend) {
 | 
				
			||||||
	struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
 | 
						struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
 | 
				
			||||||
	return drm->renderer.wlr_rend;
 | 
						return drm->renderer.wlr_rend;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_backend_impl backend_impl = {
 | 
					static struct wlr_backend_impl backend_impl = {
 | 
				
			||||||
	.start = wlr_drm_backend_start,
 | 
						.start = backend_start,
 | 
				
			||||||
	.destroy = wlr_drm_backend_destroy,
 | 
						.destroy = backend_destroy,
 | 
				
			||||||
	.get_renderer = wlr_drm_backend_get_renderer,
 | 
						.get_renderer = backend_get_renderer,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_backend_is_drm(struct wlr_backend *b) {
 | 
					bool wlr_backend_is_drm(struct wlr_backend *b) {
 | 
				
			||||||
| 
						 | 
					@ -71,14 +71,14 @@ static void session_signal(struct wl_listener *listener, void *data) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (session->active) {
 | 
						if (session->active) {
 | 
				
			||||||
		wlr_log(L_INFO, "DRM fd resumed");
 | 
							wlr_log(L_INFO, "DRM fd resumed");
 | 
				
			||||||
		wlr_drm_scan_connectors(drm);
 | 
							scan_drm_connectors(drm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		struct wlr_drm_connector *conn;
 | 
							struct wlr_drm_connector *conn;
 | 
				
			||||||
		wl_list_for_each(conn, &drm->outputs, link){
 | 
							wl_list_for_each(conn, &drm->outputs, link){
 | 
				
			||||||
			if (conn->output.enabled) {
 | 
								if (conn->output.enabled) {
 | 
				
			||||||
				wlr_output_set_mode(&conn->output, conn->output.current_mode);
 | 
									wlr_output_set_mode(&conn->output, conn->output.current_mode);
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				wlr_drm_connector_enable(&conn->output, false);
 | 
									enable_drm_connector(&conn->output, false);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (!conn->crtc) {
 | 
								if (!conn->crtc) {
 | 
				
			||||||
| 
						 | 
					@ -104,13 +104,13 @@ static void drm_invalidated(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	wlr_log(L_DEBUG, "%s invalidated", name);
 | 
						wlr_log(L_DEBUG, "%s invalidated", name);
 | 
				
			||||||
	free(name);
 | 
						free(name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_drm_scan_connectors(drm);
 | 
						scan_drm_connectors(drm);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
 | 
					static void handle_display_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	struct wlr_drm_backend *drm =
 | 
						struct wlr_drm_backend *drm =
 | 
				
			||||||
		wl_container_of(listener, drm, display_destroy);
 | 
							wl_container_of(listener, drm, display_destroy);
 | 
				
			||||||
	wlr_drm_backend_destroy(&drm->backend);
 | 
						backend_destroy(&drm->backend);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
 | 
					struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
 | 
				
			||||||
| 
						 | 
					@ -144,7 +144,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
 | 
				
			||||||
	struct wl_event_loop *event_loop = wl_display_get_event_loop(display);
 | 
						struct wl_event_loop *event_loop = wl_display_get_event_loop(display);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	drm->drm_event = wl_event_loop_add_fd(event_loop, drm->fd,
 | 
						drm->drm_event = wl_event_loop_add_fd(event_loop, drm->fd,
 | 
				
			||||||
		WL_EVENT_READABLE, wlr_drm_event, NULL);
 | 
							WL_EVENT_READABLE, handle_drm_event, NULL);
 | 
				
			||||||
	if (!drm->drm_event) {
 | 
						if (!drm->drm_event) {
 | 
				
			||||||
		wlr_log(L_ERROR, "Failed to create DRM event source");
 | 
							wlr_log(L_ERROR, "Failed to create DRM event source");
 | 
				
			||||||
		goto error_fd;
 | 
							goto error_fd;
 | 
				
			||||||
| 
						 | 
					@ -153,15 +153,15 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
 | 
				
			||||||
	drm->session_signal.notify = session_signal;
 | 
						drm->session_signal.notify = session_signal;
 | 
				
			||||||
	wl_signal_add(&session->session_signal, &drm->session_signal);
 | 
						wl_signal_add(&session->session_signal, &drm->session_signal);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!wlr_drm_check_features(drm)) {
 | 
						if (!check_drm_features(drm)) {
 | 
				
			||||||
		goto error_event;
 | 
							goto error_event;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!wlr_drm_resources_init(drm)) {
 | 
						if (!init_drm_resources(drm)) {
 | 
				
			||||||
		goto error_event;
 | 
							goto error_event;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!wlr_drm_renderer_init(drm, &drm->renderer)) {
 | 
						if (!init_drm_renderer(drm, &drm->renderer)) {
 | 
				
			||||||
		wlr_log(L_ERROR, "Failed to initialize renderer");
 | 
							wlr_log(L_ERROR, "Failed to initialize renderer");
 | 
				
			||||||
		goto error_event;
 | 
							goto error_event;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,7 @@
 | 
				
			||||||
#include "backend/drm/util.h"
 | 
					#include "backend/drm/util.h"
 | 
				
			||||||
#include "util/signal.h"
 | 
					#include "util/signal.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_check_features(struct wlr_drm_backend *drm) {
 | 
					bool check_drm_features(struct wlr_drm_backend *drm) {
 | 
				
			||||||
	if (drmSetClientCap(drm->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) {
 | 
						if (drmSetClientCap(drm->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) {
 | 
				
			||||||
		wlr_log(L_ERROR, "DRM universal planes unsupported");
 | 
							wlr_log(L_ERROR, "DRM universal planes unsupported");
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
| 
						 | 
					@ -87,8 +87,8 @@ static bool init_planes(struct wlr_drm_backend *drm) {
 | 
				
			||||||
		p->possible_crtcs = plane->possible_crtcs;
 | 
							p->possible_crtcs = plane->possible_crtcs;
 | 
				
			||||||
		uint64_t type;
 | 
							uint64_t type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!wlr_drm_get_plane_props(drm->fd, p->id, &p->props) ||
 | 
							if (!get_drm_plane_props(drm->fd, p->id, &p->props) ||
 | 
				
			||||||
				!wlr_drm_get_prop(drm->fd, p->id, p->props.type, &type)) {
 | 
									!get_drm_prop(drm->fd, p->id, p->props.type, &type)) {
 | 
				
			||||||
			drmModeFreePlane(plane);
 | 
								drmModeFreePlane(plane);
 | 
				
			||||||
			goto error_planes;
 | 
								goto error_planes;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -122,7 +122,7 @@ error_res:
 | 
				
			||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_resources_init(struct wlr_drm_backend *drm) {
 | 
					bool init_drm_resources(struct wlr_drm_backend *drm) {
 | 
				
			||||||
	drmModeRes *res = drmModeGetResources(drm->fd);
 | 
						drmModeRes *res = drmModeGetResources(drm->fd);
 | 
				
			||||||
	if (!res) {
 | 
						if (!res) {
 | 
				
			||||||
		wlr_log_errno(L_ERROR, "Failed to get DRM resources");
 | 
							wlr_log_errno(L_ERROR, "Failed to get DRM resources");
 | 
				
			||||||
| 
						 | 
					@ -142,7 +142,7 @@ bool wlr_drm_resources_init(struct wlr_drm_backend *drm) {
 | 
				
			||||||
		struct wlr_drm_crtc *crtc = &drm->crtcs[i];
 | 
							struct wlr_drm_crtc *crtc = &drm->crtcs[i];
 | 
				
			||||||
		crtc->id = res->crtcs[i];
 | 
							crtc->id = res->crtcs[i];
 | 
				
			||||||
		crtc->legacy_crtc = drmModeGetCrtc(drm->fd, crtc->id);
 | 
							crtc->legacy_crtc = drmModeGetCrtc(drm->fd, crtc->id);
 | 
				
			||||||
		wlr_drm_get_crtc_props(drm->fd, crtc->id, &crtc->props);
 | 
							get_drm_crtc_props(drm->fd, crtc->id, &crtc->props);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!init_planes(drm)) {
 | 
						if (!init_planes(drm)) {
 | 
				
			||||||
| 
						 | 
					@ -160,7 +160,7 @@ error_res:
 | 
				
			||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_drm_resources_free(struct wlr_drm_backend *drm) {
 | 
					void finish_drm_resources(struct wlr_drm_backend *drm) {
 | 
				
			||||||
	if (!drm) {
 | 
						if (!drm) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -187,13 +187,13 @@ void wlr_drm_resources_free(struct wlr_drm_backend *drm) {
 | 
				
			||||||
	free(drm->planes);
 | 
						free(drm->planes);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_drm_connector_make_current(struct wlr_output *output,
 | 
					static bool drm_connector_make_current(struct wlr_output *output,
 | 
				
			||||||
		int *buffer_age) {
 | 
							int *buffer_age) {
 | 
				
			||||||
	struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
						struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
				
			||||||
	return wlr_drm_surface_make_current(&conn->crtc->primary->surf, buffer_age);
 | 
						return make_drm_surface_current(&conn->crtc->primary->surf, buffer_age);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_drm_connector_swap_buffers(struct wlr_output *output,
 | 
					static bool drm_connector_swap_buffers(struct wlr_output *output,
 | 
				
			||||||
		pixman_region32_t *damage) {
 | 
							pixman_region32_t *damage) {
 | 
				
			||||||
	struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
						struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
				
			||||||
	struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
 | 
						struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
 | 
				
			||||||
| 
						 | 
					@ -207,9 +207,9 @@ static bool wlr_drm_connector_swap_buffers(struct wlr_output *output,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	struct wlr_drm_plane *plane = crtc->primary;
 | 
						struct wlr_drm_plane *plane = crtc->primary;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct gbm_bo *bo = wlr_drm_surface_swap_buffers(&plane->surf, damage);
 | 
						struct gbm_bo *bo = swap_drm_surface_buffers(&plane->surf, damage);
 | 
				
			||||||
	if (drm->parent) {
 | 
						if (drm->parent) {
 | 
				
			||||||
		bo = wlr_drm_surface_mgpu_copy(&plane->mgpu_surf, bo);
 | 
							bo = copy_drm_surface_mgpu(&plane->mgpu_surf, bo);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	uint32_t fb_id = get_fb_for_bo(bo);
 | 
						uint32_t fb_id = get_fb_for_bo(bo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -227,7 +227,7 @@ static bool wlr_drm_connector_swap_buffers(struct wlr_output *output,
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_drm_connector_set_gamma(struct wlr_output *output,
 | 
					static void drm_connector_set_gamma(struct wlr_output *output,
 | 
				
			||||||
		uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b) {
 | 
							uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b) {
 | 
				
			||||||
	struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
						struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
				
			||||||
	struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
 | 
						struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
 | 
				
			||||||
| 
						 | 
					@ -242,7 +242,7 @@ static void wlr_drm_connector_set_gamma(struct wlr_output *output,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static uint32_t wlr_drm_connector_get_gamma_size(struct wlr_output *output) {
 | 
					static uint32_t drm_connector_get_gamma_size(struct wlr_output *output) {
 | 
				
			||||||
	struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
						struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
				
			||||||
	struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
 | 
						struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -253,7 +253,7 @@ static uint32_t wlr_drm_connector_get_gamma_size(struct wlr_output *output) {
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) {
 | 
					static void drm_connector_start_renderer(struct wlr_drm_connector *conn) {
 | 
				
			||||||
	if (conn->state != WLR_DRM_CONN_CONNECTED) {
 | 
						if (conn->state != WLR_DRM_CONN_CONNECTED) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -265,7 +265,7 @@ void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	struct wlr_drm_plane *plane = crtc->primary;
 | 
						struct wlr_drm_plane *plane = crtc->primary;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct gbm_bo *bo = wlr_drm_surface_get_front(
 | 
						struct gbm_bo *bo = get_drm_surface_front(
 | 
				
			||||||
		drm->parent ? &plane->mgpu_surf : &plane->surf);
 | 
							drm->parent ? &plane->mgpu_surf : &plane->surf);
 | 
				
			||||||
	uint32_t fb_id = get_fb_for_bo(bo);
 | 
						uint32_t fb_id = get_fb_for_bo(bo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -279,7 +279,7 @@ void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_drm_connector_enable(struct wlr_output *output, bool enable) {
 | 
					void enable_drm_connector(struct wlr_output *output, bool enable) {
 | 
				
			||||||
	struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
						struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
				
			||||||
	if (conn->state != WLR_DRM_CONN_CONNECTED) {
 | 
						if (conn->state != WLR_DRM_CONN_CONNECTED) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					@ -292,7 +292,7 @@ void wlr_drm_connector_enable(struct wlr_output *output, bool enable) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (enable) {
 | 
						if (enable) {
 | 
				
			||||||
		wlr_drm_connector_start_renderer(conn);
 | 
							drm_connector_start_renderer(conn);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_output_update_enabled(&conn->output, enable);
 | 
						wlr_output_update_enabled(&conn->output, enable);
 | 
				
			||||||
| 
						 | 
					@ -340,9 +340,9 @@ static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
 | 
				
			||||||
			if (*old != new) {
 | 
								if (*old != new) {
 | 
				
			||||||
				changed_outputs[crtc_res[i]] = true;
 | 
									changed_outputs[crtc_res[i]] = true;
 | 
				
			||||||
				if (*old) {
 | 
									if (*old) {
 | 
				
			||||||
					wlr_drm_surface_finish(&(*old)->surf);
 | 
										finish_drm_surface(&(*old)->surf);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				wlr_drm_surface_finish(&new->surf);
 | 
									finish_drm_surface(&new->surf);
 | 
				
			||||||
				*old = new;
 | 
									*old = new;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -461,7 +461,9 @@ error_conn:
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_drm_connector_set_mode(struct wlr_output *output,
 | 
					static void drm_connector_cleanup(struct wlr_drm_connector *conn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static bool drm_connector_set_mode(struct wlr_output *output,
 | 
				
			||||||
		struct wlr_output_mode *mode) {
 | 
							struct wlr_output_mode *mode) {
 | 
				
			||||||
	struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
						struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
				
			||||||
	struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
 | 
						struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
 | 
				
			||||||
| 
						 | 
					@ -513,28 +515,28 @@ static bool wlr_drm_connector_set_mode(struct wlr_output *output,
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!wlr_drm_plane_surfaces_init(crtc->primary, drm,
 | 
							if (!init_drm_plane_surfaces(crtc->primary, drm,
 | 
				
			||||||
				mode->width, mode->height, GBM_FORMAT_XRGB8888)) {
 | 
									mode->width, mode->height, GBM_FORMAT_XRGB8888)) {
 | 
				
			||||||
			wlr_log(L_ERROR, "Failed to initialize renderer for plane");
 | 
								wlr_log(L_ERROR, "Failed to initialize renderer for plane");
 | 
				
			||||||
			goto error_conn;
 | 
								goto error_conn;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		wlr_drm_connector_start_renderer(conn);
 | 
							drm_connector_start_renderer(conn);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
error_conn:
 | 
					error_conn:
 | 
				
			||||||
	wlr_drm_connector_cleanup(conn);
 | 
						drm_connector_cleanup(conn);
 | 
				
			||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_drm_connector_transform(struct wlr_output *output,
 | 
					static void drm_connector_transform(struct wlr_output *output,
 | 
				
			||||||
		enum wl_output_transform transform) {
 | 
							enum wl_output_transform transform) {
 | 
				
			||||||
	output->transform = transform;
 | 
						output->transform = transform;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
 | 
					static bool drm_connector_set_cursor(struct wlr_output *output,
 | 
				
			||||||
		const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
 | 
							const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
 | 
				
			||||||
		int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) {
 | 
							int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) {
 | 
				
			||||||
	struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
						struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
				
			||||||
| 
						 | 
					@ -570,7 +572,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!wlr_drm_surface_init(&plane->surf, renderer, w, h,
 | 
							if (!init_drm_surface(&plane->surf, renderer, w, h,
 | 
				
			||||||
				GBM_FORMAT_ARGB8888, 0)) {
 | 
									GBM_FORMAT_ARGB8888, 0)) {
 | 
				
			||||||
			wlr_log(L_ERROR, "Cannot allocate cursor resources");
 | 
								wlr_log(L_ERROR, "Cannot allocate cursor resources");
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
| 
						 | 
					@ -629,7 +631,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		wlr_drm_surface_make_current(&plane->surf, NULL);
 | 
							make_drm_surface_current(&plane->surf, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		struct wlr_renderer *rend = plane->surf.renderer->wlr_rend;
 | 
							struct wlr_renderer *rend = plane->surf.renderer->wlr_rend;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -648,7 +650,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
 | 
				
			||||||
		wlr_renderer_read_pixels(rend, WL_SHM_FORMAT_ARGB8888, bo_stride,
 | 
							wlr_renderer_read_pixels(rend, WL_SHM_FORMAT_ARGB8888, bo_stride,
 | 
				
			||||||
			plane->surf.width, plane->surf.height, 0, 0, 0, 0, bo_data);
 | 
								plane->surf.width, plane->surf.height, 0, 0, 0, 0, bo_data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		wlr_drm_surface_swap_buffers(&plane->surf, NULL);
 | 
							swap_drm_surface_buffers(&plane->surf, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		wlr_texture_destroy(texture);
 | 
							wlr_texture_destroy(texture);
 | 
				
			||||||
		gbm_bo_unmap(plane->cursor_bo, bo_data);
 | 
							gbm_bo_unmap(plane->cursor_bo, bo_data);
 | 
				
			||||||
| 
						 | 
					@ -666,7 +668,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
 | 
				
			||||||
	return ok;
 | 
						return ok;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_drm_connector_move_cursor(struct wlr_output *output,
 | 
					static bool drm_connector_move_cursor(struct wlr_output *output,
 | 
				
			||||||
		int x, int y) {
 | 
							int x, int y) {
 | 
				
			||||||
	struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
						struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
				
			||||||
	struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
 | 
						struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
 | 
				
			||||||
| 
						 | 
					@ -703,25 +705,25 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output,
 | 
				
			||||||
	return ok;
 | 
						return ok;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_drm_connector_destroy(struct wlr_output *output) {
 | 
					static void drm_connector_destroy(struct wlr_output *output) {
 | 
				
			||||||
	struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
						struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
 | 
				
			||||||
	wlr_drm_connector_cleanup(conn);
 | 
						drm_connector_cleanup(conn);
 | 
				
			||||||
	wl_event_source_remove(conn->retry_pageflip);
 | 
						wl_event_source_remove(conn->retry_pageflip);
 | 
				
			||||||
	wl_list_remove(&conn->link);
 | 
						wl_list_remove(&conn->link);
 | 
				
			||||||
	free(conn);
 | 
						free(conn);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_output_impl output_impl = {
 | 
					static const struct wlr_output_impl output_impl = {
 | 
				
			||||||
	.enable = wlr_drm_connector_enable,
 | 
						.enable = enable_drm_connector,
 | 
				
			||||||
	.set_mode = wlr_drm_connector_set_mode,
 | 
						.set_mode = drm_connector_set_mode,
 | 
				
			||||||
	.transform = wlr_drm_connector_transform,
 | 
						.transform = drm_connector_transform,
 | 
				
			||||||
	.set_cursor = wlr_drm_connector_set_cursor,
 | 
						.set_cursor = drm_connector_set_cursor,
 | 
				
			||||||
	.move_cursor = wlr_drm_connector_move_cursor,
 | 
						.move_cursor = drm_connector_move_cursor,
 | 
				
			||||||
	.destroy = wlr_drm_connector_destroy,
 | 
						.destroy = drm_connector_destroy,
 | 
				
			||||||
	.make_current = wlr_drm_connector_make_current,
 | 
						.make_current = drm_connector_make_current,
 | 
				
			||||||
	.swap_buffers = wlr_drm_connector_swap_buffers,
 | 
						.swap_buffers = drm_connector_swap_buffers,
 | 
				
			||||||
	.set_gamma = wlr_drm_connector_set_gamma,
 | 
						.set_gamma = drm_connector_set_gamma,
 | 
				
			||||||
	.get_gamma_size = wlr_drm_connector_get_gamma_size,
 | 
						.get_gamma_size = drm_connector_get_gamma_size,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_output_is_drm(struct wlr_output *output) {
 | 
					bool wlr_output_is_drm(struct wlr_output *output) {
 | 
				
			||||||
| 
						 | 
					@ -731,7 +733,7 @@ bool wlr_output_is_drm(struct wlr_output *output) {
 | 
				
			||||||
static int retry_pageflip(void *data) {
 | 
					static int retry_pageflip(void *data) {
 | 
				
			||||||
	struct wlr_drm_connector *conn = data;
 | 
						struct wlr_drm_connector *conn = data;
 | 
				
			||||||
	wlr_log(L_INFO, "%s: Retrying pageflip", conn->output.name);
 | 
						wlr_log(L_INFO, "%s: Retrying pageflip", conn->output.name);
 | 
				
			||||||
	wlr_drm_connector_start_renderer(conn);
 | 
						drm_connector_start_renderer(conn);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -744,7 +746,7 @@ static const int32_t subpixel_map[] = {
 | 
				
			||||||
	[DRM_MODE_SUBPIXEL_NONE] = WL_OUTPUT_SUBPIXEL_NONE,
 | 
						[DRM_MODE_SUBPIXEL_NONE] = WL_OUTPUT_SUBPIXEL_NONE,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
 | 
					void scan_drm_connectors(struct wlr_drm_backend *drm) {
 | 
				
			||||||
	wlr_log(L_INFO, "Scanning DRM connectors");
 | 
						wlr_log(L_INFO, "Scanning DRM connectors");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	drmModeRes *res = drmModeGetResources(drm->fd);
 | 
						drmModeRes *res = drmModeGetResources(drm->fd);
 | 
				
			||||||
| 
						 | 
					@ -834,10 +836,10 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
 | 
				
			||||||
				wlr_conn->output.phys_width, wlr_conn->output.phys_height);
 | 
									wlr_conn->output.phys_width, wlr_conn->output.phys_height);
 | 
				
			||||||
			wlr_conn->output.subpixel = subpixel_map[drm_conn->subpixel];
 | 
								wlr_conn->output.subpixel = subpixel_map[drm_conn->subpixel];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			wlr_drm_get_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props);
 | 
								get_drm_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			size_t edid_len = 0;
 | 
								size_t edid_len = 0;
 | 
				
			||||||
			uint8_t *edid = wlr_drm_get_prop_blob(drm->fd,
 | 
								uint8_t *edid = get_drm_prop_blob(drm->fd,
 | 
				
			||||||
				wlr_conn->id, wlr_conn->props.edid, &edid_len);
 | 
									wlr_conn->id, wlr_conn->props.edid, &edid_len);
 | 
				
			||||||
			parse_edid(&wlr_conn->output, edid_len, edid);
 | 
								parse_edid(&wlr_conn->output, edid_len, edid);
 | 
				
			||||||
			free(edid);
 | 
								free(edid);
 | 
				
			||||||
| 
						 | 
					@ -874,7 +876,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
 | 
				
			||||||
			wlr_log(L_INFO, "'%s' disconnected", wlr_conn->output.name);
 | 
								wlr_log(L_INFO, "'%s' disconnected", wlr_conn->output.name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			wlr_output_update_enabled(&wlr_conn->output, false);
 | 
								wlr_output_update_enabled(&wlr_conn->output, false);
 | 
				
			||||||
			wlr_drm_connector_cleanup(wlr_conn);
 | 
								drm_connector_cleanup(wlr_conn);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		drmModeFreeEncoder(curr_enc);
 | 
							drmModeFreeEncoder(curr_enc);
 | 
				
			||||||
| 
						 | 
					@ -892,7 +894,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		wlr_log(L_INFO, "'%s' disappeared", conn->output.name);
 | 
							wlr_log(L_INFO, "'%s' disappeared", conn->output.name);
 | 
				
			||||||
		wlr_drm_connector_cleanup(conn);
 | 
							drm_connector_cleanup(conn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		drmModeFreeCrtc(conn->old_crtc);
 | 
							drmModeFreeCrtc(conn->old_crtc);
 | 
				
			||||||
		wl_event_source_remove(conn->retry_pageflip);
 | 
							wl_event_source_remove(conn->retry_pageflip);
 | 
				
			||||||
| 
						 | 
					@ -911,9 +913,9 @@ static void page_flip_handler(int fd, unsigned seq,
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_drm_surface_post(&conn->crtc->primary->surf);
 | 
						post_drm_surface(&conn->crtc->primary->surf);
 | 
				
			||||||
	if (drm->parent) {
 | 
						if (drm->parent) {
 | 
				
			||||||
		wlr_drm_surface_post(&conn->crtc->primary->mgpu_surf);
 | 
							post_drm_surface(&conn->crtc->primary->mgpu_surf);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (drm->session->active) {
 | 
						if (drm->session->active) {
 | 
				
			||||||
| 
						 | 
					@ -921,7 +923,7 @@ static void page_flip_handler(int fd, unsigned seq,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int wlr_drm_event(int fd, uint32_t mask, void *data) {
 | 
					int handle_drm_event(int fd, uint32_t mask, void *data) {
 | 
				
			||||||
	drmEventContext event = {
 | 
						drmEventContext event = {
 | 
				
			||||||
		.version = DRM_EVENT_CONTEXT_VERSION,
 | 
							.version = DRM_EVENT_CONTEXT_VERSION,
 | 
				
			||||||
		.page_flip_handler = page_flip_handler,
 | 
							.page_flip_handler = page_flip_handler,
 | 
				
			||||||
| 
						 | 
					@ -931,7 +933,7 @@ int wlr_drm_event(int fd, uint32_t mask, void *data) {
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_drm_restore_outputs(struct wlr_drm_backend *drm) {
 | 
					void restore_drm_outputs(struct wlr_drm_backend *drm) {
 | 
				
			||||||
	uint64_t to_close = (1 << wl_list_length(&drm->outputs)) - 1;
 | 
						uint64_t to_close = (1 << wl_list_length(&drm->outputs)) - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_drm_connector *conn;
 | 
						struct wlr_drm_connector *conn;
 | 
				
			||||||
| 
						 | 
					@ -944,7 +946,7 @@ void wlr_drm_restore_outputs(struct wlr_drm_backend *drm) {
 | 
				
			||||||
	time_t timeout = time(NULL) + 5;
 | 
						time_t timeout = time(NULL) + 5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (to_close && time(NULL) < timeout) {
 | 
						while (to_close && time(NULL) < timeout) {
 | 
				
			||||||
		wlr_drm_event(drm->fd, 0, NULL);
 | 
							handle_drm_event(drm->fd, 0, NULL);
 | 
				
			||||||
		size_t i = 0;
 | 
							size_t i = 0;
 | 
				
			||||||
		struct wlr_drm_connector *conn;
 | 
							struct wlr_drm_connector *conn;
 | 
				
			||||||
		wl_list_for_each(conn, &drm->outputs, link) {
 | 
							wl_list_for_each(conn, &drm->outputs, link) {
 | 
				
			||||||
| 
						 | 
					@ -971,7 +973,7 @@ void wlr_drm_restore_outputs(struct wlr_drm_backend *drm) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) {
 | 
					static void drm_connector_cleanup(struct wlr_drm_connector *conn) {
 | 
				
			||||||
	if (!conn) {
 | 
						if (!conn) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -985,8 +987,8 @@ void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) {
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			wlr_drm_surface_finish(&crtc->planes[i]->surf);
 | 
								finish_drm_surface(&crtc->planes[i]->surf);
 | 
				
			||||||
			wlr_drm_surface_finish(&crtc->planes[i]->mgpu_surf);
 | 
								finish_drm_surface(&crtc->planes[i]->mgpu_surf);
 | 
				
			||||||
			if (crtc->planes[i]->id == 0) {
 | 
								if (crtc->planes[i]->id == 0) {
 | 
				
			||||||
				free(crtc->planes[i]);
 | 
									free(crtc->planes[i]);
 | 
				
			||||||
				crtc->planes[i] = NULL;
 | 
									crtc->planes[i] = NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -87,22 +87,22 @@ static bool scan_properties(int fd, uint32_t id, uint32_t type, uint32_t *result
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_get_connector_props(int fd, uint32_t id, union wlr_drm_connector_props *out) {
 | 
					bool get_drm_connector_props(int fd, uint32_t id, union wlr_drm_connector_props *out) {
 | 
				
			||||||
	return scan_properties(fd, id, DRM_MODE_OBJECT_CONNECTOR, out->props,
 | 
						return scan_properties(fd, id, DRM_MODE_OBJECT_CONNECTOR, out->props,
 | 
				
			||||||
		connector_info, sizeof(connector_info) / sizeof(connector_info[0]));
 | 
							connector_info, sizeof(connector_info) / sizeof(connector_info[0]));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_get_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out) {
 | 
					bool get_drm_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out) {
 | 
				
			||||||
	return scan_properties(fd, id, DRM_MODE_OBJECT_CRTC, out->props,
 | 
						return scan_properties(fd, id, DRM_MODE_OBJECT_CRTC, out->props,
 | 
				
			||||||
		crtc_info, sizeof(crtc_info) / sizeof(crtc_info[0]));
 | 
							crtc_info, sizeof(crtc_info) / sizeof(crtc_info[0]));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_get_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out) {
 | 
					bool get_drm_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out) {
 | 
				
			||||||
	return scan_properties(fd, id, DRM_MODE_OBJECT_PLANE, out->props,
 | 
						return scan_properties(fd, id, DRM_MODE_OBJECT_PLANE, out->props,
 | 
				
			||||||
		plane_info, sizeof(plane_info) / sizeof(plane_info[0]));
 | 
							plane_info, sizeof(plane_info) / sizeof(plane_info[0]));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) {
 | 
					bool get_drm_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) {
 | 
				
			||||||
	drmModeObjectProperties *props = drmModeObjectGetProperties(fd, obj, DRM_MODE_OBJECT_ANY);
 | 
						drmModeObjectProperties *props = drmModeObjectGetProperties(fd, obj, DRM_MODE_OBJECT_ANY);
 | 
				
			||||||
	if (!props) {
 | 
						if (!props) {
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
| 
						 | 
					@ -122,9 +122,9 @@ bool wlr_drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) {
 | 
				
			||||||
	return found;
 | 
						return found;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void *wlr_drm_get_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len) {
 | 
					void *get_drm_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len) {
 | 
				
			||||||
	uint64_t blob_id;
 | 
						uint64_t blob_id;
 | 
				
			||||||
	if (!wlr_drm_get_prop(fd, obj, prop, &blob_id)) {
 | 
						if (!get_drm_prop(fd, obj, prop, &blob_id)) {
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,7 +18,7 @@
 | 
				
			||||||
#define DRM_FORMAT_MOD_LINEAR 0
 | 
					#define DRM_FORMAT_MOD_LINEAR 0
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_renderer_init(struct wlr_drm_backend *drm,
 | 
					bool init_drm_renderer(struct wlr_drm_backend *drm,
 | 
				
			||||||
		struct wlr_drm_renderer *renderer) {
 | 
							struct wlr_drm_renderer *renderer) {
 | 
				
			||||||
	renderer->gbm = gbm_create_device(drm->fd);
 | 
						renderer->gbm = gbm_create_device(drm->fd);
 | 
				
			||||||
	if (!renderer->gbm) {
 | 
						if (!renderer->gbm) {
 | 
				
			||||||
| 
						 | 
					@ -47,7 +47,7 @@ error_gbm:
 | 
				
			||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer) {
 | 
					void finish_drm_renderer(struct wlr_drm_renderer *renderer) {
 | 
				
			||||||
	if (!renderer) {
 | 
						if (!renderer) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -57,7 +57,7 @@ void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer) {
 | 
				
			||||||
	gbm_device_destroy(renderer->gbm);
 | 
						gbm_device_destroy(renderer->gbm);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_surface_init(struct wlr_drm_surface *surf,
 | 
					bool init_drm_surface(struct wlr_drm_surface *surf,
 | 
				
			||||||
		struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height,
 | 
							struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height,
 | 
				
			||||||
		uint32_t format, uint32_t flags) {
 | 
							uint32_t format, uint32_t flags) {
 | 
				
			||||||
	if (surf->width == width && surf->height == height) {
 | 
						if (surf->width == width && surf->height == height) {
 | 
				
			||||||
| 
						 | 
					@ -103,7 +103,7 @@ error_zero:
 | 
				
			||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_drm_surface_finish(struct wlr_drm_surface *surf) {
 | 
					void finish_drm_surface(struct wlr_drm_surface *surf) {
 | 
				
			||||||
	if (!surf || !surf->renderer) {
 | 
						if (!surf || !surf->renderer) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -123,12 +123,12 @@ void wlr_drm_surface_finish(struct wlr_drm_surface *surf) {
 | 
				
			||||||
	memset(surf, 0, sizeof(*surf));
 | 
						memset(surf, 0, sizeof(*surf));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_surface_make_current(struct wlr_drm_surface *surf,
 | 
					bool make_drm_surface_current(struct wlr_drm_surface *surf,
 | 
				
			||||||
		int *buffer_damage) {
 | 
							int *buffer_damage) {
 | 
				
			||||||
	return wlr_egl_make_current(&surf->renderer->egl, surf->egl, buffer_damage);
 | 
						return wlr_egl_make_current(&surf->renderer->egl, surf->egl, buffer_damage);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf,
 | 
					struct gbm_bo *swap_drm_surface_buffers(struct wlr_drm_surface *surf,
 | 
				
			||||||
		pixman_region32_t *damage) {
 | 
							pixman_region32_t *damage) {
 | 
				
			||||||
	if (surf->front) {
 | 
						if (surf->front) {
 | 
				
			||||||
		gbm_surface_release_buffer(surf->gbm, surf->front);
 | 
							gbm_surface_release_buffer(surf->gbm, surf->front);
 | 
				
			||||||
| 
						 | 
					@ -141,20 +141,20 @@ struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf,
 | 
				
			||||||
	return surf->back;
 | 
						return surf->back;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct gbm_bo *wlr_drm_surface_get_front(struct wlr_drm_surface *surf) {
 | 
					struct gbm_bo *get_drm_surface_front(struct wlr_drm_surface *surf) {
 | 
				
			||||||
	if (surf->front) {
 | 
						if (surf->front) {
 | 
				
			||||||
		return surf->front;
 | 
							return surf->front;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_drm_surface_make_current(surf, NULL);
 | 
						make_drm_surface_current(surf, NULL);
 | 
				
			||||||
	struct wlr_renderer *renderer = surf->renderer->wlr_rend;
 | 
						struct wlr_renderer *renderer = surf->renderer->wlr_rend;
 | 
				
			||||||
	wlr_renderer_begin(renderer, surf->width, surf->height);
 | 
						wlr_renderer_begin(renderer, surf->width, surf->height);
 | 
				
			||||||
	wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 1.0 });
 | 
						wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 1.0 });
 | 
				
			||||||
	wlr_renderer_end(renderer);
 | 
						wlr_renderer_end(renderer);
 | 
				
			||||||
	return wlr_drm_surface_swap_buffers(surf, NULL);
 | 
						return swap_drm_surface_buffers(surf, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_drm_surface_post(struct wlr_drm_surface *surf) {
 | 
					void post_drm_surface(struct wlr_drm_surface *surf) {
 | 
				
			||||||
	if (surf->front) {
 | 
						if (surf->front) {
 | 
				
			||||||
		gbm_surface_release_buffer(surf->gbm, surf->front);
 | 
							gbm_surface_release_buffer(surf->gbm, surf->front);
 | 
				
			||||||
		surf->front = NULL;
 | 
							surf->front = NULL;
 | 
				
			||||||
| 
						 | 
					@ -208,9 +208,9 @@ static struct wlr_texture *get_tex_for_bo(struct wlr_drm_renderer *renderer,
 | 
				
			||||||
	return tex->tex;
 | 
						return tex->tex;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct gbm_bo *wlr_drm_surface_mgpu_copy(struct wlr_drm_surface *dest,
 | 
					struct gbm_bo *copy_drm_surface_mgpu(struct wlr_drm_surface *dest,
 | 
				
			||||||
		struct gbm_bo *src) {
 | 
							struct gbm_bo *src) {
 | 
				
			||||||
	wlr_drm_surface_make_current(dest, NULL);
 | 
						make_drm_surface_current(dest, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_texture *tex = get_tex_for_bo(dest->renderer, src);
 | 
						struct wlr_texture *tex = get_tex_for_bo(dest->renderer, src);
 | 
				
			||||||
	assert(tex);
 | 
						assert(tex);
 | 
				
			||||||
| 
						 | 
					@ -224,25 +224,25 @@ struct gbm_bo *wlr_drm_surface_mgpu_copy(struct wlr_drm_surface *dest,
 | 
				
			||||||
	wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f);
 | 
						wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f);
 | 
				
			||||||
	wlr_renderer_end(renderer);
 | 
						wlr_renderer_end(renderer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return wlr_drm_surface_swap_buffers(dest, NULL);
 | 
						return swap_drm_surface_buffers(dest, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_plane_surfaces_init(struct wlr_drm_plane *plane,
 | 
					bool init_drm_plane_surfaces(struct wlr_drm_plane *plane,
 | 
				
			||||||
		struct wlr_drm_backend *drm, int32_t width, uint32_t height,
 | 
							struct wlr_drm_backend *drm, int32_t width, uint32_t height,
 | 
				
			||||||
		uint32_t format) {
 | 
							uint32_t format) {
 | 
				
			||||||
	if (!drm->parent) {
 | 
						if (!drm->parent) {
 | 
				
			||||||
		return wlr_drm_surface_init(&plane->surf, &drm->renderer, width, height,
 | 
							return init_drm_surface(&plane->surf, &drm->renderer, width, height,
 | 
				
			||||||
			format, GBM_BO_USE_SCANOUT);
 | 
								format, GBM_BO_USE_SCANOUT);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!wlr_drm_surface_init(&plane->surf, &drm->parent->renderer,
 | 
						if (!init_drm_surface(&plane->surf, &drm->parent->renderer,
 | 
				
			||||||
			width, height, format, GBM_BO_USE_LINEAR)) {
 | 
								width, height, format, GBM_BO_USE_LINEAR)) {
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!wlr_drm_surface_init(&plane->mgpu_surf, &drm->renderer,
 | 
						if (!init_drm_surface(&plane->mgpu_surf, &drm->renderer,
 | 
				
			||||||
			width, height, format, GBM_BO_USE_SCANOUT)) {
 | 
								width, height, format, GBM_BO_USE_SCANOUT)) {
 | 
				
			||||||
		wlr_drm_surface_finish(&plane->surf);
 | 
							finish_drm_surface(&plane->surf);
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,23 +7,23 @@
 | 
				
			||||||
#include "backend/libinput.h"
 | 
					#include "backend/libinput.h"
 | 
				
			||||||
#include "util/signal.h"
 | 
					#include "util/signal.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int wlr_libinput_open_restricted(const char *path,
 | 
					static int libinput_open_restricted(const char *path,
 | 
				
			||||||
		int flags, void *_backend) {
 | 
							int flags, void *_backend) {
 | 
				
			||||||
	struct wlr_libinput_backend *backend = _backend;
 | 
						struct wlr_libinput_backend *backend = _backend;
 | 
				
			||||||
	return wlr_session_open_file(backend->session, path);
 | 
						return wlr_session_open_file(backend->session, path);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_libinput_close_restricted(int fd, void *_backend) {
 | 
					static void libinput_close_restricted(int fd, void *_backend) {
 | 
				
			||||||
	struct wlr_libinput_backend *backend = _backend;
 | 
						struct wlr_libinput_backend *backend = _backend;
 | 
				
			||||||
	wlr_session_close_file(backend->session, fd);
 | 
						wlr_session_close_file(backend->session, fd);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct libinput_interface libinput_impl = {
 | 
					static const struct libinput_interface libinput_impl = {
 | 
				
			||||||
	.open_restricted = wlr_libinput_open_restricted,
 | 
						.open_restricted = libinput_open_restricted,
 | 
				
			||||||
	.close_restricted = wlr_libinput_close_restricted
 | 
						.close_restricted = libinput_close_restricted
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int wlr_libinput_readable(int fd, uint32_t mask, void *_backend) {
 | 
					static int handle_libinput_readable(int fd, uint32_t mask, void *_backend) {
 | 
				
			||||||
	struct wlr_libinput_backend *backend = _backend;
 | 
						struct wlr_libinput_backend *backend = _backend;
 | 
				
			||||||
	if (libinput_dispatch(backend->libinput_context) != 0) {
 | 
						if (libinput_dispatch(backend->libinput_context) != 0) {
 | 
				
			||||||
		wlr_log(L_ERROR, "Failed to dispatch libinput");
 | 
							wlr_log(L_ERROR, "Failed to dispatch libinput");
 | 
				
			||||||
| 
						 | 
					@ -32,18 +32,18 @@ static int wlr_libinput_readable(int fd, uint32_t mask, void *_backend) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	struct libinput_event *event;
 | 
						struct libinput_event *event;
 | 
				
			||||||
	while ((event = libinput_get_event(backend->libinput_context))) {
 | 
						while ((event = libinput_get_event(backend->libinput_context))) {
 | 
				
			||||||
		wlr_libinput_event(backend, event);
 | 
							handle_libinput_event(backend, event);
 | 
				
			||||||
		libinput_event_destroy(event);
 | 
							libinput_event_destroy(event);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_libinput_log(struct libinput *libinput_context,
 | 
					static void log_libinput(struct libinput *libinput_context,
 | 
				
			||||||
		enum libinput_log_priority priority, const char *fmt, va_list args) {
 | 
							enum libinput_log_priority priority, const char *fmt, va_list args) {
 | 
				
			||||||
	_wlr_vlog(L_ERROR, fmt, args);
 | 
						_wlr_vlog(L_ERROR, fmt, args);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
 | 
					static bool backend_start(struct wlr_backend *_backend) {
 | 
				
			||||||
	struct wlr_libinput_backend *backend =
 | 
						struct wlr_libinput_backend *backend =
 | 
				
			||||||
		(struct wlr_libinput_backend *)_backend;
 | 
							(struct wlr_libinput_backend *)_backend;
 | 
				
			||||||
	wlr_log(L_DEBUG, "Initializing libinput");
 | 
						wlr_log(L_DEBUG, "Initializing libinput");
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: More sophisticated logging
 | 
						// TODO: More sophisticated logging
 | 
				
			||||||
	libinput_log_set_handler(backend->libinput_context, wlr_libinput_log);
 | 
						libinput_log_set_handler(backend->libinput_context, log_libinput);
 | 
				
			||||||
	libinput_log_set_priority(backend->libinput_context, LIBINPUT_LOG_PRIORITY_ERROR);
 | 
						libinput_log_set_priority(backend->libinput_context, LIBINPUT_LOG_PRIORITY_ERROR);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int libinput_fd = libinput_get_fd(backend->libinput_context);
 | 
						int libinput_fd = libinput_get_fd(backend->libinput_context);
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!no_devs && backend->wlr_device_lists.length == 0) {
 | 
						if (!no_devs && backend->wlr_device_lists.length == 0) {
 | 
				
			||||||
		wlr_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend);
 | 
							handle_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend);
 | 
				
			||||||
		if (backend->wlr_device_lists.length == 0) {
 | 
							if (backend->wlr_device_lists.length == 0) {
 | 
				
			||||||
			wlr_log(L_ERROR, "libinput initialization failed, no input devices");
 | 
								wlr_log(L_ERROR, "libinput initialization failed, no input devices");
 | 
				
			||||||
			wlr_log(L_ERROR, "Set WLR_LIBINPUT_NO_DEVICES=1 to suppress this check");
 | 
								wlr_log(L_ERROR, "Set WLR_LIBINPUT_NO_DEVICES=1 to suppress this check");
 | 
				
			||||||
| 
						 | 
					@ -87,7 +87,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
 | 
				
			||||||
		wl_event_source_remove(backend->input_event);
 | 
							wl_event_source_remove(backend->input_event);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	backend->input_event = wl_event_loop_add_fd(event_loop, libinput_fd,
 | 
						backend->input_event = wl_event_loop_add_fd(event_loop, libinput_fd,
 | 
				
			||||||
			WL_EVENT_READABLE, wlr_libinput_readable, backend);
 | 
								WL_EVENT_READABLE, handle_libinput_readable, backend);
 | 
				
			||||||
	if (!backend->input_event) {
 | 
						if (!backend->input_event) {
 | 
				
			||||||
		wlr_log(L_ERROR, "Failed to create input event on event loop");
 | 
							wlr_log(L_ERROR, "Failed to create input event on event loop");
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
| 
						 | 
					@ -96,7 +96,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_libinput_backend_destroy(struct wlr_backend *wlr_backend) {
 | 
					static void backend_destroy(struct wlr_backend *wlr_backend) {
 | 
				
			||||||
	if (!wlr_backend) {
 | 
						if (!wlr_backend) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -125,9 +125,9 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *wlr_backend) {
 | 
				
			||||||
	free(backend);
 | 
						free(backend);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_backend_impl backend_impl = {
 | 
					static const struct wlr_backend_impl backend_impl = {
 | 
				
			||||||
	.start = wlr_libinput_backend_start,
 | 
						.start = backend_start,
 | 
				
			||||||
	.destroy = wlr_libinput_backend_destroy
 | 
						.destroy = backend_destroy,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_backend_is_libinput(struct wlr_backend *b) {
 | 
					bool wlr_backend_is_libinput(struct wlr_backend *b) {
 | 
				
			||||||
| 
						 | 
					@ -153,7 +153,7 @@ static void session_signal(struct wl_listener *listener, void *data) {
 | 
				
			||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
 | 
					static void handle_display_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	struct wlr_libinput_backend *backend =
 | 
						struct wlr_libinput_backend *backend =
 | 
				
			||||||
		wl_container_of(listener, backend, display_destroy);
 | 
							wl_container_of(listener, backend, display_destroy);
 | 
				
			||||||
	wlr_libinput_backend_destroy(&backend->backend);
 | 
						backend_destroy(&backend->backend);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
 | 
					struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,7 +24,7 @@ struct wlr_input_device *get_appropriate_device(
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_libinput_device_destroy(struct wlr_input_device *_dev) {
 | 
					static void input_device_destroy(struct wlr_input_device *_dev) {
 | 
				
			||||||
	struct wlr_libinput_input_device *dev = (struct wlr_libinput_input_device *)_dev;
 | 
						struct wlr_libinput_input_device *dev = (struct wlr_libinput_input_device *)_dev;
 | 
				
			||||||
	libinput_device_unref(dev->handle);
 | 
						libinput_device_unref(dev->handle);
 | 
				
			||||||
	wl_list_remove(&dev->wlr_input_device.link);
 | 
						wl_list_remove(&dev->wlr_input_device.link);
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@ static void wlr_libinput_device_destroy(struct wlr_input_device *_dev) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct wlr_input_device_impl input_device_impl = {
 | 
					static const struct wlr_input_device_impl input_device_impl = {
 | 
				
			||||||
	.destroy = wlr_libinput_device_destroy
 | 
						.destroy = input_device_destroy,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_input_device *allocate_device(
 | 
					static struct wlr_input_device *allocate_device(
 | 
				
			||||||
| 
						 | 
					@ -86,7 +86,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
 | 
				
			||||||
		if (!wlr_dev) {
 | 
							if (!wlr_dev) {
 | 
				
			||||||
			goto fail;
 | 
								goto fail;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		wlr_dev->keyboard = wlr_libinput_keyboard_create(libinput_dev);
 | 
							wlr_dev->keyboard = create_libinput_keyboard(libinput_dev);
 | 
				
			||||||
		if (!wlr_dev->keyboard) {
 | 
							if (!wlr_dev->keyboard) {
 | 
				
			||||||
			free(wlr_dev);
 | 
								free(wlr_dev);
 | 
				
			||||||
			goto fail;
 | 
								goto fail;
 | 
				
			||||||
| 
						 | 
					@ -99,7 +99,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
 | 
				
			||||||
		if (!wlr_dev) {
 | 
							if (!wlr_dev) {
 | 
				
			||||||
			goto fail;
 | 
								goto fail;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		wlr_dev->pointer = wlr_libinput_pointer_create(libinput_dev);
 | 
							wlr_dev->pointer = create_libinput_pointer(libinput_dev);
 | 
				
			||||||
		if (!wlr_dev->pointer) {
 | 
							if (!wlr_dev->pointer) {
 | 
				
			||||||
			free(wlr_dev);
 | 
								free(wlr_dev);
 | 
				
			||||||
			goto fail;
 | 
								goto fail;
 | 
				
			||||||
| 
						 | 
					@ -112,7 +112,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
 | 
				
			||||||
		if (!wlr_dev) {
 | 
							if (!wlr_dev) {
 | 
				
			||||||
			goto fail;
 | 
								goto fail;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		wlr_dev->touch = wlr_libinput_touch_create(libinput_dev);
 | 
							wlr_dev->touch = create_libinput_touch(libinput_dev);
 | 
				
			||||||
		if (!wlr_dev->touch) {
 | 
							if (!wlr_dev->touch) {
 | 
				
			||||||
			free(wlr_dev);
 | 
								free(wlr_dev);
 | 
				
			||||||
			goto fail;
 | 
								goto fail;
 | 
				
			||||||
| 
						 | 
					@ -125,7 +125,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
 | 
				
			||||||
		if (!wlr_dev) {
 | 
							if (!wlr_dev) {
 | 
				
			||||||
			goto fail;
 | 
								goto fail;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		wlr_dev->tablet_tool = wlr_libinput_tablet_tool_create(libinput_dev);
 | 
							wlr_dev->tablet_tool = create_libinput_tablet_tool(libinput_dev);
 | 
				
			||||||
		if (!wlr_dev->tablet_tool) {
 | 
							if (!wlr_dev->tablet_tool) {
 | 
				
			||||||
			free(wlr_dev);
 | 
								free(wlr_dev);
 | 
				
			||||||
			goto fail;
 | 
								goto fail;
 | 
				
			||||||
| 
						 | 
					@ -138,7 +138,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
 | 
				
			||||||
		if (!wlr_dev) {
 | 
							if (!wlr_dev) {
 | 
				
			||||||
			goto fail;
 | 
								goto fail;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		wlr_dev->tablet_pad = wlr_libinput_tablet_pad_create(libinput_dev);
 | 
							wlr_dev->tablet_pad = create_libinput_tablet_pad(libinput_dev);
 | 
				
			||||||
		if (!wlr_dev->tablet_pad) {
 | 
							if (!wlr_dev->tablet_pad) {
 | 
				
			||||||
			free(wlr_dev);
 | 
								free(wlr_dev);
 | 
				
			||||||
			goto fail;
 | 
								goto fail;
 | 
				
			||||||
| 
						 | 
					@ -192,7 +192,7 @@ static void handle_device_removed(struct wlr_libinput_backend *backend,
 | 
				
			||||||
	free(wlr_devices);
 | 
						free(wlr_devices);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_libinput_event(struct wlr_libinput_backend *backend,
 | 
					void handle_libinput_event(struct wlr_libinput_backend *backend,
 | 
				
			||||||
		struct libinput_event *event) {
 | 
							struct libinput_event *event) {
 | 
				
			||||||
	assert(backend && event);
 | 
						assert(backend && event);
 | 
				
			||||||
	struct libinput_device *libinput_dev = libinput_event_get_device(event);
 | 
						struct libinput_device *libinput_dev = libinput_event_get_device(event);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,23 +12,23 @@ struct wlr_libinput_keyboard {
 | 
				
			||||||
	struct libinput_device *libinput_dev;
 | 
						struct libinput_device *libinput_dev;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_libinput_keyboard_set_leds(struct wlr_keyboard *wlr_kb, uint32_t leds) {
 | 
					static void keyboard_set_leds(struct wlr_keyboard *wlr_kb, uint32_t leds) {
 | 
				
			||||||
	struct wlr_libinput_keyboard *wlr_libinput_kb = (struct wlr_libinput_keyboard *)wlr_kb;
 | 
						struct wlr_libinput_keyboard *wlr_libinput_kb = (struct wlr_libinput_keyboard *)wlr_kb;
 | 
				
			||||||
	libinput_device_led_update(wlr_libinput_kb->libinput_dev, leds);
 | 
						libinput_device_led_update(wlr_libinput_kb->libinput_dev, leds);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_libinput_keyboard_destroy(struct wlr_keyboard *wlr_kb) {
 | 
					static void keyboard_destroy(struct wlr_keyboard *wlr_kb) {
 | 
				
			||||||
	struct wlr_libinput_keyboard *wlr_libinput_kb =
 | 
						struct wlr_libinput_keyboard *wlr_libinput_kb =
 | 
				
			||||||
		(struct wlr_libinput_keyboard *)wlr_kb;
 | 
							(struct wlr_libinput_keyboard *)wlr_kb;
 | 
				
			||||||
	libinput_device_unref(wlr_libinput_kb->libinput_dev);
 | 
						libinput_device_unref(wlr_libinput_kb->libinput_dev);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_keyboard_impl impl = {
 | 
					struct wlr_keyboard_impl impl = {
 | 
				
			||||||
	.destroy = wlr_libinput_keyboard_destroy,
 | 
						.destroy = keyboard_destroy,
 | 
				
			||||||
	.led_update = wlr_libinput_keyboard_set_leds
 | 
						.led_update = keyboard_set_leds
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_keyboard *wlr_libinput_keyboard_create(
 | 
					struct wlr_keyboard *create_libinput_keyboard(
 | 
				
			||||||
		struct libinput_device *libinput_dev) {
 | 
							struct libinput_device *libinput_dev) {
 | 
				
			||||||
	assert(libinput_dev);
 | 
						assert(libinput_dev);
 | 
				
			||||||
	struct wlr_libinput_keyboard *wlr_libinput_kb;
 | 
						struct wlr_libinput_keyboard *wlr_libinput_kb;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@
 | 
				
			||||||
#include "backend/libinput.h"
 | 
					#include "backend/libinput.h"
 | 
				
			||||||
#include "util/signal.h"
 | 
					#include "util/signal.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_pointer *wlr_libinput_pointer_create(
 | 
					struct wlr_pointer *create_libinput_pointer(
 | 
				
			||||||
		struct libinput_device *libinput_dev) {
 | 
							struct libinput_device *libinput_dev) {
 | 
				
			||||||
	assert(libinput_dev);
 | 
						assert(libinput_dev);
 | 
				
			||||||
	struct wlr_pointer *wlr_pointer = calloc(1, sizeof(struct wlr_pointer));
 | 
						struct wlr_pointer *wlr_pointer = calloc(1, sizeof(struct wlr_pointer));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@
 | 
				
			||||||
#include "backend/libinput.h"
 | 
					#include "backend/libinput.h"
 | 
				
			||||||
#include "util/signal.h"
 | 
					#include "util/signal.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_tablet_pad *wlr_libinput_tablet_pad_create(
 | 
					struct wlr_tablet_pad *create_libinput_tablet_pad(
 | 
				
			||||||
		struct libinput_device *libinput_dev) {
 | 
							struct libinput_device *libinput_dev) {
 | 
				
			||||||
	assert(libinput_dev);
 | 
						assert(libinput_dev);
 | 
				
			||||||
	struct wlr_tablet_pad *wlr_tablet_pad = calloc(1, sizeof(struct wlr_tablet_pad));
 | 
						struct wlr_tablet_pad *wlr_tablet_pad = calloc(1, sizeof(struct wlr_tablet_pad));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@
 | 
				
			||||||
#include "backend/libinput.h"
 | 
					#include "backend/libinput.h"
 | 
				
			||||||
#include "util/signal.h"
 | 
					#include "util/signal.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_tablet_tool *wlr_libinput_tablet_tool_create(
 | 
					struct wlr_tablet_tool *create_libinput_tablet_tool(
 | 
				
			||||||
		struct libinput_device *libinput_dev) {
 | 
							struct libinput_device *libinput_dev) {
 | 
				
			||||||
	assert(libinput_dev);
 | 
						assert(libinput_dev);
 | 
				
			||||||
	struct wlr_tablet_tool *wlr_tablet_tool = calloc(1, sizeof(struct wlr_tablet_tool));
 | 
						struct wlr_tablet_tool *wlr_tablet_tool = calloc(1, sizeof(struct wlr_tablet_tool));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@
 | 
				
			||||||
#include "backend/libinput.h"
 | 
					#include "backend/libinput.h"
 | 
				
			||||||
#include "util/signal.h"
 | 
					#include "util/signal.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_touch *wlr_libinput_touch_create(
 | 
					struct wlr_touch *create_libinput_touch(
 | 
				
			||||||
		struct libinput_device *libinput_dev) {
 | 
							struct libinput_device *libinput_dev) {
 | 
				
			||||||
	assert(libinput_dev);
 | 
						assert(libinput_dev);
 | 
				
			||||||
	struct wlr_touch *wlr_touch = calloc(1, sizeof(struct wlr_touch));
 | 
						struct wlr_touch *wlr_touch = calloc(1, sizeof(struct wlr_touch));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,10 @@
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <wlr/backend/drm.h>
 | 
				
			||||||
#include <wlr/backend/interface.h>
 | 
					#include <wlr/backend/interface.h>
 | 
				
			||||||
#include <wlr/backend/session.h>
 | 
					#include <wlr/backend/session.h>
 | 
				
			||||||
#include <wlr/util/log.h>
 | 
					#include <wlr/util/log.h>
 | 
				
			||||||
#include "backend/drm/drm.h"
 | 
					 | 
				
			||||||
#include "backend/multi.h"
 | 
					#include "backend/multi.h"
 | 
				
			||||||
#include "util/signal.h"
 | 
					#include "util/signal.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,11 +39,11 @@ static int dispatch_events(int fd, uint32_t mask, void *data) {
 | 
				
			||||||
 * compositor and creates surfaces for each output, then registers globals on
 | 
					 * compositor and creates surfaces for each output, then registers globals on
 | 
				
			||||||
 * the specified display.
 | 
					 * the specified display.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static bool wlr_wl_backend_start(struct wlr_backend *_backend) {
 | 
					static bool backend_start(struct wlr_backend *_backend) {
 | 
				
			||||||
	struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend;
 | 
						struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend;
 | 
				
			||||||
	wlr_log(L_INFO, "Initializating wayland backend");
 | 
						wlr_log(L_INFO, "Initializating wayland backend");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_wl_registry_poll(backend);
 | 
						poll_wl_registry(backend);
 | 
				
			||||||
	if (!backend->compositor || !backend->shell) {
 | 
						if (!backend->compositor || !backend->shell) {
 | 
				
			||||||
		wlr_log_errno(L_ERROR, "Could not obtain retrieve required globals");
 | 
							wlr_log_errno(L_ERROR, "Could not obtain retrieve required globals");
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,7 @@ static bool wlr_wl_backend_start(struct wlr_backend *_backend) {
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_wl_backend_destroy(struct wlr_backend *wlr_backend) {
 | 
					static void backend_destroy(struct wlr_backend *wlr_backend) {
 | 
				
			||||||
	struct wlr_wl_backend *backend = (struct wlr_wl_backend *)wlr_backend;
 | 
						struct wlr_wl_backend *backend = (struct wlr_wl_backend *)wlr_backend;
 | 
				
			||||||
	if (backend == NULL) {
 | 
						if (backend == NULL) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					@ -110,23 +110,23 @@ static void wlr_wl_backend_destroy(struct wlr_backend *wlr_backend) {
 | 
				
			||||||
	free(backend);
 | 
						free(backend);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_renderer *wlr_wl_backend_get_renderer(
 | 
					static struct wlr_renderer *backend_get_renderer(
 | 
				
			||||||
		struct wlr_backend *wlr_backend) {
 | 
							struct wlr_backend *wlr_backend) {
 | 
				
			||||||
	struct wlr_wl_backend *backend = (struct wlr_wl_backend *)wlr_backend;
 | 
						struct wlr_wl_backend *backend = (struct wlr_wl_backend *)wlr_backend;
 | 
				
			||||||
	return backend->renderer;
 | 
						return backend->renderer;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_backend_impl backend_impl = {
 | 
					static struct wlr_backend_impl backend_impl = {
 | 
				
			||||||
	.start = wlr_wl_backend_start,
 | 
						.start = backend_start,
 | 
				
			||||||
	.destroy = wlr_wl_backend_destroy,
 | 
						.destroy = backend_destroy,
 | 
				
			||||||
	.get_renderer = wlr_wl_backend_get_renderer,
 | 
						.get_renderer = backend_get_renderer,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_backend_is_wl(struct wlr_backend *b) {
 | 
					bool wlr_backend_is_wl(struct wlr_backend *b) {
 | 
				
			||||||
	return b->impl == &backend_impl;
 | 
						return b->impl == &backend_impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_wl_backend_output *wlr_wl_output_for_surface(
 | 
					struct wlr_wl_backend_output *get_wl_output_for_surface(
 | 
				
			||||||
		struct wlr_wl_backend *backend, struct wl_surface *surface) {
 | 
							struct wlr_wl_backend *backend, struct wl_surface *surface) {
 | 
				
			||||||
	struct wlr_wl_backend_output *output;
 | 
						struct wlr_wl_backend_output *output;
 | 
				
			||||||
	wl_list_for_each(output, &backend->outputs, link) {
 | 
						wl_list_for_each(output, &backend->outputs, link) {
 | 
				
			||||||
| 
						 | 
					@ -137,7 +137,7 @@ struct wlr_wl_backend_output *wlr_wl_output_for_surface(
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_wl_output_layout_get_box(struct wlr_wl_backend *backend,
 | 
					void get_wl_output_layout_box(struct wlr_wl_backend *backend,
 | 
				
			||||||
		struct wlr_box *box) {
 | 
							struct wlr_box *box) {
 | 
				
			||||||
	int min_x = INT_MAX, min_y = INT_MAX;
 | 
						int min_x = INT_MAX, min_y = INT_MAX;
 | 
				
			||||||
	int max_x = INT_MIN, max_y = INT_MIN;
 | 
						int max_x = INT_MIN, max_y = INT_MIN;
 | 
				
			||||||
| 
						 | 
					@ -172,7 +172,7 @@ void wlr_wl_output_layout_get_box(struct wlr_wl_backend *backend,
 | 
				
			||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
 | 
					static void handle_display_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	struct wlr_wl_backend *backend =
 | 
						struct wlr_wl_backend *backend =
 | 
				
			||||||
		wl_container_of(listener, backend, local_display_destroy);
 | 
							wl_container_of(listener, backend, local_display_destroy);
 | 
				
			||||||
	wlr_wl_backend_destroy(&backend->backend);
 | 
						backend_destroy(&backend->backend);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, const char *remote) {
 | 
					struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, const char *remote) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@ static struct wl_callback_listener frame_listener = {
 | 
				
			||||||
	.done = surface_frame_callback
 | 
						.done = surface_frame_callback
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_wl_output_set_custom_mode(struct wlr_output *_output,
 | 
					static bool output_set_custom_mode(struct wlr_output *_output,
 | 
				
			||||||
		int32_t width, int32_t height, int32_t refresh) {
 | 
							int32_t width, int32_t height, int32_t refresh) {
 | 
				
			||||||
	struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
 | 
						struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
 | 
				
			||||||
	wl_egl_window_resize(output->egl_window, width, height, 0, 0);
 | 
						wl_egl_window_resize(output->egl_window, width, height, 0, 0);
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@ static bool wlr_wl_output_set_custom_mode(struct wlr_output *_output,
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_wl_output_make_current(struct wlr_output *wlr_output,
 | 
					static bool output_make_current(struct wlr_output *wlr_output,
 | 
				
			||||||
		int *buffer_age) {
 | 
							int *buffer_age) {
 | 
				
			||||||
	struct wlr_wl_backend_output *output =
 | 
						struct wlr_wl_backend_output *output =
 | 
				
			||||||
		(struct wlr_wl_backend_output *)wlr_output;
 | 
							(struct wlr_wl_backend_output *)wlr_output;
 | 
				
			||||||
| 
						 | 
					@ -48,7 +48,7 @@ static bool wlr_wl_output_make_current(struct wlr_output *wlr_output,
 | 
				
			||||||
		buffer_age);
 | 
							buffer_age);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_wl_output_swap_buffers(struct wlr_output *wlr_output,
 | 
					static bool output_swap_buffers(struct wlr_output *wlr_output,
 | 
				
			||||||
		pixman_region32_t *damage) {
 | 
							pixman_region32_t *damage) {
 | 
				
			||||||
	struct wlr_wl_backend_output *output =
 | 
						struct wlr_wl_backend_output *output =
 | 
				
			||||||
		(struct wlr_wl_backend_output *)wlr_output;
 | 
							(struct wlr_wl_backend_output *)wlr_output;
 | 
				
			||||||
| 
						 | 
					@ -65,13 +65,13 @@ static bool wlr_wl_output_swap_buffers(struct wlr_output *wlr_output,
 | 
				
			||||||
		damage);
 | 
							damage);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_wl_output_transform(struct wlr_output *_output,
 | 
					static void output_transform(struct wlr_output *_output,
 | 
				
			||||||
		enum wl_output_transform transform) {
 | 
							enum wl_output_transform transform) {
 | 
				
			||||||
	struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
 | 
						struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
 | 
				
			||||||
	output->wlr_output.transform = transform;
 | 
						output->wlr_output.transform = transform;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
 | 
					static bool output_set_cursor(struct wlr_output *_output,
 | 
				
			||||||
		const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
 | 
							const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
 | 
				
			||||||
		int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) {
 | 
							int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) {
 | 
				
			||||||
	struct wlr_wl_backend_output *output =
 | 
						struct wlr_wl_backend_output *output =
 | 
				
			||||||
| 
						 | 
					@ -84,7 +84,7 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!update_pixels) {
 | 
						if (!update_pixels) {
 | 
				
			||||||
		// Update hotspot without changing cursor image
 | 
							// Update hotspot without changing cursor image
 | 
				
			||||||
		wlr_wl_output_update_cursor(output);
 | 
							update_wl_output_cursor(output);
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!buf) {
 | 
						if (!buf) {
 | 
				
			||||||
| 
						 | 
					@ -95,7 +95,7 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
 | 
				
			||||||
			output->cursor.surface = NULL;
 | 
								output->cursor.surface = NULL;
 | 
				
			||||||
			output->cursor.buf_size = 0;
 | 
								output->cursor.buf_size = 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		wlr_wl_output_update_cursor(output);
 | 
							update_wl_output_cursor(output);
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -153,11 +153,11 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
 | 
				
			||||||
	wl_surface_damage(output->cursor.surface, 0, 0, width, height);
 | 
						wl_surface_damage(output->cursor.surface, 0, 0, width, height);
 | 
				
			||||||
	wl_surface_commit(output->cursor.surface);
 | 
						wl_surface_commit(output->cursor.surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_wl_output_update_cursor(output);
 | 
						update_wl_output_cursor(output);
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_wl_output_destroy(struct wlr_output *wlr_output) {
 | 
					static void output_destroy(struct wlr_output *wlr_output) {
 | 
				
			||||||
	struct wlr_wl_backend_output *output =
 | 
						struct wlr_wl_backend_output *output =
 | 
				
			||||||
		(struct wlr_wl_backend_output *)wlr_output;
 | 
							(struct wlr_wl_backend_output *)wlr_output;
 | 
				
			||||||
	if (output == NULL) {
 | 
						if (output == NULL) {
 | 
				
			||||||
| 
						 | 
					@ -192,7 +192,7 @@ static void wlr_wl_output_destroy(struct wlr_output *wlr_output) {
 | 
				
			||||||
	free(output);
 | 
						free(output);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output) {
 | 
					void update_wl_output_cursor(struct wlr_wl_backend_output *output) {
 | 
				
			||||||
	if (output->backend->pointer && output->enter_serial) {
 | 
						if (output->backend->pointer && output->enter_serial) {
 | 
				
			||||||
		wl_pointer_set_cursor(output->backend->pointer, output->enter_serial,
 | 
							wl_pointer_set_cursor(output->backend->pointer, output->enter_serial,
 | 
				
			||||||
			output->cursor.surface, output->cursor.hotspot_x,
 | 
								output->cursor.surface, output->cursor.hotspot_x,
 | 
				
			||||||
| 
						 | 
					@ -200,19 +200,19 @@ void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_wl_output_move_cursor(struct wlr_output *_output, int x, int y) {
 | 
					bool output_move_cursor(struct wlr_output *_output, int x, int y) {
 | 
				
			||||||
	// TODO: only return true if x == current x and y == current y
 | 
						// TODO: only return true if x == current x and y == current y
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_output_impl output_impl = {
 | 
					static const struct wlr_output_impl output_impl = {
 | 
				
			||||||
	.set_custom_mode = wlr_wl_output_set_custom_mode,
 | 
						.set_custom_mode = output_set_custom_mode,
 | 
				
			||||||
	.transform = wlr_wl_output_transform,
 | 
						.transform = output_transform,
 | 
				
			||||||
	.destroy = wlr_wl_output_destroy,
 | 
						.destroy = output_destroy,
 | 
				
			||||||
	.make_current = wlr_wl_output_make_current,
 | 
						.make_current = output_make_current,
 | 
				
			||||||
	.swap_buffers = wlr_wl_output_swap_buffers,
 | 
						.swap_buffers = output_swap_buffers,
 | 
				
			||||||
	.set_cursor = wlr_wl_output_set_cursor,
 | 
						.set_cursor = output_set_cursor,
 | 
				
			||||||
	.move_cursor = wlr_wl_output_move_cursor,
 | 
						.move_cursor = output_move_cursor,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_output_is_wl(struct wlr_output *wlr_output) {
 | 
					bool wlr_output_is_wl(struct wlr_output *wlr_output) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,7 +48,7 @@ static const struct wl_registry_listener registry_listener = {
 | 
				
			||||||
	.global_remove = registry_global_remove
 | 
						.global_remove = registry_global_remove
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_wl_registry_poll(struct wlr_wl_backend *backend) {
 | 
					void poll_wl_registry(struct wlr_wl_backend *backend) {
 | 
				
			||||||
	wl_registry_add_listener(backend->registry, ®istry_listener, backend);
 | 
						wl_registry_add_listener(backend->registry, ®istry_listener, backend);
 | 
				
			||||||
	wl_display_dispatch(backend->remote_display);
 | 
						wl_display_dispatch(backend->remote_display);
 | 
				
			||||||
	wl_display_roundtrip(backend->remote_display);
 | 
						wl_display_roundtrip(backend->remote_display);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
 | 
				
			||||||
	assert(dev && dev->pointer);
 | 
						assert(dev && dev->pointer);
 | 
				
			||||||
	struct wlr_wl_pointer *wlr_wl_pointer = (struct wlr_wl_pointer *)dev->pointer;
 | 
						struct wlr_wl_pointer *wlr_wl_pointer = (struct wlr_wl_pointer *)dev->pointer;
 | 
				
			||||||
	struct wlr_wl_backend_output *output =
 | 
						struct wlr_wl_backend_output *output =
 | 
				
			||||||
		wlr_wl_output_for_surface(wlr_wl_dev->backend, surface);
 | 
							get_wl_output_for_surface(wlr_wl_dev->backend, surface);
 | 
				
			||||||
	if (!output) {
 | 
						if (!output) {
 | 
				
			||||||
		// GNOME sends a pointer enter when the surface is being destroyed
 | 
							// GNOME sends a pointer enter when the surface is being destroyed
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
 | 
				
			||||||
		&wlr_wl_pointer->output_destroy_listener);
 | 
							&wlr_wl_pointer->output_destroy_listener);
 | 
				
			||||||
	wlr_wl_pointer->current_output = output;
 | 
						wlr_wl_pointer->current_output = output;
 | 
				
			||||||
	output->enter_serial = serial;
 | 
						output->enter_serial = serial;
 | 
				
			||||||
	wlr_wl_output_update_cursor(output);
 | 
						update_wl_output_cursor(output);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer,
 | 
					static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer,
 | 
				
			||||||
| 
						 | 
					@ -70,7 +70,7 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
 | 
				
			||||||
	box.y /= wlr_output->scale;
 | 
						box.y /= wlr_output->scale;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_box layout_box;
 | 
						struct wlr_box layout_box;
 | 
				
			||||||
	wlr_wl_output_layout_get_box(wlr_wl_pointer->current_output->backend,
 | 
						get_wl_output_layout_box(wlr_wl_pointer->current_output->backend,
 | 
				
			||||||
		&layout_box);
 | 
							&layout_box);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	double ox = wlr_output->lx / (double)layout_box.width;
 | 
						double ox = wlr_output->lx / (double)layout_box.width;
 | 
				
			||||||
| 
						 | 
					@ -235,7 +235,7 @@ static struct wlr_input_device *allocate_device(struct wlr_wl_backend *backend,
 | 
				
			||||||
	return wlr_device;
 | 
						return wlr_device;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_wl_pointer_handle_output_destroy(struct wl_listener *listener,
 | 
					static void pointer_handle_output_destroy(struct wl_listener *listener,
 | 
				
			||||||
		void *data) {
 | 
							void *data) {
 | 
				
			||||||
	struct wlr_wl_pointer *wlr_wl_pointer =
 | 
						struct wlr_wl_pointer *wlr_wl_pointer =
 | 
				
			||||||
		wl_container_of(listener, wlr_wl_pointer, output_destroy_listener);
 | 
							wl_container_of(listener, wlr_wl_pointer, output_destroy_listener);
 | 
				
			||||||
| 
						 | 
					@ -256,7 +256,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		wlr_wl_pointer->output_destroy_listener.notify =
 | 
							wlr_wl_pointer->output_destroy_listener.notify =
 | 
				
			||||||
			wlr_wl_pointer_handle_output_destroy;
 | 
								pointer_handle_output_destroy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		struct wlr_input_device *wlr_device;
 | 
							struct wlr_input_device *wlr_device;
 | 
				
			||||||
		if (!(wlr_device = allocate_device(backend, WLR_INPUT_DEVICE_POINTER))) {
 | 
							if (!(wlr_device = allocate_device(backend, WLR_INPUT_DEVICE_POINTER))) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@
 | 
				
			||||||
#include "backend/x11.h"
 | 
					#include "backend/x11.h"
 | 
				
			||||||
#include "util/signal.h"
 | 
					#include "util/signal.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_x11_output *x11_output_from_window_id(struct wlr_x11_backend *x11,
 | 
					struct wlr_x11_output *get_x11_output_from_window_id(struct wlr_x11_backend *x11,
 | 
				
			||||||
		xcb_window_t window) {
 | 
							xcb_window_t window) {
 | 
				
			||||||
	struct wlr_x11_output *output;
 | 
						struct wlr_x11_output *output;
 | 
				
			||||||
	wl_list_for_each(output, &x11->outputs, link) {
 | 
						wl_list_for_each(output, &x11->outputs, link) {
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,7 @@ struct wlr_x11_output *x11_output_from_window_id(struct wlr_x11_backend *x11,
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void x11_output_layout_get_box(struct wlr_x11_backend *backend,
 | 
					void get_x11_output_layout_box(struct wlr_x11_backend *backend,
 | 
				
			||||||
		struct wlr_box *box) {
 | 
							struct wlr_box *box) {
 | 
				
			||||||
	int min_x = INT_MAX, min_y = INT_MAX;
 | 
						int min_x = INT_MAX, min_y = INT_MAX;
 | 
				
			||||||
	int max_x = INT_MIN, max_y = INT_MIN;
 | 
						int max_x = INT_MIN, max_y = INT_MIN;
 | 
				
			||||||
| 
						 | 
					@ -67,13 +67,13 @@ void x11_output_layout_get_box(struct wlr_x11_backend *backend,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_x11_event(struct wlr_x11_backend *x11,
 | 
					static void handle_x11_event(struct wlr_x11_backend *x11,
 | 
				
			||||||
		xcb_generic_event_t *event) {
 | 
							xcb_generic_event_t *event) {
 | 
				
			||||||
	x11_handle_input_event(x11, event);
 | 
						handle_x11_input_event(x11, event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) {
 | 
						switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) {
 | 
				
			||||||
	case XCB_EXPOSE: {
 | 
						case XCB_EXPOSE: {
 | 
				
			||||||
		xcb_expose_event_t *ev = (xcb_expose_event_t *)event;
 | 
							xcb_expose_event_t *ev = (xcb_expose_event_t *)event;
 | 
				
			||||||
		struct wlr_x11_output *output =
 | 
							struct wlr_x11_output *output =
 | 
				
			||||||
			x11_output_from_window_id(x11, ev->window);
 | 
								get_x11_output_from_window_id(x11, ev->window);
 | 
				
			||||||
		if (output != NULL) {
 | 
							if (output != NULL) {
 | 
				
			||||||
			wlr_output_update_needs_swap(&output->wlr_output);
 | 
								wlr_output_update_needs_swap(&output->wlr_output);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -83,9 +83,9 @@ static void handle_x11_event(struct wlr_x11_backend *x11,
 | 
				
			||||||
		xcb_configure_notify_event_t *ev =
 | 
							xcb_configure_notify_event_t *ev =
 | 
				
			||||||
			(xcb_configure_notify_event_t *)event;
 | 
								(xcb_configure_notify_event_t *)event;
 | 
				
			||||||
		struct wlr_x11_output *output =
 | 
							struct wlr_x11_output *output =
 | 
				
			||||||
			x11_output_from_window_id(x11, ev->window);
 | 
								get_x11_output_from_window_id(x11, ev->window);
 | 
				
			||||||
		if (output != NULL) {
 | 
							if (output != NULL) {
 | 
				
			||||||
			x11_output_handle_configure_notify(output, ev);
 | 
								handle_x11_configure_notify(output, ev);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -93,7 +93,7 @@ static void handle_x11_event(struct wlr_x11_backend *x11,
 | 
				
			||||||
		xcb_client_message_event_t *ev = (xcb_client_message_event_t *)event;
 | 
							xcb_client_message_event_t *ev = (xcb_client_message_event_t *)event;
 | 
				
			||||||
		if (ev->data.data32[0] == x11->atoms.wm_delete_window) {
 | 
							if (ev->data.data32[0] == x11->atoms.wm_delete_window) {
 | 
				
			||||||
			struct wlr_x11_output *output =
 | 
								struct wlr_x11_output *output =
 | 
				
			||||||
				x11_output_from_window_id(x11, ev->window);
 | 
									get_x11_output_from_window_id(x11, ev->window);
 | 
				
			||||||
			if (output != NULL) {
 | 
								if (output != NULL) {
 | 
				
			||||||
				wlr_output_destroy(&output->wlr_output);
 | 
									wlr_output_destroy(&output->wlr_output);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -120,7 +120,7 @@ static int x11_event(int fd, uint32_t mask, void *data) {
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_x11_backend_start(struct wlr_backend *backend) {
 | 
					static bool backend_start(struct wlr_backend *backend) {
 | 
				
			||||||
	struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
 | 
						struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
 | 
				
			||||||
	x11->started = true;
 | 
						x11->started = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -209,7 +209,7 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) {
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_x11_backend_destroy(struct wlr_backend *backend) {
 | 
					static void backend_destroy(struct wlr_backend *backend) {
 | 
				
			||||||
	if (!backend) {
 | 
						if (!backend) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -250,16 +250,16 @@ static void wlr_x11_backend_destroy(struct wlr_backend *backend) {
 | 
				
			||||||
	free(x11);
 | 
						free(x11);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_renderer *wlr_x11_backend_get_renderer(
 | 
					static struct wlr_renderer *backend_get_renderer(
 | 
				
			||||||
		struct wlr_backend *backend) {
 | 
							struct wlr_backend *backend) {
 | 
				
			||||||
	struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
 | 
						struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
 | 
				
			||||||
	return x11->renderer;
 | 
						return x11->renderer;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct wlr_backend_impl backend_impl = {
 | 
					static const struct wlr_backend_impl backend_impl = {
 | 
				
			||||||
	.start = wlr_x11_backend_start,
 | 
						.start = backend_start,
 | 
				
			||||||
	.destroy = wlr_x11_backend_destroy,
 | 
						.destroy = backend_destroy,
 | 
				
			||||||
	.get_renderer = wlr_x11_backend_get_renderer,
 | 
						.get_renderer = backend_get_renderer,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_backend_is_x11(struct wlr_backend *backend) {
 | 
					bool wlr_backend_is_x11(struct wlr_backend *backend) {
 | 
				
			||||||
| 
						 | 
					@ -269,7 +269,7 @@ bool wlr_backend_is_x11(struct wlr_backend *backend) {
 | 
				
			||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
 | 
					static void handle_display_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	struct wlr_x11_backend *x11 =
 | 
						struct wlr_x11_backend *x11 =
 | 
				
			||||||
		wl_container_of(listener, x11, display_destroy);
 | 
							wl_container_of(listener, x11, display_destroy);
 | 
				
			||||||
	wlr_x11_backend_destroy(&x11->backend);
 | 
						backend_destroy(&x11->backend);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
 | 
					struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@ static void x11_handle_pointer_position(struct wlr_x11_output *output,
 | 
				
			||||||
	box.y /= wlr_output->scale;
 | 
						box.y /= wlr_output->scale;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_box layout_box;
 | 
						struct wlr_box layout_box;
 | 
				
			||||||
	x11_output_layout_get_box(x11, &layout_box);
 | 
						get_x11_output_layout_box(x11, &layout_box);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	double ox = wlr_output->lx / (double)layout_box.width;
 | 
						double ox = wlr_output->lx / (double)layout_box.width;
 | 
				
			||||||
	double oy = wlr_output->ly / (double)layout_box.height;
 | 
						double oy = wlr_output->ly / (double)layout_box.height;
 | 
				
			||||||
| 
						 | 
					@ -56,7 +56,7 @@ static void x11_handle_pointer_position(struct wlr_x11_output *output,
 | 
				
			||||||
	x11->time = time;
 | 
						x11->time = time;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void x11_handle_input_event(struct wlr_x11_backend *x11,
 | 
					void handle_x11_input_event(struct wlr_x11_backend *x11,
 | 
				
			||||||
		xcb_generic_event_t *event) {
 | 
							xcb_generic_event_t *event) {
 | 
				
			||||||
	switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) {
 | 
						switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) {
 | 
				
			||||||
	case XCB_KEY_PRESS:
 | 
						case XCB_KEY_PRESS:
 | 
				
			||||||
| 
						 | 
					@ -116,7 +116,7 @@ void x11_handle_input_event(struct wlr_x11_backend *x11,
 | 
				
			||||||
		xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)event;
 | 
							xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)event;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		struct wlr_x11_output *output =
 | 
							struct wlr_x11_output *output =
 | 
				
			||||||
			x11_output_from_window_id(x11, ev->event);
 | 
								get_x11_output_from_window_id(x11, ev->event);
 | 
				
			||||||
		if (output != NULL) {
 | 
							if (output != NULL) {
 | 
				
			||||||
			x11_handle_pointer_position(output, ev->event_x, ev->event_y, ev->time);
 | 
								x11_handle_pointer_position(output, ev->event_x, ev->event_y, ev->time);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -138,7 +138,7 @@ void x11_handle_input_event(struct wlr_x11_backend *x11,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const struct wlr_input_device_impl input_device_impl = { 0 };
 | 
					const struct wlr_input_device_impl input_device_impl = { 0 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void x11_update_pointer_position(struct wlr_x11_output *output,
 | 
					void update_x11_pointer_position(struct wlr_x11_output *output,
 | 
				
			||||||
		xcb_timestamp_t time) {
 | 
							xcb_timestamp_t time) {
 | 
				
			||||||
	struct wlr_x11_backend *x11 = output->x11;
 | 
						struct wlr_x11_backend *x11 = output->x11;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -164,13 +164,13 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
 | 
				
			||||||
	return wlr_output;
 | 
						return wlr_output;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void x11_output_handle_configure_notify(struct wlr_x11_output *output,
 | 
					void handle_x11_configure_notify(struct wlr_x11_output *output,
 | 
				
			||||||
		xcb_configure_notify_event_t *ev) {
 | 
							xcb_configure_notify_event_t *ev) {
 | 
				
			||||||
	wlr_output_update_custom_mode(&output->wlr_output, ev->width,
 | 
						wlr_output_update_custom_mode(&output->wlr_output, ev->width,
 | 
				
			||||||
		ev->height, output->wlr_output.refresh);
 | 
							ev->height, output->wlr_output.refresh);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Move the pointer to its new location
 | 
						// Move the pointer to its new location
 | 
				
			||||||
	x11_update_pointer_position(output, output->x11->time);
 | 
						update_x11_pointer_position(output, output->x11->time);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_output_is_x11(struct wlr_output *wlr_output) {
 | 
					bool wlr_output_is_x11(struct wlr_output *wlr_output) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -136,17 +136,12 @@ struct wlr_drm_connector {
 | 
				
			||||||
	struct wl_list link;
 | 
						struct wl_list link;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_check_features(struct wlr_drm_backend *drm);
 | 
					bool check_drm_features(struct wlr_drm_backend *drm);
 | 
				
			||||||
bool wlr_drm_resources_init(struct wlr_drm_backend *drm);
 | 
					bool init_drm_resources(struct wlr_drm_backend *drm);
 | 
				
			||||||
void wlr_drm_resources_free(struct wlr_drm_backend *drm);
 | 
					void finish_drm_resources(struct wlr_drm_backend *drm);
 | 
				
			||||||
void wlr_drm_restore_outputs(struct wlr_drm_backend *drm);
 | 
					void restore_drm_outputs(struct wlr_drm_backend *drm);
 | 
				
			||||||
void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn);
 | 
					void scan_drm_connectors(struct wlr_drm_backend *state);
 | 
				
			||||||
void wlr_drm_scan_connectors(struct wlr_drm_backend *state);
 | 
					int handle_drm_event(int fd, uint32_t mask, void *data);
 | 
				
			||||||
int wlr_drm_event(int fd, uint32_t mask, void *data);
 | 
					void enable_drm_connector(struct wlr_output *output, bool enable);
 | 
				
			||||||
void wlr_drm_connector_enable(struct wlr_output *output, bool enable);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct wlr_session *wlr_drm_backend_get_session(struct wlr_backend *backend);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,11 +59,12 @@ union wlr_drm_plane_props {
 | 
				
			||||||
	uint32_t props[12];
 | 
						uint32_t props[12];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_get_connector_props(int fd, uint32_t id, union wlr_drm_connector_props *out);
 | 
					bool get_drm_connector_props(int fd, uint32_t id,
 | 
				
			||||||
bool wlr_drm_get_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out);
 | 
						union wlr_drm_connector_props *out);
 | 
				
			||||||
bool wlr_drm_get_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out);
 | 
					bool get_drm_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out);
 | 
				
			||||||
 | 
					bool get_drm_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret);
 | 
					bool get_drm_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret);
 | 
				
			||||||
void *wlr_drm_get_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len);
 | 
					void *get_drm_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,25 +31,25 @@ struct wlr_drm_surface {
 | 
				
			||||||
	struct gbm_bo *back;
 | 
						struct gbm_bo *back;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_renderer_init(struct wlr_drm_backend *drm,
 | 
					bool init_drm_renderer(struct wlr_drm_backend *drm,
 | 
				
			||||||
	struct wlr_drm_renderer *renderer);
 | 
						struct wlr_drm_renderer *renderer);
 | 
				
			||||||
void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer);
 | 
					void finish_drm_renderer(struct wlr_drm_renderer *renderer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_surface_init(struct wlr_drm_surface *surf,
 | 
					bool init_drm_surface(struct wlr_drm_surface *surf,
 | 
				
			||||||
	struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height,
 | 
						struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height,
 | 
				
			||||||
	uint32_t format, uint32_t flags);
 | 
						uint32_t format, uint32_t flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_drm_plane_surfaces_init(struct wlr_drm_plane *plane,
 | 
					bool init_drm_plane_surfaces(struct wlr_drm_plane *plane,
 | 
				
			||||||
	struct wlr_drm_backend *drm, int32_t width, uint32_t height,
 | 
						struct wlr_drm_backend *drm, int32_t width, uint32_t height,
 | 
				
			||||||
	uint32_t format);
 | 
						uint32_t format);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_drm_surface_finish(struct wlr_drm_surface *surf);
 | 
					void finish_drm_surface(struct wlr_drm_surface *surf);
 | 
				
			||||||
bool wlr_drm_surface_make_current(struct wlr_drm_surface *surf, int *buffer_age);
 | 
					bool make_drm_surface_current(struct wlr_drm_surface *surf, int *buffer_age);
 | 
				
			||||||
struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf,
 | 
					struct gbm_bo *swap_drm_surface_buffers(struct wlr_drm_surface *surf,
 | 
				
			||||||
	pixman_region32_t *damage);
 | 
						pixman_region32_t *damage);
 | 
				
			||||||
struct gbm_bo *wlr_drm_surface_get_front(struct wlr_drm_surface *surf);
 | 
					struct gbm_bo *get_drm_surface_front(struct wlr_drm_surface *surf);
 | 
				
			||||||
void wlr_drm_surface_post(struct wlr_drm_surface *surf);
 | 
					void post_drm_surface(struct wlr_drm_surface *surf);
 | 
				
			||||||
struct gbm_bo *wlr_drm_surface_mgpu_copy(struct wlr_drm_surface *dest,
 | 
					struct gbm_bo *copy_drm_surface_mgpu(struct wlr_drm_surface *dest,
 | 
				
			||||||
	struct gbm_bo *src);
 | 
						struct gbm_bo *src);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,8 @@
 | 
				
			||||||
// Calculates a more accurate refresh rate (mHz) than what mode itself provides
 | 
					// Calculates a more accurate refresh rate (mHz) than what mode itself provides
 | 
				
			||||||
int32_t calculate_refresh_rate(drmModeModeInfo *mode);
 | 
					int32_t calculate_refresh_rate(drmModeModeInfo *mode);
 | 
				
			||||||
// Populates the make/model/phys_{width,height} of output from the edid data
 | 
					// Populates the make/model/phys_{width,height} of output from the edid data
 | 
				
			||||||
void parse_edid(struct wlr_output *restrict output, size_t len, const uint8_t *data);
 | 
					void parse_edid(struct wlr_output *restrict output, size_t len,
 | 
				
			||||||
 | 
						const uint8_t *data);
 | 
				
			||||||
// Returns the string representation of a DRM output type
 | 
					// Returns the string representation of a DRM output type
 | 
				
			||||||
const char *conn_get_name(uint32_t type_id);
 | 
					const char *conn_get_name(uint32_t type_id);
 | 
				
			||||||
// Returns the DRM framebuffer id for a gbm_bo
 | 
					// Returns the DRM framebuffer id for a gbm_bo
 | 
				
			||||||
| 
						 | 
					@ -36,4 +37,5 @@ enum {
 | 
				
			||||||
size_t match_obj(size_t num_objs, const uint32_t objs[static restrict num_objs],
 | 
					size_t match_obj(size_t num_objs, const uint32_t objs[static restrict num_objs],
 | 
				
			||||||
		size_t num_res, const uint32_t res[static restrict num_res],
 | 
							size_t num_res, const uint32_t res[static restrict num_res],
 | 
				
			||||||
		uint32_t out[static restrict num_res]);
 | 
							uint32_t out[static restrict num_res]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,19 +31,19 @@ struct wlr_libinput_input_device {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint32_t usec_to_msec(uint64_t usec);
 | 
					uint32_t usec_to_msec(uint64_t usec);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_libinput_event(struct wlr_libinput_backend *state,
 | 
					void handle_libinput_event(struct wlr_libinput_backend *state,
 | 
				
			||||||
		struct libinput_event *event);
 | 
							struct libinput_event *event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_input_device *get_appropriate_device(
 | 
					struct wlr_input_device *get_appropriate_device(
 | 
				
			||||||
		enum wlr_input_device_type desired_type,
 | 
							enum wlr_input_device_type desired_type,
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_keyboard *wlr_libinput_keyboard_create(
 | 
					struct wlr_keyboard *create_libinput_keyboard(
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
void handle_keyboard_key(struct libinput_event *event,
 | 
					void handle_keyboard_key(struct libinput_event *event,
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_pointer *wlr_libinput_pointer_create(
 | 
					struct wlr_pointer *create_libinput_pointer(
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
void handle_pointer_motion(struct libinput_event *event,
 | 
					void handle_pointer_motion(struct libinput_event *event,
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
| 
						 | 
					@ -54,7 +54,7 @@ void handle_pointer_button(struct libinput_event *event,
 | 
				
			||||||
void handle_pointer_axis(struct libinput_event *event,
 | 
					void handle_pointer_axis(struct libinput_event *event,
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_touch *wlr_libinput_touch_create(
 | 
					struct wlr_touch *create_libinput_touch(
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
void handle_touch_down(struct libinput_event *event,
 | 
					void handle_touch_down(struct libinput_event *event,
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,7 @@ void handle_touch_motion(struct libinput_event *event,
 | 
				
			||||||
void handle_touch_cancel(struct libinput_event *event,
 | 
					void handle_touch_cancel(struct libinput_event *event,
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_tablet_tool *wlr_libinput_tablet_tool_create(
 | 
					struct wlr_tablet_tool *create_libinput_tablet_tool(
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
void handle_tablet_tool_axis(struct libinput_event *event,
 | 
					void handle_tablet_tool_axis(struct libinput_event *event,
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
| 
						 | 
					@ -76,7 +76,7 @@ void handle_tablet_tool_tip(struct libinput_event *event,
 | 
				
			||||||
void handle_tablet_tool_button(struct libinput_event *event,
 | 
					void handle_tablet_tool_button(struct libinput_event *event,
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_tablet_pad *wlr_libinput_tablet_pad_create(
 | 
					struct wlr_tablet_pad *create_libinput_tablet_pad(
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
void handle_tablet_pad_button(struct libinput_event *event,
 | 
					void handle_tablet_pad_button(struct libinput_event *event,
 | 
				
			||||||
		struct libinput_device *device);
 | 
							struct libinput_device *device);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,11 +74,11 @@ struct wlr_wl_pointer {
 | 
				
			||||||
	struct wl_listener output_destroy_listener;
 | 
						struct wl_listener output_destroy_listener;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_wl_registry_poll(struct wlr_wl_backend *backend);
 | 
					void poll_wl_registry(struct wlr_wl_backend *backend);
 | 
				
			||||||
void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output);
 | 
					void update_wl_output_cursor(struct wlr_wl_backend_output *output);
 | 
				
			||||||
struct wlr_wl_backend_output *wlr_wl_output_for_surface(
 | 
					struct wlr_wl_backend_output *get_wl_output_for_surface(
 | 
				
			||||||
		struct wlr_wl_backend *backend, struct wl_surface *surface);
 | 
							struct wlr_wl_backend *backend, struct wl_surface *surface);
 | 
				
			||||||
void wlr_wl_output_layout_get_box(struct wlr_wl_backend *backend,
 | 
					void get_wl_output_layout_box(struct wlr_wl_backend *backend,
 | 
				
			||||||
		struct wlr_box *box);
 | 
							struct wlr_box *box);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern const struct wl_seat_listener seat_listener;
 | 
					extern const struct wl_seat_listener seat_listener;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,19 +72,19 @@ struct wlr_x11_backend {
 | 
				
			||||||
	struct wl_listener display_destroy;
 | 
						struct wl_listener display_destroy;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_x11_output *x11_output_from_window_id(struct wlr_x11_backend *x11,
 | 
					struct wlr_x11_output *get_x11_output_from_window_id(struct wlr_x11_backend *x11,
 | 
				
			||||||
	xcb_window_t window);
 | 
						xcb_window_t window);
 | 
				
			||||||
void x11_output_layout_get_box(struct wlr_x11_backend *backend,
 | 
					void get_x11_output_layout_box(struct wlr_x11_backend *backend,
 | 
				
			||||||
	struct wlr_box *box);
 | 
						struct wlr_box *box);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const struct wlr_input_device_impl input_device_impl;
 | 
					extern const struct wlr_input_device_impl input_device_impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void x11_handle_input_event(struct wlr_x11_backend *x11,
 | 
					void handle_x11_input_event(struct wlr_x11_backend *x11,
 | 
				
			||||||
	xcb_generic_event_t *event);
 | 
						xcb_generic_event_t *event);
 | 
				
			||||||
void x11_update_pointer_position(struct wlr_x11_output *output,
 | 
					void update_x11_pointer_position(struct wlr_x11_output *output,
 | 
				
			||||||
	xcb_timestamp_t time);
 | 
						xcb_timestamp_t time);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void x11_output_handle_configure_notify(struct wlr_x11_output *output,
 | 
					void handle_x11_configure_notify(struct wlr_x11_output *output,
 | 
				
			||||||
	xcb_configure_notify_event_t *event);
 | 
						xcb_configure_notify_event_t *event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,7 +18,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
 | 
					extern PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct gles2_pixel_format {
 | 
					struct wlr_gles2_pixel_format {
 | 
				
			||||||
	uint32_t wl_format;
 | 
						uint32_t wl_format;
 | 
				
			||||||
	GLint gl_format, gl_type;
 | 
						GLint gl_format, gl_type;
 | 
				
			||||||
	int depth, bpp;
 | 
						int depth, bpp;
 | 
				
			||||||
| 
						 | 
					@ -68,15 +68,16 @@ struct wlr_gles2_texture {
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const struct gles2_pixel_format *gles2_format_from_wl(enum wl_shm_format fmt);
 | 
					const struct wlr_gles2_pixel_format *get_gles2_format_from_wl(
 | 
				
			||||||
const enum wl_shm_format *gles2_formats(size_t *len);
 | 
						enum wl_shm_format fmt);
 | 
				
			||||||
 | 
					const enum wl_shm_format *get_gles2_formats(size_t *len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_gles2_texture *gles2_get_texture_in_context(
 | 
					struct wlr_gles2_texture *get_gles2_texture_in_context(
 | 
				
			||||||
	struct wlr_texture *wlr_texture);
 | 
						struct wlr_texture *wlr_texture);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void gles2_push_marker(const char *file, const char *func);
 | 
					void push_gles2_marker(const char *file, const char *func);
 | 
				
			||||||
void gles2_pop_marker(void);
 | 
					void pop_gles2_marker(void);
 | 
				
			||||||
#define GLES2_DEBUG_PUSH gles2_push_marker(wlr_strip_path(__FILE__), __func__)
 | 
					#define PUSH_GLES2_DEBUG push_gles2_marker(wlr_strip_path(__FILE__), __func__)
 | 
				
			||||||
#define GLES2_DEBUG_POP gles2_pop_marker()
 | 
					#define POP_GLES2_DEBUG pop_gles2_marker()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,4 +19,6 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
 | 
				
			||||||
bool wlr_backend_is_drm(struct wlr_backend *backend);
 | 
					bool wlr_backend_is_drm(struct wlr_backend *backend);
 | 
				
			||||||
bool wlr_output_is_drm(struct wlr_output *output);
 | 
					bool wlr_output_is_drm(struct wlr_output *output);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct wlr_session *wlr_drm_backend_get_session(struct wlr_backend *backend);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,8 +60,8 @@ void xwm_handle_selection_notify(struct wlr_xwm *xwm,
 | 
				
			||||||
	xcb_selection_notify_event_t *event);
 | 
						xcb_selection_notify_event_t *event);
 | 
				
			||||||
int xwm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
 | 
					int xwm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
 | 
				
			||||||
	xcb_xfixes_selection_notify_event_t *event);
 | 
						xcb_xfixes_selection_notify_event_t *event);
 | 
				
			||||||
bool wlr_data_source_is_xwayland_data_source(struct wlr_data_source *wlr_source);
 | 
					bool data_source_is_xwayland(struct wlr_data_source *wlr_source);
 | 
				
			||||||
bool wlr_primary_selection_source_is_xwayland_primary_selection_source(
 | 
					bool primary_selection_source_is_xwayland(
 | 
				
			||||||
	struct wlr_primary_selection_source *wlr_source);
 | 
						struct wlr_primary_selection_source *wlr_source);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void xwm_seat_handle_start_drag(struct wlr_xwm *xwm, struct wlr_drag *drag);
 | 
					void xwm_seat_handle_start_drag(struct wlr_xwm *xwm, struct wlr_drag *drag);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@
 | 
				
			||||||
* The wayland formats are little endian while the GL formats are big endian,
 | 
					* The wayland formats are little endian while the GL formats are big endian,
 | 
				
			||||||
* so WL_SHM_FORMAT_ARGB8888 is actually compatible with GL_BGRA_EXT.
 | 
					* so WL_SHM_FORMAT_ARGB8888 is actually compatible with GL_BGRA_EXT.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
static const struct gles2_pixel_format formats[] = {
 | 
					static const struct wlr_gles2_pixel_format formats[] = {
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		.wl_format = WL_SHM_FORMAT_ARGB8888,
 | 
							.wl_format = WL_SHM_FORMAT_ARGB8888,
 | 
				
			||||||
		.depth = 32,
 | 
							.depth = 32,
 | 
				
			||||||
| 
						 | 
					@ -50,7 +50,8 @@ static const enum wl_shm_format wl_formats[] = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO: more pixel formats
 | 
					// TODO: more pixel formats
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const struct gles2_pixel_format *gles2_format_from_wl(enum wl_shm_format fmt) {
 | 
					const struct wlr_gles2_pixel_format *get_gles2_format_from_wl(
 | 
				
			||||||
 | 
							enum wl_shm_format fmt) {
 | 
				
			||||||
	for (size_t i = 0; i < sizeof(formats) / sizeof(*formats); ++i) {
 | 
						for (size_t i = 0; i < sizeof(formats) / sizeof(*formats); ++i) {
 | 
				
			||||||
		if (formats[i].wl_format == fmt) {
 | 
							if (formats[i].wl_format == fmt) {
 | 
				
			||||||
			return &formats[i];
 | 
								return &formats[i];
 | 
				
			||||||
| 
						 | 
					@ -59,7 +60,7 @@ const struct gles2_pixel_format *gles2_format_from_wl(enum wl_shm_format fmt) {
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const enum wl_shm_format *gles2_formats(size_t *len) {
 | 
					const enum wl_shm_format *get_gles2_formats(size_t *len) {
 | 
				
			||||||
	*len = sizeof(wl_formats) / sizeof(wl_formats[0]);
 | 
						*len = sizeof(wl_formats) / sizeof(wl_formats[0]);
 | 
				
			||||||
	return wl_formats;
 | 
						return wl_formats;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@ static void gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width,
 | 
				
			||||||
	struct wlr_gles2_renderer *renderer =
 | 
						struct wlr_gles2_renderer *renderer =
 | 
				
			||||||
		gles2_get_renderer_in_context(wlr_renderer);
 | 
							gles2_get_renderer_in_context(wlr_renderer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	glViewport(0, 0, width, height);
 | 
						glViewport(0, 0, width, height);
 | 
				
			||||||
	renderer->viewport_width = width;
 | 
						renderer->viewport_width = width;
 | 
				
			||||||
| 
						 | 
					@ -47,7 +47,7 @@ static void gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width,
 | 
				
			||||||
	// XXX: maybe we should save output projection and remove some of the need
 | 
						// XXX: maybe we should save output projection and remove some of the need
 | 
				
			||||||
	// for users to sling matricies themselves
 | 
						// for users to sling matricies themselves
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void gles2_end(struct wlr_renderer *wlr_renderer) {
 | 
					static void gles2_end(struct wlr_renderer *wlr_renderer) {
 | 
				
			||||||
| 
						 | 
					@ -59,10 +59,10 @@ static void gles2_clear(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
		const float color[static 4]) {
 | 
							const float color[static 4]) {
 | 
				
			||||||
	gles2_get_renderer_in_context(wlr_renderer);
 | 
						gles2_get_renderer_in_context(wlr_renderer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
	glClearColor(color[0], color[1], color[2], color[3]);
 | 
						glClearColor(color[0], color[1], color[2], color[3]);
 | 
				
			||||||
	glClear(GL_COLOR_BUFFER_BIT);
 | 
						glClear(GL_COLOR_BUFFER_BIT);
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void gles2_scissor(struct wlr_renderer *wlr_renderer,
 | 
					static void gles2_scissor(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
| 
						 | 
					@ -70,7 +70,7 @@ static void gles2_scissor(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
	struct wlr_gles2_renderer *renderer =
 | 
						struct wlr_gles2_renderer *renderer =
 | 
				
			||||||
		gles2_get_renderer_in_context(wlr_renderer);
 | 
							gles2_get_renderer_in_context(wlr_renderer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
	if (box != NULL) {
 | 
						if (box != NULL) {
 | 
				
			||||||
		struct wlr_box gl_box;
 | 
							struct wlr_box gl_box;
 | 
				
			||||||
		wlr_box_transform(box, WL_OUTPUT_TRANSFORM_FLIPPED_180,
 | 
							wlr_box_transform(box, WL_OUTPUT_TRANSFORM_FLIPPED_180,
 | 
				
			||||||
| 
						 | 
					@ -81,7 +81,7 @@ static void gles2_scissor(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		glDisable(GL_SCISSOR_TEST);
 | 
							glDisable(GL_SCISSOR_TEST);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void draw_quad() {
 | 
					static void draw_quad() {
 | 
				
			||||||
| 
						 | 
					@ -116,7 +116,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
	struct wlr_gles2_renderer *renderer =
 | 
						struct wlr_gles2_renderer *renderer =
 | 
				
			||||||
		gles2_get_renderer_in_context(wlr_renderer);
 | 
							gles2_get_renderer_in_context(wlr_renderer);
 | 
				
			||||||
	struct wlr_gles2_texture *texture =
 | 
						struct wlr_gles2_texture *texture =
 | 
				
			||||||
		gles2_get_texture_in_context(wlr_texture);
 | 
							get_gles2_texture_in_context(wlr_texture);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLuint prog = 0;
 | 
						GLuint prog = 0;
 | 
				
			||||||
	GLenum target = 0;
 | 
						GLenum target = 0;
 | 
				
			||||||
| 
						 | 
					@ -139,7 +139,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
	float transposition[9];
 | 
						float transposition[9];
 | 
				
			||||||
	wlr_matrix_transpose(transposition, matrix);
 | 
						wlr_matrix_transpose(transposition, matrix);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLuint tex_id = texture->type == WLR_GLES2_TEXTURE_GLTEX ?
 | 
						GLuint tex_id = texture->type == WLR_GLES2_TEXTURE_GLTEX ?
 | 
				
			||||||
		texture->gl_tex : texture->image_tex;
 | 
							texture->gl_tex : texture->image_tex;
 | 
				
			||||||
| 
						 | 
					@ -157,7 +157,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	draw_quad();
 | 
						draw_quad();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -172,12 +172,12 @@ static void gles2_render_quad_with_matrix(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
	float transposition[9];
 | 
						float transposition[9];
 | 
				
			||||||
	wlr_matrix_transpose(transposition, matrix);
 | 
						wlr_matrix_transpose(transposition, matrix);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
	glUseProgram(renderer->shaders.quad);
 | 
						glUseProgram(renderer->shaders.quad);
 | 
				
			||||||
	glUniformMatrix3fv(0, 1, GL_FALSE, transposition);
 | 
						glUniformMatrix3fv(0, 1, GL_FALSE, transposition);
 | 
				
			||||||
	glUniform4f(1, color[0], color[1], color[2], color[3]);
 | 
						glUniform4f(1, color[0], color[1], color[2], color[3]);
 | 
				
			||||||
	draw_quad();
 | 
						draw_quad();
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void gles2_render_ellipse_with_matrix(struct wlr_renderer *wlr_renderer,
 | 
					static void gles2_render_ellipse_with_matrix(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
| 
						 | 
					@ -190,17 +190,17 @@ static void gles2_render_ellipse_with_matrix(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
	float transposition[9];
 | 
						float transposition[9];
 | 
				
			||||||
	wlr_matrix_transpose(transposition, matrix);
 | 
						wlr_matrix_transpose(transposition, matrix);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
	glUseProgram(renderer->shaders.ellipse);
 | 
						glUseProgram(renderer->shaders.ellipse);
 | 
				
			||||||
	glUniformMatrix3fv(0, 1, GL_FALSE, transposition);
 | 
						glUniformMatrix3fv(0, 1, GL_FALSE, transposition);
 | 
				
			||||||
	glUniform4f(1, color[0], color[1], color[2], color[3]);
 | 
						glUniform4f(1, color[0], color[1], color[2], color[3]);
 | 
				
			||||||
	draw_quad();
 | 
						draw_quad();
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const enum wl_shm_format *gles2_renderer_formats(
 | 
					static const enum wl_shm_format *gles2_renderer_formats(
 | 
				
			||||||
		struct wlr_renderer *wlr_renderer, size_t *len) {
 | 
							struct wlr_renderer *wlr_renderer, size_t *len) {
 | 
				
			||||||
	return gles2_formats(len);
 | 
						return get_gles2_formats(len);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool gles2_resource_is_wl_drm_buffer(struct wlr_renderer *wlr_renderer,
 | 
					static bool gles2_resource_is_wl_drm_buffer(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
| 
						 | 
					@ -254,13 +254,13 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
		uint32_t dst_y, void *data) {
 | 
							uint32_t dst_y, void *data) {
 | 
				
			||||||
	gles2_get_renderer_in_context(wlr_renderer);
 | 
						gles2_get_renderer_in_context(wlr_renderer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const struct gles2_pixel_format *fmt = gles2_format_from_wl(wl_fmt);
 | 
						const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
 | 
				
			||||||
	if (fmt == NULL) {
 | 
						if (fmt == NULL) {
 | 
				
			||||||
		wlr_log(L_ERROR, "Cannot read pixels: unsupported pixel format");
 | 
							wlr_log(L_ERROR, "Cannot read pixels: unsupported pixel format");
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Make sure any pending drawing is finished before we try to read it
 | 
						// Make sure any pending drawing is finished before we try to read it
 | 
				
			||||||
	glFinish();
 | 
						glFinish();
 | 
				
			||||||
| 
						 | 
					@ -273,14 +273,14 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
			fmt->gl_type, p + i * stride + dst_x * fmt->bpp / 8);
 | 
								fmt->gl_type, p + i * stride + dst_x * fmt->bpp / 8);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool gles2_format_supported(struct wlr_renderer *wlr_renderer,
 | 
					static bool gles2_format_supported(struct wlr_renderer *wlr_renderer,
 | 
				
			||||||
		enum wl_shm_format wl_fmt) {
 | 
							enum wl_shm_format wl_fmt) {
 | 
				
			||||||
	return gles2_format_from_wl(wl_fmt) != NULL;
 | 
						return get_gles2_format_from_wl(wl_fmt) != NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_texture *gles2_texture_from_pixels(
 | 
					static struct wlr_texture *gles2_texture_from_pixels(
 | 
				
			||||||
| 
						 | 
					@ -309,13 +309,13 @@ static void gles2_destroy(struct wlr_renderer *wlr_renderer) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
 | 
						wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
	glDeleteProgram(renderer->shaders.quad);
 | 
						glDeleteProgram(renderer->shaders.quad);
 | 
				
			||||||
	glDeleteProgram(renderer->shaders.ellipse);
 | 
						glDeleteProgram(renderer->shaders.ellipse);
 | 
				
			||||||
	glDeleteProgram(renderer->shaders.tex_rgba);
 | 
						glDeleteProgram(renderer->shaders.tex_rgba);
 | 
				
			||||||
	glDeleteProgram(renderer->shaders.tex_rgbx);
 | 
						glDeleteProgram(renderer->shaders.tex_rgbx);
 | 
				
			||||||
	glDeleteProgram(renderer->shaders.tex_ext);
 | 
						glDeleteProgram(renderer->shaders.tex_ext);
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (glDebugMessageCallbackKHR) {
 | 
						if (glDebugMessageCallbackKHR) {
 | 
				
			||||||
		glDisable(GL_DEBUG_OUTPUT_KHR);
 | 
							glDisable(GL_DEBUG_OUTPUT_KHR);
 | 
				
			||||||
| 
						 | 
					@ -347,7 +347,7 @@ static const struct wlr_renderer_impl renderer_impl = {
 | 
				
			||||||
	.texture_from_dmabuf = gles2_texture_from_dmabuf,
 | 
						.texture_from_dmabuf = gles2_texture_from_dmabuf,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void gles2_push_marker(const char *file, const char *func) {
 | 
					void push_gles2_marker(const char *file, const char *func) {
 | 
				
			||||||
	if (!glPushDebugGroupKHR) {
 | 
						if (!glPushDebugGroupKHR) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -358,7 +358,7 @@ void gles2_push_marker(const char *file, const char *func) {
 | 
				
			||||||
	glPushDebugGroupKHR(GL_DEBUG_SOURCE_APPLICATION_KHR, 1, -1, str);
 | 
						glPushDebugGroupKHR(GL_DEBUG_SOURCE_APPLICATION_KHR, 1, -1, str);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void gles2_pop_marker(void) {
 | 
					void pop_gles2_marker(void) {
 | 
				
			||||||
	if (glPopDebugGroupKHR) {
 | 
						if (glPopDebugGroupKHR) {
 | 
				
			||||||
		glPopDebugGroupKHR();
 | 
							glPopDebugGroupKHR();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -385,7 +385,7 @@ static void gles2_log(GLenum src, GLenum type, GLuint id, GLenum severity,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static GLuint compile_shader(GLuint type, const GLchar *src) {
 | 
					static GLuint compile_shader(GLuint type, const GLchar *src) {
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLuint shader = glCreateShader(type);
 | 
						GLuint shader = glCreateShader(type);
 | 
				
			||||||
	glShaderSource(shader, 1, &src, NULL);
 | 
						glShaderSource(shader, 1, &src, NULL);
 | 
				
			||||||
| 
						 | 
					@ -398,12 +398,12 @@ static GLuint compile_shader(GLuint type, const GLchar *src) {
 | 
				
			||||||
		shader = 0;
 | 
							shader = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
	return shader;
 | 
						return shader;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static GLuint link_program(const GLchar *vert_src, const GLchar *frag_src) {
 | 
					static GLuint link_program(const GLchar *vert_src, const GLchar *frag_src) {
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLuint vert = compile_shader(GL_VERTEX_SHADER, vert_src);
 | 
						GLuint vert = compile_shader(GL_VERTEX_SHADER, vert_src);
 | 
				
			||||||
	if (!vert) {
 | 
						if (!vert) {
 | 
				
			||||||
| 
						 | 
					@ -433,11 +433,11 @@ static GLuint link_program(const GLchar *vert_src, const GLchar *frag_src) {
 | 
				
			||||||
		goto error;
 | 
							goto error;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
	return prog;
 | 
						return prog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
error:
 | 
					error:
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -481,7 +481,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
 | 
				
			||||||
			GL_DONT_CARE, 0, NULL, GL_FALSE);
 | 
								GL_DONT_CARE, 0, NULL, GL_FALSE);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	renderer->shaders.quad = link_program(quad_vertex_src, quad_fragment_src);
 | 
						renderer->shaders.quad = link_program(quad_vertex_src, quad_fragment_src);
 | 
				
			||||||
	if (!renderer->shaders.quad) {
 | 
						if (!renderer->shaders.quad) {
 | 
				
			||||||
| 
						 | 
					@ -510,7 +510,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return &renderer->wlr_renderer;
 | 
						return &renderer->wlr_renderer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -521,7 +521,7 @@ error:
 | 
				
			||||||
	glDeleteProgram(renderer->shaders.tex_rgbx);
 | 
						glDeleteProgram(renderer->shaders.tex_rgbx);
 | 
				
			||||||
	glDeleteProgram(renderer->shaders.tex_ext);
 | 
						glDeleteProgram(renderer->shaders.tex_ext);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (glDebugMessageCallbackKHR) {
 | 
						if (glDebugMessageCallbackKHR) {
 | 
				
			||||||
		glDisable(GL_DEBUG_OUTPUT_KHR);
 | 
							glDisable(GL_DEBUG_OUTPUT_KHR);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@ static struct wlr_gles2_texture *gles2_get_texture(
 | 
				
			||||||
	return (struct wlr_gles2_texture *)wlr_texture;
 | 
						return (struct wlr_gles2_texture *)wlr_texture;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_gles2_texture *gles2_get_texture_in_context(
 | 
					struct wlr_gles2_texture *get_gles2_texture_in_context(
 | 
				
			||||||
		struct wlr_texture *wlr_texture) {
 | 
							struct wlr_texture *wlr_texture) {
 | 
				
			||||||
	struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture);
 | 
						struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture);
 | 
				
			||||||
	assert(wlr_egl_is_current(texture->egl));
 | 
						assert(wlr_egl_is_current(texture->egl));
 | 
				
			||||||
| 
						 | 
					@ -41,21 +41,21 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture,
 | 
				
			||||||
		uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t dst_x,
 | 
							uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t dst_x,
 | 
				
			||||||
		uint32_t dst_y, const void *data) {
 | 
							uint32_t dst_y, const void *data) {
 | 
				
			||||||
	struct wlr_gles2_texture *texture =
 | 
						struct wlr_gles2_texture *texture =
 | 
				
			||||||
		gles2_get_texture_in_context(wlr_texture);
 | 
							get_gles2_texture_in_context(wlr_texture);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (texture->type != WLR_GLES2_TEXTURE_GLTEX) {
 | 
						if (texture->type != WLR_GLES2_TEXTURE_GLTEX) {
 | 
				
			||||||
		wlr_log(L_ERROR, "Cannot write pixels to immutable texture");
 | 
							wlr_log(L_ERROR, "Cannot write pixels to immutable texture");
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const struct gles2_pixel_format *fmt = gles2_format_from_wl(wl_fmt);
 | 
						const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
 | 
				
			||||||
	if (fmt == NULL) {
 | 
						if (fmt == NULL) {
 | 
				
			||||||
		wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
 | 
							wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: what if the unpack subimage extension isn't supported?
 | 
						// TODO: what if the unpack subimage extension isn't supported?
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	glBindTexture(GL_TEXTURE_2D, texture->gl_tex);
 | 
						glBindTexture(GL_TEXTURE_2D, texture->gl_tex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,7 +70,7 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture,
 | 
				
			||||||
	glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
 | 
						glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
 | 
				
			||||||
	glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
 | 
						glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -83,7 +83,7 @@ static void gles2_texture_destroy(struct wlr_texture *wlr_texture) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_egl_make_current(texture->egl, EGL_NO_SURFACE, NULL);
 | 
						wlr_egl_make_current(texture->egl, EGL_NO_SURFACE, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (texture->image_tex) {
 | 
						if (texture->image_tex) {
 | 
				
			||||||
		glDeleteTextures(1, &texture->image_tex);
 | 
							glDeleteTextures(1, &texture->image_tex);
 | 
				
			||||||
| 
						 | 
					@ -94,7 +94,7 @@ static void gles2_texture_destroy(struct wlr_texture *wlr_texture) {
 | 
				
			||||||
		glDeleteTextures(1, &texture->gl_tex);
 | 
							glDeleteTextures(1, &texture->gl_tex);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(texture);
 | 
						free(texture);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -110,7 +110,7 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
 | 
				
			||||||
		uint32_t height, const void *data) {
 | 
							uint32_t height, const void *data) {
 | 
				
			||||||
	assert(wlr_egl_is_current(egl));
 | 
						assert(wlr_egl_is_current(egl));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const struct gles2_pixel_format *fmt = gles2_format_from_wl(wl_fmt);
 | 
						const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
 | 
				
			||||||
	if (fmt == NULL) {
 | 
						if (fmt == NULL) {
 | 
				
			||||||
		wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
 | 
							wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					@ -129,7 +129,7 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
 | 
				
			||||||
	texture->type = WLR_GLES2_TEXTURE_GLTEX;
 | 
						texture->type = WLR_GLES2_TEXTURE_GLTEX;
 | 
				
			||||||
	texture->has_alpha = fmt->has_alpha;
 | 
						texture->has_alpha = fmt->has_alpha;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	glGenTextures(1, &texture->gl_tex);
 | 
						glGenTextures(1, &texture->gl_tex);
 | 
				
			||||||
	glBindTexture(GL_TEXTURE_2D, texture->gl_tex);
 | 
						glBindTexture(GL_TEXTURE_2D, texture->gl_tex);
 | 
				
			||||||
| 
						 | 
					@ -139,7 +139,7 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
 | 
				
			||||||
		fmt->gl_format, fmt->gl_type, data);
 | 
							fmt->gl_format, fmt->gl_type, data);
 | 
				
			||||||
	glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
 | 
						glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
	return &texture->wlr_texture;
 | 
						return &texture->wlr_texture;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -188,13 +188,13 @@ struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl,
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	glGenTextures(1, &texture->image_tex);
 | 
						glGenTextures(1, &texture->image_tex);
 | 
				
			||||||
	glBindTexture(target, texture->image_tex);
 | 
						glBindTexture(target, texture->image_tex);
 | 
				
			||||||
	glEGLImageTargetTexture2DOES(target, texture->image);
 | 
						glEGLImageTargetTexture2DOES(target, texture->image);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
	return &texture->wlr_texture;
 | 
						return &texture->wlr_texture;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -233,12 +233,12 @@ struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl,
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_PUSH;
 | 
						PUSH_GLES2_DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	glGenTextures(1, &texture->image_tex);
 | 
						glGenTextures(1, &texture->image_tex);
 | 
				
			||||||
	glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture->image_tex);
 | 
						glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture->image_tex);
 | 
				
			||||||
	glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, texture->image);
 | 
						glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, texture->image);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLES2_DEBUG_POP;
 | 
						POP_GLES2_DEBUG;
 | 
				
			||||||
	return &texture->wlr_texture;
 | 
						return &texture->wlr_texture;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,7 +107,7 @@ static void output_cursor_destroy(
 | 
				
			||||||
	free(output_cursor);
 | 
						free(output_cursor);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_cursor_detach_output_layout(struct wlr_cursor *cur) {
 | 
					static void cursor_detach_output_layout(struct wlr_cursor *cur) {
 | 
				
			||||||
	if (!cur->state->layout) {
 | 
						if (!cur->state->layout) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -125,7 +125,7 @@ static void wlr_cursor_detach_output_layout(struct wlr_cursor *cur) {
 | 
				
			||||||
	cur->state->layout = NULL;
 | 
						cur->state->layout = NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_cursor_device_destroy(struct wlr_cursor_device *c_device) {
 | 
					static void cursor_device_destroy(struct wlr_cursor_device *c_device) {
 | 
				
			||||||
	struct wlr_input_device *dev = c_device->device;
 | 
						struct wlr_input_device *dev = c_device->device;
 | 
				
			||||||
	if (dev->type == WLR_INPUT_DEVICE_POINTER) {
 | 
						if (dev->type == WLR_INPUT_DEVICE_POINTER) {
 | 
				
			||||||
		wl_list_remove(&c_device->motion.link);
 | 
							wl_list_remove(&c_device->motion.link);
 | 
				
			||||||
| 
						 | 
					@ -150,11 +150,11 @@ static void wlr_cursor_device_destroy(struct wlr_cursor_device *c_device) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_cursor_destroy(struct wlr_cursor *cur) {
 | 
					void wlr_cursor_destroy(struct wlr_cursor *cur) {
 | 
				
			||||||
	wlr_cursor_detach_output_layout(cur);
 | 
						cursor_detach_output_layout(cur);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_cursor_device *device, *device_tmp = NULL;
 | 
						struct wlr_cursor_device *device, *device_tmp = NULL;
 | 
				
			||||||
	wl_list_for_each_safe(device, device_tmp, &cur->state->devices, link) {
 | 
						wl_list_for_each_safe(device, device_tmp, &cur->state->devices, link) {
 | 
				
			||||||
		wlr_cursor_device_destroy(device);
 | 
							cursor_device_destroy(device);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(cur->state);
 | 
						free(cur->state);
 | 
				
			||||||
| 
						 | 
					@ -174,7 +174,7 @@ static struct wlr_cursor_device *get_cursor_device(struct wlr_cursor *cur,
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_cursor_warp_unchecked(struct wlr_cursor *cur,
 | 
					static void cursor_warp_unchecked(struct wlr_cursor *cur,
 | 
				
			||||||
		double x, double y) {
 | 
							double x, double y) {
 | 
				
			||||||
	assert(cur->state->layout);
 | 
						assert(cur->state->layout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -241,12 +241,12 @@ bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (mapping) {
 | 
						if (mapping) {
 | 
				
			||||||
		if (wlr_box_contains_point(mapping, x, y)) {
 | 
							if (wlr_box_contains_point(mapping, x, y)) {
 | 
				
			||||||
			wlr_cursor_warp_unchecked(cur, x, y);
 | 
								cursor_warp_unchecked(cur, x, y);
 | 
				
			||||||
			result = true;
 | 
								result = true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if (wlr_output_layout_contains_point(cur->state->layout, NULL,
 | 
						} else if (wlr_output_layout_contains_point(cur->state->layout, NULL,
 | 
				
			||||||
				x, y)) {
 | 
									x, y)) {
 | 
				
			||||||
		wlr_cursor_warp_unchecked(cur, x, y);
 | 
							cursor_warp_unchecked(cur, x, y);
 | 
				
			||||||
		result = true;
 | 
							result = true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -265,7 +265,7 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
 | 
				
			||||||
	x = x >= 0 ? mapping->width * x + mapping->x : cur->x;
 | 
						x = x >= 0 ? mapping->width * x + mapping->x : cur->x;
 | 
				
			||||||
	y = y >= 0 ? mapping->height * y + mapping->y : cur->y;
 | 
						y = y >= 0 ? mapping->height * y + mapping->y : cur->y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_cursor_warp_unchecked(cur, x, y);
 | 
						cursor_warp_unchecked(cur, x, y);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
 | 
					void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
 | 
				
			||||||
| 
						 | 
					@ -295,7 +295,7 @@ void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_cursor_warp_unchecked(cur, x, y);
 | 
						cursor_warp_unchecked(cur, x, y);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels,
 | 
					void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels,
 | 
				
			||||||
| 
						 | 
					@ -414,7 +414,7 @@ static void handle_device_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	wlr_cursor_detach_input_device(c_device->cursor, c_device->device);
 | 
						wlr_cursor_detach_input_device(c_device->cursor, c_device->device);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_cursor_device *wlr_cursor_device_create(
 | 
					static struct wlr_cursor_device *cursor_device_create(
 | 
				
			||||||
		struct wlr_cursor *cursor, struct wlr_input_device *device) {
 | 
							struct wlr_cursor *cursor, struct wlr_input_device *device) {
 | 
				
			||||||
	struct wlr_cursor_device *c_device =
 | 
						struct wlr_cursor_device *c_device =
 | 
				
			||||||
		calloc(1, sizeof(struct wlr_cursor_device));
 | 
							calloc(1, sizeof(struct wlr_cursor_device));
 | 
				
			||||||
| 
						 | 
					@ -496,7 +496,7 @@ void wlr_cursor_attach_input_device(struct wlr_cursor *cur,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_cursor_device_create(cur, dev);
 | 
						cursor_device_create(cur, dev);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
 | 
					void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
 | 
				
			||||||
| 
						 | 
					@ -504,7 +504,7 @@ void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
 | 
				
			||||||
	struct wlr_cursor_device *c_device, *tmp = NULL;
 | 
						struct wlr_cursor_device *c_device, *tmp = NULL;
 | 
				
			||||||
	wl_list_for_each_safe(c_device, tmp, &cur->state->devices, link) {
 | 
						wl_list_for_each_safe(c_device, tmp, &cur->state->devices, link) {
 | 
				
			||||||
		if (c_device->device == dev) {
 | 
							if (c_device->device == dev) {
 | 
				
			||||||
			wlr_cursor_device_destroy(c_device);
 | 
								cursor_device_destroy(c_device);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -512,7 +512,7 @@ void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
 | 
				
			||||||
static void handle_layout_destroy(struct wl_listener *listener, void *data) {
 | 
					static void handle_layout_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	struct wlr_cursor_state *state =
 | 
						struct wlr_cursor_state *state =
 | 
				
			||||||
		wl_container_of(listener, state, layout_destroy);
 | 
							wl_container_of(listener, state, layout_destroy);
 | 
				
			||||||
	wlr_cursor_detach_output_layout(state->cursor);
 | 
						cursor_detach_output_layout(state->cursor);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_layout_output_destroy(struct wl_listener *listener,
 | 
					static void handle_layout_output_destroy(struct wl_listener *listener,
 | 
				
			||||||
| 
						 | 
					@ -567,13 +567,13 @@ static void handle_layout_change(struct wl_listener *listener, void *data) {
 | 
				
			||||||
		wlr_output_layout_closest_point(layout, NULL, state->cursor->x,
 | 
							wlr_output_layout_closest_point(layout, NULL, state->cursor->x,
 | 
				
			||||||
			state->cursor->y, &x, &y);
 | 
								state->cursor->y, &x, &y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		wlr_cursor_warp_unchecked(state->cursor, x, y);
 | 
							cursor_warp_unchecked(state->cursor, x, y);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_cursor_attach_output_layout(struct wlr_cursor *cur,
 | 
					void wlr_cursor_attach_output_layout(struct wlr_cursor *cur,
 | 
				
			||||||
		struct wlr_output_layout *l) {
 | 
							struct wlr_output_layout *l) {
 | 
				
			||||||
	wlr_cursor_detach_output_layout(cur);
 | 
						cursor_detach_output_layout(cur);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (l == NULL) {
 | 
						if (l == NULL) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -219,7 +219,7 @@ static void handle_offer_source_destroyed(struct wl_listener *listener,
 | 
				
			||||||
	offer->source = NULL;
 | 
						offer->source = NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_data_offer *wlr_data_source_send_offer(
 | 
					static struct wlr_data_offer *data_source_send_offer(
 | 
				
			||||||
		struct wlr_data_source *source,
 | 
							struct wlr_data_source *source,
 | 
				
			||||||
		struct wlr_seat_client *target) {
 | 
							struct wlr_seat_client *target) {
 | 
				
			||||||
	if (wl_list_empty(&target->data_devices)) {
 | 
						if (wl_list_empty(&target->data_devices)) {
 | 
				
			||||||
| 
						 | 
					@ -268,7 +268,7 @@ void wlr_seat_client_send_selection(struct wlr_seat_client *seat_client) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (seat_client->seat->selection_source) {
 | 
						if (seat_client->seat->selection_source) {
 | 
				
			||||||
		struct wlr_data_offer *offer = wlr_data_source_send_offer(
 | 
							struct wlr_data_offer *offer = data_source_send_offer(
 | 
				
			||||||
			seat_client->seat->selection_source, seat_client);
 | 
								seat_client->seat->selection_source, seat_client);
 | 
				
			||||||
		if (offer == NULL) {
 | 
							if (offer == NULL) {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
| 
						 | 
					@ -375,7 +375,7 @@ static void handle_drag_seat_client_destroy(struct wl_listener *listener,
 | 
				
			||||||
	wl_list_remove(&drag->seat_client_destroy.link);
 | 
						wl_list_remove(&drag->seat_client_destroy.link);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_drag_set_focus(struct wlr_drag *drag,
 | 
					static void drag_set_focus(struct wlr_drag *drag,
 | 
				
			||||||
		struct wlr_surface *surface, double sx, double sy) {
 | 
							struct wlr_surface *surface, double sx, double sy) {
 | 
				
			||||||
	if (drag->focus == surface) {
 | 
						if (drag->focus == surface) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					@ -420,7 +420,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
 | 
				
			||||||
	struct wl_resource *offer_resource = NULL;
 | 
						struct wl_resource *offer_resource = NULL;
 | 
				
			||||||
	if (drag->source) {
 | 
						if (drag->source) {
 | 
				
			||||||
		drag->source->accepted = false;
 | 
							drag->source->accepted = false;
 | 
				
			||||||
		struct wlr_data_offer *offer = wlr_data_source_send_offer(drag->source,
 | 
							struct wlr_data_offer *offer = data_source_send_offer(drag->source,
 | 
				
			||||||
			focus_client);
 | 
								focus_client);
 | 
				
			||||||
		if (offer != NULL) {
 | 
							if (offer != NULL) {
 | 
				
			||||||
			data_offer_update_action(offer);
 | 
								data_offer_update_action(offer);
 | 
				
			||||||
| 
						 | 
					@ -454,7 +454,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
 | 
				
			||||||
	wlr_signal_emit_safe(&drag->events.focus, drag);
 | 
						wlr_signal_emit_safe(&drag->events.focus, drag);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_drag_end(struct wlr_drag *drag) {
 | 
					static void drag_end(struct wlr_drag *drag) {
 | 
				
			||||||
	if (!drag->cancelling) {
 | 
						if (!drag->cancelling) {
 | 
				
			||||||
		drag->cancelling = true;
 | 
							drag->cancelling = true;
 | 
				
			||||||
		if (drag->is_pointer_grab) {
 | 
							if (drag->is_pointer_grab) {
 | 
				
			||||||
| 
						 | 
					@ -468,7 +468,7 @@ static void wlr_drag_end(struct wlr_drag *drag) {
 | 
				
			||||||
			wl_list_remove(&drag->source_destroy.link);
 | 
								wl_list_remove(&drag->source_destroy.link);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		wlr_drag_set_focus(drag, NULL, 0, 0);
 | 
							drag_set_focus(drag, NULL, 0, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (drag->icon) {
 | 
							if (drag->icon) {
 | 
				
			||||||
			drag->icon->mapped = false;
 | 
								drag->icon->mapped = false;
 | 
				
			||||||
| 
						 | 
					@ -484,7 +484,7 @@ static void wlr_drag_end(struct wlr_drag *drag) {
 | 
				
			||||||
static void pointer_drag_enter(struct wlr_seat_pointer_grab *grab,
 | 
					static void pointer_drag_enter(struct wlr_seat_pointer_grab *grab,
 | 
				
			||||||
		struct wlr_surface *surface, double sx, double sy) {
 | 
							struct wlr_surface *surface, double sx, double sy) {
 | 
				
			||||||
	struct wlr_drag *drag = grab->data;
 | 
						struct wlr_drag *drag = grab->data;
 | 
				
			||||||
	wlr_drag_set_focus(drag, surface, sx, sy);
 | 
						drag_set_focus(drag, surface, sx, sy);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void pointer_drag_motion(struct wlr_seat_pointer_grab *grab,
 | 
					static void pointer_drag_motion(struct wlr_seat_pointer_grab *grab,
 | 
				
			||||||
| 
						 | 
					@ -540,7 +540,7 @@ static uint32_t pointer_drag_button(struct wlr_seat_pointer_grab *grab,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (grab->seat->pointer_state.button_count == 0 &&
 | 
						if (grab->seat->pointer_state.button_count == 0 &&
 | 
				
			||||||
			state == WL_POINTER_BUTTON_STATE_RELEASED) {
 | 
								state == WL_POINTER_BUTTON_STATE_RELEASED) {
 | 
				
			||||||
		wlr_drag_end(drag);
 | 
							drag_end(drag);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					@ -553,7 +553,7 @@ static void pointer_drag_axis(struct wlr_seat_pointer_grab *grab, uint32_t time,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void pointer_drag_cancel(struct wlr_seat_pointer_grab *grab) {
 | 
					static void pointer_drag_cancel(struct wlr_seat_pointer_grab *grab) {
 | 
				
			||||||
	struct wlr_drag *drag = grab->data;
 | 
						struct wlr_drag *drag = grab->data;
 | 
				
			||||||
	wlr_drag_end(drag);
 | 
						drag_end(drag);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct wlr_pointer_grab_interface
 | 
					static const struct wlr_pointer_grab_interface
 | 
				
			||||||
| 
						 | 
					@ -585,7 +585,7 @@ static void touch_drag_up(struct wlr_seat_touch_grab *grab, uint32_t time,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_drag_end(drag);
 | 
						drag_end(drag);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void touch_drag_motion(struct wlr_seat_touch_grab *grab, uint32_t time,
 | 
					static void touch_drag_motion(struct wlr_seat_touch_grab *grab, uint32_t time,
 | 
				
			||||||
| 
						 | 
					@ -604,12 +604,12 @@ static void touch_drag_motion(struct wlr_seat_touch_grab *grab, uint32_t time,
 | 
				
			||||||
static void touch_drag_enter(struct wlr_seat_touch_grab *grab, uint32_t time,
 | 
					static void touch_drag_enter(struct wlr_seat_touch_grab *grab, uint32_t time,
 | 
				
			||||||
		struct wlr_touch_point *point) {
 | 
							struct wlr_touch_point *point) {
 | 
				
			||||||
	struct wlr_drag *drag = grab->data;
 | 
						struct wlr_drag *drag = grab->data;
 | 
				
			||||||
	wlr_drag_set_focus(drag, point->focus_surface, point->sx, point->sy);
 | 
						drag_set_focus(drag, point->focus_surface, point->sx, point->sy);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void touch_drag_cancel(struct wlr_seat_touch_grab *grab) {
 | 
					static void touch_drag_cancel(struct wlr_seat_touch_grab *grab) {
 | 
				
			||||||
	struct wlr_drag *drag = grab->data;
 | 
						struct wlr_drag *drag = grab->data;
 | 
				
			||||||
	wlr_drag_end(drag);
 | 
						drag_end(drag);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct wlr_touch_grab_interface
 | 
					static const struct wlr_touch_grab_interface
 | 
				
			||||||
| 
						 | 
					@ -641,7 +641,7 @@ static void keyboard_drag_modifiers(struct wlr_seat_keyboard_grab *grab,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void keyboard_drag_cancel(struct wlr_seat_keyboard_grab *grab) {
 | 
					static void keyboard_drag_cancel(struct wlr_seat_keyboard_grab *grab) {
 | 
				
			||||||
	struct wlr_drag *drag = grab->data;
 | 
						struct wlr_drag *drag = grab->data;
 | 
				
			||||||
	wlr_drag_end(drag);
 | 
						drag_end(drag);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct wlr_keyboard_grab_interface
 | 
					static const struct wlr_keyboard_grab_interface
 | 
				
			||||||
| 
						 | 
					@ -660,10 +660,10 @@ static void drag_handle_icon_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
static void drag_handle_drag_source_destroy(struct wl_listener *listener,
 | 
					static void drag_handle_drag_source_destroy(struct wl_listener *listener,
 | 
				
			||||||
		void *data) {
 | 
							void *data) {
 | 
				
			||||||
	struct wlr_drag *drag = wl_container_of(listener, drag, source_destroy);
 | 
						struct wlr_drag *drag = wl_container_of(listener, drag, source_destroy);
 | 
				
			||||||
	wlr_drag_end(drag);
 | 
						drag_end(drag);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_drag_icon_destroy(struct wlr_drag_icon *icon) {
 | 
					static void drag_icon_destroy(struct wlr_drag_icon *icon) {
 | 
				
			||||||
	if (!icon) {
 | 
						if (!icon) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -679,7 +679,7 @@ static void handle_drag_icon_surface_destroy(struct wl_listener *listener,
 | 
				
			||||||
		void *data) {
 | 
							void *data) {
 | 
				
			||||||
	struct wlr_drag_icon *icon =
 | 
						struct wlr_drag_icon *icon =
 | 
				
			||||||
		wl_container_of(listener, icon, surface_destroy);
 | 
							wl_container_of(listener, icon, surface_destroy);
 | 
				
			||||||
	wlr_drag_icon_destroy(icon);
 | 
						drag_icon_destroy(icon);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_drag_icon_surface_commit(struct wlr_surface *surface,
 | 
					static void handle_drag_icon_surface_commit(struct wlr_surface *surface,
 | 
				
			||||||
| 
						 | 
					@ -694,10 +694,10 @@ static void handle_drag_icon_seat_client_destroy(struct wl_listener *listener,
 | 
				
			||||||
	struct wlr_drag_icon *icon =
 | 
						struct wlr_drag_icon *icon =
 | 
				
			||||||
		wl_container_of(listener, icon, seat_client_destroy);
 | 
							wl_container_of(listener, icon, seat_client_destroy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_drag_icon_destroy(icon);
 | 
						drag_icon_destroy(icon);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_drag_icon *wlr_drag_icon_create(
 | 
					static struct wlr_drag_icon *drag_icon_create(
 | 
				
			||||||
		struct wlr_surface *icon_surface, struct wlr_seat_client *client,
 | 
							struct wlr_surface *icon_surface, struct wlr_seat_client *client,
 | 
				
			||||||
		bool is_pointer, int32_t touch_id) {
 | 
							bool is_pointer, int32_t touch_id) {
 | 
				
			||||||
	struct wlr_drag_icon *icon = calloc(1, sizeof(struct wlr_drag_icon));
 | 
						struct wlr_drag_icon *icon = calloc(1, sizeof(struct wlr_drag_icon));
 | 
				
			||||||
| 
						 | 
					@ -780,7 +780,7 @@ static bool seat_client_start_drag(struct wlr_seat_client *client,
 | 
				
			||||||
	if (icon_surface) {
 | 
						if (icon_surface) {
 | 
				
			||||||
		int32_t touch_id = (point ? point->touch_id : 0);
 | 
							int32_t touch_id = (point ? point->touch_id : 0);
 | 
				
			||||||
		struct wlr_drag_icon *icon =
 | 
							struct wlr_drag_icon *icon =
 | 
				
			||||||
			wlr_drag_icon_create(icon_surface, client, drag->is_pointer_grab,
 | 
								drag_icon_create(icon_surface, client, drag->is_pointer_grab,
 | 
				
			||||||
				touch_id);
 | 
									touch_id);
 | 
				
			||||||
		if (!icon) {
 | 
							if (!icon) {
 | 
				
			||||||
			free(drag);
 | 
								free(drag);
 | 
				
			||||||
| 
						 | 
					@ -817,7 +817,7 @@ static bool seat_client_start_drag(struct wlr_seat_client *client,
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		assert(point);
 | 
							assert(point);
 | 
				
			||||||
		wlr_seat_touch_start_grab(seat, &drag->touch_grab);
 | 
							wlr_seat_touch_start_grab(seat, &drag->touch_grab);
 | 
				
			||||||
		wlr_drag_set_focus(drag, point->surface, point->sx, point->sy);
 | 
							drag_set_focus(drag, point->surface, point->sx, point->sy);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	seat->drag = drag; // TODO: unset this thing somewhere
 | 
						seat->drag = drag; // TODO: unset this thing somewhere
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,9 +8,9 @@
 | 
				
			||||||
#include "wayland-server.h"
 | 
					#include "wayland-server.h"
 | 
				
			||||||
#include "idle-inhibit-unstable-v1-protocol.h"
 | 
					#include "idle-inhibit-unstable-v1-protocol.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl;
 | 
					static const struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl;
 | 
					static const struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_idle_inhibit_manager_v1 *
 | 
					static struct wlr_idle_inhibit_manager_v1 *
 | 
				
			||||||
wlr_idle_inhibit_manager_v1_from_resource(struct wl_resource *resource) {
 | 
					wlr_idle_inhibit_manager_v1_from_resource(struct wl_resource *resource) {
 | 
				
			||||||
| 
						 | 
					@ -50,11 +50,11 @@ static void idle_inhibitor_v1_handle_destroy(struct wl_client *client,
 | 
				
			||||||
	wl_resource_destroy(manager_resource);
 | 
						wl_resource_destroy(manager_resource);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl = {
 | 
					static const struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl = {
 | 
				
			||||||
	.destroy = idle_inhibitor_v1_handle_destroy,
 | 
						.destroy = idle_inhibitor_v1_handle_destroy,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_create_inhibitor(struct wl_client *client,
 | 
					static void manager_create_inhibitor(struct wl_client *client,
 | 
				
			||||||
		struct wl_resource *resource, uint32_t id,
 | 
							struct wl_resource *resource, uint32_t id,
 | 
				
			||||||
		struct wl_resource *surface_resource) {
 | 
							struct wl_resource *surface_resource) {
 | 
				
			||||||
	struct wlr_surface *surface = wlr_surface_from_resource(surface_resource);
 | 
						struct wlr_surface *surface = wlr_surface_from_resource(surface_resource);
 | 
				
			||||||
| 
						 | 
					@ -96,14 +96,14 @@ static void idle_inhibit_manager_v1_destroy(struct wl_resource *resource) {
 | 
				
			||||||
	wl_list_remove(wl_resource_get_link(resource));
 | 
						wl_list_remove(wl_resource_get_link(resource));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void idle_inhibit_manager_v1_handle_destroy(struct wl_client *client,
 | 
					static void manager_destroy(struct wl_client *client,
 | 
				
			||||||
		struct wl_resource *manager_resource) {
 | 
							struct wl_resource *manager_resource) {
 | 
				
			||||||
	wl_resource_destroy(manager_resource);
 | 
						wl_resource_destroy(manager_resource);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl = {
 | 
					static const struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl = {
 | 
				
			||||||
	.destroy = idle_inhibit_manager_v1_handle_destroy,
 | 
						.destroy = manager_destroy,
 | 
				
			||||||
	.create_inhibitor = wlr_create_inhibitor,
 | 
						.create_inhibitor = manager_create_inhibitor,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
 | 
					static void handle_display_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -195,7 +195,7 @@ static void layer_surface_resource_destroy(struct wl_resource *resource) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_layer_surface_state_changed(struct wlr_layer_surface *surface) {
 | 
					static bool layer_surface_state_changed(struct wlr_layer_surface *surface) {
 | 
				
			||||||
	struct wlr_layer_surface_state *state;
 | 
						struct wlr_layer_surface_state *state;
 | 
				
			||||||
	if (wl_list_empty(&surface->configure_list)) {
 | 
						if (wl_list_empty(&surface->configure_list)) {
 | 
				
			||||||
		if (surface->acked_configure) {
 | 
							if (surface->acked_configure) {
 | 
				
			||||||
| 
						 | 
					@ -220,7 +220,7 @@ void wlr_layer_surface_configure(struct wlr_layer_surface *surface,
 | 
				
			||||||
		uint32_t width, uint32_t height) {
 | 
							uint32_t width, uint32_t height) {
 | 
				
			||||||
	surface->server_pending.actual_width = width;
 | 
						surface->server_pending.actual_width = width;
 | 
				
			||||||
	surface->server_pending.actual_height = height;
 | 
						surface->server_pending.actual_height = height;
 | 
				
			||||||
	if (wlr_layer_surface_state_changed(surface)) {
 | 
						if (layer_surface_state_changed(surface)) {
 | 
				
			||||||
		struct wl_display *display =
 | 
							struct wl_display *display =
 | 
				
			||||||
			wl_client_get_display(wl_resource_get_client(surface->resource));
 | 
								wl_client_get_display(wl_resource_get_client(surface->resource));
 | 
				
			||||||
		struct wlr_layer_surface_configure *configure =
 | 
							struct wlr_layer_surface_configure *configure =
 | 
				
			||||||
| 
						 | 
					@ -249,7 +249,7 @@ void wlr_layer_surface_close(struct wlr_layer_surface *surface) {
 | 
				
			||||||
	zwlr_layer_surface_v1_send_closed(surface->resource);
 | 
						zwlr_layer_surface_v1_send_closed(surface->resource);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
 | 
					static void handle_surface_committed(struct wlr_surface *wlr_surface,
 | 
				
			||||||
		void *role_data) {
 | 
							void *role_data) {
 | 
				
			||||||
	struct wlr_layer_surface *surface = role_data;
 | 
						struct wlr_layer_surface *surface = role_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -372,7 +372,7 @@ static void layer_shell_handle_get_layer_surface(struct wl_client *wl_client,
 | 
				
			||||||
	wl_signal_init(&surface->events.new_popup);
 | 
						wl_signal_init(&surface->events.new_popup);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_surface_set_role_committed(surface->surface,
 | 
						wlr_surface_set_role_committed(surface->surface,
 | 
				
			||||||
		handle_wlr_surface_committed, surface);
 | 
							handle_surface_committed, surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_log(L_DEBUG, "new layer_surface %p (res %p)",
 | 
						wlr_log(L_DEBUG, "new layer_surface %p (res %p)",
 | 
				
			||||||
			surface, surface->resource);
 | 
								surface, surface->resource);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,7 +48,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_output_send_current_mode_to_resource(
 | 
					static void output_send_current_mode_to_resource(
 | 
				
			||||||
		struct wl_resource *resource) {
 | 
							struct wl_resource *resource) {
 | 
				
			||||||
	struct wlr_output *output = wlr_output_from_resource(resource);
 | 
						struct wlr_output *output = wlr_output_from_resource(resource);
 | 
				
			||||||
	const uint32_t version = wl_resource_get_version(resource);
 | 
						const uint32_t version = wl_resource_get_version(resource);
 | 
				
			||||||
| 
						 | 
					@ -138,7 +138,7 @@ void wlr_output_update_enabled(struct wlr_output *output, bool enabled) {
 | 
				
			||||||
	wlr_signal_emit_safe(&output->events.enable, output);
 | 
						wlr_signal_emit_safe(&output->events.enable, output);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_output_update_matrix(struct wlr_output *output) {
 | 
					static void output_update_matrix(struct wlr_output *output) {
 | 
				
			||||||
	wlr_matrix_projection(output->transform_matrix, output->width,
 | 
						wlr_matrix_projection(output->transform_matrix, output->width,
 | 
				
			||||||
		output->height, output->transform);
 | 
							output->height, output->transform);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -185,13 +185,13 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	output->width = width;
 | 
						output->width = width;
 | 
				
			||||||
	output->height = height;
 | 
						output->height = height;
 | 
				
			||||||
	wlr_output_update_matrix(output);
 | 
						output_update_matrix(output);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	output->refresh = refresh;
 | 
						output->refresh = refresh;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wl_resource *resource;
 | 
						struct wl_resource *resource;
 | 
				
			||||||
	wl_resource_for_each(resource, &output->wl_resources) {
 | 
						wl_resource_for_each(resource, &output->wl_resources) {
 | 
				
			||||||
		wlr_output_send_current_mode_to_resource(resource);
 | 
							output_send_current_mode_to_resource(resource);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_signal_emit_safe(&output->events.mode, output);
 | 
						wlr_signal_emit_safe(&output->events.mode, output);
 | 
				
			||||||
| 
						 | 
					@ -200,7 +200,7 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
 | 
				
			||||||
void wlr_output_set_transform(struct wlr_output *output,
 | 
					void wlr_output_set_transform(struct wlr_output *output,
 | 
				
			||||||
		enum wl_output_transform transform) {
 | 
							enum wl_output_transform transform) {
 | 
				
			||||||
	output->impl->transform(output, transform);
 | 
						output->impl->transform(output, transform);
 | 
				
			||||||
	wlr_output_update_matrix(output);
 | 
						output_update_matrix(output);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: only send geometry and done
 | 
						// TODO: only send geometry and done
 | 
				
			||||||
	struct wl_resource *resource;
 | 
						struct wl_resource *resource;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,7 +45,7 @@ struct wlr_output_layout *wlr_output_layout_create() {
 | 
				
			||||||
	return layout;
 | 
						return layout;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_output_layout_output_destroy(
 | 
					static void output_layout_output_destroy(
 | 
				
			||||||
		struct wlr_output_layout_output *l_output) {
 | 
							struct wlr_output_layout_output *l_output) {
 | 
				
			||||||
	wlr_signal_emit_safe(&l_output->events.destroy, l_output);
 | 
						wlr_signal_emit_safe(&l_output->events.destroy, l_output);
 | 
				
			||||||
	wlr_output_destroy_global(l_output->output);
 | 
						wlr_output_destroy_global(l_output->output);
 | 
				
			||||||
| 
						 | 
					@ -67,14 +67,14 @@ void wlr_output_layout_destroy(struct wlr_output_layout *layout) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_output_layout_output *l_output, *temp;
 | 
						struct wlr_output_layout_output *l_output, *temp;
 | 
				
			||||||
	wl_list_for_each_safe(l_output, temp, &layout->outputs, link) {
 | 
						wl_list_for_each_safe(l_output, temp, &layout->outputs, link) {
 | 
				
			||||||
		wlr_output_layout_output_destroy(l_output);
 | 
							output_layout_output_destroy(l_output);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(layout->state);
 | 
						free(layout->state);
 | 
				
			||||||
	free(layout);
 | 
						free(layout);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_box *wlr_output_layout_output_get_box(
 | 
					static struct wlr_box *output_layout_output_get_box(
 | 
				
			||||||
		struct wlr_output_layout_output *l_output) {
 | 
							struct wlr_output_layout_output *l_output) {
 | 
				
			||||||
	l_output->state->_box.x = l_output->x;
 | 
						l_output->state->_box.x = l_output->x;
 | 
				
			||||||
	l_output->state->_box.y = l_output->y;
 | 
						l_output->state->_box.y = l_output->y;
 | 
				
			||||||
| 
						 | 
					@ -92,7 +92,7 @@ static struct wlr_box *wlr_output_layout_output_get_box(
 | 
				
			||||||
 * Auto configured outputs are placed to the right of the north east corner of
 | 
					 * Auto configured outputs are placed to the right of the north east corner of
 | 
				
			||||||
 * the rightmost output in the layout in a horizontal line.
 | 
					 * the rightmost output in the layout in a horizontal line.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
 | 
					static void output_layout_reconfigure(struct wlr_output_layout *layout) {
 | 
				
			||||||
	int max_x = INT_MIN;
 | 
						int max_x = INT_MIN;
 | 
				
			||||||
	int max_x_y = INT_MIN; // y value for the max_x output
 | 
						int max_x_y = INT_MIN; // y value for the max_x output
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -104,7 +104,7 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
 | 
							struct wlr_box *box = output_layout_output_get_box(l_output);
 | 
				
			||||||
		if (box->x + box->width > max_x) {
 | 
							if (box->x + box->width > max_x) {
 | 
				
			||||||
			max_x = box->x + box->width;
 | 
								max_x = box->x + box->width;
 | 
				
			||||||
			max_x_y = box->y;
 | 
								max_x_y = box->y;
 | 
				
			||||||
| 
						 | 
					@ -121,7 +121,7 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
 | 
				
			||||||
		if (!l_output->state->auto_configured) {
 | 
							if (!l_output->state->auto_configured) {
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
 | 
							struct wlr_box *box = output_layout_output_get_box(l_output);
 | 
				
			||||||
		l_output->x = max_x;
 | 
							l_output->x = max_x;
 | 
				
			||||||
		l_output->y = max_x_y;
 | 
							l_output->y = max_x_y;
 | 
				
			||||||
		max_x += box->width;
 | 
							max_x += box->width;
 | 
				
			||||||
| 
						 | 
					@ -137,30 +137,30 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
 | 
				
			||||||
static void handle_output_mode(struct wl_listener *listener, void *data) {
 | 
					static void handle_output_mode(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	struct wlr_output_layout_output_state *state =
 | 
						struct wlr_output_layout_output_state *state =
 | 
				
			||||||
		wl_container_of(listener, state, mode);
 | 
							wl_container_of(listener, state, mode);
 | 
				
			||||||
	wlr_output_layout_reconfigure(state->layout);
 | 
						output_layout_reconfigure(state->layout);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_output_scale(struct wl_listener *listener, void *data) {
 | 
					static void handle_output_scale(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	struct wlr_output_layout_output_state *state =
 | 
						struct wlr_output_layout_output_state *state =
 | 
				
			||||||
		wl_container_of(listener, state, scale);
 | 
							wl_container_of(listener, state, scale);
 | 
				
			||||||
	wlr_output_layout_reconfigure(state->layout);
 | 
						output_layout_reconfigure(state->layout);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_output_transform(struct wl_listener *listener, void *data) {
 | 
					static void handle_output_transform(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	struct wlr_output_layout_output_state *state =
 | 
						struct wlr_output_layout_output_state *state =
 | 
				
			||||||
		wl_container_of(listener, state, transform);
 | 
							wl_container_of(listener, state, transform);
 | 
				
			||||||
	wlr_output_layout_reconfigure(state->layout);
 | 
						output_layout_reconfigure(state->layout);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_output_destroy(struct wl_listener *listener, void *data) {
 | 
					static void handle_output_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	struct wlr_output_layout_output_state *state =
 | 
						struct wlr_output_layout_output_state *state =
 | 
				
			||||||
		wl_container_of(listener, state, output_destroy);
 | 
							wl_container_of(listener, state, output_destroy);
 | 
				
			||||||
	struct wlr_output_layout *layout = state->layout;
 | 
						struct wlr_output_layout *layout = state->layout;
 | 
				
			||||||
	wlr_output_layout_output_destroy(state->l_output);
 | 
						output_layout_output_destroy(state->l_output);
 | 
				
			||||||
	wlr_output_layout_reconfigure(layout);
 | 
						output_layout_reconfigure(layout);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_output_layout_output *wlr_output_layout_output_create(
 | 
					static struct wlr_output_layout_output *output_layout_output_create(
 | 
				
			||||||
		struct wlr_output_layout *layout, struct wlr_output *output) {
 | 
							struct wlr_output_layout *layout, struct wlr_output *output) {
 | 
				
			||||||
	struct wlr_output_layout_output *l_output =
 | 
						struct wlr_output_layout_output *l_output =
 | 
				
			||||||
		calloc(1, sizeof(struct wlr_output_layout_output));
 | 
							calloc(1, sizeof(struct wlr_output_layout_output));
 | 
				
			||||||
| 
						 | 
					@ -195,7 +195,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
 | 
				
			||||||
	struct wlr_output_layout_output *l_output =
 | 
						struct wlr_output_layout_output *l_output =
 | 
				
			||||||
		wlr_output_layout_get(layout, output);
 | 
							wlr_output_layout_get(layout, output);
 | 
				
			||||||
	if (!l_output) {
 | 
						if (!l_output) {
 | 
				
			||||||
		l_output = wlr_output_layout_output_create(layout, output);
 | 
							l_output = output_layout_output_create(layout, output);
 | 
				
			||||||
		if (!l_output) {
 | 
							if (!l_output) {
 | 
				
			||||||
			wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
 | 
								wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
| 
						 | 
					@ -204,7 +204,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
 | 
				
			||||||
	l_output->x = lx;
 | 
						l_output->x = lx;
 | 
				
			||||||
	l_output->y = ly;
 | 
						l_output->y = ly;
 | 
				
			||||||
	l_output->state->auto_configured = false;
 | 
						l_output->state->auto_configured = false;
 | 
				
			||||||
	wlr_output_layout_reconfigure(layout);
 | 
						output_layout_reconfigure(layout);
 | 
				
			||||||
	wlr_output_create_global(output);
 | 
						wlr_output_create_global(output);
 | 
				
			||||||
	wlr_signal_emit_safe(&layout->events.add, l_output);
 | 
						wlr_signal_emit_safe(&layout->events.add, l_output);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -225,7 +225,7 @@ bool wlr_output_layout_contains_point(struct wlr_output_layout *layout,
 | 
				
			||||||
	if (reference) {
 | 
						if (reference) {
 | 
				
			||||||
		struct wlr_output_layout_output *l_output =
 | 
							struct wlr_output_layout_output *l_output =
 | 
				
			||||||
			wlr_output_layout_get(layout, reference);
 | 
								wlr_output_layout_get(layout, reference);
 | 
				
			||||||
		struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
 | 
							struct wlr_box *box = output_layout_output_get_box(l_output);
 | 
				
			||||||
		return wlr_box_contains_point(box, lx, ly);
 | 
							return wlr_box_contains_point(box, lx, ly);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		return !!wlr_output_layout_output_at(layout, lx, ly);
 | 
							return !!wlr_output_layout_output_at(layout, lx, ly);
 | 
				
			||||||
| 
						 | 
					@ -240,7 +240,7 @@ bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
 | 
				
			||||||
		struct wlr_output_layout_output *l_output;
 | 
							struct wlr_output_layout_output *l_output;
 | 
				
			||||||
		wl_list_for_each(l_output, &layout->outputs, link) {
 | 
							wl_list_for_each(l_output, &layout->outputs, link) {
 | 
				
			||||||
			struct wlr_box *output_box =
 | 
								struct wlr_box *output_box =
 | 
				
			||||||
				wlr_output_layout_output_get_box(l_output);
 | 
									output_layout_output_get_box(l_output);
 | 
				
			||||||
			if (wlr_box_intersection(output_box, target_lbox, &out_box)) {
 | 
								if (wlr_box_intersection(output_box, target_lbox, &out_box)) {
 | 
				
			||||||
				return true;
 | 
									return true;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -253,7 +253,7 @@ bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		struct wlr_box *output_box = wlr_output_layout_output_get_box(l_output);
 | 
							struct wlr_box *output_box = output_layout_output_get_box(l_output);
 | 
				
			||||||
		return wlr_box_intersection(output_box, target_lbox, &out_box);
 | 
							return wlr_box_intersection(output_box, target_lbox, &out_box);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -262,7 +262,7 @@ struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout,
 | 
				
			||||||
		double lx, double ly) {
 | 
							double lx, double ly) {
 | 
				
			||||||
	struct wlr_output_layout_output *l_output;
 | 
						struct wlr_output_layout_output *l_output;
 | 
				
			||||||
	wl_list_for_each(l_output, &layout->outputs, link) {
 | 
						wl_list_for_each(l_output, &layout->outputs, link) {
 | 
				
			||||||
		struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
 | 
							struct wlr_box *box = output_layout_output_get_box(l_output);
 | 
				
			||||||
		if (wlr_box_contains_point(box, lx, ly)) {
 | 
							if (wlr_box_contains_point(box, lx, ly)) {
 | 
				
			||||||
			return l_output->output;
 | 
								return l_output->output;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -278,7 +278,7 @@ void wlr_output_layout_move(struct wlr_output_layout *layout,
 | 
				
			||||||
		l_output->x = lx;
 | 
							l_output->x = lx;
 | 
				
			||||||
		l_output->y = ly;
 | 
							l_output->y = ly;
 | 
				
			||||||
		l_output->state->auto_configured = false;
 | 
							l_output->state->auto_configured = false;
 | 
				
			||||||
		wlr_output_layout_reconfigure(layout);
 | 
							output_layout_reconfigure(layout);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		wlr_log(L_ERROR, "output not found in this layout: %s", output->name);
 | 
							wlr_log(L_ERROR, "output not found in this layout: %s", output->name);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -289,8 +289,8 @@ void wlr_output_layout_remove(struct wlr_output_layout *layout,
 | 
				
			||||||
	struct wlr_output_layout_output *l_output =
 | 
						struct wlr_output_layout_output *l_output =
 | 
				
			||||||
		wlr_output_layout_get(layout, output);
 | 
							wlr_output_layout_get(layout, output);
 | 
				
			||||||
	if (l_output) {
 | 
						if (l_output) {
 | 
				
			||||||
		wlr_output_layout_output_destroy(l_output);
 | 
							output_layout_output_destroy(l_output);
 | 
				
			||||||
		wlr_output_layout_reconfigure(layout);
 | 
							output_layout_reconfigure(layout);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -325,7 +325,7 @@ void wlr_output_layout_closest_point(struct wlr_output_layout *layout,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		double output_x, output_y, output_distance;
 | 
							double output_x, output_y, output_distance;
 | 
				
			||||||
		struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
 | 
							struct wlr_box *box = output_layout_output_get_box(l_output);
 | 
				
			||||||
		wlr_box_closest_point(box, lx, ly, &output_x, &output_y);
 | 
							wlr_box_closest_point(box, lx, ly, &output_x, &output_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// calculate squared distance suitable for comparison
 | 
							// calculate squared distance suitable for comparison
 | 
				
			||||||
| 
						 | 
					@ -359,7 +359,7 @@ struct wlr_box *wlr_output_layout_get_box(
 | 
				
			||||||
		l_output = wlr_output_layout_get(layout, reference);
 | 
							l_output = wlr_output_layout_get(layout, reference);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (l_output) {
 | 
							if (l_output) {
 | 
				
			||||||
			return wlr_output_layout_output_get_box(l_output);
 | 
								return output_layout_output_get_box(l_output);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			return NULL;
 | 
								return NULL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -368,7 +368,7 @@ struct wlr_box *wlr_output_layout_get_box(
 | 
				
			||||||
		int min_x = INT_MAX, min_y = INT_MAX;
 | 
							int min_x = INT_MAX, min_y = INT_MAX;
 | 
				
			||||||
		int max_x = INT_MIN, max_y = INT_MIN;
 | 
							int max_x = INT_MIN, max_y = INT_MIN;
 | 
				
			||||||
		wl_list_for_each(l_output, &layout->outputs, link) {
 | 
							wl_list_for_each(l_output, &layout->outputs, link) {
 | 
				
			||||||
			struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
 | 
								struct wlr_box *box = output_layout_output_get_box(l_output);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (box->x < min_x) {
 | 
								if (box->x < min_x) {
 | 
				
			||||||
				min_x = box->x;
 | 
									min_x = box->x;
 | 
				
			||||||
| 
						 | 
					@ -400,7 +400,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
 | 
				
			||||||
	struct wlr_output_layout_output *l_output =
 | 
						struct wlr_output_layout_output *l_output =
 | 
				
			||||||
		wlr_output_layout_get(layout, output);
 | 
							wlr_output_layout_get(layout, output);
 | 
				
			||||||
	if (!l_output) {
 | 
						if (!l_output) {
 | 
				
			||||||
		l_output = wlr_output_layout_output_create(layout, output);
 | 
							l_output = output_layout_output_create(layout, output);
 | 
				
			||||||
		if (!l_output) {
 | 
							if (!l_output) {
 | 
				
			||||||
			wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
 | 
								wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
| 
						 | 
					@ -408,7 +408,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	l_output->state->auto_configured = true;
 | 
						l_output->state->auto_configured = true;
 | 
				
			||||||
	wlr_output_layout_reconfigure(layout);
 | 
						output_layout_reconfigure(layout);
 | 
				
			||||||
	wlr_output_create_global(output);
 | 
						wlr_output_create_global(output);
 | 
				
			||||||
	wlr_signal_emit_safe(&layout->events.add, l_output);
 | 
						wlr_signal_emit_safe(&layout->events.add, l_output);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -445,7 +445,7 @@ struct wlr_output *wlr_output_layout_adjacent_output(
 | 
				
			||||||
		if (reference != NULL && reference == l_output->output) {
 | 
							if (reference != NULL && reference == l_output->output) {
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
 | 
							struct wlr_box *box = output_layout_output_get_box(l_output);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		bool match = false;
 | 
							bool match = false;
 | 
				
			||||||
		// test to make sure this output is in the given direction
 | 
							// test to make sure this output is in the given direction
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -185,7 +185,7 @@ static void wl_seat_get_touch(struct wl_client *client,
 | 
				
			||||||
	wl_list_insert(&seat_client->touches, wl_resource_get_link(resource));
 | 
						wl_list_insert(&seat_client->touches, wl_resource_get_link(resource));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_seat_client_resource_destroy(struct wl_resource *seat_resource) {
 | 
					static void seat_client_resource_destroy(struct wl_resource *seat_resource) {
 | 
				
			||||||
	struct wlr_seat_client *client =
 | 
						struct wlr_seat_client *client =
 | 
				
			||||||
		wlr_seat_client_from_resource(seat_resource);
 | 
							wlr_seat_client_from_resource(seat_resource);
 | 
				
			||||||
	wlr_signal_emit_safe(&client->events.destroy, client);
 | 
						wlr_signal_emit_safe(&client->events.destroy, client);
 | 
				
			||||||
| 
						 | 
					@ -251,7 +251,7 @@ static void wl_seat_bind(struct wl_client *client, void *_wlr_seat,
 | 
				
			||||||
	wl_list_init(&seat_client->data_devices);
 | 
						wl_list_init(&seat_client->data_devices);
 | 
				
			||||||
	wl_list_init(&seat_client->primary_selection_devices);
 | 
						wl_list_init(&seat_client->primary_selection_devices);
 | 
				
			||||||
	wl_resource_set_implementation(seat_client->wl_resource, &wl_seat_impl,
 | 
						wl_resource_set_implementation(seat_client->wl_resource, &wl_seat_impl,
 | 
				
			||||||
		seat_client, wlr_seat_client_resource_destroy);
 | 
							seat_client, seat_client_resource_destroy);
 | 
				
			||||||
	wl_list_insert(&wlr_seat->clients, &seat_client->link);
 | 
						wl_list_insert(&wlr_seat->clients, &seat_client->link);
 | 
				
			||||||
	if (version >= WL_SEAT_NAME_SINCE_VERSION) {
 | 
						if (version >= WL_SEAT_NAME_SINCE_VERSION) {
 | 
				
			||||||
		wl_seat_send_name(seat_client->wl_resource, wlr_seat->name);
 | 
							wl_seat_send_name(seat_client->wl_resource, wlr_seat->name);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,7 @@
 | 
				
			||||||
#include <wlr/util/region.h>
 | 
					#include <wlr/util/region.h>
 | 
				
			||||||
#include "util/signal.h"
 | 
					#include "util/signal.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_surface_state_reset_buffer(struct wlr_surface_state *state) {
 | 
					static void surface_state_reset_buffer(struct wlr_surface_state *state) {
 | 
				
			||||||
	if (state->buffer) {
 | 
						if (state->buffer) {
 | 
				
			||||||
		wl_list_remove(&state->buffer_destroy_listener.link);
 | 
							wl_list_remove(&state->buffer_destroy_listener.link);
 | 
				
			||||||
		state->buffer = NULL;
 | 
							state->buffer = NULL;
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,7 @@ static void buffer_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	state->buffer = NULL;
 | 
						state->buffer = NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_surface_state_release_buffer(struct wlr_surface_state *state) {
 | 
					static void surface_state_release_buffer(struct wlr_surface_state *state) {
 | 
				
			||||||
	if (state->buffer) {
 | 
						if (state->buffer) {
 | 
				
			||||||
		wl_resource_post_event(state->buffer, WL_BUFFER_RELEASE);
 | 
							wl_resource_post_event(state->buffer, WL_BUFFER_RELEASE);
 | 
				
			||||||
		wl_list_remove(&state->buffer_destroy_listener.link);
 | 
							wl_list_remove(&state->buffer_destroy_listener.link);
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@ static void wlr_surface_state_release_buffer(struct wlr_surface_state *state) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_surface_state_set_buffer(struct wlr_surface_state *state,
 | 
					static void surface_state_set_buffer(struct wlr_surface_state *state,
 | 
				
			||||||
		struct wl_resource *buffer) {
 | 
							struct wl_resource *buffer) {
 | 
				
			||||||
	state->buffer = buffer;
 | 
						state->buffer = buffer;
 | 
				
			||||||
	if (buffer) {
 | 
						if (buffer) {
 | 
				
			||||||
| 
						 | 
					@ -57,8 +57,8 @@ static void surface_attach(struct wl_client *client,
 | 
				
			||||||
	surface->pending->invalid |= WLR_SURFACE_INVALID_BUFFER;
 | 
						surface->pending->invalid |= WLR_SURFACE_INVALID_BUFFER;
 | 
				
			||||||
	surface->pending->sx = sx;
 | 
						surface->pending->sx = sx;
 | 
				
			||||||
	surface->pending->sy = sy;
 | 
						surface->pending->sy = sy;
 | 
				
			||||||
	wlr_surface_state_reset_buffer(surface->pending);
 | 
						surface_state_reset_buffer(surface->pending);
 | 
				
			||||||
	wlr_surface_state_set_buffer(surface->pending, buffer);
 | 
						surface_state_set_buffer(surface->pending, buffer);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void surface_damage(struct wl_client *client,
 | 
					static void surface_damage(struct wl_client *client,
 | 
				
			||||||
| 
						 | 
					@ -143,7 +143,7 @@ static void surface_set_input_region(struct wl_client *client,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_surface_update_size(struct wlr_surface *surface,
 | 
					static bool surface_update_size(struct wlr_surface *surface,
 | 
				
			||||||
		struct wlr_surface_state *state) {
 | 
							struct wlr_surface_state *state) {
 | 
				
			||||||
	if (!state->buffer) {
 | 
						if (!state->buffer) {
 | 
				
			||||||
		pixman_region32_union_rect(&state->surface_damage,
 | 
							pixman_region32_union_rect(&state->surface_damage,
 | 
				
			||||||
| 
						 | 
					@ -207,7 +207,7 @@ static bool wlr_surface_update_size(struct wlr_surface *surface,
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Append pending state to current state and clear pending state.
 | 
					 * Append pending state to current state and clear pending state.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void wlr_surface_move_state(struct wlr_surface *surface,
 | 
					static void surface_move_state(struct wlr_surface *surface,
 | 
				
			||||||
		struct wlr_surface_state *next, struct wlr_surface_state *state) {
 | 
							struct wlr_surface_state *next, struct wlr_surface_state *state) {
 | 
				
			||||||
	bool update_damage = false;
 | 
						bool update_damage = false;
 | 
				
			||||||
	bool update_size = false;
 | 
						bool update_size = false;
 | 
				
			||||||
| 
						 | 
					@ -224,15 +224,15 @@ static void wlr_surface_move_state(struct wlr_surface *surface,
 | 
				
			||||||
		update_size = true;
 | 
							update_size = true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if ((next->invalid & WLR_SURFACE_INVALID_BUFFER)) {
 | 
						if ((next->invalid & WLR_SURFACE_INVALID_BUFFER)) {
 | 
				
			||||||
		wlr_surface_state_release_buffer(state);
 | 
							surface_state_release_buffer(state);
 | 
				
			||||||
		wlr_surface_state_set_buffer(state, next->buffer);
 | 
							surface_state_set_buffer(state, next->buffer);
 | 
				
			||||||
		wlr_surface_state_reset_buffer(next);
 | 
							surface_state_reset_buffer(next);
 | 
				
			||||||
		state->sx = next->sx;
 | 
							state->sx = next->sx;
 | 
				
			||||||
		state->sy = next->sy;
 | 
							state->sy = next->sy;
 | 
				
			||||||
		update_size = true;
 | 
							update_size = true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (update_size) {
 | 
						if (update_size) {
 | 
				
			||||||
		update_damage = wlr_surface_update_size(surface, state);
 | 
							update_damage = surface_update_size(surface, state);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if ((next->invalid & WLR_SURFACE_INVALID_SURFACE_DAMAGE)) {
 | 
						if ((next->invalid & WLR_SURFACE_INVALID_SURFACE_DAMAGE)) {
 | 
				
			||||||
		pixman_region32_intersect_rect(&next->surface_damage,
 | 
							pixman_region32_intersect_rect(&next->surface_damage,
 | 
				
			||||||
| 
						 | 
					@ -312,7 +312,7 @@ static void wlr_surface_move_state(struct wlr_surface *surface,
 | 
				
			||||||
	next->invalid = 0;
 | 
						next->invalid = 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
 | 
					static void surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
 | 
				
			||||||
	// XXX: This is probably the wrong way to do it, because this damage should
 | 
						// XXX: This is probably the wrong way to do it, because this damage should
 | 
				
			||||||
	// come from the client, but weston doesn't do it correctly either and it
 | 
						// come from the client, but weston doesn't do it correctly either and it
 | 
				
			||||||
	// seems to work ok. See the comment on weston_surface_damage for more info
 | 
						// seems to work ok. See the comment on weston_surface_damage for more info
 | 
				
			||||||
| 
						 | 
					@ -327,11 +327,11 @@ static void wlr_surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_subsurface *child;
 | 
						struct wlr_subsurface *child;
 | 
				
			||||||
	wl_list_for_each(child, &subsurface->surface->subsurfaces, parent_link) {
 | 
						wl_list_for_each(child, &subsurface->surface->subsurfaces, parent_link) {
 | 
				
			||||||
		wlr_surface_damage_subsurfaces(child);
 | 
							surface_damage_subsurfaces(child);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_surface_apply_damage(struct wlr_surface *surface,
 | 
					static void surface_apply_damage(struct wlr_surface *surface,
 | 
				
			||||||
		bool invalid_buffer, bool reupload_buffer) {
 | 
							bool invalid_buffer, bool reupload_buffer) {
 | 
				
			||||||
	struct wl_resource *resource = surface->current->buffer;
 | 
						struct wl_resource *resource = surface->current->buffer;
 | 
				
			||||||
	if (resource == NULL) {
 | 
						if (resource == NULL) {
 | 
				
			||||||
| 
						 | 
					@ -392,17 +392,17 @@ static void wlr_surface_apply_damage(struct wlr_surface *surface,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_surface_state_release_buffer(surface->current);
 | 
						surface_state_release_buffer(surface->current);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_surface_commit_pending(struct wlr_surface *surface) {
 | 
					static void surface_commit_pending(struct wlr_surface *surface) {
 | 
				
			||||||
	int32_t oldw = surface->current->buffer_width;
 | 
						int32_t oldw = surface->current->buffer_width;
 | 
				
			||||||
	int32_t oldh = surface->current->buffer_height;
 | 
						int32_t oldh = surface->current->buffer_height;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool invalid_buffer = surface->pending->invalid & WLR_SURFACE_INVALID_BUFFER;
 | 
						bool invalid_buffer = surface->pending->invalid & WLR_SURFACE_INVALID_BUFFER;
 | 
				
			||||||
	bool null_buffer_commit = invalid_buffer && surface->pending->buffer == NULL;
 | 
						bool null_buffer_commit = invalid_buffer && surface->pending->buffer == NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_surface_move_state(surface, surface->pending, surface->current);
 | 
						surface_move_state(surface, surface->pending, surface->current);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (null_buffer_commit) {
 | 
						if (null_buffer_commit) {
 | 
				
			||||||
		wlr_texture_destroy(surface->texture);
 | 
							wlr_texture_destroy(surface->texture);
 | 
				
			||||||
| 
						 | 
					@ -411,7 +411,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool reupload_buffer = oldw != surface->current->buffer_width ||
 | 
						bool reupload_buffer = oldw != surface->current->buffer_width ||
 | 
				
			||||||
		oldh != surface->current->buffer_height;
 | 
							oldh != surface->current->buffer_height;
 | 
				
			||||||
	wlr_surface_apply_damage(surface, invalid_buffer, reupload_buffer);
 | 
						surface_apply_damage(surface, invalid_buffer, reupload_buffer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// commit subsurface order
 | 
						// commit subsurface order
 | 
				
			||||||
	struct wlr_subsurface *subsurface;
 | 
						struct wlr_subsurface *subsurface;
 | 
				
			||||||
| 
						 | 
					@ -422,7 +422,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (subsurface->reordered) {
 | 
							if (subsurface->reordered) {
 | 
				
			||||||
			// TODO: damage all the subsurfaces
 | 
								// TODO: damage all the subsurfaces
 | 
				
			||||||
			wlr_surface_damage_subsurfaces(subsurface);
 | 
								surface_damage_subsurfaces(subsurface);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -437,7 +437,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
 | 
				
			||||||
	pixman_region32_clear(&surface->current->buffer_damage);
 | 
						pixman_region32_clear(&surface->current->buffer_damage);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
 | 
					static bool subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
 | 
				
			||||||
	while (1) {
 | 
						while (1) {
 | 
				
			||||||
		if (subsurface->synchronized) {
 | 
							if (subsurface->synchronized) {
 | 
				
			||||||
			return true;
 | 
								return true;
 | 
				
			||||||
| 
						 | 
					@ -459,43 +459,43 @@ static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Recursive function to commit the effectively synchronized children.
 | 
					 * Recursive function to commit the effectively synchronized children.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void wlr_subsurface_parent_commit(struct wlr_subsurface *subsurface,
 | 
					static void subsurface_parent_commit(struct wlr_subsurface *subsurface,
 | 
				
			||||||
		bool synchronized) {
 | 
							bool synchronized) {
 | 
				
			||||||
		struct wlr_surface *surface = subsurface->surface;
 | 
							struct wlr_surface *surface = subsurface->surface;
 | 
				
			||||||
	if (synchronized || subsurface->synchronized) {
 | 
						if (synchronized || subsurface->synchronized) {
 | 
				
			||||||
		if (subsurface->has_cache) {
 | 
							if (subsurface->has_cache) {
 | 
				
			||||||
			wlr_surface_move_state(surface, subsurface->cached, surface->pending);
 | 
								surface_move_state(surface, subsurface->cached, surface->pending);
 | 
				
			||||||
			wlr_surface_commit_pending(surface);
 | 
								surface_commit_pending(surface);
 | 
				
			||||||
			subsurface->has_cache = false;
 | 
								subsurface->has_cache = false;
 | 
				
			||||||
			subsurface->cached->invalid = 0;
 | 
								subsurface->cached->invalid = 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		struct wlr_subsurface *tmp;
 | 
							struct wlr_subsurface *tmp;
 | 
				
			||||||
		wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
 | 
							wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
 | 
				
			||||||
			wlr_subsurface_parent_commit(tmp, true);
 | 
								subsurface_parent_commit(tmp, true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_subsurface_commit(struct wlr_subsurface *subsurface) {
 | 
					static void subsurface_commit(struct wlr_subsurface *subsurface) {
 | 
				
			||||||
	struct wlr_surface *surface = subsurface->surface;
 | 
						struct wlr_surface *surface = subsurface->surface;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (wlr_subsurface_is_synchronized(subsurface)) {
 | 
						if (subsurface_is_synchronized(subsurface)) {
 | 
				
			||||||
		wlr_surface_move_state(surface, surface->pending, subsurface->cached);
 | 
							surface_move_state(surface, surface->pending, subsurface->cached);
 | 
				
			||||||
		subsurface->has_cache = true;
 | 
							subsurface->has_cache = true;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if (subsurface->has_cache) {
 | 
							if (subsurface->has_cache) {
 | 
				
			||||||
			wlr_surface_move_state(surface, subsurface->cached, surface->pending);
 | 
								surface_move_state(surface, subsurface->cached, surface->pending);
 | 
				
			||||||
			wlr_surface_commit_pending(surface);
 | 
								surface_commit_pending(surface);
 | 
				
			||||||
			subsurface->has_cache = false;
 | 
								subsurface->has_cache = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			wlr_surface_commit_pending(surface);
 | 
								surface_commit_pending(surface);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		struct wlr_subsurface *tmp;
 | 
							struct wlr_subsurface *tmp;
 | 
				
			||||||
		wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
 | 
							wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
 | 
				
			||||||
			wlr_subsurface_parent_commit(tmp, false);
 | 
								subsurface_parent_commit(tmp, false);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -507,15 +507,15 @@ static void surface_commit(struct wl_client *client,
 | 
				
			||||||
	if (wlr_surface_is_subsurface(surface)) {
 | 
						if (wlr_surface_is_subsurface(surface)) {
 | 
				
			||||||
		struct wlr_subsurface *subsurface =
 | 
							struct wlr_subsurface *subsurface =
 | 
				
			||||||
			wlr_subsurface_from_surface(surface);
 | 
								wlr_subsurface_from_surface(surface);
 | 
				
			||||||
		wlr_subsurface_commit(subsurface);
 | 
							subsurface_commit(subsurface);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_surface_commit_pending(surface);
 | 
						surface_commit_pending(surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_subsurface *tmp;
 | 
						struct wlr_subsurface *tmp;
 | 
				
			||||||
	wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
 | 
						wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
 | 
				
			||||||
		wlr_subsurface_parent_commit(tmp, false);
 | 
							subsurface_parent_commit(tmp, false);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -567,7 +567,7 @@ struct wlr_surface *wlr_surface_from_resource(struct wl_resource *resource) {
 | 
				
			||||||
	return wl_resource_get_user_data(resource);
 | 
						return wl_resource_get_user_data(resource);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_surface_state *wlr_surface_state_create() {
 | 
					static struct wlr_surface_state *surface_state_create() {
 | 
				
			||||||
	struct wlr_surface_state *state =
 | 
						struct wlr_surface_state *state =
 | 
				
			||||||
		calloc(1, sizeof(struct wlr_surface_state));
 | 
							calloc(1, sizeof(struct wlr_surface_state));
 | 
				
			||||||
	if (state == NULL) {
 | 
						if (state == NULL) {
 | 
				
			||||||
| 
						 | 
					@ -588,8 +588,8 @@ static struct wlr_surface_state *wlr_surface_state_create() {
 | 
				
			||||||
	return state;
 | 
						return state;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_surface_state_destroy(struct wlr_surface_state *state) {
 | 
					static void surface_state_destroy(struct wlr_surface_state *state) {
 | 
				
			||||||
	wlr_surface_state_reset_buffer(state);
 | 
						surface_state_reset_buffer(state);
 | 
				
			||||||
	struct wlr_frame_callback *cb, *tmp;
 | 
						struct wlr_frame_callback *cb, *tmp;
 | 
				
			||||||
	wl_list_for_each_safe(cb, tmp, &state->frame_callback_list, link) {
 | 
						wl_list_for_each_safe(cb, tmp, &state->frame_callback_list, link) {
 | 
				
			||||||
		wl_resource_destroy(cb->resource);
 | 
							wl_resource_destroy(cb->resource);
 | 
				
			||||||
| 
						 | 
					@ -603,11 +603,11 @@ static void wlr_surface_state_destroy(struct wlr_surface_state *state) {
 | 
				
			||||||
	free(state);
 | 
						free(state);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_subsurface_destroy(struct wlr_subsurface *subsurface) {
 | 
					static void subsurface_destroy(struct wlr_subsurface *subsurface) {
 | 
				
			||||||
	wlr_signal_emit_safe(&subsurface->events.destroy, subsurface);
 | 
						wlr_signal_emit_safe(&subsurface->events.destroy, subsurface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_list_remove(&subsurface->surface_destroy.link);
 | 
						wl_list_remove(&subsurface->surface_destroy.link);
 | 
				
			||||||
	wlr_surface_state_destroy(subsurface->cached);
 | 
						surface_state_destroy(subsurface->cached);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (subsurface->parent) {
 | 
						if (subsurface->parent) {
 | 
				
			||||||
		wl_list_remove(&subsurface->parent_link);
 | 
							wl_list_remove(&subsurface->parent_link);
 | 
				
			||||||
| 
						 | 
					@ -628,8 +628,8 @@ static void destroy_surface(struct wl_resource *resource) {
 | 
				
			||||||
	wlr_signal_emit_safe(&surface->events.destroy, surface);
 | 
						wlr_signal_emit_safe(&surface->events.destroy, surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_texture_destroy(surface->texture);
 | 
						wlr_texture_destroy(surface->texture);
 | 
				
			||||||
	wlr_surface_state_destroy(surface->pending);
 | 
						surface_state_destroy(surface->pending);
 | 
				
			||||||
	wlr_surface_state_destroy(surface->current);
 | 
						surface_state_destroy(surface->current);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(surface);
 | 
						free(surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -645,8 +645,8 @@ struct wlr_surface *wlr_surface_create(struct wl_resource *res,
 | 
				
			||||||
	surface->renderer = renderer;
 | 
						surface->renderer = renderer;
 | 
				
			||||||
	surface->resource = res;
 | 
						surface->resource = res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	surface->current = wlr_surface_state_create();
 | 
						surface->current = surface_state_create();
 | 
				
			||||||
	surface->pending = wlr_surface_state_create();
 | 
						surface->pending = surface_state_create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_signal_init(&surface->events.commit);
 | 
						wl_signal_init(&surface->events.commit);
 | 
				
			||||||
	wl_signal_init(&surface->events.destroy);
 | 
						wl_signal_init(&surface->events.destroy);
 | 
				
			||||||
| 
						 | 
					@ -696,11 +696,11 @@ static void subsurface_resource_destroy(struct wl_resource *resource) {
 | 
				
			||||||
	struct wlr_subsurface *subsurface = subsurface_from_resource(resource);
 | 
						struct wlr_subsurface *subsurface = subsurface_from_resource(resource);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (subsurface) {
 | 
						if (subsurface) {
 | 
				
			||||||
		wlr_subsurface_destroy(subsurface);
 | 
							subsurface_destroy(subsurface);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void subsurface_destroy(struct wl_client *client,
 | 
					static void subsurface_handle_destroy(struct wl_client *client,
 | 
				
			||||||
		struct wl_resource *resource) {
 | 
							struct wl_resource *resource) {
 | 
				
			||||||
	wl_resource_destroy(resource);
 | 
						wl_resource_destroy(resource);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -794,15 +794,15 @@ static void subsurface_set_desync(struct wl_client *client,
 | 
				
			||||||
	if (subsurface && subsurface->synchronized) {
 | 
						if (subsurface && subsurface->synchronized) {
 | 
				
			||||||
		subsurface->synchronized = false;
 | 
							subsurface->synchronized = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!wlr_subsurface_is_synchronized(subsurface)) {
 | 
							if (!subsurface_is_synchronized(subsurface)) {
 | 
				
			||||||
			// TODO: do a synchronized commit to flush the cache
 | 
								// TODO: do a synchronized commit to flush the cache
 | 
				
			||||||
			wlr_subsurface_parent_commit(subsurface, true);
 | 
								subsurface_parent_commit(subsurface, true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct wl_subsurface_interface subsurface_implementation = {
 | 
					static const struct wl_subsurface_interface subsurface_implementation = {
 | 
				
			||||||
	.destroy = subsurface_destroy,
 | 
						.destroy = subsurface_handle_destroy,
 | 
				
			||||||
	.set_position = subsurface_set_position,
 | 
						.set_position = subsurface_set_position,
 | 
				
			||||||
	.place_above = subsurface_place_above,
 | 
						.place_above = subsurface_place_above,
 | 
				
			||||||
	.place_below = subsurface_place_below,
 | 
						.place_below = subsurface_place_below,
 | 
				
			||||||
| 
						 | 
					@ -824,7 +824,7 @@ static void subsurface_handle_surface_destroy(struct wl_listener *listener,
 | 
				
			||||||
		void *data) {
 | 
							void *data) {
 | 
				
			||||||
	struct wlr_subsurface *subsurface =
 | 
						struct wlr_subsurface *subsurface =
 | 
				
			||||||
		wl_container_of(listener, subsurface, surface_destroy);
 | 
							wl_container_of(listener, subsurface, surface_destroy);
 | 
				
			||||||
	wlr_subsurface_destroy(subsurface);
 | 
						subsurface_destroy(subsurface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_surface_make_subsurface(struct wlr_surface *surface,
 | 
					void wlr_surface_make_subsurface(struct wlr_surface *surface,
 | 
				
			||||||
| 
						 | 
					@ -837,7 +837,7 @@ void wlr_surface_make_subsurface(struct wlr_surface *surface,
 | 
				
			||||||
		wl_client_post_no_memory(client);
 | 
							wl_client_post_no_memory(client);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	subsurface->cached = wlr_surface_state_create();
 | 
						subsurface->cached = surface_state_create();
 | 
				
			||||||
	if (subsurface->cached == NULL) {
 | 
						if (subsurface->cached == NULL) {
 | 
				
			||||||
		free(subsurface);
 | 
							free(subsurface);
 | 
				
			||||||
		wl_client_post_no_memory(client);
 | 
							wl_client_post_no_memory(client);
 | 
				
			||||||
| 
						 | 
					@ -860,7 +860,7 @@ void wlr_surface_make_subsurface(struct wlr_surface *surface,
 | 
				
			||||||
	subsurface->resource =
 | 
						subsurface->resource =
 | 
				
			||||||
		wl_resource_create(client, &wl_subsurface_interface, 1, id);
 | 
							wl_resource_create(client, &wl_subsurface_interface, 1, id);
 | 
				
			||||||
	if (subsurface->resource == NULL) {
 | 
						if (subsurface->resource == NULL) {
 | 
				
			||||||
		wlr_surface_state_destroy(subsurface->cached);
 | 
							surface_state_destroy(subsurface->cached);
 | 
				
			||||||
		free(subsurface);
 | 
							free(subsurface);
 | 
				
			||||||
		wl_client_post_no_memory(client);
 | 
							wl_client_post_no_memory(client);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -461,13 +461,13 @@ static void shell_surface_resource_destroy(struct wl_resource *resource) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_wlr_surface_destroyed(struct wl_listener *listener,
 | 
					static void shell_surface_handle_surface_destroy(struct wl_listener *listener,
 | 
				
			||||||
		void *data) {
 | 
							void *data) {
 | 
				
			||||||
	struct wlr_wl_shell_surface *surface =
 | 
						struct wlr_wl_shell_surface *surface =
 | 
				
			||||||
		wl_container_of(listener, surface, surface_destroy_listener);
 | 
							wl_container_of(listener, surface, surface_destroy_listener);
 | 
				
			||||||
	shell_surface_destroy(surface);
 | 
						shell_surface_destroy(surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
 | 
					static void handle_surface_committed(struct wlr_surface *wlr_surface,
 | 
				
			||||||
		void *role_data) {
 | 
							void *role_data) {
 | 
				
			||||||
	struct wlr_wl_shell_surface *surface = role_data;
 | 
						struct wlr_wl_shell_surface *surface = role_data;
 | 
				
			||||||
	if (!surface->configured &&
 | 
						if (!surface->configured &&
 | 
				
			||||||
| 
						 | 
					@ -556,9 +556,10 @@ static void shell_protocol_get_shell_surface(struct wl_client *client,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_signal_add(&wl_surface->surface->events.destroy,
 | 
						wl_signal_add(&wl_surface->surface->events.destroy,
 | 
				
			||||||
		&wl_surface->surface_destroy_listener);
 | 
							&wl_surface->surface_destroy_listener);
 | 
				
			||||||
	wl_surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
 | 
						wl_surface->surface_destroy_listener.notify =
 | 
				
			||||||
 | 
							shell_surface_handle_surface_destroy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_surface_set_role_committed(surface, handle_wlr_surface_committed,
 | 
						wlr_surface_set_role_committed(surface, handle_surface_committed,
 | 
				
			||||||
		wl_surface);
 | 
							wl_surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wl_display *display = wl_client_get_display(client);
 | 
						struct wl_display *display = wl_client_get_display(client);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -122,7 +122,7 @@ static const struct wlr_keyboard_grab_interface xdg_keyboard_grab_impl = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void xdg_surface_destroy(struct wlr_xdg_surface *surface);
 | 
					static void xdg_surface_destroy(struct wlr_xdg_surface *surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_popup_grab_handle_seat_destroy(
 | 
					static void xdg_popup_grab_handle_seat_destroy(
 | 
				
			||||||
		struct wl_listener *listener, void *data) {
 | 
							struct wl_listener *listener, void *data) {
 | 
				
			||||||
	struct wlr_xdg_popup_grab *xdg_grab =
 | 
						struct wlr_xdg_popup_grab *xdg_grab =
 | 
				
			||||||
		wl_container_of(listener, xdg_grab, seat_destroy);
 | 
							wl_container_of(listener, xdg_grab, seat_destroy);
 | 
				
			||||||
| 
						 | 
					@ -162,7 +162,7 @@ static struct wlr_xdg_popup_grab *xdg_shell_popup_grab_from_seat(
 | 
				
			||||||
	wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
 | 
						wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
 | 
				
			||||||
	xdg_grab->seat = seat;
 | 
						xdg_grab->seat = seat;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xdg_grab->seat_destroy.notify = wlr_xdg_popup_grab_handle_seat_destroy;
 | 
						xdg_grab->seat_destroy.notify = xdg_popup_grab_handle_seat_destroy;
 | 
				
			||||||
	wl_signal_add(&seat->events.destroy, &xdg_grab->seat_destroy);
 | 
						wl_signal_add(&seat->events.destroy, &xdg_grab->seat_destroy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return xdg_grab;
 | 
						return xdg_grab;
 | 
				
			||||||
| 
						 | 
					@ -910,7 +910,7 @@ static void xdg_surface_handle_get_toplevel(struct wl_client *client,
 | 
				
			||||||
		xdg_toplevel_resource_destroy);
 | 
							xdg_toplevel_resource_destroy);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_toplevel_ack_configure(
 | 
					static void xdg_toplevel_ack_configure(
 | 
				
			||||||
		struct wlr_xdg_surface *surface,
 | 
							struct wlr_xdg_surface *surface,
 | 
				
			||||||
		struct wlr_xdg_surface_configure *configure) {
 | 
							struct wlr_xdg_surface_configure *configure) {
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
				
			||||||
| 
						 | 
					@ -961,7 +961,7 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
 | 
				
			||||||
		assert(0 && "not reached");
 | 
							assert(0 && "not reached");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
 | 
						case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
 | 
				
			||||||
		wlr_xdg_toplevel_ack_configure(surface, configure);
 | 
							xdg_toplevel_ack_configure(surface, configure);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_ROLE_POPUP:
 | 
						case WLR_XDG_SURFACE_ROLE_POPUP:
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
| 
						 | 
					@ -1013,7 +1013,7 @@ static const struct xdg_surface_interface xdg_surface_implementation = {
 | 
				
			||||||
	.set_window_geometry = xdg_surface_handle_set_window_geometry,
 | 
						.set_window_geometry = xdg_surface_handle_set_window_geometry,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_xdg_surface_toplevel_state_compare(
 | 
					static bool xdg_surface_toplevel_state_compare(
 | 
				
			||||||
		struct wlr_xdg_toplevel *state) {
 | 
							struct wlr_xdg_toplevel *state) {
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		struct wlr_xdg_toplevel_state state;
 | 
							struct wlr_xdg_toplevel_state state;
 | 
				
			||||||
| 
						 | 
					@ -1063,7 +1063,7 @@ static bool wlr_xdg_surface_toplevel_state_compare(
 | 
				
			||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_toplevel_send_configure(
 | 
					static void toplevel_send_configure(
 | 
				
			||||||
		struct wlr_xdg_surface *surface,
 | 
							struct wlr_xdg_surface *surface,
 | 
				
			||||||
		struct wlr_xdg_surface_configure *configure) {
 | 
							struct wlr_xdg_surface_configure *configure) {
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
				
			||||||
| 
						 | 
					@ -1125,7 +1125,7 @@ error_out:
 | 
				
			||||||
	wl_resource_post_no_memory(surface->toplevel->resource);
 | 
						wl_resource_post_no_memory(surface->toplevel->resource);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_surface_send_configure(void *user_data) {
 | 
					static void surface_send_configure(void *user_data) {
 | 
				
			||||||
	struct wlr_xdg_surface *surface = user_data;
 | 
						struct wlr_xdg_surface *surface = user_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	surface->configure_idle = NULL;
 | 
						surface->configure_idle = NULL;
 | 
				
			||||||
| 
						 | 
					@ -1145,7 +1145,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
 | 
				
			||||||
		assert(0 && "not reached");
 | 
							assert(0 && "not reached");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
 | 
						case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
 | 
				
			||||||
		wlr_xdg_toplevel_send_configure(surface, configure);
 | 
							toplevel_send_configure(surface, configure);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_ROLE_POPUP:
 | 
						case WLR_XDG_SURFACE_ROLE_POPUP:
 | 
				
			||||||
		xdg_popup_send_configure(surface->popup->resource,
 | 
							xdg_popup_send_configure(surface->popup->resource,
 | 
				
			||||||
| 
						 | 
					@ -1159,7 +1159,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
 | 
				
			||||||
	xdg_surface_send_configure(surface->resource, configure->serial);
 | 
						xdg_surface_send_configure(surface->resource, configure->serial);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static uint32_t wlr_xdg_surface_schedule_configure(
 | 
					static uint32_t xdg_surface_schedule_configure(
 | 
				
			||||||
		struct wlr_xdg_surface *surface) {
 | 
							struct wlr_xdg_surface *surface) {
 | 
				
			||||||
	struct wl_display *display = wl_client_get_display(surface->client->client);
 | 
						struct wl_display *display = wl_client_get_display(surface->client->client);
 | 
				
			||||||
	struct wl_event_loop *loop = wl_display_get_event_loop(display);
 | 
						struct wl_event_loop *loop = wl_display_get_event_loop(display);
 | 
				
			||||||
| 
						 | 
					@ -1171,7 +1171,7 @@ static uint32_t wlr_xdg_surface_schedule_configure(
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
 | 
						case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
 | 
				
			||||||
		pending_same =
 | 
							pending_same =
 | 
				
			||||||
			wlr_xdg_surface_toplevel_state_compare(surface->toplevel);
 | 
								xdg_surface_toplevel_state_compare(surface->toplevel);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_ROLE_POPUP:
 | 
						case WLR_XDG_SURFACE_ROLE_POPUP:
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
| 
						 | 
					@ -1195,26 +1195,26 @@ static uint32_t wlr_xdg_surface_schedule_configure(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		surface->configure_next_serial = wl_display_next_serial(display);
 | 
							surface->configure_next_serial = wl_display_next_serial(display);
 | 
				
			||||||
		surface->configure_idle = wl_event_loop_add_idle(loop,
 | 
							surface->configure_idle = wl_event_loop_add_idle(loop,
 | 
				
			||||||
			wlr_xdg_surface_send_configure, surface);
 | 
								surface_send_configure, surface);
 | 
				
			||||||
		return surface->configure_next_serial;
 | 
							return surface->configure_next_serial;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_wlr_surface_destroyed(struct wl_listener *listener,
 | 
					static void xdg_surface_handle_surface_destroy(struct wl_listener *listener,
 | 
				
			||||||
		void *data) {
 | 
							void *data) {
 | 
				
			||||||
	struct wlr_xdg_surface *xdg_surface =
 | 
						struct wlr_xdg_surface *xdg_surface =
 | 
				
			||||||
		wl_container_of(listener, xdg_surface, surface_destroy_listener);
 | 
							wl_container_of(listener, xdg_surface, surface_destroy_listener);
 | 
				
			||||||
	xdg_surface_destroy(xdg_surface);
 | 
						xdg_surface_destroy(xdg_surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_surface_toplevel_committed(
 | 
					static void xdg_surface_toplevel_committed(
 | 
				
			||||||
		struct wlr_xdg_surface *surface) {
 | 
							struct wlr_xdg_surface *surface) {
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!surface->toplevel->added) {
 | 
						if (!surface->toplevel->added) {
 | 
				
			||||||
		// on the first commit, send a configure request to tell the client it
 | 
							// on the first commit, send a configure request to tell the client it
 | 
				
			||||||
		// is added
 | 
							// is added
 | 
				
			||||||
		wlr_xdg_surface_schedule_configure(surface);
 | 
							xdg_surface_schedule_configure(surface);
 | 
				
			||||||
		surface->toplevel->added = true;
 | 
							surface->toplevel->added = true;
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1230,7 +1230,7 @@ static void wlr_xdg_surface_toplevel_committed(
 | 
				
			||||||
		surface->toplevel->client_pending.min_height;
 | 
							surface->toplevel->client_pending.min_height;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_surface_popup_committed(
 | 
					static void xdg_surface_popup_committed(
 | 
				
			||||||
		struct wlr_xdg_surface *surface) {
 | 
							struct wlr_xdg_surface *surface) {
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_ROLE_POPUP);
 | 
						assert(surface->role == WLR_XDG_SURFACE_ROLE_POPUP);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1242,12 +1242,12 @@ static void wlr_xdg_surface_popup_committed(
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!surface->popup->committed) {
 | 
						if (!surface->popup->committed) {
 | 
				
			||||||
		wlr_xdg_surface_schedule_configure(surface);
 | 
							xdg_surface_schedule_configure(surface);
 | 
				
			||||||
		surface->popup->committed = true;
 | 
							surface->popup->committed = true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
 | 
					static void handle_surface_committed(struct wlr_surface *wlr_surface,
 | 
				
			||||||
		void *role_data) {
 | 
							void *role_data) {
 | 
				
			||||||
	struct wlr_xdg_surface *surface = role_data;
 | 
						struct wlr_xdg_surface *surface = role_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1273,10 +1273,10 @@ static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
 | 
				
			||||||
			"xdg_surface must have a role");
 | 
								"xdg_surface must have a role");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
 | 
						case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
 | 
				
			||||||
		wlr_xdg_surface_toplevel_committed(surface);
 | 
							xdg_surface_toplevel_committed(surface);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_ROLE_POPUP:
 | 
						case WLR_XDG_SURFACE_ROLE_POPUP:
 | 
				
			||||||
		wlr_xdg_surface_popup_committed(surface);
 | 
							xdg_surface_popup_committed(surface);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1350,10 +1350,11 @@ static void xdg_shell_handle_get_xdg_surface(struct wl_client *wl_client,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_signal_add(&surface->surface->events.destroy,
 | 
						wl_signal_add(&surface->surface->events.destroy,
 | 
				
			||||||
		&surface->surface_destroy_listener);
 | 
							&surface->surface_destroy_listener);
 | 
				
			||||||
	surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
 | 
						surface->surface_destroy_listener.notify =
 | 
				
			||||||
 | 
							xdg_surface_handle_surface_destroy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_surface_set_role_committed(surface->surface,
 | 
						wlr_surface_set_role_committed(surface->surface,
 | 
				
			||||||
		handle_wlr_surface_committed, surface);
 | 
							handle_surface_committed, surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource);
 | 
						wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource);
 | 
				
			||||||
	wl_resource_set_implementation(surface->resource,
 | 
						wl_resource_set_implementation(surface->resource,
 | 
				
			||||||
| 
						 | 
					@ -1394,7 +1395,7 @@ static const struct xdg_wm_base_interface xdg_shell_impl = {
 | 
				
			||||||
	.pong = xdg_shell_handle_pong,
 | 
						.pong = xdg_shell_handle_pong,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_client_destroy(struct wl_resource *resource) {
 | 
					static void xdg_client_handle_resource_destroy(struct wl_resource *resource) {
 | 
				
			||||||
	struct wlr_xdg_client *client = xdg_client_from_resource(resource);
 | 
						struct wlr_xdg_client *client = xdg_client_from_resource(resource);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_xdg_surface *surface, *tmp = NULL;
 | 
						struct wlr_xdg_surface *surface, *tmp = NULL;
 | 
				
			||||||
| 
						 | 
					@ -1410,7 +1411,7 @@ static void wlr_xdg_client_destroy(struct wl_resource *resource) {
 | 
				
			||||||
	free(client);
 | 
						free(client);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int wlr_xdg_client_ping_timeout(void *user_data) {
 | 
					static int xdg_client_ping_timeout(void *user_data) {
 | 
				
			||||||
	struct wlr_xdg_client *client = user_data;
 | 
						struct wlr_xdg_client *client = user_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_xdg_surface *surface;
 | 
						struct wlr_xdg_surface *surface;
 | 
				
			||||||
| 
						 | 
					@ -1447,13 +1448,13 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
 | 
				
			||||||
	client->shell = xdg_shell;
 | 
						client->shell = xdg_shell;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_resource_set_implementation(client->resource, &xdg_shell_impl, client,
 | 
						wl_resource_set_implementation(client->resource, &xdg_shell_impl, client,
 | 
				
			||||||
		wlr_xdg_client_destroy);
 | 
							xdg_client_handle_resource_destroy);
 | 
				
			||||||
	wl_list_insert(&xdg_shell->clients, &client->link);
 | 
						wl_list_insert(&xdg_shell->clients, &client->link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wl_display *display = wl_client_get_display(client->client);
 | 
						struct wl_display *display = wl_client_get_display(client->client);
 | 
				
			||||||
	struct wl_event_loop *loop = wl_display_get_event_loop(display);
 | 
						struct wl_event_loop *loop = wl_display_get_event_loop(display);
 | 
				
			||||||
	client->ping_timer = wl_event_loop_add_timer(loop,
 | 
						client->ping_timer = wl_event_loop_add_timer(loop,
 | 
				
			||||||
		wlr_xdg_client_ping_timeout, client);
 | 
							xdg_client_ping_timeout, client);
 | 
				
			||||||
	if (client->ping_timer == NULL) {
 | 
						if (client->ping_timer == NULL) {
 | 
				
			||||||
		wl_client_post_no_memory(client->client);
 | 
							wl_client_post_no_memory(client->client);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1522,7 +1523,7 @@ uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_surface *surface,
 | 
				
			||||||
	surface->toplevel->server_pending.width = width;
 | 
						surface->toplevel->server_pending.width = width;
 | 
				
			||||||
	surface->toplevel->server_pending.height = height;
 | 
						surface->toplevel->server_pending.height = height;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return wlr_xdg_surface_schedule_configure(surface);
 | 
						return xdg_surface_schedule_configure(surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
 | 
					uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
 | 
				
			||||||
| 
						 | 
					@ -1530,7 +1531,7 @@ uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
				
			||||||
	surface->toplevel->server_pending.activated = activated;
 | 
						surface->toplevel->server_pending.activated = activated;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return wlr_xdg_surface_schedule_configure(surface);
 | 
						return xdg_surface_schedule_configure(surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
 | 
					uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
 | 
				
			||||||
| 
						 | 
					@ -1538,7 +1539,7 @@ uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
				
			||||||
	surface->toplevel->server_pending.maximized = maximized;
 | 
						surface->toplevel->server_pending.maximized = maximized;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return wlr_xdg_surface_schedule_configure(surface);
 | 
						return xdg_surface_schedule_configure(surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
 | 
					uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
 | 
				
			||||||
| 
						 | 
					@ -1546,7 +1547,7 @@ uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
				
			||||||
	surface->toplevel->server_pending.fullscreen = fullscreen;
 | 
						surface->toplevel->server_pending.fullscreen = fullscreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return wlr_xdg_surface_schedule_configure(surface);
 | 
						return xdg_surface_schedule_configure(surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
 | 
					uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
 | 
				
			||||||
| 
						 | 
					@ -1554,7 +1555,7 @@ uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
 | 
				
			||||||
	surface->toplevel->server_pending.resizing = resizing;
 | 
						surface->toplevel->server_pending.resizing = resizing;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return wlr_xdg_surface_schedule_configure(surface);
 | 
						return xdg_surface_schedule_configure(surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface) {
 | 
					void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface) {
 | 
				
			||||||
| 
						 | 
					@ -1669,7 +1670,7 @@ void wlr_xdg_popup_get_toplevel_coords(struct wlr_xdg_popup *popup,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
 | 
					static void xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
 | 
				
			||||||
		struct wlr_box *toplevel_sx_box, int *offset_x, int *offset_y) {
 | 
							struct wlr_box *toplevel_sx_box, int *offset_x, int *offset_y) {
 | 
				
			||||||
	int popup_width = popup->geometry.width;
 | 
						int popup_width = popup->geometry.width;
 | 
				
			||||||
	int popup_height = popup->geometry.height;
 | 
						int popup_height = popup->geometry.height;
 | 
				
			||||||
| 
						 | 
					@ -1697,10 +1698,10 @@ static void wlr_xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
 | 
					static bool xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
 | 
				
			||||||
		struct wlr_box *toplevel_sx_box) {
 | 
							struct wlr_box *toplevel_sx_box) {
 | 
				
			||||||
	int offset_x = 0, offset_y = 0;
 | 
						int offset_x = 0, offset_y = 0;
 | 
				
			||||||
	wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
 | 
						xdg_popup_box_constraints(popup, toplevel_sx_box,
 | 
				
			||||||
		&offset_x, &offset_y);
 | 
							&offset_x, &offset_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!offset_x && !offset_y) {
 | 
						if (!offset_x && !offset_y) {
 | 
				
			||||||
| 
						 | 
					@ -1725,7 +1726,7 @@ static bool wlr_xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
 | 
				
			||||||
	popup->geometry =
 | 
						popup->geometry =
 | 
				
			||||||
		wlr_xdg_positioner_get_geometry(&popup->positioner);
 | 
							wlr_xdg_positioner_get_geometry(&popup->positioner);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
 | 
						xdg_popup_box_constraints(popup, toplevel_sx_box,
 | 
				
			||||||
		&offset_x, &offset_y);
 | 
							&offset_x, &offset_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!offset_x && !offset_y) {
 | 
						if (!offset_x && !offset_y) {
 | 
				
			||||||
| 
						 | 
					@ -1747,10 +1748,10 @@ static bool wlr_xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
 | 
				
			||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
 | 
					static bool xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
 | 
				
			||||||
		struct wlr_box *toplevel_sx_box) {
 | 
							struct wlr_box *toplevel_sx_box) {
 | 
				
			||||||
	int offset_x = 0, offset_y = 0;
 | 
						int offset_x = 0, offset_y = 0;
 | 
				
			||||||
	wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
 | 
						xdg_popup_box_constraints(popup, toplevel_sx_box,
 | 
				
			||||||
		&offset_x, &offset_y);
 | 
							&offset_x, &offset_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!offset_x && !offset_y) {
 | 
						if (!offset_x && !offset_y) {
 | 
				
			||||||
| 
						 | 
					@ -1784,16 +1785,16 @@ static bool wlr_xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
 | 
				
			||||||
		popup->geometry.y += toplevel_sx_box->y - toplevel_y;
 | 
							popup->geometry.y += toplevel_sx_box->y - toplevel_y;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
 | 
						xdg_popup_box_constraints(popup, toplevel_sx_box,
 | 
				
			||||||
		&offset_x, &offset_y);
 | 
							&offset_x, &offset_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return !offset_x && !offset_y;
 | 
						return !offset_x && !offset_y;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
 | 
					static bool xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
 | 
				
			||||||
		struct wlr_box *toplevel_sx_box) {
 | 
							struct wlr_box *toplevel_sx_box) {
 | 
				
			||||||
	int offset_x, offset_y;
 | 
						int offset_x, offset_y;
 | 
				
			||||||
	wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
 | 
						xdg_popup_box_constraints(popup, toplevel_sx_box,
 | 
				
			||||||
		&offset_x, &offset_y);
 | 
							&offset_x, &offset_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!offset_x && !offset_y) {
 | 
						if (!offset_x && !offset_y) {
 | 
				
			||||||
| 
						 | 
					@ -1815,7 +1816,7 @@ static bool wlr_xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
 | 
				
			||||||
		popup->geometry.height -= offset_y;
 | 
							popup->geometry.height -= offset_y;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
 | 
						xdg_popup_box_constraints(popup, toplevel_sx_box,
 | 
				
			||||||
		&offset_y, &offset_y);
 | 
							&offset_y, &offset_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return !offset_x && !offset_y;
 | 
						return !offset_x && !offset_y;
 | 
				
			||||||
| 
						 | 
					@ -1823,13 +1824,13 @@ static bool wlr_xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_xdg_popup_unconstrain_from_box(struct wlr_xdg_popup *popup,
 | 
					void wlr_xdg_popup_unconstrain_from_box(struct wlr_xdg_popup *popup,
 | 
				
			||||||
		struct wlr_box *toplevel_sx_box) {
 | 
							struct wlr_box *toplevel_sx_box) {
 | 
				
			||||||
	if (wlr_xdg_popup_unconstrain_flip(popup, toplevel_sx_box)) {
 | 
						if (xdg_popup_unconstrain_flip(popup, toplevel_sx_box)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (wlr_xdg_popup_unconstrain_slide(popup, toplevel_sx_box)) {
 | 
						if (xdg_popup_unconstrain_slide(popup, toplevel_sx_box)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (wlr_xdg_popup_unconstrain_resize(popup, toplevel_sx_box)) {
 | 
						if (xdg_popup_unconstrain_resize(popup, toplevel_sx_box)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -132,7 +132,7 @@ static const struct wlr_keyboard_grab_interface xdg_keyboard_grab_impl = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void xdg_surface_destroy(struct wlr_xdg_surface_v6 *surface);
 | 
					static void xdg_surface_destroy(struct wlr_xdg_surface_v6 *surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_popup_grab_handle_seat_destroy(
 | 
					static void xdg_popup_grab_handle_seat_destroy(
 | 
				
			||||||
		struct wl_listener *listener, void *data) {
 | 
							struct wl_listener *listener, void *data) {
 | 
				
			||||||
	struct wlr_xdg_popup_grab_v6 *xdg_grab =
 | 
						struct wlr_xdg_popup_grab_v6 *xdg_grab =
 | 
				
			||||||
		wl_container_of(listener, xdg_grab, seat_destroy);
 | 
							wl_container_of(listener, xdg_grab, seat_destroy);
 | 
				
			||||||
| 
						 | 
					@ -172,7 +172,7 @@ static struct wlr_xdg_popup_grab_v6 *xdg_shell_popup_grab_from_seat(
 | 
				
			||||||
	wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
 | 
						wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
 | 
				
			||||||
	xdg_grab->seat = seat;
 | 
						xdg_grab->seat = seat;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xdg_grab->seat_destroy.notify = wlr_xdg_popup_grab_handle_seat_destroy;
 | 
						xdg_grab->seat_destroy.notify = xdg_popup_grab_handle_seat_destroy;
 | 
				
			||||||
	wl_signal_add(&seat->events.destroy, &xdg_grab->seat_destroy);
 | 
						wl_signal_add(&seat->events.destroy, &xdg_grab->seat_destroy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return xdg_grab;
 | 
						return xdg_grab;
 | 
				
			||||||
| 
						 | 
					@ -924,7 +924,7 @@ static void xdg_surface_handle_get_toplevel(struct wl_client *client,
 | 
				
			||||||
		xdg_toplevel_resource_destroy);
 | 
							xdg_toplevel_resource_destroy);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_toplevel_v6_ack_configure(
 | 
					static void xdg_toplevel_v6_ack_configure(
 | 
				
			||||||
		struct wlr_xdg_surface_v6 *surface,
 | 
							struct wlr_xdg_surface_v6 *surface,
 | 
				
			||||||
		struct wlr_xdg_surface_v6_configure *configure) {
 | 
							struct wlr_xdg_surface_v6_configure *configure) {
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
				
			||||||
| 
						 | 
					@ -975,7 +975,7 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
 | 
				
			||||||
		assert(0 && "not reached");
 | 
							assert(0 && "not reached");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
 | 
						case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
 | 
				
			||||||
		wlr_xdg_toplevel_v6_ack_configure(surface, configure);
 | 
							xdg_toplevel_v6_ack_configure(surface, configure);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_V6_ROLE_POPUP:
 | 
						case WLR_XDG_SURFACE_V6_ROLE_POPUP:
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
| 
						 | 
					@ -1027,7 +1027,7 @@ static const struct zxdg_surface_v6_interface zxdg_surface_v6_implementation = {
 | 
				
			||||||
	.set_window_geometry = xdg_surface_handle_set_window_geometry,
 | 
						.set_window_geometry = xdg_surface_handle_set_window_geometry,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_xdg_surface_v6_toplevel_state_compare(
 | 
					static bool xdg_surface_v6_toplevel_state_compare(
 | 
				
			||||||
		struct wlr_xdg_toplevel_v6 *state) {
 | 
							struct wlr_xdg_toplevel_v6 *state) {
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		struct wlr_xdg_toplevel_v6_state state;
 | 
							struct wlr_xdg_toplevel_v6_state state;
 | 
				
			||||||
| 
						 | 
					@ -1077,7 +1077,7 @@ static bool wlr_xdg_surface_v6_toplevel_state_compare(
 | 
				
			||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_toplevel_v6_send_configure(
 | 
					static void xdg_toplevel_v6_send_configure(
 | 
				
			||||||
		struct wlr_xdg_surface_v6 *surface,
 | 
							struct wlr_xdg_surface_v6 *surface,
 | 
				
			||||||
		struct wlr_xdg_surface_v6_configure *configure) {
 | 
							struct wlr_xdg_surface_v6_configure *configure) {
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
				
			||||||
| 
						 | 
					@ -1143,7 +1143,7 @@ error_out:
 | 
				
			||||||
	wl_resource_post_no_memory(surface->toplevel->resource);
 | 
						wl_resource_post_no_memory(surface->toplevel->resource);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_surface_send_configure(void *user_data) {
 | 
					static void xdg_surface_send_configure(void *user_data) {
 | 
				
			||||||
	struct wlr_xdg_surface_v6 *surface = user_data;
 | 
						struct wlr_xdg_surface_v6 *surface = user_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	surface->configure_idle = NULL;
 | 
						surface->configure_idle = NULL;
 | 
				
			||||||
| 
						 | 
					@ -1163,7 +1163,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
 | 
				
			||||||
		assert(0 && "not reached");
 | 
							assert(0 && "not reached");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
 | 
						case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
 | 
				
			||||||
		wlr_xdg_toplevel_v6_send_configure(surface, configure);
 | 
							xdg_toplevel_v6_send_configure(surface, configure);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_V6_ROLE_POPUP:
 | 
						case WLR_XDG_SURFACE_V6_ROLE_POPUP:
 | 
				
			||||||
		zxdg_popup_v6_send_configure(surface->popup->resource,
 | 
							zxdg_popup_v6_send_configure(surface->popup->resource,
 | 
				
			||||||
| 
						 | 
					@ -1177,7 +1177,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
 | 
				
			||||||
	zxdg_surface_v6_send_configure(surface->resource, configure->serial);
 | 
						zxdg_surface_v6_send_configure(surface->resource, configure->serial);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static uint32_t wlr_xdg_surface_v6_schedule_configure(
 | 
					static uint32_t xdg_surface_v6_schedule_configure(
 | 
				
			||||||
		struct wlr_xdg_surface_v6 *surface) {
 | 
							struct wlr_xdg_surface_v6 *surface) {
 | 
				
			||||||
	struct wl_display *display = wl_client_get_display(surface->client->client);
 | 
						struct wl_display *display = wl_client_get_display(surface->client->client);
 | 
				
			||||||
	struct wl_event_loop *loop = wl_display_get_event_loop(display);
 | 
						struct wl_event_loop *loop = wl_display_get_event_loop(display);
 | 
				
			||||||
| 
						 | 
					@ -1189,7 +1189,7 @@ static uint32_t wlr_xdg_surface_v6_schedule_configure(
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
 | 
						case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
 | 
				
			||||||
		pending_same =
 | 
							pending_same =
 | 
				
			||||||
			wlr_xdg_surface_v6_toplevel_state_compare(surface->toplevel);
 | 
								xdg_surface_v6_toplevel_state_compare(surface->toplevel);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_V6_ROLE_POPUP:
 | 
						case WLR_XDG_SURFACE_V6_ROLE_POPUP:
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
| 
						 | 
					@ -1213,26 +1213,26 @@ static uint32_t wlr_xdg_surface_v6_schedule_configure(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		surface->configure_next_serial = wl_display_next_serial(display);
 | 
							surface->configure_next_serial = wl_display_next_serial(display);
 | 
				
			||||||
		surface->configure_idle = wl_event_loop_add_idle(loop,
 | 
							surface->configure_idle = wl_event_loop_add_idle(loop,
 | 
				
			||||||
			wlr_xdg_surface_send_configure, surface);
 | 
								xdg_surface_send_configure, surface);
 | 
				
			||||||
		return surface->configure_next_serial;
 | 
							return surface->configure_next_serial;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_wlr_surface_destroyed(struct wl_listener *listener,
 | 
					static void xdg_surface_handle_surface_destroy(struct wl_listener *listener,
 | 
				
			||||||
		void *data) {
 | 
							void *data) {
 | 
				
			||||||
	struct wlr_xdg_surface_v6 *xdg_surface =
 | 
						struct wlr_xdg_surface_v6 *xdg_surface =
 | 
				
			||||||
		wl_container_of(listener, xdg_surface, surface_destroy_listener);
 | 
							wl_container_of(listener, xdg_surface, surface_destroy_listener);
 | 
				
			||||||
	xdg_surface_destroy(xdg_surface);
 | 
						xdg_surface_destroy(xdg_surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_surface_v6_toplevel_committed(
 | 
					static void xdg_surface_v6_toplevel_committed(
 | 
				
			||||||
		struct wlr_xdg_surface_v6 *surface) {
 | 
							struct wlr_xdg_surface_v6 *surface) {
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!surface->toplevel->added) {
 | 
						if (!surface->toplevel->added) {
 | 
				
			||||||
		// on the first commit, send a configure request to tell the client it
 | 
							// on the first commit, send a configure request to tell the client it
 | 
				
			||||||
		// is added
 | 
							// is added
 | 
				
			||||||
		wlr_xdg_surface_v6_schedule_configure(surface);
 | 
							xdg_surface_v6_schedule_configure(surface);
 | 
				
			||||||
		surface->toplevel->added = true;
 | 
							surface->toplevel->added = true;
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1248,17 +1248,17 @@ static void wlr_xdg_surface_v6_toplevel_committed(
 | 
				
			||||||
		surface->toplevel->client_pending.min_height;
 | 
							surface->toplevel->client_pending.min_height;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_surface_v6_popup_committed(
 | 
					static void xdg_surface_v6_popup_committed(
 | 
				
			||||||
		struct wlr_xdg_surface_v6 *surface) {
 | 
							struct wlr_xdg_surface_v6 *surface) {
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP);
 | 
						assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!surface->popup->committed) {
 | 
						if (!surface->popup->committed) {
 | 
				
			||||||
		wlr_xdg_surface_v6_schedule_configure(surface);
 | 
							xdg_surface_v6_schedule_configure(surface);
 | 
				
			||||||
		surface->popup->committed = true;
 | 
							surface->popup->committed = true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
 | 
					static void handle_surface_committed(struct wlr_surface *wlr_surface,
 | 
				
			||||||
		void *role_data) {
 | 
							void *role_data) {
 | 
				
			||||||
	struct wlr_xdg_surface_v6 *surface = role_data;
 | 
						struct wlr_xdg_surface_v6 *surface = role_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1284,10 +1284,10 @@ static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
 | 
				
			||||||
			"xdg_surface must have a role");
 | 
								"xdg_surface must have a role");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
 | 
						case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
 | 
				
			||||||
		wlr_xdg_surface_v6_toplevel_committed(surface);
 | 
							xdg_surface_v6_toplevel_committed(surface);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_XDG_SURFACE_V6_ROLE_POPUP:
 | 
						case WLR_XDG_SURFACE_V6_ROLE_POPUP:
 | 
				
			||||||
		wlr_xdg_surface_v6_popup_committed(surface);
 | 
							xdg_surface_v6_popup_committed(surface);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1361,10 +1361,11 @@ static void xdg_shell_handle_get_xdg_surface(struct wl_client *wl_client,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_signal_add(&surface->surface->events.destroy,
 | 
						wl_signal_add(&surface->surface->events.destroy,
 | 
				
			||||||
		&surface->surface_destroy_listener);
 | 
							&surface->surface_destroy_listener);
 | 
				
			||||||
	surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
 | 
						surface->surface_destroy_listener.notify =
 | 
				
			||||||
 | 
							xdg_surface_handle_surface_destroy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_surface_set_role_committed(surface->surface,
 | 
						wlr_surface_set_role_committed(surface->surface,
 | 
				
			||||||
		handle_wlr_surface_committed, surface);
 | 
							handle_surface_committed, surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource);
 | 
						wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource);
 | 
				
			||||||
	wl_resource_set_implementation(surface->resource,
 | 
						wl_resource_set_implementation(surface->resource,
 | 
				
			||||||
| 
						 | 
					@ -1405,7 +1406,8 @@ static const struct zxdg_shell_v6_interface xdg_shell_impl = {
 | 
				
			||||||
	.pong = xdg_shell_handle_pong,
 | 
						.pong = xdg_shell_handle_pong,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_client_v6_destroy(struct wl_resource *resource) {
 | 
					static void xdg_client_v6_handle_resource_destroy(
 | 
				
			||||||
 | 
							struct wl_resource *resource) {
 | 
				
			||||||
	struct wlr_xdg_client_v6 *client = xdg_client_from_resource(resource);
 | 
						struct wlr_xdg_client_v6 *client = xdg_client_from_resource(resource);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_xdg_surface_v6 *surface, *tmp = NULL;
 | 
						struct wlr_xdg_surface_v6 *surface, *tmp = NULL;
 | 
				
			||||||
| 
						 | 
					@ -1421,7 +1423,7 @@ static void wlr_xdg_client_v6_destroy(struct wl_resource *resource) {
 | 
				
			||||||
	free(client);
 | 
						free(client);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int wlr_xdg_client_v6_ping_timeout(void *user_data) {
 | 
					static int xdg_client_v6_ping_timeout(void *user_data) {
 | 
				
			||||||
	struct wlr_xdg_client_v6 *client = user_data;
 | 
						struct wlr_xdg_client_v6 *client = user_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_xdg_surface_v6 *surface;
 | 
						struct wlr_xdg_surface_v6 *surface;
 | 
				
			||||||
| 
						 | 
					@ -1458,13 +1460,13 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
 | 
				
			||||||
	client->shell = xdg_shell;
 | 
						client->shell = xdg_shell;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_resource_set_implementation(client->resource, &xdg_shell_impl, client,
 | 
						wl_resource_set_implementation(client->resource, &xdg_shell_impl, client,
 | 
				
			||||||
		wlr_xdg_client_v6_destroy);
 | 
							xdg_client_v6_handle_resource_destroy);
 | 
				
			||||||
	wl_list_insert(&xdg_shell->clients, &client->link);
 | 
						wl_list_insert(&xdg_shell->clients, &client->link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wl_display *display = wl_client_get_display(client->client);
 | 
						struct wl_display *display = wl_client_get_display(client->client);
 | 
				
			||||||
	struct wl_event_loop *loop = wl_display_get_event_loop(display);
 | 
						struct wl_event_loop *loop = wl_display_get_event_loop(display);
 | 
				
			||||||
	client->ping_timer = wl_event_loop_add_timer(loop,
 | 
						client->ping_timer = wl_event_loop_add_timer(loop,
 | 
				
			||||||
		wlr_xdg_client_v6_ping_timeout, client);
 | 
							xdg_client_v6_ping_timeout, client);
 | 
				
			||||||
	if (client->ping_timer == NULL) {
 | 
						if (client->ping_timer == NULL) {
 | 
				
			||||||
		wl_client_post_no_memory(client->client);
 | 
							wl_client_post_no_memory(client->client);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1533,7 +1535,7 @@ uint32_t wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface,
 | 
				
			||||||
	surface->toplevel->server_pending.width = width;
 | 
						surface->toplevel->server_pending.width = width;
 | 
				
			||||||
	surface->toplevel->server_pending.height = height;
 | 
						surface->toplevel->server_pending.height = height;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return wlr_xdg_surface_v6_schedule_configure(surface);
 | 
						return xdg_surface_v6_schedule_configure(surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
 | 
					uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
 | 
				
			||||||
| 
						 | 
					@ -1541,7 +1543,7 @@ uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
				
			||||||
	surface->toplevel->server_pending.activated = activated;
 | 
						surface->toplevel->server_pending.activated = activated;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return wlr_xdg_surface_v6_schedule_configure(surface);
 | 
						return xdg_surface_v6_schedule_configure(surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
 | 
					uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
 | 
				
			||||||
| 
						 | 
					@ -1549,7 +1551,7 @@ uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
				
			||||||
	surface->toplevel->server_pending.maximized = maximized;
 | 
						surface->toplevel->server_pending.maximized = maximized;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return wlr_xdg_surface_v6_schedule_configure(surface);
 | 
						return xdg_surface_v6_schedule_configure(surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
 | 
					uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
 | 
				
			||||||
| 
						 | 
					@ -1557,7 +1559,7 @@ uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
				
			||||||
	surface->toplevel->server_pending.fullscreen = fullscreen;
 | 
						surface->toplevel->server_pending.fullscreen = fullscreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return wlr_xdg_surface_v6_schedule_configure(surface);
 | 
						return xdg_surface_v6_schedule_configure(surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
 | 
					uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
 | 
				
			||||||
| 
						 | 
					@ -1565,7 +1567,7 @@ uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
 | 
				
			||||||
	assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
						assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
 | 
				
			||||||
	surface->toplevel->server_pending.resizing = resizing;
 | 
						surface->toplevel->server_pending.resizing = resizing;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return wlr_xdg_surface_v6_schedule_configure(surface);
 | 
						return xdg_surface_v6_schedule_configure(surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_xdg_surface_v6_send_close(struct wlr_xdg_surface_v6 *surface) {
 | 
					void wlr_xdg_surface_v6_send_close(struct wlr_xdg_surface_v6 *surface) {
 | 
				
			||||||
| 
						 | 
					@ -1677,7 +1679,7 @@ void wlr_xdg_popup_v6_get_toplevel_coords(struct wlr_xdg_popup_v6 *popup,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
 | 
					static void xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
 | 
				
			||||||
		struct wlr_box *toplevel_sx_box, int *offset_x, int *offset_y) {
 | 
							struct wlr_box *toplevel_sx_box, int *offset_x, int *offset_y) {
 | 
				
			||||||
	int popup_width = popup->geometry.width;
 | 
						int popup_width = popup->geometry.width;
 | 
				
			||||||
	int popup_height = popup->geometry.height;
 | 
						int popup_height = popup->geometry.height;
 | 
				
			||||||
| 
						 | 
					@ -1705,10 +1707,10 @@ static void wlr_xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
 | 
					static bool xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
 | 
				
			||||||
		struct wlr_box *toplevel_sx_box) {
 | 
							struct wlr_box *toplevel_sx_box) {
 | 
				
			||||||
	int offset_x = 0, offset_y = 0;
 | 
						int offset_x = 0, offset_y = 0;
 | 
				
			||||||
	wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
 | 
						xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
 | 
				
			||||||
		&offset_x, &offset_y);
 | 
							&offset_x, &offset_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!offset_x && !offset_y) {
 | 
						if (!offset_x && !offset_y) {
 | 
				
			||||||
| 
						 | 
					@ -1733,7 +1735,7 @@ static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
 | 
				
			||||||
	popup->geometry =
 | 
						popup->geometry =
 | 
				
			||||||
		wlr_xdg_positioner_v6_get_geometry(&popup->positioner);
 | 
							wlr_xdg_positioner_v6_get_geometry(&popup->positioner);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
 | 
						xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
 | 
				
			||||||
		&offset_x, &offset_y);
 | 
							&offset_x, &offset_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!offset_x && !offset_y) {
 | 
						if (!offset_x && !offset_y) {
 | 
				
			||||||
| 
						 | 
					@ -1755,10 +1757,10 @@ static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
 | 
				
			||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
 | 
					static bool xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
 | 
				
			||||||
		struct wlr_box *toplevel_sx_box) {
 | 
							struct wlr_box *toplevel_sx_box) {
 | 
				
			||||||
	int offset_x = 0, offset_y = 0;
 | 
						int offset_x = 0, offset_y = 0;
 | 
				
			||||||
	wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
 | 
						xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
 | 
				
			||||||
		&offset_x, &offset_y);
 | 
							&offset_x, &offset_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!offset_x && !offset_y) {
 | 
						if (!offset_x && !offset_y) {
 | 
				
			||||||
| 
						 | 
					@ -1792,16 +1794,16 @@ static bool wlr_xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
 | 
				
			||||||
		popup->geometry.y += toplevel_sx_box->y - toplevel_y;
 | 
							popup->geometry.y += toplevel_sx_box->y - toplevel_y;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
 | 
						xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
 | 
				
			||||||
		&offset_x, &offset_y);
 | 
							&offset_x, &offset_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return !offset_x && !offset_y;
 | 
						return !offset_x && !offset_y;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
 | 
					static bool xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
 | 
				
			||||||
		struct wlr_box *toplevel_sx_box) {
 | 
							struct wlr_box *toplevel_sx_box) {
 | 
				
			||||||
	int offset_x, offset_y;
 | 
						int offset_x, offset_y;
 | 
				
			||||||
	wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
 | 
						xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
 | 
				
			||||||
		&offset_x, &offset_y);
 | 
							&offset_x, &offset_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!offset_x && !offset_y) {
 | 
						if (!offset_x && !offset_y) {
 | 
				
			||||||
| 
						 | 
					@ -1823,7 +1825,7 @@ static bool wlr_xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
 | 
				
			||||||
		popup->geometry.height -= offset_y;
 | 
							popup->geometry.height -= offset_y;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
 | 
						xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
 | 
				
			||||||
		&offset_y, &offset_y);
 | 
							&offset_y, &offset_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return !offset_x && !offset_y;
 | 
						return !offset_x && !offset_y;
 | 
				
			||||||
| 
						 | 
					@ -1831,13 +1833,13 @@ static bool wlr_xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_xdg_popup_v6_unconstrain_from_box(struct wlr_xdg_popup_v6 *popup,
 | 
					void wlr_xdg_popup_v6_unconstrain_from_box(struct wlr_xdg_popup_v6 *popup,
 | 
				
			||||||
		struct wlr_box *toplevel_sx_box) {
 | 
							struct wlr_box *toplevel_sx_box) {
 | 
				
			||||||
	if (wlr_xdg_popup_v6_unconstrain_flip(popup, toplevel_sx_box)) {
 | 
						if (xdg_popup_v6_unconstrain_flip(popup, toplevel_sx_box)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (wlr_xdg_popup_v6_unconstrain_slide(popup, toplevel_sx_box)) {
 | 
						if (xdg_popup_v6_unconstrain_slide(popup, toplevel_sx_box)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (wlr_xdg_popup_v6_unconstrain_resize(popup, toplevel_sx_box)) {
 | 
						if (xdg_popup_v6_unconstrain_resize(popup, toplevel_sx_box)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,7 +18,8 @@ static const char *verbosity_colors[] = {
 | 
				
			||||||
	[L_DEBUG ] = "\x1B[1;30m",
 | 
						[L_DEBUG ] = "\x1B[1;30m",
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_log_stderr(log_importance_t verbosity, const char *fmt, va_list args) {
 | 
					static void log_stderr(log_importance_t verbosity, const char *fmt,
 | 
				
			||||||
 | 
							va_list args) {
 | 
				
			||||||
	if (verbosity > log_importance) {
 | 
						if (verbosity > log_importance) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -46,7 +47,7 @@ void wlr_log_stderr(log_importance_t verbosity, const char *fmt, va_list args) {
 | 
				
			||||||
	fprintf(stderr, "\n");
 | 
						fprintf(stderr, "\n");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static log_callback_t log_callback = wlr_log_stderr;
 | 
					static log_callback_t log_callback = log_stderr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_log_init(log_importance_t verbosity, log_callback_t callback) {
 | 
					void wlr_log_init(log_importance_t verbosity, log_callback_t callback) {
 | 
				
			||||||
	if (verbosity < L_LAST) {
 | 
						if (verbosity < L_LAST) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										37
									
								
								wlroots.syms
									
										
									
									
									
								
							
							
						
						
									
										37
									
								
								wlroots.syms
									
										
									
									
									
								
							| 
						 | 
					@ -4,43 +4,6 @@ WLROOTS_0_0_0 {
 | 
				
			||||||
		_wlr_log;
 | 
							_wlr_log;
 | 
				
			||||||
		_wlr_vlog;
 | 
							_wlr_vlog;
 | 
				
			||||||
	local:
 | 
						local:
 | 
				
			||||||
		wlr_drm_backend_get_session;
 | 
					 | 
				
			||||||
		wlr_drm_check_features;
 | 
					 | 
				
			||||||
		wlr_drm_connector_cleanup;
 | 
					 | 
				
			||||||
		wlr_drm_connector_start_renderer;
 | 
					 | 
				
			||||||
		wlr_drm_event;
 | 
					 | 
				
			||||||
		wlr_drm_get_connector_props;
 | 
					 | 
				
			||||||
		wlr_drm_get_crtc_props;
 | 
					 | 
				
			||||||
		wlr_drm_get_plane_props;
 | 
					 | 
				
			||||||
		wlr_drm_get_prop_blob;
 | 
					 | 
				
			||||||
		wlr_drm_get_prop;
 | 
					 | 
				
			||||||
		wlr_drm_plane_surfaces_init;
 | 
					 | 
				
			||||||
		wlr_drm_renderer_finish;
 | 
					 | 
				
			||||||
		wlr_drm_renderer_init;
 | 
					 | 
				
			||||||
		wlr_drm_resources_free;
 | 
					 | 
				
			||||||
		wlr_drm_resources_init;
 | 
					 | 
				
			||||||
		wlr_drm_restore_outputs;
 | 
					 | 
				
			||||||
		wlr_drm_scan_connectors;
 | 
					 | 
				
			||||||
		wlr_drm_surface_finish;
 | 
					 | 
				
			||||||
		wlr_drm_surface_get_front;
 | 
					 | 
				
			||||||
		wlr_drm_surface_init;
 | 
					 | 
				
			||||||
		wlr_drm_surface_make_current;
 | 
					 | 
				
			||||||
		wlr_drm_surface_mgpu_copy;
 | 
					 | 
				
			||||||
		wlr_drm_surface_post;
 | 
					 | 
				
			||||||
		wlr_drm_surface_swap_buffers;
 | 
					 | 
				
			||||||
		wlr_libinput_event;
 | 
					 | 
				
			||||||
		wlr_libinput_keyboard_create;
 | 
					 | 
				
			||||||
		wlr_libinput_pointer_create;
 | 
					 | 
				
			||||||
		wlr_libinput_tablet_pad_create;
 | 
					 | 
				
			||||||
		wlr_libinput_tablet_tool_create;
 | 
					 | 
				
			||||||
		wlr_libinput_touch_create;
 | 
					 | 
				
			||||||
		wlr_log_stderr;
 | 
					 | 
				
			||||||
		wlr_signal_emit_safe;
 | 
							wlr_signal_emit_safe;
 | 
				
			||||||
		wlr_subsurface_destroy;
 | 
					 | 
				
			||||||
		wlr_wl_output_for_surface;
 | 
					 | 
				
			||||||
		wlr_wl_output_layout_get_box;
 | 
					 | 
				
			||||||
		wlr_wl_output_move_cursor;
 | 
					 | 
				
			||||||
		wlr_wl_output_update_cursor;
 | 
					 | 
				
			||||||
		wlr_wl_registry_poll;
 | 
					 | 
				
			||||||
		*;
 | 
							*;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@
 | 
				
			||||||
#include <wlr/xcursor.h>
 | 
					#include <wlr/xcursor.h>
 | 
				
			||||||
#include "xcursor/xcursor.h"
 | 
					#include "xcursor/xcursor.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xcursor_destroy(struct wlr_xcursor *cursor) {
 | 
					static void xcursor_destroy(struct wlr_xcursor *cursor) {
 | 
				
			||||||
	for (size_t i = 0; i < cursor->image_count; i++) {
 | 
						for (size_t i = 0; i < cursor->image_count; i++) {
 | 
				
			||||||
		free(cursor->images[i]->buffer);
 | 
							free(cursor->images[i]->buffer);
 | 
				
			||||||
		free(cursor->images[i]);
 | 
							free(cursor->images[i]);
 | 
				
			||||||
| 
						 | 
					@ -45,7 +45,7 @@ static void wlr_xcursor_destroy(struct wlr_xcursor *cursor) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "xcursor/cursor_data.h"
 | 
					#include "xcursor/cursor_data.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_xcursor *wlr_xcursor_create_from_data(
 | 
					static struct wlr_xcursor *xcursor_create_from_data(
 | 
				
			||||||
		struct cursor_metadata *metadata, struct wlr_xcursor_theme *theme) {
 | 
							struct cursor_metadata *metadata, struct wlr_xcursor_theme *theme) {
 | 
				
			||||||
	struct wlr_xcursor *cursor;
 | 
						struct wlr_xcursor *cursor;
 | 
				
			||||||
	struct wlr_xcursor_image *image;
 | 
						struct wlr_xcursor_image *image;
 | 
				
			||||||
| 
						 | 
					@ -117,7 +117,7 @@ static void load_default_theme(struct wlr_xcursor_theme *theme) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < theme->cursor_count; ++i) {
 | 
						for (i = 0; i < theme->cursor_count; ++i) {
 | 
				
			||||||
		theme->cursors[i] =
 | 
							theme->cursors[i] =
 | 
				
			||||||
			wlr_xcursor_create_from_data(&cursor_metadata[i], theme);
 | 
								xcursor_create_from_data(&cursor_metadata[i], theme);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (theme->cursors[i] == NULL) {
 | 
							if (theme->cursors[i] == NULL) {
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
| 
						 | 
					@ -126,7 +126,7 @@ static void load_default_theme(struct wlr_xcursor_theme *theme) {
 | 
				
			||||||
	theme->cursor_count = i;
 | 
						theme->cursor_count = i;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_xcursor *wlr_xcursor_create_from_xcursor_images(
 | 
					static struct wlr_xcursor *xcursor_create_from_xcursor_images(
 | 
				
			||||||
		XcursorImages *images, struct wlr_xcursor_theme *theme) {
 | 
							XcursorImages *images, struct wlr_xcursor_theme *theme) {
 | 
				
			||||||
	struct wlr_xcursor *cursor;
 | 
						struct wlr_xcursor *cursor;
 | 
				
			||||||
	struct wlr_xcursor_image *image;
 | 
						struct wlr_xcursor_image *image;
 | 
				
			||||||
| 
						 | 
					@ -193,7 +193,7 @@ static void load_callback(XcursorImages *images, void *data) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cursor = wlr_xcursor_create_from_xcursor_images(images, theme);
 | 
						cursor = xcursor_create_from_xcursor_images(images, theme);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (cursor) {
 | 
						if (cursor) {
 | 
				
			||||||
		theme->cursor_count++;
 | 
							theme->cursor_count++;
 | 
				
			||||||
| 
						 | 
					@ -259,7 +259,7 @@ void wlr_xcursor_theme_destroy(struct wlr_xcursor_theme *theme) {
 | 
				
			||||||
	unsigned int i;
 | 
						unsigned int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < theme->cursor_count; i++) {
 | 
						for (i = 0; i < theme->cursor_count; i++) {
 | 
				
			||||||
		wlr_xcursor_destroy(theme->cursors[i]);
 | 
							xcursor_destroy(theme->cursors[i]);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(theme->name);
 | 
						free(theme->name);
 | 
				
			||||||
| 
						 | 
					@ -280,7 +280,7 @@ struct wlr_xcursor *wlr_xcursor_theme_get_cursor(struct wlr_xcursor_theme *theme
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int wlr_xcursor_frame_and_duration(struct wlr_xcursor *cursor,
 | 
					static int xcursor_frame_and_duration(struct wlr_xcursor *cursor,
 | 
				
			||||||
		uint32_t time, uint32_t *duration) {
 | 
							uint32_t time, uint32_t *duration) {
 | 
				
			||||||
	uint32_t t;
 | 
						uint32_t t;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
| 
						 | 
					@ -323,7 +323,7 @@ static int wlr_xcursor_frame_and_duration(struct wlr_xcursor *cursor,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int wlr_xcursor_frame(struct wlr_xcursor *_cursor, uint32_t time) {
 | 
					int wlr_xcursor_frame(struct wlr_xcursor *_cursor, uint32_t time) {
 | 
				
			||||||
	return wlr_xcursor_frame_and_duration(_cursor, time, NULL);
 | 
						return xcursor_frame_and_duration(_cursor, time, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char *wlr_xcursor_get_resize_name(enum wlr_edges edges) {
 | 
					const char *wlr_xcursor_get_resize_name(enum wlr_edges edges) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -182,14 +182,14 @@ struct x11_data_source {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct wlr_data_source_impl data_source_impl;
 | 
					static const struct wlr_data_source_impl data_source_impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_data_source_is_xwayland_data_source(
 | 
					bool data_source_is_xwayland(
 | 
				
			||||||
		struct wlr_data_source *wlr_source) {
 | 
							struct wlr_data_source *wlr_source) {
 | 
				
			||||||
	return wlr_source->impl == &data_source_impl;
 | 
						return wlr_source->impl == &data_source_impl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct x11_data_source *data_source_from_wlr_data_source(
 | 
					static struct x11_data_source *data_source_from_wlr_data_source(
 | 
				
			||||||
		struct wlr_data_source *wlr_source) {
 | 
							struct wlr_data_source *wlr_source) {
 | 
				
			||||||
	assert(wlr_data_source_is_xwayland_data_source(wlr_source));
 | 
						assert(data_source_is_xwayland(wlr_source));
 | 
				
			||||||
	return (struct x11_data_source *)wlr_source;
 | 
						return (struct x11_data_source *)wlr_source;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -225,7 +225,7 @@ struct x11_primary_selection_source {
 | 
				
			||||||
static void primary_selection_source_cancel(
 | 
					static void primary_selection_source_cancel(
 | 
				
			||||||
	struct wlr_primary_selection_source *wlr_source);
 | 
						struct wlr_primary_selection_source *wlr_source);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_primary_selection_source_is_xwayland_primary_selection_source(
 | 
					bool primary_selection_source_is_xwayland(
 | 
				
			||||||
		struct wlr_primary_selection_source *wlr_source) {
 | 
							struct wlr_primary_selection_source *wlr_source) {
 | 
				
			||||||
	return wlr_source->cancel == primary_selection_source_cancel;
 | 
						return wlr_source->cancel == primary_selection_source_cancel;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -223,13 +223,13 @@ void xwm_selection_finish(struct wlr_xwm *xwm) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (xwm->seat) {
 | 
						if (xwm->seat) {
 | 
				
			||||||
		if (xwm->seat->selection_source &&
 | 
							if (xwm->seat->selection_source &&
 | 
				
			||||||
				wlr_data_source_is_xwayland_data_source(
 | 
									data_source_is_xwayland(
 | 
				
			||||||
					xwm->seat->selection_source)) {
 | 
										xwm->seat->selection_source)) {
 | 
				
			||||||
			wlr_seat_set_selection(xwm->seat, NULL,
 | 
								wlr_seat_set_selection(xwm->seat, NULL,
 | 
				
			||||||
				wl_display_next_serial(xwm->xwayland->wl_display));
 | 
									wl_display_next_serial(xwm->xwayland->wl_display));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (xwm->seat->primary_selection_source &&
 | 
							if (xwm->seat->primary_selection_source &&
 | 
				
			||||||
				wlr_primary_selection_source_is_xwayland_primary_selection_source(
 | 
									primary_selection_source_is_xwayland(
 | 
				
			||||||
					xwm->seat->primary_selection_source)) {
 | 
										xwm->seat->primary_selection_source)) {
 | 
				
			||||||
			wlr_seat_set_primary_selection(xwm->seat, NULL,
 | 
								wlr_seat_set_primary_selection(xwm->seat, NULL,
 | 
				
			||||||
				wl_display_next_serial(xwm->xwayland->wl_display));
 | 
									wl_display_next_serial(xwm->xwayland->wl_display));
 | 
				
			||||||
| 
						 | 
					@ -262,7 +262,7 @@ static void seat_handle_selection(struct wl_listener *listener,
 | 
				
			||||||
		wl_container_of(listener, xwm, seat_selection);
 | 
							wl_container_of(listener, xwm, seat_selection);
 | 
				
			||||||
	struct wlr_data_source *source = seat->selection_source;
 | 
						struct wlr_data_source *source = seat->selection_source;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (source != NULL && wlr_data_source_is_xwayland_data_source(source)) {
 | 
						if (source != NULL && data_source_is_xwayland(source)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -277,7 +277,7 @@ static void seat_handle_primary_selection(struct wl_listener *listener,
 | 
				
			||||||
	struct wlr_primary_selection_source *source = seat->primary_selection_source;
 | 
						struct wlr_primary_selection_source *source = seat->primary_selection_source;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (source != NULL &&
 | 
						if (source != NULL &&
 | 
				
			||||||
			wlr_primary_selection_source_is_xwayland_primary_selection_source(
 | 
								primary_selection_source_is_xwayland(
 | 
				
			||||||
				source)) {
 | 
									source)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -128,7 +128,7 @@ static void exec_xwayland(struct wlr_xwayland *wlr_xwayland) {
 | 
				
			||||||
	execvp("Xwayland", argv);
 | 
						execvp("Xwayland", argv);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
 | 
					static void xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
 | 
				
			||||||
	if (!wlr_xwayland || wlr_xwayland->display == -1) {
 | 
						if (!wlr_xwayland || wlr_xwayland->display == -1) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -165,7 +165,7 @@ static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
 | 
					static bool xwayland_start(struct wlr_xwayland *wlr_xwayland,
 | 
				
			||||||
	struct wl_display *wl_display, struct wlr_compositor *compositor);
 | 
						struct wl_display *wl_display, struct wlr_compositor *compositor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_client_destroy(struct wl_listener *listener, void *data) {
 | 
					static void handle_client_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
| 
						 | 
					@ -176,11 +176,11 @@ static void handle_client_destroy(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	wlr_xwayland->client = NULL;
 | 
						wlr_xwayland->client = NULL;
 | 
				
			||||||
	wl_list_remove(&wlr_xwayland->client_destroy.link);
 | 
						wl_list_remove(&wlr_xwayland->client_destroy.link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_xwayland_finish(wlr_xwayland);
 | 
						xwayland_finish(wlr_xwayland);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (time(NULL) - wlr_xwayland->server_start > 5) {
 | 
						if (time(NULL) - wlr_xwayland->server_start > 5) {
 | 
				
			||||||
		wlr_log(L_INFO, "Restarting Xwayland");
 | 
							wlr_log(L_INFO, "Restarting Xwayland");
 | 
				
			||||||
		wlr_xwayland_start(wlr_xwayland, wlr_xwayland->wl_display,
 | 
							xwayland_start(wlr_xwayland, wlr_xwayland->wl_display,
 | 
				
			||||||
			wlr_xwayland->compositor);
 | 
								wlr_xwayland->compositor);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -217,7 +217,7 @@ static int xserver_handle_ready(int signal_number, void *data) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_xwayland->xwm = xwm_create(wlr_xwayland);
 | 
						wlr_xwayland->xwm = xwm_create(wlr_xwayland);
 | 
				
			||||||
	if (!wlr_xwayland->xwm) {
 | 
						if (!wlr_xwayland->xwm) {
 | 
				
			||||||
		wlr_xwayland_finish(wlr_xwayland);
 | 
							xwayland_finish(wlr_xwayland);
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -247,7 +247,7 @@ static int xserver_handle_ready(int signal_number, void *data) {
 | 
				
			||||||
	return 1; /* wayland event loop dispatcher's count */
 | 
						return 1; /* wayland event loop dispatcher's count */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
 | 
					static bool xwayland_start(struct wlr_xwayland *wlr_xwayland,
 | 
				
			||||||
		struct wl_display *wl_display, struct wlr_compositor *compositor) {
 | 
							struct wl_display *wl_display, struct wlr_compositor *compositor) {
 | 
				
			||||||
	memset(wlr_xwayland, 0, offsetof(struct wlr_xwayland, seat));
 | 
						memset(wlr_xwayland, 0, offsetof(struct wlr_xwayland, seat));
 | 
				
			||||||
	wlr_xwayland->wl_display = wl_display;
 | 
						wlr_xwayland->wl_display = wl_display;
 | 
				
			||||||
| 
						 | 
					@ -261,13 +261,13 @@ static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_xwayland->display = open_display_sockets(wlr_xwayland->x_fd);
 | 
						wlr_xwayland->display = open_display_sockets(wlr_xwayland->x_fd);
 | 
				
			||||||
	if (wlr_xwayland->display < 0) {
 | 
						if (wlr_xwayland->display < 0) {
 | 
				
			||||||
		wlr_xwayland_finish(wlr_xwayland);
 | 
							xwayland_finish(wlr_xwayland);
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wl_fd) != 0 ||
 | 
						if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wl_fd) != 0 ||
 | 
				
			||||||
			socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wm_fd) != 0) {
 | 
								socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wm_fd) != 0) {
 | 
				
			||||||
		wlr_log_errno(L_ERROR, "failed to create socketpair");
 | 
							wlr_log_errno(L_ERROR, "failed to create socketpair");
 | 
				
			||||||
		wlr_xwayland_finish(wlr_xwayland);
 | 
							xwayland_finish(wlr_xwayland);
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -275,7 +275,7 @@ static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(wlr_xwayland->client = wl_client_create(wl_display, wlr_xwayland->wl_fd[0]))) {
 | 
						if (!(wlr_xwayland->client = wl_client_create(wl_display, wlr_xwayland->wl_fd[0]))) {
 | 
				
			||||||
		wlr_log_errno(L_ERROR, "wl_client_create failed");
 | 
							wlr_log_errno(L_ERROR, "wl_client_create failed");
 | 
				
			||||||
		wlr_xwayland_finish(wlr_xwayland);
 | 
							xwayland_finish(wlr_xwayland);
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -323,7 +323,7 @@ static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (wlr_xwayland->pid < 0) {
 | 
						if (wlr_xwayland->pid < 0) {
 | 
				
			||||||
		wlr_log_errno(L_ERROR, "fork failed");
 | 
							wlr_log_errno(L_ERROR, "fork failed");
 | 
				
			||||||
		wlr_xwayland_finish(wlr_xwayland);
 | 
							xwayland_finish(wlr_xwayland);
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -340,7 +340,7 @@ static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_xwayland_destroy(struct wlr_xwayland *wlr_xwayland) {
 | 
					void wlr_xwayland_destroy(struct wlr_xwayland *wlr_xwayland) {
 | 
				
			||||||
	wlr_xwayland_set_seat(wlr_xwayland, NULL);
 | 
						wlr_xwayland_set_seat(wlr_xwayland, NULL);
 | 
				
			||||||
	wlr_xwayland_finish(wlr_xwayland);
 | 
						xwayland_finish(wlr_xwayland);
 | 
				
			||||||
	free(wlr_xwayland);
 | 
						free(wlr_xwayland);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -350,7 +350,7 @@ struct wlr_xwayland *wlr_xwayland_create(struct wl_display *wl_display,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_signal_init(&wlr_xwayland->events.new_surface);
 | 
						wl_signal_init(&wlr_xwayland->events.new_surface);
 | 
				
			||||||
	wl_signal_init(&wlr_xwayland->events.ready);
 | 
						wl_signal_init(&wlr_xwayland->events.ready);
 | 
				
			||||||
	if (wlr_xwayland_start(wlr_xwayland, wl_display, compositor)) {
 | 
						if (xwayland_start(wlr_xwayland, wl_display, compositor)) {
 | 
				
			||||||
		return wlr_xwayland;
 | 
							return wlr_xwayland;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	free(wlr_xwayland);
 | 
						free(wlr_xwayland);
 | 
				
			||||||
| 
						 | 
					@ -380,7 +380,7 @@ void wlr_xwayland_set_cursor(struct wlr_xwayland *wlr_xwayland,
 | 
				
			||||||
	wlr_xwayland->cursor->hotspot_y = hotspot_y;
 | 
						wlr_xwayland->cursor->hotspot_y = hotspot_y;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xwayland_handle_seat_destroy(struct wl_listener *listener,
 | 
					static void xwayland_handle_seat_destroy(struct wl_listener *listener,
 | 
				
			||||||
		void *data) {
 | 
							void *data) {
 | 
				
			||||||
	struct wlr_xwayland *xwayland =
 | 
						struct wlr_xwayland *xwayland =
 | 
				
			||||||
		wl_container_of(listener, xwayland, seat_destroy);
 | 
							wl_container_of(listener, xwayland, seat_destroy);
 | 
				
			||||||
| 
						 | 
					@ -404,6 +404,6 @@ void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland,
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xwayland->seat_destroy.notify = wlr_xwayland_handle_seat_destroy;
 | 
						xwayland->seat_destroy.notify = xwayland_handle_seat_destroy;
 | 
				
			||||||
	wl_signal_add(&seat->events.destroy, &xwayland->seat_destroy);
 | 
						wl_signal_add(&seat->events.destroy, &xwayland->seat_destroy);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -278,7 +278,7 @@ static void xsurface_set_net_wm_state(struct wlr_xwayland_surface *xsurface) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void xsurface_unmap(struct wlr_xwayland_surface *surface);
 | 
					static void xsurface_unmap(struct wlr_xwayland_surface *surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void wlr_xwayland_surface_destroy(
 | 
					static void xwayland_surface_destroy(
 | 
				
			||||||
		struct wlr_xwayland_surface *xsurface) {
 | 
							struct wlr_xwayland_surface *xsurface) {
 | 
				
			||||||
	xsurface_unmap(xsurface);
 | 
						xsurface_unmap(xsurface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -708,7 +708,7 @@ static void xwm_handle_destroy_notify(struct wlr_xwm *xwm,
 | 
				
			||||||
	if (xsurface == NULL) {
 | 
						if (xsurface == NULL) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	wlr_xwayland_surface_destroy(xsurface);
 | 
						xwayland_surface_destroy(xsurface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void xwm_handle_configure_request(struct wlr_xwm *xwm,
 | 
					static void xwm_handle_configure_request(struct wlr_xwm *xwm,
 | 
				
			||||||
| 
						 | 
					@ -1304,10 +1304,10 @@ void xwm_destroy(struct wlr_xwm *xwm) {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	struct wlr_xwayland_surface *xsurface, *tmp;
 | 
						struct wlr_xwayland_surface *xsurface, *tmp;
 | 
				
			||||||
	wl_list_for_each_safe(xsurface, tmp, &xwm->surfaces, link) {
 | 
						wl_list_for_each_safe(xsurface, tmp, &xwm->surfaces, link) {
 | 
				
			||||||
		wlr_xwayland_surface_destroy(xsurface);
 | 
							xwayland_surface_destroy(xsurface);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	wl_list_for_each_safe(xsurface, tmp, &xwm->unpaired_surfaces, link) {
 | 
						wl_list_for_each_safe(xsurface, tmp, &xwm->unpaired_surfaces, link) {
 | 
				
			||||||
		wlr_xwayland_surface_destroy(xsurface);
 | 
							xwayland_surface_destroy(xsurface);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	wl_list_remove(&xwm->compositor_new_surface.link);
 | 
						wl_list_remove(&xwm->compositor_new_surface.link);
 | 
				
			||||||
	wl_list_remove(&xwm->compositor_destroy.link);
 | 
						wl_list_remove(&xwm->compositor_destroy.link);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue