This commit is contained in:
2024-05-15 04:36:26 -07:00
5 changed files with 38 additions and 16 deletions

View File

@ -769,6 +769,14 @@ fn handleRequestSetCursor(
pub fn hide(cursor: *Cursor) void {
if (cursor.pressed_count > 0) return;
// Hiding the cursor and sending wl_pointer.leave whlie a pointer constraint
// is active does not make much sense. In particular, doing so seems to interact
// poorly with Xwayland's pointer constraints implementation.
if (cursor.constraint) |constraint| {
if (constraint.state == .active) return;
}
cursor.hidden = true;
cursor.wlr_cursor.unsetImage();
cursor.xcursor_name = null;

View File

@ -489,7 +489,6 @@ fn tryAddDevice(seat: *Seat, wlr_device: *wlr.InputDevice) !void {
seat.wlr_seat.setKeyboard(keyboard.device.wlr_device.toKeyboard());
if (seat.wlr_seat.keyboard_state.focused_surface) |wlr_surface| {
seat.wlr_seat.keyboardNotifyClearFocus();
seat.keyboardNotifyEnter(wlr_surface);
}
},

View File

@ -289,21 +289,17 @@ fn allowlist(server: *Server, global: *const wl.Global) bool {
if (server.drm) |drm| if (global == drm.global) return true;
if (server.linux_dmabuf) |linux_dmabuf| if (global == linux_dmabuf.global) return true;
{
var it = server.root.all_outputs.iterator(.forward);
while (it.next()) |output| {
if (global == output.wlr_output.global) return true;
}
}
{
var it = server.input_manager.seats.first;
while (it) |node| : (it = node.next) {
if (global == node.data.wlr_seat.global) return true;
}
}
return global == hackGlobal(server.shm) or
// We must use the getInterface() approach for dynamically created globals
// such as wl_output and wl_seat since the wl_global_create() function will
// advertise the global to clients and invoke this filter before returning
// the new global pointer.
//
// For other globals I like the current pointer comparison approach as it
// should catch river accidentally exposing multiple copies of e.g. wl_shm
// with an assertion failure.
return global.getInterface() == wl.Output.getInterface() or
global.getInterface() == wl.Seat.getInterface() or
global == hackGlobal(server.shm) or
global == hackGlobal(server.single_pixel_buffer_manager) or
global == server.viewporter.global or
global == server.fractional_scale_manager.global or

View File

@ -67,6 +67,7 @@ pub fn swap(
assert(!target.pending.float);
assert(!target.pending.fullscreen);
seat.focused.view.pending_wm_stack_link.swapWith(&target.pending_wm_stack_link);
seat.cursor.may_need_warp = true;
server.root.applyPending();
}
}