Skip to content

Commit

Permalink
Merge pull request #209 from mahkoh/jorth/input-method-cap
Browse files Browse the repository at this point in the history
wayland: restrict input method global to privileged applications
  • Loading branch information
mahkoh authored May 30, 2024
2 parents 077651d + 413bbde commit 53b7d3c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion src/ifs/wl_seat/text_input/zwp_input_method_manager_v2.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion src/video/gbm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
}
Expand Down

0 comments on commit 53b7d3c

Please sign in to comment.