mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	Fix surface picking
This commit is contained in:
		
							parent
							
								
									7824d81e07
								
							
						
					
					
						commit
						0b8646bbd3
					
				
					 1 changed files with 12 additions and 6 deletions
				
			
		
							
								
								
									
										18
									
								
								compositor.c
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								compositor.c
									
										
									
									
									
								
							| 
						 | 
					@ -319,14 +319,15 @@ static void
 | 
				
			||||||
wlsc_matrix_transform(struct wlsc_matrix *matrix, struct wlsc_vector *v)
 | 
					wlsc_matrix_transform(struct wlsc_matrix *matrix, struct wlsc_vector *v)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i, j;
 | 
						int i, j;
 | 
				
			||||||
	GLfloat t;
 | 
						struct wlsc_vector t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < 4; i++) {
 | 
						for (i = 0; i < 4; i++) {
 | 
				
			||||||
		t = 0;
 | 
							t.f[i] = 0;
 | 
				
			||||||
		for (j = 0; j < 4; j++)
 | 
							for (j = 0; j < 4; j++)
 | 
				
			||||||
			t += v->f[j] * matrix->d[i + j * 4];
 | 
								t.f[i] += v->f[j] * matrix->d[i + j * 4];
 | 
				
			||||||
		v->f[i] = t;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						*v = t;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
| 
						 | 
					@ -694,6 +695,11 @@ surface_map(struct wl_client *client,
 | 
				
			||||||
	wlsc_matrix_init(&es->matrix);
 | 
						wlsc_matrix_init(&es->matrix);
 | 
				
			||||||
	wlsc_matrix_scale(&es->matrix, width, height, 1);
 | 
						wlsc_matrix_scale(&es->matrix, width, height, 1);
 | 
				
			||||||
	wlsc_matrix_translate(&es->matrix, x, y, 0);
 | 
						wlsc_matrix_translate(&es->matrix, x, y, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						wlsc_matrix_init(&es->matrix_inv);
 | 
				
			||||||
 | 
						wlsc_matrix_translate(&es->matrix_inv, -x, -y, 0);
 | 
				
			||||||
 | 
						wlsc_matrix_scale(&es->matrix_inv, 1.0 / width, 1.0 / height, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
| 
						 | 
					@ -762,8 +768,8 @@ wlsc_surface_transform(struct wlsc_surface *surface,
 | 
				
			||||||
	struct wlsc_vector v = { { x, y, 0, 1 } };
 | 
						struct wlsc_vector v = { { x, y, 0, 1 } };
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	wlsc_matrix_transform(&surface->matrix_inv, &v);
 | 
						wlsc_matrix_transform(&surface->matrix_inv, &v);
 | 
				
			||||||
	*sx = v.f[0];
 | 
						*sx = v.f[0] * surface->width;
 | 
				
			||||||
	*sy = v.f[1];
 | 
						*sy = v.f[1] * surface->height;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue