mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Use UTF-8 xwayland window title if available
This commit is contained in:
		
							parent
							
								
									caf9f9022c
								
							
						
					
					
						commit
						cf10cbc00c
					
				
					 2 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
					@ -103,6 +103,7 @@ struct wlr_xwayland_surface {
 | 
				
			||||||
	char *class;
 | 
						char *class;
 | 
				
			||||||
	char *instance;
 | 
						char *instance;
 | 
				
			||||||
	pid_t pid;
 | 
						pid_t pid;
 | 
				
			||||||
 | 
						bool has_utf8_title;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wl_list children; // wlr_xwayland_surface::parent_link
 | 
						struct wl_list children; // wlr_xwayland_surface::parent_link
 | 
				
			||||||
	struct wlr_xwayland_surface *parent;
 | 
						struct wlr_xwayland_surface *parent;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -353,8 +353,10 @@ static void read_surface_title(struct wlr_xwm *xwm,
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: if reply->type == XCB_ATOM_STRING, uses latin1 encoding
 | 
						bool is_utf8 = reply->type == xwm->atoms[UTF8_STRING];
 | 
				
			||||||
	// if reply->type == xwm->atoms[UTF8_STRING], uses utf8 encoding
 | 
						if (!is_utf8 && xsurface->has_utf8_title) {
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	size_t len = xcb_get_property_value_length(reply);
 | 
						size_t len = xcb_get_property_value_length(reply);
 | 
				
			||||||
	char *title = xcb_get_property_value(reply);
 | 
						char *title = xcb_get_property_value(reply);
 | 
				
			||||||
| 
						 | 
					@ -365,6 +367,7 @@ static void read_surface_title(struct wlr_xwm *xwm,
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		xsurface->title = NULL;
 | 
							xsurface->title = NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						xsurface->has_utf8_title = is_utf8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_log(L_DEBUG, "XCB_ATOM_WM_NAME: %s", xsurface->title);
 | 
						wlr_log(L_DEBUG, "XCB_ATOM_WM_NAME: %s", xsurface->title);
 | 
				
			||||||
	wlr_signal_emit_safe(&xsurface->events.set_title, xsurface);
 | 
						wlr_signal_emit_safe(&xsurface->events.set_title, xsurface);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue