mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Merge pull request #297 from acrisci/feature/wl-output-geometry
wl-output: send layout position
This commit is contained in:
		
						commit
						c7f39d0eb8
					
				
					 3 changed files with 23 additions and 1 deletions
				
			
		| 
						 | 
					@ -56,6 +56,9 @@ struct wlr_output {
 | 
				
			||||||
		struct wl_listener surface_destroy;
 | 
							struct wl_listener surface_destroy;
 | 
				
			||||||
	} cursor;
 | 
						} cursor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// the output position in layout space reported to clients
 | 
				
			||||||
 | 
						int32_t lx, ly;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void *data;
 | 
						void *data;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,6 +69,7 @@ bool wlr_output_set_mode(struct wlr_output *output,
 | 
				
			||||||
	struct wlr_output_mode *mode);
 | 
						struct wlr_output_mode *mode);
 | 
				
			||||||
void wlr_output_transform(struct wlr_output *output,
 | 
					void wlr_output_transform(struct wlr_output *output,
 | 
				
			||||||
	enum wl_output_transform transform);
 | 
						enum wl_output_transform transform);
 | 
				
			||||||
 | 
					void wlr_output_set_position(struct wlr_output *output, int32_t lx, int32_t ly);
 | 
				
			||||||
bool wlr_output_set_cursor(struct wlr_output *output,
 | 
					bool wlr_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);
 | 
						int32_t hotspot_x, int32_t hotspot_y);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
 | 
				
			||||||
	assert(output);
 | 
						assert(output);
 | 
				
			||||||
	const uint32_t version = wl_resource_get_version(resource);
 | 
						const uint32_t version = wl_resource_get_version(resource);
 | 
				
			||||||
	if (version >= WL_OUTPUT_GEOMETRY_SINCE_VERSION) {
 | 
						if (version >= WL_OUTPUT_GEOMETRY_SINCE_VERSION) {
 | 
				
			||||||
		wl_output_send_geometry(resource, 0, 0, // TODO: get position from layout?
 | 
							wl_output_send_geometry(resource, output->lx, output->ly,
 | 
				
			||||||
			output->phys_width, output->phys_height, output->subpixel,
 | 
								output->phys_width, output->phys_height, output->subpixel,
 | 
				
			||||||
			output->make, output->model, output->transform);
 | 
								output->make, output->model, output->transform);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -122,6 +122,20 @@ void wlr_output_transform(struct wlr_output *output,
 | 
				
			||||||
	wlr_output_update_matrix(output);
 | 
						wlr_output_update_matrix(output);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void wlr_output_set_position(struct wlr_output *output, int32_t lx, int32_t ly) {
 | 
				
			||||||
 | 
						if (lx == output->lx && ly == output->ly) {
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						output->lx = lx;
 | 
				
			||||||
 | 
						output->ly = ly;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct wl_resource *resource;
 | 
				
			||||||
 | 
						wl_resource_for_each(resource, &output->wl_resources) {
 | 
				
			||||||
 | 
							wl_output_send_to_resource(resource);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool set_cursor(struct wlr_output *output, const uint8_t *buf,
 | 
					static bool set_cursor(struct wlr_output *output, const uint8_t *buf,
 | 
				
			||||||
		int32_t stride, uint32_t width, uint32_t height, int32_t hotspot_x,
 | 
							int32_t stride, uint32_t width, uint32_t height, int32_t hotspot_x,
 | 
				
			||||||
		int32_t hotspot_y) {
 | 
							int32_t hotspot_y) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -115,6 +115,10 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
 | 
				
			||||||
		max_x += box->width;
 | 
							max_x += box->width;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						wl_list_for_each(l_output, &layout->outputs, link) {
 | 
				
			||||||
 | 
							wlr_output_set_position(l_output->output, l_output->x, l_output->y);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_signal_emit(&layout->events.change, layout);
 | 
						wl_signal_emit(&layout->events.change, layout);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue