chore(client): checkpoint deployed features and unfinished server management

User requested a checkpoint and stopped all agents. Deployed artifacts remain the last verified releases; unfinished settings/categories/forums are preserved as WIP. See TODO/roadmap for verification and remaining release/updater work.
This commit is contained in:
Loki 2026-11-01 15:31:21 +01:00
parent 15f03bf8df
commit f04691c3cd
Signed by: boba
GPG key ID: 253067914055423B
90 changed files with 9599 additions and 371 deletions

View file

@ -0,0 +1,74 @@
// Copyright © VNOX Contributors
// SPDX-License-Identifier: GPL-3.0-only
/// Translate standard Ctrl shortcuts without replacing normal layout text.
/// Latin layouts retain their logical letters (including AZERTY/Dvorak).
pub(crate) fn shortcut_letter(
logical: &str,
physical: Option<char>,
control: bool,
alt_or_altgr: bool,
meta: bool,
) -> Option<char> {
if !control || alt_or_altgr || meta {
return None;
}
let mut chars = logical.chars();
let letter = chars.next()?;
if chars.next().is_some() || !letter.is_alphabetic() {
return None;
}
let letter = if letter.is_ascii() {
letter.to_ascii_lowercase()
} else {
physical?
};
"acvxyzfspr".contains(letter).then_some(letter)
}
#[cfg(test)]
mod tests {
use super::shortcut_letter;
#[test]
fn russian_control_shortcuts_use_physical_letters() {
for (logical, physical) in [("м", 'v'), ("с", 'c'), ("ч", 'x'), ("ф", 'a'), ("я", 'z')]
{
assert_eq!(
shortcut_letter(logical, Some(physical), true, false, false),
Some(physical)
);
}
}
#[test]
fn ordinary_cyrillic_and_altgr_are_untouched() {
assert_eq!(shortcut_letter("м", Some('v'), false, false, false), None);
assert_eq!(shortcut_letter("м", Some('v'), true, true, false), None);
assert_eq!(shortcut_letter("м", Some('v'), true, false, true), None);
}
#[test]
fn latin_layouts_use_logical_shortcuts_and_ignore_physical_positions() {
assert_eq!(
shortcut_letter("a", Some('q'), true, false, false),
Some('a')
);
assert_eq!(shortcut_letter("q", Some('a'), true, false, false), None);
assert_eq!(
shortcut_letter("V", Some('v'), true, false, false),
Some('v')
);
}
#[test]
fn dead_composed_and_non_letter_keys_are_untouched() {
for logical in ["", "´", "éa", "\u{0011}", ";"] {
assert_eq!(
shortcut_letter(logical, Some('v'), true, false, false),
None
);
}
assert_eq!(shortcut_letter("м", None, true, false, false), None);
}
}

View file

@ -29,6 +29,8 @@ use winit::event_loop::ActiveEventLoop;
#[cfg(not(target_arch = "wasm32"))]
mod clipboard;
#[cfg(target_os = "linux")]
mod keyboard_shortcuts;
mod drag_resize_window;
mod winit_compat;
mod winitwindowadapter;

View file

@ -462,6 +462,10 @@ pub struct WinitWindowAdapter {
current_resize_direction: Cell<Option<ResizeDirection>>,
/// Allocates small i32 finger ids for winit's per-device u64 touch ids.
touch_finger_ids: RefCell<crate::touch_finger_id::TouchFingerIdAllocator>,
#[cfg(target_os = "linux")]
keyboard_modifiers: Cell<winit::keyboard::ModifiersState>,
#[cfg(target_os = "linux")]
alt_graph_pressed: Cell<bool>,
}
impl WinitWindowAdapter {
@ -516,6 +520,10 @@ impl WinitWindowAdapter {
pressed: Default::default(),
current_resize_direction: Default::default(),
touch_finger_ids: Default::default(),
#[cfg(target_os = "linux")]
keyboard_modifiers: Default::default(),
#[cfg(target_os = "linux")]
alt_graph_pressed: Default::default(),
});
self_rc.shared_backend_data.register_inactive_window((self_rc.clone()) as _);
@ -1314,13 +1322,76 @@ impl WinitWindowAdapter {
.dispatch_event_with_result(corelib::platform::WindowEvent::CloseRequested)?;
}
WinitWindowEvent::Focused(have_focus) => {
#[cfg(target_os = "linux")]
if !have_focus {
self.keyboard_modifiers.set(Default::default());
self.alt_graph_pressed.set(false);
}
// Work around https://github.com/rust-windowing/winit/issues/4371
let have_focus =
if cfg!(target_os = "macos") { winit_window.has_focus() } else { have_focus };
self.activation_changed(have_focus)?;
}
#[cfg(target_os = "linux")]
WinitWindowEvent::ModifiersChanged(modifiers) => {
let next = modifiers.state();
let previous = self.keyboard_modifiers.replace(next);
// Wayland may report modifiers without individual key events
// (virtual keyboards, or focus acquired with Ctrl held).
if self.shared_backend_data.is_wayland {
use corelib::input::key_codes;
for (was, now, left, right) in [
(
previous.control_key(),
next.control_key(),
key_codes::Control,
key_codes::ControlR,
),
(
previous.shift_key(),
next.shift_key(),
key_codes::Shift,
key_codes::ShiftR,
),
(
previous.alt_key(),
next.alt_key(),
key_codes::Alt,
key_codes::AltGr,
),
(
previous.super_key(),
next.super_key(),
key_codes::Meta,
key_codes::MetaR,
),
] {
if was != now {
let text = left.to_string().into();
self.window().dispatch_event_with_result(if now {
WindowEvent::KeyPressed { text }
} else {
WindowEvent::KeyReleased { text }
})?;
if !now {
self.window().dispatch_event_with_result(
WindowEvent::KeyReleased {
text: right.to_string().into(),
},
)?;
}
}
}
}
}
WinitWindowEvent::KeyboardInput { event, is_synthetic, .. } => {
#[cfg(target_os = "linux")]
if event.logical_key == Key::Named(winit::keyboard::NamedKey::AltGraph) {
// Linux AltGr is usually Mod5, absent from ModifiersState::ALT.
self.alt_graph_pressed.set(event.state == winit::event::ElementState::Pressed);
}
let key_code = event.logical_key.clone();
// For now: Match Qt's behavior of mapping command to control and control to meta (LWin/RWin).
let swap_cmd_ctrl = i_slint_core::is_apple_platform();
@ -1366,6 +1437,34 @@ impl WinitWindowAdapter {
#[allow(unused_mut)]
let mut text = to_slint_key(&event, &key_code);
#[cfg(target_os = "linux")]
if matches!(key_code, Key::Character(_)) {
use winit::keyboard::{KeyCode, PhysicalKey};
let physical = match event.physical_key {
PhysicalKey::Code(KeyCode::KeyA) => Some('a'),
PhysicalKey::Code(KeyCode::KeyC) => Some('c'),
PhysicalKey::Code(KeyCode::KeyV) => Some('v'),
PhysicalKey::Code(KeyCode::KeyX) => Some('x'),
PhysicalKey::Code(KeyCode::KeyY) => Some('y'),
PhysicalKey::Code(KeyCode::KeyZ) => Some('z'),
PhysicalKey::Code(KeyCode::KeyF) => Some('f'),
PhysicalKey::Code(KeyCode::KeyS) => Some('s'),
PhysicalKey::Code(KeyCode::KeyP) => Some('p'),
PhysicalKey::Code(KeyCode::KeyR) => Some('r'),
_ => None,
};
let modifiers = self.keyboard_modifiers.get();
if let Some(letter) = crate::keyboard_shortcuts::shortcut_letter(
text.as_str(),
physical,
modifiers.control_key(),
modifiers.alt_key() || self.alt_graph_pressed.get(),
modifiers.super_key(),
) {
text = letter.to_string().into();
}
}
#[cfg(target_os = "windows")]
let text_without_modifiers = {
use winit::platform::modifier_supplement::KeyEventExtModifierSupplement;