ext-foreign-toplevel-list-v1: implement protocol
This commit is contained in:
		
				
					committed by
					
						 Isaac Freund
						Isaac Freund
					
				
			
			
				
	
			
			
			
						parent
						
							d08c170571
						
					
				
				
					commit
					1db51285c0
				
			| @ -17,8 +17,8 @@ | ||||
|             .hash = "wayland-0.3.0-lQa1kjPIAQDmhGYpY-zxiRzQJFHQ2VqhJkQLbKKdt5wl", | ||||
|         }, | ||||
|         .wlroots = .{ | ||||
|             .url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.19.1.tar.gz", | ||||
|             .hash = "wlroots-0.19.1-jmOlcs7dAwCajnVWlQZIc-ySYjRlbLxy0F5FvTQqYA3P", | ||||
|             .url = "https://codeberg.org/ifreund/zig-wlroots/archive/bb222027d3ab96cca4d217c5b3bab616edc14632.tar.gz", | ||||
|             .hash = "wlroots-0.19.1-jmOlcsnnAwA88XV5BSNEhufSaNzlSmKNcvhkFSv1nGJa", | ||||
|         }, | ||||
|         .xkbcommon = .{ | ||||
|             .url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.3.0.tar.gz", | ||||
|  | ||||
| @ -85,6 +85,8 @@ screencopy_manager: *wlr.ScreencopyManagerV1, | ||||
|  | ||||
| foreign_toplevel_manager: *wlr.ForeignToplevelManagerV1, | ||||
|  | ||||
| foreign_toplevel_list: *wlr.ExtForeignToplevelListV1, | ||||
|  | ||||
| tearing_control_manager: *wlr.TearingControlManagerV1, | ||||
|  | ||||
| alpha_modifier: *wlr.AlphaModifierV1, | ||||
| @ -164,6 +166,8 @@ pub fn init(server: *Server, runtime_xwayland: bool) !void { | ||||
|  | ||||
|         .foreign_toplevel_manager = try wlr.ForeignToplevelManagerV1.create(wl_server), | ||||
|  | ||||
|         .foreign_toplevel_list = try wlr.ExtForeignToplevelListV1.create(wl_server, 1), | ||||
|  | ||||
|         .tearing_control_manager = try wlr.TearingControlManagerV1.create(wl_server, 1), | ||||
|  | ||||
|         .alpha_modifier = try wlr.AlphaModifierV1.create(wl_server), | ||||
| @ -344,6 +348,7 @@ fn blocklist(server: *Server, global: *const wl.Global) bool { | ||||
|     return global == server.security_context_manager.global or | ||||
|         global == server.layer_shell.global or | ||||
|         global == server.foreign_toplevel_manager.global or | ||||
|         global == server.foreign_toplevel_list.global or | ||||
|         global == server.screencopy_manager.global or | ||||
|         global == server.export_dmabuf_manager.global or | ||||
|         global == server.data_control_manager.global or | ||||
|  | ||||
| @ -181,6 +181,8 @@ post_fullscreen_box: wlr.Box = undefined, | ||||
|  | ||||
| foreign_toplevel_handle: ForeignToplevelHandle = .{}, | ||||
|  | ||||
| ext_foreign_toplevel_handle: ?*wlr.ExtForeignToplevelHandleV1 = null, | ||||
|  | ||||
| /// Connector name of the output this view occupied before an evacuation. | ||||
| output_before_evac: ?[]const u8 = null, | ||||
|  | ||||
| @ -656,6 +658,15 @@ pub fn map(view: *View) !void { | ||||
|     assert(!view.mapped and !view.destroying); | ||||
|     view.mapped = true; | ||||
|  | ||||
|     if (wlr.ExtForeignToplevelHandleV1.create(server.foreign_toplevel_list, &.{ | ||||
|         .title = view.getTitle(), | ||||
|         .app_id = view.getAppId(), | ||||
|     })) |handle| { | ||||
|         view.ext_foreign_toplevel_handle = handle; | ||||
|     } else |_| { | ||||
|         log.err("failed to create ext foreign toplevel handle", .{}); | ||||
|     } | ||||
|  | ||||
|     view.foreign_toplevel_handle.map(); | ||||
|  | ||||
|     if (server.config.rules.float.match(view)) |float| { | ||||
| @ -745,6 +756,10 @@ pub fn unmap(view: *View) void { | ||||
|     assert(view.mapped and !view.destroying); | ||||
|     view.mapped = false; | ||||
|  | ||||
|     if (view.ext_foreign_toplevel_handle) |handle| { | ||||
|         handle.destroy(); | ||||
|         view.ext_foreign_toplevel_handle = null; | ||||
|     } | ||||
|     view.foreign_toplevel_handle.unmap(); | ||||
|  | ||||
|     server.root.applyPending(); | ||||
| @ -754,6 +769,14 @@ pub fn notifyTitle(view: *const View) void { | ||||
|     if (view.foreign_toplevel_handle.wlr_handle) |wlr_handle| { | ||||
|         if (view.getTitle()) |title| wlr_handle.setTitle(title); | ||||
|     } | ||||
|  | ||||
|     if (view.ext_foreign_toplevel_handle) |handle| { | ||||
|         handle.updateState(&.{ | ||||
|             .title = view.getTitle(), | ||||
|             .app_id = view.getAppId(), | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     // Send title to all status listeners attached to a seat which focuses this view | ||||
|     var seat_it = server.input_manager.seats.first; | ||||
|     while (seat_it) |seat_node| : (seat_it = seat_node.next) { | ||||
| @ -770,4 +793,11 @@ pub fn notifyAppId(view: View) void { | ||||
|     if (view.foreign_toplevel_handle.wlr_handle) |wlr_handle| { | ||||
|         if (view.getAppId()) |app_id| wlr_handle.setAppId(app_id); | ||||
|     } | ||||
|  | ||||
|     if (view.ext_foreign_toplevel_handle) |handle| { | ||||
|         handle.updateState(&.{ | ||||
|             .title = view.getTitle(), | ||||
|             .app_id = view.getAppId(), | ||||
|         }); | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user