Add Caps Lock support (#30470)

Closes #21700

Release Notes:

- Added caps lock support and show a warning if the user is entering an
SSH password with Caps Lock enabled

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Co-authored-by: 张小白 <364772080@qq.com>
This commit is contained in:
Maxim Zaks 2025-06-18 02:43:33 +02:00 committed by GitHub
parent e47c48fd3b
commit 90aa99bb14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 146 additions and 31 deletions

View file

@ -21,11 +21,6 @@ use wayland_protocols::xdg::shell::client::xdg_surface;
use wayland_protocols::xdg::shell::client::xdg_toplevel::{self};
use wayland_protocols_plasma::blur::client::org_kde_kwin_blur;
use crate::platform::{
PlatformAtlas, PlatformInputHandler, PlatformWindow,
blade::{BladeContext, BladeRenderer, BladeSurfaceConfig},
linux::wayland::{display::WaylandDisplay, serial::SerialKind},
};
use crate::scene::Scene;
use crate::{
AnyWindowHandle, Bounds, Decorations, Globals, GpuSpecs, Modifiers, Output, Pixels,
@ -34,6 +29,14 @@ use crate::{
WindowBackgroundAppearance, WindowBounds, WindowControlArea, WindowControls, WindowDecorations,
WindowParams, px, size,
};
use crate::{
Capslock,
platform::{
PlatformAtlas, PlatformInputHandler, PlatformWindow,
blade::{BladeContext, BladeRenderer, BladeSurfaceConfig},
linux::wayland::{display::WaylandDisplay, serial::SerialKind},
},
};
#[derive(Default)]
pub(crate) struct Callbacks {
@ -861,6 +864,10 @@ impl PlatformWindow for WaylandWindow {
self.borrow().client.get_client().borrow().modifiers
}
fn capslock(&self) -> Capslock {
self.borrow().client.get_client().borrow().capslock
}
fn set_input_handler(&mut self, input_handler: PlatformInputHandler) {
self.borrow_mut().input_handler = Some(input_handler);
}