fix, compilation

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-11-29 01:42:44 -05:00
parent 4cbbb5b64f
commit 7a2590d1f9
2 changed files with 22 additions and 21 deletions

View File

@ -1603,7 +1603,6 @@ class _KeyboardMenu extends StatelessWidget {
menuChildren: [
keyboardMode(modeOnly),
localKeyboardType(),
Divider(),
inputSource(),
Divider(),
viewMode(),
@ -1693,25 +1692,25 @@ class _KeyboardMenu extends StatelessWidget {
if (supportedInputSourceList.length < 2) return Offstage();
final inputSource = stateGlobal.getInputSource();
final enabled = !ffi.ffiModel.viewOnly;
return Column(
children: supportedInputSourceList.map((e) {
final d = e as List<dynamic>;
return RdoMenuButton<String>(
child: Text(translate(d[1] as String)),
value: d[0] as String,
groupValue: inputSource,
onChanged: enabled
? (v) async {
if (v != null) {
await stateGlobal.setInputSource(ffi.sessionId, v);
await ffi.ffiModel.checkDesktopKeyboardMode();
}
final children = <Widget>[Divider()];
children.addAll(supportedInputSourceList.map((e) {
final d = e as List<dynamic>;
return RdoMenuButton<String>(
child: Text(translate(d[1] as String)),
value: d[0] as String,
groupValue: inputSource,
onChanged: enabled
? (v) async {
if (v != null) {
await stateGlobal.setInputSource(ffi.sessionId, v);
await ffi.ffiModel.checkDesktopKeyboardMode();
}
: null,
ffi: ffi,
);
}).toList(),
);
}
: null,
ffi: ffi,
);
}));
return Column(children: children);
}
viewMode() {

View File

@ -12,7 +12,7 @@ use hbb_common::message_proto::*;
#[cfg(any(target_os = "windows", target_os = "macos"))]
use rdev::KeyCode;
use rdev::{Event, EventType, Key};
#[cfg(any(target_os = "windows", target_os = "macos"))]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use std::sync::atomic::{AtomicBool, Ordering};
use std::{
collections::HashMap,
@ -324,7 +324,7 @@ pub fn stop_grab_loop() -> Result<(), rdev::GrabError> {
#[cfg(any(target_os = "windows", target_os = "macos"))]
rdev::exit_grab()?;
#[cfg(target_os = "linux")]
rdev::exit_grab_listen()?;
rdev::exit_grab_listen();
Ok(())
}
@ -1082,6 +1082,8 @@ pub fn keycode_to_rdev_key(keycode: u32) -> Key {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub mod input_source {
use hbb_common::SessionID;
#[cfg(target_os = "macos")]
use hbb_common::log;
use crate::ui_interface::{get_local_option, set_local_option};