Merge branch 'master' of github.com-rustdesk:rustdesk/rustdesk

This commit is contained in:
Huabing Zhou 2022-12-23 22:02:06 +08:00
commit 385a1594f3
7 changed files with 285 additions and 136 deletions

277
Cargo.lock generated
View File

@ -295,7 +295,7 @@ dependencies = [
"glib-sys 0.15.10",
"gobject-sys 0.15.10",
"libc",
"system-deps",
"system-deps 6.0.3",
]
[[package]]
@ -313,12 +313,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"
[[package]]
name = "atomic_refcell"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73b5e5f48b927f04e952dedc932f31995a65a0bf65ec971c74436e51bf6e970d"
[[package]]
name = "atty"
version = "0.2.14"
@ -525,7 +519,7 @@ checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8"
dependencies = [
"glib-sys 0.15.10",
"libc",
"system-deps",
"system-deps 6.0.3",
]
[[package]]
@ -2002,7 +1996,7 @@ dependencies = [
"glib-sys 0.15.10",
"gobject-sys 0.15.10",
"libc",
"system-deps",
"system-deps 6.0.3",
]
[[package]]
@ -2019,7 +2013,7 @@ dependencies = [
"libc",
"pango-sys",
"pkg-config",
"system-deps",
"system-deps 6.0.3",
]
[[package]]
@ -2085,7 +2079,7 @@ dependencies = [
"glib-sys 0.15.10",
"gobject-sys 0.15.10",
"libc",
"system-deps",
"system-deps 6.0.3",
"winapi 0.3.9",
]
@ -2098,10 +2092,29 @@ dependencies = [
"glib-sys 0.16.3",
"gobject-sys 0.16.3",
"libc",
"system-deps",
"system-deps 6.0.3",
"winapi 0.3.9",
]
[[package]]
name = "glib"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c685013b7515e668f1b57a165b009d4d28cb139a8a989bbd699c10dad29d0c5"
dependencies = [
"bitflags",
"futures-channel",
"futures-core",
"futures-executor",
"futures-task",
"futures-util",
"glib-macros 0.10.1",
"glib-sys 0.10.1",
"gobject-sys 0.10.0",
"libc",
"once_cell",
]
[[package]]
name = "glib"
version = "0.15.12"
@ -2144,6 +2157,22 @@ dependencies = [
"thiserror",
]
[[package]]
name = "glib-macros"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41486a26d1366a8032b160b59065a59fb528530a46a49f627e7048fb8c064039"
dependencies = [
"anyhow",
"heck 0.3.3",
"itertools",
"proc-macro-crate 0.1.5",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "glib-macros"
version = "0.15.11"
@ -2152,7 +2181,7 @@ checksum = "25a68131a662b04931e71891fb14aaf65ee4b44d08e8abc10f49e77418c86c64"
dependencies = [
"anyhow",
"heck 0.4.0",
"proc-macro-crate",
"proc-macro-crate 1.2.1",
"proc-macro-error",
"proc-macro2",
"quote",
@ -2167,13 +2196,23 @@ checksum = "e084807350b01348b6d9dbabb724d1a0bb987f47a2c85de200e98e12e30733bf"
dependencies = [
"anyhow",
"heck 0.4.0",
"proc-macro-crate",
"proc-macro-crate 1.2.1",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "glib-sys"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7e9b997a66e9a23d073f2b1abb4dbfc3925e0b8952f67efd8d9b6e168e4cdc1"
dependencies = [
"libc",
"system-deps 1.3.2",
]
[[package]]
name = "glib-sys"
version = "0.15.10"
@ -2181,7 +2220,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef4b192f8e65e9cf76cbf4ea71fa8e3be4a0e18ffe3d68b8da6836974cc5bad4"
dependencies = [
"libc",
"system-deps",
"system-deps 6.0.3",
]
[[package]]
@ -2191,7 +2230,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61a4f46316d06bfa33a7ac22df6f0524c8be58e3db2d9ca99ccb1f357b62a65"
dependencies = [
"libc",
"system-deps",
"system-deps 6.0.3",
]
[[package]]
@ -2200,6 +2239,17 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "gobject-sys"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "952133b60c318a62bf82ee75b93acc7e84028a093e06b9e27981c2b6fe68218c"
dependencies = [
"glib-sys 0.10.1",
"libc",
"system-deps 1.3.2",
]
[[package]]
name = "gobject-sys"
version = "0.15.10"
@ -2208,7 +2258,7 @@ checksum = "0d57ce44246becd17153bd035ab4d32cfee096a657fc01f2231c9278378d1e0a"
dependencies = [
"glib-sys 0.15.10",
"libc",
"system-deps",
"system-deps 6.0.3",
]
[[package]]
@ -2219,28 +2269,28 @@ checksum = "3520bb9c07ae2a12c7f2fbb24d4efc11231c8146a86956413fb1a79bb760a0f1"
dependencies = [
"glib-sys 0.16.3",
"libc",
"system-deps",
"system-deps 6.0.3",
]
[[package]]
name = "gstreamer"
version = "0.19.4"
version = "0.16.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87a7570ad1d3c1cbf64561ada514fe0c03cf834f2076b85ffc616756c840b665"
checksum = "9ff5d0f7ff308ae37e6eb47b6ded17785bdea06e438a708cd09e0288c1862f33"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
"futures-channel",
"futures-core",
"futures-util",
"glib 0.16.5",
"glib 0.10.3",
"glib-sys 0.10.1",
"gobject-sys 0.10.0",
"gstreamer-sys",
"libc",
"muldiv",
"num-integer",
"num-rational 0.4.1",
"num-rational",
"once_cell",
"option-operations",
"paste",
"pretty-hex",
"thiserror",
@ -2248,86 +2298,94 @@ dependencies = [
[[package]]
name = "gstreamer-app"
version = "0.19.2"
version = "0.16.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c45202b4d565034d4fe5577c990d3a99eaf0c2bfd2cb3f73f70db14d58e0208c"
checksum = "cc80888271338c3ede875d8cafc452eb207476ff5539dcbe0018a8f5b827af0e"
dependencies = [
"bitflags",
"futures-core",
"futures-sink",
"glib 0.16.5",
"glib 0.10.3",
"glib-sys 0.10.1",
"gobject-sys 0.10.0",
"gstreamer",
"gstreamer-app-sys",
"gstreamer-base",
"gstreamer-sys",
"libc",
"once_cell",
]
[[package]]
name = "gstreamer-app-sys"
version = "0.19.2"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29b0159da8dd0672c1a5507445c70c8dc483abfb63a0295cabaedd396f1d67d1"
checksum = "813f64275c9e7b33b828b9efcf9dfa64b95996766d4de996e84363ac65b87e3d"
dependencies = [
"glib-sys 0.16.3",
"glib-sys 0.10.1",
"gstreamer-base-sys",
"gstreamer-sys",
"libc",
"system-deps",
"system-deps 1.3.2",
]
[[package]]
name = "gstreamer-base"
version = "0.19.3"
version = "0.16.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a61a299f9ea2ca892b43e2e428b86c679875e95ba23f8ae06fd730308df630f0"
checksum = "bafd01c56f59cb10f4b5a10f97bb4bdf8c2b2784ae5b04da7e2d400cf6e6afcf"
dependencies = [
"atomic_refcell",
"bitflags",
"cfg-if 1.0.0",
"glib 0.16.5",
"glib 0.10.3",
"glib-sys 0.10.1",
"gobject-sys 0.10.0",
"gstreamer",
"gstreamer-base-sys",
"gstreamer-sys",
"libc",
]
[[package]]
name = "gstreamer-base-sys"
version = "0.19.3"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbc3c4476e1503ae245c89fbe20060c30ec6ade5f44620bcc402cbc70a3911a1"
checksum = "a4b7b6dc2d6e160a1ae28612f602bd500b3fa474ce90bf6bb2f08072682beef5"
dependencies = [
"glib-sys 0.16.3",
"gobject-sys 0.16.3",
"glib-sys 0.10.1",
"gobject-sys 0.10.0",
"gstreamer-sys",
"libc",
"system-deps",
"system-deps 1.3.2",
]
[[package]]
name = "gstreamer-sys"
version = "0.19.4"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "545f52ad8a480732cc4290fd65dfe42952c8ae374fe581831ba15981fedf18a4"
checksum = "fc1f154082d01af5718c5f8a8eb4f565a4ea5586ad8833a8fc2c2aa6844b601d"
dependencies = [
"glib-sys 0.16.3",
"gobject-sys 0.16.3",
"glib-sys 0.10.1",
"gobject-sys 0.10.0",
"libc",
"system-deps",
"system-deps 1.3.2",
]
[[package]]
name = "gstreamer-video"
version = "0.19.4"
version = "0.16.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e99623fb99436c4b2da66ae94b25881c94db5144afc1bd7c84cee5cabb72f18"
checksum = "f7bbb1485d87469849ec45c08e03c2f280d3ea20ff3c439d03185be54e3ce98e"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
"futures-channel",
"glib 0.16.5",
"futures-util",
"glib 0.10.3",
"glib-sys 0.10.1",
"gobject-sys 0.10.0",
"gstreamer",
"gstreamer-base",
"gstreamer-base-sys",
"gstreamer-sys",
"gstreamer-video-sys",
"libc",
"once_cell",
@ -2335,16 +2393,16 @@ dependencies = [
[[package]]
name = "gstreamer-video-sys"
version = "0.19.4"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9206e9df0ed84824bfe4cc13e3359154ad7624221c7d3d6242585db3f19a15d9"
checksum = "92347e46438007d6a2386302125f62cb9df6769cdacb931af5c0f12c1ee21de4"
dependencies = [
"glib-sys 0.16.3",
"gobject-sys 0.16.3",
"glib-sys 0.10.1",
"gobject-sys 0.10.0",
"gstreamer-base-sys",
"gstreamer-sys",
"libc",
"system-deps",
"system-deps 1.3.2",
]
[[package]]
@ -2385,7 +2443,7 @@ dependencies = [
"gobject-sys 0.15.10",
"libc",
"pango-sys",
"system-deps",
"system-deps 6.0.3",
]
[[package]]
@ -2395,7 +2453,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24f518afe90c23fba585b2d7697856f9e6a7bbc62f65588035e66f6afb01a2e9"
dependencies = [
"anyhow",
"proc-macro-crate",
"proc-macro-crate 1.2.1",
"proc-macro-error",
"proc-macro2",
"quote",
@ -2642,7 +2700,7 @@ dependencies = [
"byteorder",
"color_quant",
"num-iter",
"num-rational 0.3.2",
"num-rational",
"num-traits 0.2.15",
"png",
"tiff",
@ -2732,6 +2790,15 @@ version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec947b7a4ce12e3b87e353abae7ce124d025b6c7d6c5aea5cc0bcf92e9510ded"
[[package]]
name = "itertools"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "0.3.4"
@ -3185,9 +3252,9 @@ dependencies = [
[[package]]
name = "muldiv"
version = "1.0.1"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0"
checksum = "0419348c027fa7be448d2ae7ea0e4e04c2334c31dc4e74ab29f00a2a7ca69204"
[[package]]
name = "ndk"
@ -3272,7 +3339,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c"
dependencies = [
"darling",
"proc-macro-crate",
"proc-macro-crate 1.2.1",
"proc-macro2",
"quote",
"syn",
@ -3459,17 +3526,6 @@ dependencies = [
"num-traits 0.2.15",
]
[[package]]
name = "num-rational"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
dependencies = [
"autocfg 1.1.0",
"num-integer",
"num-traits 0.2.15",
]
[[package]]
name = "num-traits"
version = "0.1.43"
@ -3513,7 +3569,7 @@ version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce"
dependencies = [
"proc-macro-crate",
"proc-macro-crate 1.2.1",
"proc-macro2",
"quote",
"syn",
@ -3601,15 +3657,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "option-operations"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c26d27bb1aeab65138e4bf7666045169d1717febcc9ff870166be8348b223d0"
dependencies = [
"paste",
]
[[package]]
name = "ordered-multimap"
version = "0.4.3"
@ -3664,7 +3711,7 @@ dependencies = [
"glib-sys 0.15.10",
"gobject-sys 0.15.10",
"libc",
"system-deps",
"system-deps 6.0.3",
]
[[package]]
@ -3880,9 +3927,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "pretty-hex"
version = "0.3.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5"
checksum = "bc5c99d529f0d30937f6f4b8a86d988047327bb88d04d2c4afc356de74722131"
[[package]]
name = "primal-check"
@ -3893,6 +3940,15 @@ dependencies = [
"num-integer",
]
[[package]]
name = "proc-macro-crate"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
dependencies = [
"toml",
]
[[package]]
name = "proc-macro-crate"
version = "1.2.1"
@ -4249,7 +4305,7 @@ dependencies = [
[[package]]
name = "rdev"
version = "0.5.0-2"
source = "git+https://github.com/asur4s/rdev#18bb9dd64563fc9761005bb39ff830e6402e326e"
source = "git+https://github.com/asur4s/rdev#81aa6559e931fed914e0d38edfd98cbe4bc908c1"
dependencies = [
"cocoa",
"core-foundation 0.9.3",
@ -4262,8 +4318,8 @@ dependencies = [
"libc",
"log",
"mio 0.8.5",
"strum",
"strum_macros",
"strum 0.24.1",
"strum_macros 0.24.3",
"widestring 1.0.2",
"winapi 0.3.9",
"x11 2.20.1",
@ -5118,12 +5174,30 @@ dependencies = [
"syn",
]
[[package]]
name = "strum"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b"
[[package]]
name = "strum"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"
[[package]]
name = "strum_macros"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c"
dependencies = [
"heck 0.3.3",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "strum_macros"
version = "0.24.3"
@ -5209,6 +5283,21 @@ dependencies = [
"libc",
]
[[package]]
name = "system-deps"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f3ecc17269a19353b3558b313bba738b25d82993e30d62a18406a24aba4649b"
dependencies = [
"heck 0.3.3",
"pkg-config",
"strum 0.18.0",
"strum_macros 0.18.0",
"thiserror",
"toml",
"version-compare 0.0.10",
]
[[package]]
name = "system-deps"
version = "6.0.3"
@ -5219,7 +5308,7 @@ dependencies = [
"heck 0.4.0",
"pkg-config",
"toml",
"version-compare",
"version-compare 0.1.1",
]
[[package]]
@ -5650,6 +5739,12 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version-compare"
version = "0.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1"
[[package]]
name = "version-compare"
version = "0.1.1"
@ -6476,7 +6571,7 @@ version = "3.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45066039ebf3330820e495e854f8b312abb68f0a39e97972d092bd72e8bb3e8e"
dependencies = [
"proc-macro-crate",
"proc-macro-crate 1.2.1",
"proc-macro2",
"quote",
"regex",
@ -6543,7 +6638,7 @@ version = "3.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "155247a5d1ab55e335421c104ccd95d64f17cebbd02f50cdbc1c33385f9c4d81"
dependencies = [
"proc-macro-crate",
"proc-macro-crate 1.2.1",
"proc-macro2",
"quote",
"syn",

View File

@ -9,11 +9,12 @@ class RawKeyFocusScope extends StatelessWidget {
final InputModel inputModel;
final Widget child;
RawKeyFocusScope(
{this.focusNode,
this.onFocusChange,
required this.inputModel,
required this.child});
RawKeyFocusScope({
this.focusNode,
this.onFocusChange,
required this.inputModel,
required this.child,
});
@override
Widget build(BuildContext context) {
@ -35,11 +36,15 @@ class RawPointerMouseRegion extends StatelessWidget {
final MouseCursor? cursor;
final PointerEnterEventListener? onEnter;
final PointerExitEventListener? onExit;
final PointerDownEventListener? onPointerDown;
final PointerUpEventListener? onPointerUp;
RawPointerMouseRegion(
{this.onEnter,
this.onExit,
this.cursor,
this.onPointerDown,
this.onPointerUp,
required this.inputModel,
required this.child});
@ -47,8 +52,14 @@ class RawPointerMouseRegion extends StatelessWidget {
Widget build(BuildContext context) {
return Listener(
onPointerHover: inputModel.onPointHoverImage,
onPointerDown: inputModel.onPointDownImage,
onPointerUp: inputModel.onPointUpImage,
onPointerDown: (evt) {
onPointerDown?.call(evt);
inputModel.onPointDownImage(evt);
},
onPointerUp: (evt) {
onPointerUp?.call(evt);
inputModel.onPointUpImage(evt);
},
onPointerMove: inputModel.onPointMoveImage,
onPointerSignal: inputModel.onPointerSignalImage,
/*

View File

@ -52,6 +52,7 @@ class _RemotePageState extends State<RemotePage>
with AutomaticKeepAliveClientMixin, MultiWindowListener {
Timer? _timer;
String keyboardMode = "legacy";
bool _isWindowBlur = false;
final _cursorOverImage = false.obs;
late RxBool _showRemoteCursor;
late RxBool _zoomCursor;
@ -59,7 +60,6 @@ class _RemotePageState extends State<RemotePage>
late RxBool _keyboardEnabled;
final FocusNode _rawKeyFocusNode = FocusNode(debugLabel: "rawkeyFocusNode");
var _imageFocused = false;
Function(bool)? _onEnterOrLeaveImage4Menubar;
@ -104,7 +104,6 @@ class _RemotePageState extends State<RemotePage>
if (!Platform.isLinux) {
Wakelock.enable();
}
_rawKeyFocusNode.requestFocus();
_ffi.ffiModel.updateEventListener(widget.id);
_ffi.qualityMonitorModel.checkShowQualityMonitor(widget.id);
// Session option should be set after models.dart/FFI.start
@ -129,14 +128,31 @@ class _RemotePageState extends State<RemotePage>
@override
void onWindowBlur() {
super.onWindowBlur();
// unfocus the key focus when the whole window is lost focus,
// and let OS to handle events instead.
_rawKeyFocusNode.unfocus();
// On windows, we use `focus` way to handle keyboard better.
// Now on Linux, there's some rdev issues which will break the input.
// We disable the `focus` way for non-Windows temporarily.
if (Platform.isWindows) {
_isWindowBlur = true;
// unfocus the primary-focus when the whole window is lost focus,
// and let OS to handle events instead.
_rawKeyFocusNode.unfocus();
}
}
@override
void onWindowFocus() {
super.onWindowFocus();
// See [onWindowBlur].
if (Platform.isWindows) {
_isWindowBlur = false;
}
}
@override
void dispose() {
debugPrint("REMOTE PAGE dispose ${widget.id}");
// ensure we leave this session, this is a double check
bind.sessionEnterOrLeave(id: widget.id, enter: false);
DesktopMultiWindow.removeListener(this);
_ffi.dialogManager.hideMobileActionsOverlay();
_ffi.recordingModel.onClose();
@ -166,12 +182,22 @@ class _RemotePageState extends State<RemotePage>
color: Colors.black,
child: RawKeyFocusScope(
focusNode: _rawKeyFocusNode,
onFocusChange: (bool v) {
_imageFocused = v;
if (_imageFocused) {
_ffi.inputModel.enterOrLeave(true);
} else {
_ffi.inputModel.enterOrLeave(false);
onFocusChange: (bool imageFocused) {
debugPrint(
"onFocusChange(window active:${!_isWindowBlur}) $imageFocused");
// See [onWindowBlur].
if (Platform.isWindows) {
if (_isWindowBlur) {
imageFocused = false;
Future.delayed(Duration.zero, () {
_rawKeyFocusNode.unfocus();
});
}
if (imageFocused) {
_ffi.inputModel.enterOrLeave(true);
} else {
_ffi.inputModel.enterOrLeave(false);
}
}
},
inputModel: _ffi.inputModel,
@ -199,9 +225,6 @@ class _RemotePageState extends State<RemotePage>
}
void enterView(PointerEnterEvent evt) {
if (!_imageFocused) {
_rawKeyFocusNode.requestFocus();
}
_cursorOverImage.value = true;
_firstEnterImage.value = true;
if (_onEnterOrLeaveImage4Menubar != null) {
@ -211,6 +234,13 @@ class _RemotePageState extends State<RemotePage>
//
}
}
// See [onWindowBlur].
if (!Platform.isWindows) {
if (!_rawKeyFocusNode.hasFocus) {
_rawKeyFocusNode.requestFocus();
}
bind.sessionEnterOrLeave(id: widget.id, enter: true);
}
}
void leaveView(PointerExitEvent evt) {
@ -223,6 +253,10 @@ class _RemotePageState extends State<RemotePage>
//
}
}
// See [onWindowBlur].
if (!Platform.isWindows) {
bind.sessionEnterOrLeave(id: widget.id, enter: false);
}
}
Widget getBodyForDesktop(BuildContext context) {
@ -244,6 +278,11 @@ class _RemotePageState extends State<RemotePage>
listenerBuilder: (child) => RawPointerMouseRegion(
onEnter: enterView,
onExit: leaveView,
onPointerDown: (event) {
if (!_rawKeyFocusNode.hasFocus) {
_rawKeyFocusNode.requestFocus();
}
},
inputModel: _ffi.inputModel,
child: child,
),

View File

@ -827,7 +827,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
qualityInitValue = qualityMaxValue;
}
final RxDouble qualitySliderValue = RxDouble(qualityInitValue);
final debouncerQuanlity = Debouncer<double>(
final debouncerQuality = Debouncer<double>(
Duration(milliseconds: 1000),
onChanged: (double v) {
setCustomValues(quality: v);
@ -843,7 +843,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
divisions: 90,
onChanged: (double value) {
qualitySliderValue.value = value;
debouncerQuanlity.value = value;
debouncerQuality.value = value;
},
),
SizedBox(

View File

@ -48,9 +48,9 @@ bindgen = "0.59"
[target.'cfg(target_os = "linux")'.dependencies]
dbus = { version = "0.9", optional = true }
tracing = { version = "0.1", optional = true }
gstreamer = { version = "0.19", optional = true }
gstreamer-app = { version = "0.19", features = ["v1_16"], optional = true }
gstreamer-video = { version = "0.19", optional = true }
gstreamer = { version = "0.16", optional = true }
gstreamer-app = { version = "0.16", features = ["v1_10"], optional = true }
gstreamer-video = { version = "0.16", optional = true }
[target.'cfg(any(target_os = "windows", target_os = "linux"))'.dependencies]
hwcodec = { git = "https://github.com/21pages/hwcodec", optional = true }

View File

@ -130,18 +130,18 @@ impl PipeWireRecorder {
pub fn new(capturable: PipeWireCapturable) -> Result<Self, Box<dyn Error>> {
let pipeline = gst::Pipeline::new(None);
let src = gst::ElementFactory::make_with_name("pipewiresrc", None)?;
src.set_property("fd", &capturable.fd.as_raw_fd());
src.set_property("path", &format!("{}", capturable.path));
src.set_property("keepalive_time", &1_000.as_raw_fd());
let src = gst::ElementFactory::make("pipewiresrc", None)?;
src.set_property("fd", &capturable.fd.as_raw_fd())?;
src.set_property("path", &format!("{}", capturable.path))?;
src.set_property("keepalive_time", &1_000.as_raw_fd())?;
// For some reason pipewire blocks on destruction of AppSink if this is not set to true,
// see: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/982
src.set_property("always-copy", &true);
src.set_property("always-copy", &true)?;
let sink = gst::ElementFactory::make_with_name("appsink", None)?;
sink.set_property("drop", &true);
sink.set_property("max-buffers", &1u32);
let sink = gst::ElementFactory::make("appsink", None)?;
sink.set_property("drop", &true)?;
sink.set_property("max-buffers", &1u32)?;
pipeline.add_many(&[&src, &sink])?;
src.link(&sink)?;
@ -182,21 +182,25 @@ impl Recorder for PipeWireRecorder {
.try_pull_sample(gst::ClockTime::from_mseconds(timeout_ms))
{
let cap = sample
.caps()
.get_caps()
.ok_or("Failed get caps")?
.structure(0)
.get_structure(0)
.ok_or("Failed to get structure")?;
let w: i32 = cap.value("width")?.get()?;
let h: i32 = cap.value("height")?.get()?;
self.pix_fmt = cap.value("format")?.get()?;
let w: i32 = cap.get_value("width")?.get_some()?;
let h: i32 = cap.get_value("height")?.get_some()?;
let w = w as usize;
let h = h as usize;
self.pix_fmt = cap
.get::<&str>("format")?
.ok_or("Failed to get pixel format")?
.to_string();
let buf = sample
.buffer_owned()
.get_buffer_owned()
.ok_or_else(|| GStreamerError("Failed to get owned buffer.".into()))?;
let mut crop = buf
.meta::<gstreamer_video::VideoCropMeta>()
.map(|m| m.rect());
.get_meta::<gstreamer_video::VideoCropMeta>()
.map(|m| m.get_rect());
// only crop if necessary
if Some((0, 0, w as u32, h as u32)) == crop {
crop = None;
@ -207,7 +211,7 @@ impl Recorder for PipeWireRecorder {
if let Err(..) = crate::would_block_if_equal(&mut self.saved_raw_data, buf.as_slice()) {
return Ok(PixelProvider::NONE);
}
let buf_size = buf.size();
let buf_size = buf.get_size();
// BGRx is 4 bytes per pixel
if buf_size != (w * h * 4) {
// for some reason the width and height of the caps do not guarantee correct buffer

View File

@ -334,7 +334,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Scale original", "Escala original"),
("Scale adaptive", "Escala adaptativa"),
("General", ""),
("Security", "Seguritat"),
("Security", "Seguretat"),
("Account", "Compte"),
("Theme", "Tema"),
("Dark Theme", "Tema Fosc"),
@ -342,7 +342,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Light", "Clar"),
("Follow System", "Tema del sistema"),
("Enable hardware codec", "Habilitar còdec per hardware"),
("Unlock Security Settings", "Desbloquejar ajustaments de seguritat"),
("Unlock Security Settings", "Desbloquejar ajustaments de seguretat"),
("Enable Audio", "Habilitar àudio"),
("Unlock Network Settings", "Desbloquejar Ajustaments de Xarxa"),
("Server", "Servidor"),