mirror of
https://codeberg.org/waydeer/layer-shika.git
synced 2025-11-17 23:14:23 +00:00
fix: popup global pointer grab area
This commit is contained in:
parent
eb8e19cb9e
commit
f7cd653605
2 changed files with 19 additions and 1 deletions
|
|
@ -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,
|
||||
});
|
||||
|
||||
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())
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue