From be5c2bc99af50c9e65e1b54d77e8dbcba456b9bf Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Thu, 30 May 2024 11:28:45 +0200 Subject: [PATCH 1/2] wayland: restrict input method global to privileged applications --- src/client.rs | 1 + src/ifs/wl_seat/text_input/zwp_input_method_manager_v2.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client.rs b/src/client.rs index d964bbd9..f5c9e6df 100644 --- a/src/client.rs +++ b/src/client.rs @@ -56,6 +56,7 @@ bitflags! { CAP_SCREENCOPY_MANAGER = 1 << 7, CAP_SEAT_MANAGER = 1 << 8, CAP_DRM_LEASE = 1 << 9, + CAP_INPUT_METHOD = 1 << 10, } pub const CAPS_DEFAULT: ClientCaps = ClientCaps(CAP_LAYER_SHELL.0 | CAP_DRM_LEASE.0); diff --git a/src/ifs/wl_seat/text_input/zwp_input_method_manager_v2.rs b/src/ifs/wl_seat/text_input/zwp_input_method_manager_v2.rs index d2b03ab4..4dccf2b5 100644 --- a/src/ifs/wl_seat/text_input/zwp_input_method_manager_v2.rs +++ b/src/ifs/wl_seat/text_input/zwp_input_method_manager_v2.rs @@ -1,6 +1,6 @@ use { crate::{ - client::{Client, ClientError}, + client::{Client, ClientCaps, ClientError, CAP_INPUT_METHOD}, globals::{Global, GlobalName}, ifs::wl_seat::text_input::{zwp_input_method_v2::ZwpInputMethodV2, TextConnectReason}, leaks::Tracker, @@ -59,6 +59,10 @@ impl Global for ZwpInputMethodManagerV2Global { fn version(&self) -> u32 { 1 } + + fn required_caps(&self) -> ClientCaps { + CAP_INPUT_METHOD + } } simple_add_global!(ZwpInputMethodManagerV2Global); From 413bbde26b741c87601802021a3cd10c04ea420d Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Thu, 30 May 2024 12:57:34 +0200 Subject: [PATCH 2/2] gbm: hard-code invalid modifier if explicit modifiers are not supported --- src/video/gbm.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/video/gbm.rs b/src/video/gbm.rs index 4eb888b8..bc7c04f0 100644 --- a/src/video/gbm.rs +++ b/src/video/gbm.rs @@ -237,7 +237,10 @@ impl GbmDevice { return Err(GbmError::CreateBo(OsError::default())); } let bo = BoHolder { bo }; - let dma = export_bo(dma_buf_ids, bo.bo)?; + let mut dma = export_bo(dma_buf_ids, bo.bo)?; + if modifiers.is_null() { + dma.modifier = INVALID_MODIFIER; + } Ok(GbmBo { bo, dmabuf: dma }) } }