View: send enter/leave events to full surface tree
This commit is contained in:
parent
5bf7d22972
commit
c84fd1a936
1 changed files with 22 additions and 5 deletions
|
@ -123,7 +123,7 @@ post_fullscreen_box: Box = undefined,
|
||||||
|
|
||||||
draw_borders: bool = true,
|
draw_borders: bool = true,
|
||||||
|
|
||||||
/// This is created when the view is mapped and destroyed with the view
|
/// This is created when the view is mapped and destroyed when unmapped
|
||||||
foreign_toplevel_handle: ?*wlr.ForeignToplevelHandleV1 = null,
|
foreign_toplevel_handle: ?*wlr.ForeignToplevelHandleV1 = null,
|
||||||
foreign_activate: wl.Listener(*wlr.ForeignToplevelHandleV1.event.Activated) =
|
foreign_activate: wl.Listener(*wlr.ForeignToplevelHandleV1.event.Activated) =
|
||||||
wl.Listener(*wlr.ForeignToplevelHandleV1.event.Activated).init(handleForeignActivate),
|
wl.Listener(*wlr.ForeignToplevelHandleV1.event.Activated).init(handleForeignActivate),
|
||||||
|
@ -286,9 +286,10 @@ pub fn sendToOutput(self: *Self, destination_output: *Output) void {
|
||||||
destination_output.sendUrgentTags();
|
destination_output.sendUrgentTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.surface) |surface| {
|
// if the view is mapped send enter/leave events
|
||||||
surface.sendLeave(self.output.wlr_output);
|
if (self.surface != null) {
|
||||||
surface.sendEnter(destination_output.wlr_output);
|
self.sendLeave(self.output);
|
||||||
|
self.sendEnter(destination_output);
|
||||||
|
|
||||||
// Must be present if surface is non-null indicating that the view
|
// Must be present if surface is non-null indicating that the view
|
||||||
// is mapped.
|
// is mapped.
|
||||||
|
@ -308,6 +309,22 @@ pub fn sendToOutput(self: *Self, destination_output: *Output) void {
|
||||||
self.output = destination_output;
|
self.output = destination_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn sendEnter(self: *Self, output: *Output) void {
|
||||||
|
self.forEachSurface(*wlr.Output, sendEnterIterator, output.wlr_output);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sendEnterIterator(surface: *wlr.Surface, sx: c_int, sy: c_int, wlr_output: *wlr.Output) callconv(.C) void {
|
||||||
|
surface.sendEnter(wlr_output);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sendLeave(self: *Self, output: *Output) void {
|
||||||
|
self.forEachSurface(*wlr.Output, sendLeaveIterator, output.wlr_output);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sendLeaveIterator(surface: *wlr.Surface, sx: c_int, sy: c_int, wlr_output: *wlr.Output) callconv(.C) void {
|
||||||
|
surface.sendLeave(wlr_output);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn close(self: Self) void {
|
pub fn close(self: Self) void {
|
||||||
switch (self.impl) {
|
switch (self.impl) {
|
||||||
.xdg_toplevel => |xdg_toplevel| xdg_toplevel.close(),
|
.xdg_toplevel => |xdg_toplevel| xdg_toplevel.close(),
|
||||||
|
@ -475,7 +492,7 @@ pub fn map(self: *Self) !void {
|
||||||
var it = server.input_manager.seats.first;
|
var it = server.input_manager.seats.first;
|
||||||
while (it) |seat_node| : (it = seat_node.next) try seat_node.data.handleViewMap(self);
|
while (it) |seat_node| : (it = seat_node.next) try seat_node.data.handleViewMap(self);
|
||||||
|
|
||||||
self.surface.?.sendEnter(self.output.wlr_output);
|
self.sendEnter(self.output);
|
||||||
|
|
||||||
self.output.sendViewTags();
|
self.output.sendViewTags();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue