mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Completely fix resize offset
This commit is contained in:
		
							parent
							
								
									77d28183b5
								
							
						
					
					
						commit
						74f2d0cd63
					
				
					 4 changed files with 19 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -61,11 +61,13 @@ struct roots_view {
 | 
			
		|||
	// configure event from the xdg_shell
 | 
			
		||||
	// If not then this should follow the typical type/impl pattern we use
 | 
			
		||||
	// elsewhere
 | 
			
		||||
	void (*get_size)(struct roots_view *view, struct wlr_box *box);
 | 
			
		||||
	void (*get_input_bounds)(struct roots_view *view, struct wlr_box *box);
 | 
			
		||||
	void (*activate)(struct roots_view *view, bool active);
 | 
			
		||||
	void (*resize)(struct roots_view *view, uint32_t width, uint32_t height);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void view_get_size(struct roots_view *view, struct wlr_box *box);
 | 
			
		||||
void view_get_input_bounds(struct roots_view *view, struct wlr_box *box);
 | 
			
		||||
void view_activate(struct roots_view *view, bool active);
 | 
			
		||||
void view_resize(struct roots_view *view, uint32_t width, uint32_t height);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,8 +37,10 @@ void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor,
 | 
			
		|||
	input->offs_y = cursor->y;
 | 
			
		||||
	input->view_x = view->x;
 | 
			
		||||
	input->view_y = view->y;
 | 
			
		||||
	input->view_width = view->wlr_surface->current.width;
 | 
			
		||||
	input->view_height = view->wlr_surface->current.height;
 | 
			
		||||
	struct wlr_box size;
 | 
			
		||||
	view_get_size(view, &size);
 | 
			
		||||
	input->view_width = size.width;
 | 
			
		||||
	input->view_height = size.height;
 | 
			
		||||
	input->resize_edges = edges;
 | 
			
		||||
	wlr_seat_pointer_clear_focus(input->wl_seat);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,6 +25,16 @@ void view_destroy(struct roots_view *view) {
 | 
			
		|||
	free(view);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void view_get_size(struct roots_view *view, struct wlr_box *box) {
 | 
			
		||||
	if (view->get_size) {
 | 
			
		||||
		view->get_size(view, box);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	box->x = box->y = 0;
 | 
			
		||||
	box->width = view->wlr_surface->current.width;
 | 
			
		||||
	box->height = view->wlr_surface->current.height;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void view_get_input_bounds(struct roots_view *view, struct wlr_box *box) {
 | 
			
		||||
	if (view->get_input_bounds) {
 | 
			
		||||
		view->get_input_bounds(view, box);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,12 +10,12 @@
 | 
			
		|||
#include "rootston/server.h"
 | 
			
		||||
#include "rootston/input.h"
 | 
			
		||||
 | 
			
		||||
/*static void get_input_bounds(struct roots_view *view, struct wlr_box *box) {
 | 
			
		||||
static void get_size(struct roots_view *view, struct wlr_box *box) {
 | 
			
		||||
	assert(view->type == ROOTS_XDG_SHELL_V6_VIEW);
 | 
			
		||||
	struct wlr_xdg_surface_v6 *surf = view->xdg_surface_v6;
 | 
			
		||||
	// TODO: surf->geometry can be NULL
 | 
			
		||||
	memcpy(box, surf->geometry, sizeof(struct wlr_box));
 | 
			
		||||
}*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void activate(struct roots_view *view, bool active) {
 | 
			
		||||
	assert(view->type == ROOTS_XDG_SHELL_V6_VIEW);
 | 
			
		||||
| 
						 | 
				
			
			@ -104,7 +104,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
 | 
			
		|||
	view->xdg_surface_v6 = surface;
 | 
			
		||||
	view->roots_xdg_surface_v6 = roots_surface;
 | 
			
		||||
	view->wlr_surface = surface->surface;
 | 
			
		||||
	//view->get_input_bounds = get_input_bounds;
 | 
			
		||||
	view->get_size = get_size;
 | 
			
		||||
	view->activate = activate;
 | 
			
		||||
	view->resize = resize;
 | 
			
		||||
	view->desktop = desktop;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue