Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass modifiers and group from parent compositor #298

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/c
] }

[patch."https://github.com/Smithay/client-toolkit"]
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit//", features = [
sctk = { package = "smithay-client-toolkit", git = "https://github.com/ids1024/client-toolkit//", branch = "raw_modifiers", features = [
"calloop",
"xkbcommon",
] }
[patch."crates-io"]
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit//", features = [
sctk = { package = "smithay-client-toolkit", git = "https://github.com/ids1024/client-toolkit//", branch = "raw_modifiers", features = [
"calloop",
"xkbcommon",
] }
Expand Down
4 changes: 2 additions & 2 deletions cosmic-panel-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ path = "src/main.rs"
[dependencies]
calloop = { version = "0.14.0", features = ["executor"] }
ordered-float = "4.2.0"
smithay = { git = "https://github.com/smithay/smithay", default-features = false, features = [
smithay = { default-features = false, features = [
"use_system_lib",
"desktop",
"backend_egl",
"backend_drm",
"renderer_gl",
], rev = "df79eeb" }
], git = "https://github.com/ids1024/smithay", branch = "update_mask" }
# sctk = { git = "https://github.com/smithay/client-toolkit", package = "smithay-client-toolkit", features = ["calloop", "xkbcommon"] }
sctk.workspace = true
# sctk = { package = "smithay-client-toolkit", path = "../../fork/client-toolkit", default-features = false, features = ["calloop", "xkbcommon"] }
Expand Down
20 changes: 17 additions & 3 deletions cosmic-panel-bin/src/xdg_shell_wrapper/client/handlers/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use sctk::{
seat::keyboard::{KeyCode, KeyboardHandler, Keysym, RepeatInfo},
shell::WaylandSurface,
};
use smithay::{backend::input::KeyState, input::keyboard::FilterResult, utils::SERIAL_COUNTER};
use smithay::{backend::input::KeyState, input::keyboard::{FilterResult, Layout}, utils::SERIAL_COUNTER};

impl KeyboardHandler for GlobalState {
fn enter(
Expand Down Expand Up @@ -260,12 +260,26 @@ impl KeyboardHandler for GlobalState {
&mut self,
_conn: &sctk::reexports::client::Connection,
_qh: &sctk::reexports::client::QueueHandle<Self>,
_keyboard: &sctk::reexports::client::protocol::wl_keyboard::WlKeyboard,
keyboard: &sctk::reexports::client::protocol::wl_keyboard::WlKeyboard,
_serial: u32,
_modifiers: sctk::seat::keyboard::Modifiers,
_: u32,
raw_modifiers: sctk::seat::keyboard::RawModifiers,
layout: u32,
) {
// TODO should these be handled specially
if let Some((name, Some(kbd))) = self
.server_state
.seats
.iter()
.find(|SeatPair { client, .. }| {
client.kbd.as_ref().map(|k| k == keyboard).unwrap_or(false)
})
.map(|seat| (seat.name.as_str(), seat.server.seat.get_keyboard()))
{
kbd.with_xkb_state(self, |mut context| {
context.update_mask(raw_modifiers.depressed, raw_modifiers.latched, raw_modifiers.locked, Layout(layout));
});
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ impl SeatHandler for GlobalState {
// So instead of doing the right thing (and initialize these capabilities as
// matching devices appear), we have to surrender to reality and
// just always expose a keyboard and pointer.
new_server_seat.add_keyboard(Default::default(), 200, 20).unwrap();
let keyboard = new_server_seat.add_keyboard(Default::default(), 200, 20).unwrap();
keyboard.set_update_key(false);
new_server_seat.add_pointer();

let data_device = self.client_state.data_device_manager.get_data_device(qh, &seat);
Expand Down Expand Up @@ -147,7 +148,8 @@ impl SeatHandler for GlobalState {
match capability {
sctk::seat::Capability::Keyboard => {
if info.has_keyboard {
sp.server.seat.add_keyboard(Default::default(), 200, 20).unwrap();
let keyboard = sp.server.seat.add_keyboard(Default::default(), 200, 20).unwrap();
keyboard.set_update_key(false);
if let Ok(kbd) = self.client_state.seat_state.get_keyboard(qh, &seat, None) {
sp.client.kbd.replace(kbd);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl ClientDndGrabHandler for GlobalState {
seat.server.dnd_icon = icon;
}

fn dropped(&mut self, seat: Seat<Self>) {
fn dropped(&mut self, _target: Option<WlSurface>, _validated: bool, seat: Seat<Self>) {
let seat = match self.server_state.seats.iter_mut().find(|s| s.server.seat == seat) {
Some(s) => s,
None => return,
Expand Down