mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	cursor: send surface scale events
wlr_cursor is responsible for sending enter/leave events, but
doesn't send fractional-scale-v1 and wl_surface.preferred_buffer_scale
events. This is not an easy thing to do from a compositor, so let's
just do it in wlr_cursor itself.
(cherry picked from commit 78836298ef)
			
			
This commit is contained in:
		
							parent
							
								
									bb8bcb354e
								
							
						
					
					
						commit
						a577308276
					
				
					 1 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
					@ -6,6 +6,7 @@
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <wayland-server-core.h>
 | 
					#include <wayland-server-core.h>
 | 
				
			||||||
#include <wlr/types/wlr_cursor.h>
 | 
					#include <wlr/types/wlr_cursor.h>
 | 
				
			||||||
 | 
					#include <wlr/types/wlr_fractional_scale_v1.h>
 | 
				
			||||||
#include <wlr/types/wlr_input_device.h>
 | 
					#include <wlr/types/wlr_input_device.h>
 | 
				
			||||||
#include <wlr/types/wlr_output_layout.h>
 | 
					#include <wlr/types/wlr_output_layout.h>
 | 
				
			||||||
#include <wlr/types/wlr_output.h>
 | 
					#include <wlr/types/wlr_output.h>
 | 
				
			||||||
| 
						 | 
					@ -545,6 +546,16 @@ static void cursor_output_cursor_update(struct wlr_cursor_output_cursor *output_
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			wlr_surface_send_leave(surface, output);
 | 
								wlr_surface_send_leave(surface, output);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							float scale = 1;
 | 
				
			||||||
 | 
							struct wlr_surface_output *surface_output;
 | 
				
			||||||
 | 
							wl_list_for_each(surface_output, &surface->current_outputs, link) {
 | 
				
			||||||
 | 
								if (surface_output->output->scale > scale) {
 | 
				
			||||||
 | 
									scale = surface_output->output->scale;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							wlr_fractional_scale_v1_notify_scale(surface, scale);
 | 
				
			||||||
 | 
							wlr_surface_set_preferred_buffer_scale(surface, ceil(scale));
 | 
				
			||||||
	} else if (cur->state->xcursor_name != NULL) {
 | 
						} else if (cur->state->xcursor_name != NULL) {
 | 
				
			||||||
		struct wlr_xcursor_manager *manager = cur->state->xcursor_manager;
 | 
							struct wlr_xcursor_manager *manager = cur->state->xcursor_manager;
 | 
				
			||||||
		const char *name = cur->state->xcursor_name;
 | 
							const char *name = cur->state->xcursor_name;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue