view: ensure surface_box is initailized before use
This commit is contained in:
parent
37251c8758
commit
6f61ea07db
2 changed files with 13 additions and 5 deletions
|
@ -185,8 +185,6 @@ fn handleMap(listener: *wl.Listener(*wlr.XdgSurface), xdg_surface: *wlr.XdgSurfa
|
|||
toplevel.events.set_title.add(&self.set_title);
|
||||
toplevel.events.set_app_id.add(&self.set_app_id);
|
||||
|
||||
view.surface = self.xdg_surface.surface;
|
||||
|
||||
// Use the view's initial size centered on the output as the default
|
||||
// floating dimensions
|
||||
var initial_box: wlr.Box = undefined;
|
||||
|
@ -203,6 +201,9 @@ fn handleMap(listener: *wl.Listener(*wlr.XdgSurface), xdg_surface: *wlr.XdgSurfa
|
|||
toplevel.server_pending.width = @intCast(u32, initial_box.width);
|
||||
toplevel.server_pending.height = @intCast(u32, initial_box.height);
|
||||
|
||||
view.surface = self.xdg_surface.surface;
|
||||
view.surface_box = Box.fromWlrBox(initial_box);
|
||||
|
||||
// Also use the view's "natural" size as the initial regular dimensions,
|
||||
// for the case that it does not get arranged by a lyaout.
|
||||
view.pending.box = view.float_box;
|
||||
|
|
|
@ -163,11 +163,18 @@ fn handleMap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface: *wl
|
|||
const view = self.view;
|
||||
|
||||
// Add listeners that are only active while mapped
|
||||
xwayland_surface.surface.?.events.commit.add(&self.commit);
|
||||
const surface = xwayland_surface.surface.?;
|
||||
surface.events.commit.add(&self.commit);
|
||||
xwayland_surface.events.set_title.add(&self.set_title);
|
||||
xwayland_surface.events.set_class.add(&self.set_class);
|
||||
|
||||
view.surface = self.xwayland_surface.surface;
|
||||
view.surface = surface;
|
||||
self.view.surface_box = .{
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = @intCast(u32, surface.current.width),
|
||||
.height = @intCast(u32, surface.current.height),
|
||||
};
|
||||
|
||||
// Use the view's "natural" size centered on the output as the default
|
||||
// floating dimensions
|
||||
|
@ -240,7 +247,7 @@ fn handleCommit(listener: *wl.Listener(*wlr.Surface), surface: *wlr.Surface) voi
|
|||
|
||||
self.view.output.damage.addWhole();
|
||||
|
||||
self.view.surface_box = Box{
|
||||
self.view.surface_box = .{
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = @intCast(u32, surface.current.width),
|
||||
|
|
Loading…
Reference in a new issue