ltk_webkit/wpe/modifiers.rs
// SPDX-License-Identifier: LGPL-2.1-only
// Copyright (C) 2026 Liberux Labs, S. L. <info@liberux.net>
//! The keyboard modifiers held, which every view's pointer events carry: one keyboard serves every page.
use std::sync::atomic::{ AtomicU32, Ordering };
use wpe_platform_sys::*;
static HELD: AtomicU32 = AtomicU32::new( 0 );
/// The keyboard modifiers the user holds, for pages that read them on a click, a motion or the wheel, as Shift+click extends a
/// selection and Ctrl+click adds to it. The host calls this whenever they change.
pub fn set_modifiers( ctrl: bool, shift: bool, alt: bool )
{
let mut mods: WPEModifiers = 0;
if ctrl { mods |= WPE_MODIFIER_KEYBOARD_CONTROL; }
if shift { mods |= WPE_MODIFIER_KEYBOARD_SHIFT; }
if alt { mods |= WPE_MODIFIER_KEYBOARD_ALT; }
HELD.store( mods, Ordering::Relaxed );
}
pub( crate ) fn held() -> WPEModifiers
{
HELD.load( Ordering::Relaxed )
}