show disabled cursor on the control end

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2022-10-16 12:29:51 +08:00
parent 268dddc303
commit 52a21234d4
2 changed files with 38 additions and 5 deletions

View File

@ -280,10 +280,12 @@ class ImagePaint extends StatelessWidget {
final s = c.scale; final s = c.scale;
mouseRegion({child}) => Obx(() => MouseRegion( mouseRegion({child}) => Obx(() => MouseRegion(
cursor: (cursorOverImage.isTrue && keyboardEnabled.isTrue) cursor: cursorOverImage.isTrue
? (remoteCursorMoved.isTrue ? keyboardEnabled.isTrue
? SystemMouseCursors.none ? (remoteCursorMoved.isTrue
: _buildCustomCursorLinux(context, s)) ? SystemMouseCursors.none
: _buildCustomCursorLinux(context, s))
: _buildDisabledCursor(context, s)
: MouseCursor.defer, : MouseCursor.defer,
onHover: (evt) {}, onHover: (evt) {},
child: child)); child: child));
@ -350,6 +352,28 @@ class ImagePaint extends StatelessWidget {
} }
} }
MouseCursor _buildDisabledCursor(BuildContext context, double scale) {
final cursor = Provider.of<CursorModel>(context);
final cacheLinux = cursor.cacheLinux;
if (cacheLinux == null) {
return MouseCursor.defer;
} else {
if (cursor.cachedForbidmemoryCursorData == null) {
cursor.updateForbiddenCursorBuffer();
}
final key = 'disabled_cursor_key';
cursor.addKeyLinux(key);
return FlutterCustomMemoryImageCursor(
pixbuf: cursor.cachedForbidmemoryCursorData,
key: key,
hotx: cacheLinux.hotx,
hoty: cacheLinux.hoty,
imageWidth: 32,
imageHeight: 32,
);
}
}
Widget _buildCrossScrollbarFromLayout( Widget _buildCrossScrollbarFromLayout(
BuildContext context, Widget child, Size layoutSize, Size size) { BuildContext context, Widget child, Size layoutSize, Size size) {
final scrollConfig = CustomMouseWheelScrollConfig( final scrollConfig = CustomMouseWheelScrollConfig(

View File

@ -79,7 +79,10 @@ class FfiModel with ChangeNotifier {
if (k == 'name' || k.isEmpty) return; if (k == 'name' || k.isEmpty) return;
_permissions[k] = v == 'true'; _permissions[k] = v == 'true';
}); });
KeyboardEnabledState.find(id).value = _permissions['keyboard'] != false; // Only inited at remote page
if (desktopType == DesktopType.remote) {
KeyboardEnabledState.find(id).value = _permissions['keyboard'] != false;
}
debugPrint('$_permissions'); debugPrint('$_permissions');
notifyListeners(); notifyListeners();
} }
@ -938,6 +941,12 @@ class CursorModel with ChangeNotifier {
customCursorController.freeCache(key); customCursorController.freeCache(key);
} }
} }
Uint8List? cachedForbidmemoryCursorData;
void updateForbiddenCursorBuffer() {
cachedForbidmemoryCursorData ??= base64Decode(
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAkZQTFRFAAAA2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4G2B4GWAwCAAAAAAAA2B4GAAAAMTExAAAAAAAA2B4G2B4G2B4GAAAAmZmZkZGRAQEBAAAA2B4G2B4G2B4G////oKCgAwMDag8D2B4G2B4G2B4Gra2tBgYGbg8D2B4G2B4Gubm5CQkJTwsCVgwC2B4GxcXFDg4OAAAAAAAA2B4G2B4Gz8/PFBQUAAAAAAAA2B4G2B4G2B4G2B4G2B4G2B4G2B4GDgIA2NjYGxsbAAAAAAAA2B4GFwMB4eHhIyMjAAAAAAAA2B4G6OjoLCwsAAAAAAAA2B4G2B4G2B4G2B4G2B4GCQEA4ODgv7+/iYmJY2NjAgICAAAA9PT0Ojo6AAAAAAAAAAAA+/v7SkpKhYWFr6+vAAAAAAAA8/PzOTk5ERER9fX1KCgoAAAAgYGBKioqAAAAAAAApqamlpaWAAAAAAAAAAAAAAAAAAAAAAAALi4u/v7+GRkZAAAAAAAAAAAAAAAAAAAAfn5+AAAAAAAAV1dXkJCQAAAAAAAAAQEBAAAAAAAAAAAA7Hz6BAAAAMJ0Uk5TAAIWEwEynNz6//fVkCAatP2fDUHs6cDD8d0mPfT5fiEskiIR584A0gejr3AZ+P4plfALf5ZiTL85a4ziD6697fzN3UYE4v/4TwrNHuT///tdRKZh///+1U/ZBv///yjb///eAVL//50Cocv//6oFBbPvpGZCbfT//7cIhv///8INM///zBEcWYSZmO7//////1P////ts/////8vBv//////gv//R/z///QQz9sevP///2waXhNO/+fc//8mev/5gAe2r90MAAAByUlEQVR4nGNggANGJmYWBpyAlY2dg5OTi5uHF6s0H78AJxRwCAphyguLgKRExcQlQLSkFLq8tAwnp6ycPNABjAqKQKNElVDllVU4OVVhVquJA81Q10BRoAkUUYbJa4Edoo0sr6PLqaePLG/AyWlohKTAmJPTBFnelAFoixmSAnNOTgsUeQZLTk4rJAXWnJw2EHlbiDyDPCenHZICe04HFrh+RydnBgYWPU5uJAWinJwucPNd3dw9GDw5Ob2QFHBzcnrD7ffx9fMPCOTkDEINhmC4+3x8Q0LDwlEDIoKTMzIKKg9SEBIdE8sZh6SAJZ6Tkx0qD1YQkpCYlIwclCng0AXLQxSEpKalZyCryATKZwkhKQjJzsnNQ1KQXwBUUVhUXBJYWgZREFJeUVmFpMKlWg+anmqgCkJq6+obkG1pLEBTENLU3NKKrIKhrb2js8u4G6Kgpze0r3/CRAZMAHbkpJDJU6ZMmTqtFbuC6TNmhsyaMnsOFlmwgrnzpsxfELJwEXZ5Bp/FS3yWLlsesmLlKuwKVk9Ys5Zh3foN0zduwq5g85atDAzbpqSGbN9RhV0FGOzctWH3lD14FOzdt3H/gQw8Cg4u2gQPAwBYDXXdIH+wqAAAAABJRU5ErkJggg==');
}
} }
class QualityMonitorData { class QualityMonitorData {