mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Merge pull request #645 from agx/x11-window-title
x11 backend: set window title
This commit is contained in:
		
						commit
						566c98846a
					
				
					 2 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
					@ -221,11 +221,21 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	init_atom(x11, &x11->atoms.wm_protocols, 1, "WM_PROTOCOLS");
 | 
						init_atom(x11, &x11->atoms.wm_protocols, 1, "WM_PROTOCOLS");
 | 
				
			||||||
	init_atom(x11, &x11->atoms.wm_delete_window, 0, "WM_DELETE_WINDOW");
 | 
						init_atom(x11, &x11->atoms.wm_delete_window, 0, "WM_DELETE_WINDOW");
 | 
				
			||||||
 | 
						init_atom(x11, &x11->atoms.net_wm_name, 1, "_NET_WM_NAME");
 | 
				
			||||||
 | 
						init_atom(x11, &x11->atoms.utf8_string, 0, "UTF8_STRING");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xcb_change_property(x11->xcb_conn, XCB_PROP_MODE_REPLACE, output->win,
 | 
						xcb_change_property(x11->xcb_conn, XCB_PROP_MODE_REPLACE, output->win,
 | 
				
			||||||
		x11->atoms.wm_protocols.reply->atom, XCB_ATOM_ATOM, 32, 1,
 | 
							x11->atoms.wm_protocols.reply->atom, XCB_ATOM_ATOM, 32, 1,
 | 
				
			||||||
		&x11->atoms.wm_delete_window.reply->atom);
 | 
							&x11->atoms.wm_delete_window.reply->atom);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char title[32];
 | 
				
			||||||
 | 
						if (snprintf(title, sizeof(title), "wlroots - %s", output->wlr_output.name)) {
 | 
				
			||||||
 | 
							xcb_change_property(x11->xcb_conn, XCB_PROP_MODE_REPLACE, output->win,
 | 
				
			||||||
 | 
								x11->atoms.net_wm_name.reply->atom,
 | 
				
			||||||
 | 
								x11->atoms.utf8_string.reply->atom, 8,
 | 
				
			||||||
 | 
								strlen(title), title);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xcb_map_window(x11->xcb_conn, output->win);
 | 
						xcb_map_window(x11->xcb_conn, output->win);
 | 
				
			||||||
	xcb_flush(x11->xcb_conn);
 | 
						xcb_flush(x11->xcb_conn);
 | 
				
			||||||
	wlr_output_update_enabled(&output->wlr_output, true);
 | 
						wlr_output_update_enabled(&output->wlr_output, true);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,6 +46,8 @@ struct wlr_x11_backend {
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		struct wlr_x11_atom wm_protocols;
 | 
							struct wlr_x11_atom wm_protocols;
 | 
				
			||||||
		struct wlr_x11_atom wm_delete_window;
 | 
							struct wlr_x11_atom wm_delete_window;
 | 
				
			||||||
 | 
							struct wlr_x11_atom net_wm_name;
 | 
				
			||||||
 | 
							struct wlr_x11_atom utf8_string;
 | 
				
			||||||
	} atoms;
 | 
						} atoms;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// The time we last received an event
 | 
						// The time we last received an event
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue