river: only expose xwayland_shell_v1 to Xwayland
This is a private protocol only intended for the Xwayland client.
This commit is contained in:
parent
0eacde7d01
commit
60f4cafad0
@ -168,6 +168,8 @@ pub fn init(self: *Self, runtime_xwayland: bool) !void {
|
|||||||
_ = try wlr.SinglePixelBufferManagerV1.create(self.wl_server);
|
_ = try wlr.SinglePixelBufferManagerV1.create(self.wl_server);
|
||||||
_ = try wlr.Viewporter.create(self.wl_server);
|
_ = try wlr.Viewporter.create(self.wl_server);
|
||||||
_ = try wlr.FractionalScaleManagerV1.create(self.wl_server, 1);
|
_ = try wlr.FractionalScaleManagerV1.create(self.wl_server, 1);
|
||||||
|
|
||||||
|
self.wl_server.setGlobalFilter(*Self, globalFilter, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Free allocated memory and clean up. Note: order is important here
|
/// Free allocated memory and clean up. Note: order is important here
|
||||||
@ -222,6 +224,22 @@ pub fn start(self: Self) !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn globalFilter(client: *const wl.Client, global: *const wl.Global, self: *Self) bool {
|
||||||
|
// Only expose the xwalyand_shell_v1 global to the Xwayland process.
|
||||||
|
if (build_options.xwayland) {
|
||||||
|
if (self.xwayland) |xwayland| {
|
||||||
|
if (global == xwayland.shell_v1.global) {
|
||||||
|
if (xwayland.server) |server| {
|
||||||
|
return client == server.client;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// Handle SIGINT and SIGTERM by gracefully stopping the server
|
/// Handle SIGINT and SIGTERM by gracefully stopping the server
|
||||||
fn terminate(_: c_int, wl_server: *wl.Server) c_int {
|
fn terminate(_: c_int, wl_server: *wl.Server) c_int {
|
||||||
wl_server.terminate();
|
wl_server.terminate();
|
||||||
|
Loading…
Reference in New Issue
Block a user