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 width: f32,
|
||||||
pub height: f32,
|
pub height: f32,
|
||||||
pub positioning_mode: PopupPositioningMode,
|
pub positioning_mode: PopupPositioningMode,
|
||||||
|
pub grab: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PopupContext {
|
pub struct PopupContext {
|
||||||
|
|
@ -241,6 +242,7 @@ impl PopupManager {
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
positioning_mode: request.mode,
|
positioning_mode: request.mode,
|
||||||
|
grab: request.grab,
|
||||||
};
|
};
|
||||||
|
|
||||||
self.create_popup_internal(queue_handle, parent_layer_surface, params, request, id)
|
self.create_popup_internal(queue_handle, parent_layer_surface, params, request, id)
|
||||||
|
|
@ -313,7 +315,12 @@ impl PopupManager {
|
||||||
scale_factor,
|
scale_factor,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if params.grab {
|
||||||
popup_surface.grab(&self.context.seat, params.last_pointer_serial);
|
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()
|
let context = EGLContext::builder()
|
||||||
.with_display_id(self.context.display.id())
|
.with_display_id(self.context.display.id())
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ pub struct PopupRequest {
|
||||||
pub at: PopupAt,
|
pub at: PopupAt,
|
||||||
pub size: PopupSize,
|
pub size: PopupSize,
|
||||||
pub mode: PopupPositioningMode,
|
pub mode: PopupPositioningMode,
|
||||||
|
pub grab: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PopupRequest {
|
impl PopupRequest {
|
||||||
|
|
@ -36,6 +37,7 @@ impl PopupRequest {
|
||||||
at,
|
at,
|
||||||
size,
|
size,
|
||||||
mode,
|
mode,
|
||||||
|
grab: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,6 +110,7 @@ pub struct PopupRequestBuilder {
|
||||||
at: PopupAt,
|
at: PopupAt,
|
||||||
size: PopupSize,
|
size: PopupSize,
|
||||||
mode: PopupPositioningMode,
|
mode: PopupPositioningMode,
|
||||||
|
grab: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PopupRequestBuilder {
|
impl PopupRequestBuilder {
|
||||||
|
|
@ -118,6 +121,7 @@ impl PopupRequestBuilder {
|
||||||
at: PopupAt::Cursor,
|
at: PopupAt::Cursor,
|
||||||
size: PopupSize::Content,
|
size: PopupSize::Content,
|
||||||
mode: PopupPositioningMode::default(),
|
mode: PopupPositioningMode::default(),
|
||||||
|
grab: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,6 +143,12 @@ impl PopupRequestBuilder {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub const fn grab(mut self, grab: bool) -> Self {
|
||||||
|
self.grab = grab;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn build(self) -> PopupRequest {
|
pub fn build(self) -> PopupRequest {
|
||||||
PopupRequest {
|
PopupRequest {
|
||||||
|
|
@ -146,6 +156,7 @@ impl PopupRequestBuilder {
|
||||||
at: self.at,
|
at: self.at,
|
||||||
size: self.size,
|
size: self.size,
|
||||||
mode: self.mode,
|
mode: self.mode,
|
||||||
|
grab: self.grab,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue