mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	cursor: intitialize sx and sy to zero
If node_at_coords does an early return without setting these values, they can be used uninitialized later. Initialize both to zero.
This commit is contained in:
		
							parent
							
								
									35d610a43c
								
							
						
					
					
						commit
						4e028dba47
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -280,7 +280,7 @@ static void cursor_do_rebase(struct sway_cursor *cursor, uint32_t time_msec,
 | 
				
			||||||
void cursor_rebase(struct sway_cursor *cursor) {
 | 
					void cursor_rebase(struct sway_cursor *cursor) {
 | 
				
			||||||
	uint32_t time_msec = get_current_time_msec();
 | 
						uint32_t time_msec = get_current_time_msec();
 | 
				
			||||||
	struct wlr_surface *surface = NULL;
 | 
						struct wlr_surface *surface = NULL;
 | 
				
			||||||
	double sx, sy;
 | 
						double sx = 0.0, sy = 0.0;
 | 
				
			||||||
	cursor->previous.node = node_at_coords(cursor->seat,
 | 
						cursor->previous.node = node_at_coords(cursor->seat,
 | 
				
			||||||
			cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
 | 
								cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
 | 
				
			||||||
	cursor_do_rebase(cursor, time_msec, cursor->previous.node, surface, sx, sy);
 | 
						cursor_do_rebase(cursor, time_msec, cursor->previous.node, surface, sx, sy);
 | 
				
			||||||
| 
						 | 
					@ -476,7 +476,7 @@ static void cursor_motion_absolute(struct sway_cursor *cursor,
 | 
				
			||||||
		dx, dy, dx, dy);
 | 
							dx, dy, dx, dy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_surface *surface = NULL;
 | 
						struct wlr_surface *surface = NULL;
 | 
				
			||||||
	double sx, sy;
 | 
						double sx = 0.0, sy = 0.0;
 | 
				
			||||||
	struct sway_node *node = node_at_coords(cursor->seat,
 | 
						struct sway_node *node = node_at_coords(cursor->seat,
 | 
				
			||||||
		lx, ly, &surface, &sx, &sy);
 | 
							lx, ly, &surface, &sx, &sy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue