Xwayland: fix View.fromWlrSurface for OR surfaces

This commit is contained in:
Isaac Freund 2022-06-24 12:05:54 +02:00
parent 7d9d889226
commit db366e9455
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
2 changed files with 3 additions and 1 deletions

View File

@ -430,7 +430,7 @@ pub fn fromWlrSurface(surface: *wlr.Surface) ?*Self {
if (build_options.xwayland) { if (build_options.xwayland) {
if (surface.isXWaylandSurface()) { if (surface.isXWaylandSurface()) {
const xwayland_surface = wlr.XwaylandSurface.fromWlrSurface(surface); const xwayland_surface = wlr.XwaylandSurface.fromWlrSurface(surface);
return @intToPtr(*Self, xwayland_surface.data); return @intToPtr(?*Self, xwayland_surface.data);
} }
} }
if (surface.isSubsurface()) { if (surface.isSubsurface()) {

View File

@ -53,6 +53,8 @@ pub fn create(xwayland_surface: *wlr.XwaylandSurface) error{OutOfMemory}!*Self {
const self = &node.data; const self = &node.data;
self.* = .{ .xwayland_surface = xwayland_surface }; self.* = .{ .xwayland_surface = xwayland_surface };
// This must be set to 0 for usage in View.fromWlrSurface()
xwayland_surface.data = 0;
// Add listeners that are active over the the entire lifetime // Add listeners that are active over the the entire lifetime
xwayland_surface.events.request_configure.add(&self.request_configure); xwayland_surface.events.request_configure.add(&self.request_configure);