fix: popup global pointer grab area

This commit is contained in:
drendog 2025-11-16 22:03:07 +01:00
parent eb8e19cb9e
commit f7cd653605
Signed by: dwenya
GPG key ID: 8DD77074645332D0
2 changed files with 19 additions and 1 deletions

View file

@ -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())

View file

@ -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,
}
}
}