From f7cd653605b3e3a302ba63c62793676aa6ba5823 Mon Sep 17 00:00:00 2001 From: drendog Date: Sun, 16 Nov 2025 22:03:07 +0100 Subject: [PATCH] fix: popup global pointer grab area --- crates/adapters/src/wayland/surfaces/popup_manager.rs | 9 ++++++++- crates/domain/src/value_objects/popup_request.rs | 11 +++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/crates/adapters/src/wayland/surfaces/popup_manager.rs b/crates/adapters/src/wayland/surfaces/popup_manager.rs index babd6ca..e742e41 100644 --- a/crates/adapters/src/wayland/surfaces/popup_manager.rs +++ b/crates/adapters/src/wayland/surfaces/popup_manager.rs @@ -63,6 +63,7 @@ pub struct CreatePopupParams { pub width: f32, pub height: f32, pub positioning_mode: PopupPositioningMode, + pub grab: bool, } pub struct PopupContext { @@ -241,6 +242,7 @@ impl PopupManager { width, height, positioning_mode: request.mode, + grab: request.grab, }; self.create_popup_internal(queue_handle, parent_layer_surface, params, request, id) @@ -313,7 +315,12 @@ impl PopupManager { scale_factor, }); - popup_surface.grab(&self.context.seat, params.last_pointer_serial); + if params.grab { + popup_surface.grab(&self.context.seat, params.last_pointer_serial); + } else { + info!("Skipping popup grab (grab disabled in request)"); + popup_surface.surface.commit(); + } let context = EGLContext::builder() .with_display_id(self.context.display.id()) diff --git a/crates/domain/src/value_objects/popup_request.rs b/crates/domain/src/value_objects/popup_request.rs index e116a6e..9aa2315 100644 --- a/crates/domain/src/value_objects/popup_request.rs +++ b/crates/domain/src/value_objects/popup_request.rs @@ -21,6 +21,7 @@ pub struct PopupRequest { pub at: PopupAt, pub size: PopupSize, pub mode: PopupPositioningMode, + pub grab: bool, } impl PopupRequest { @@ -36,6 +37,7 @@ impl PopupRequest { at, size, mode, + grab: false, } } @@ -108,6 +110,7 @@ pub struct PopupRequestBuilder { at: PopupAt, size: PopupSize, mode: PopupPositioningMode, + grab: bool, } impl PopupRequestBuilder { @@ -118,6 +121,7 @@ impl PopupRequestBuilder { at: PopupAt::Cursor, size: PopupSize::Content, mode: PopupPositioningMode::default(), + grab: false, } } @@ -139,6 +143,12 @@ impl PopupRequestBuilder { self } + #[must_use] + pub const fn grab(mut self, grab: bool) -> Self { + self.grab = grab; + self + } + #[must_use] pub fn build(self) -> PopupRequest { PopupRequest { @@ -146,6 +156,7 @@ impl PopupRequestBuilder { at: self.at, size: self.size, mode: self.mode, + grab: self.grab, } } }