diff --git a/.github/patches/cycle_monitor.diff b/.github/patches/cycle_monitor.diff new file mode 100644 index 0000000..9381b23 --- /dev/null +++ b/.github/patches/cycle_monitor.diff @@ -0,0 +1,87 @@ +diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart +index 839ea1a81..9cee52263 100644 +--- a/flutter/lib/desktop/widgets/remote_toolbar.dart ++++ b/flutter/lib/desktop/widgets/remote_toolbar.dart +@@ -437,6 +437,7 @@ class _RemoteToolbarState extends State { + borderRadius: borderRadius, + child: _DraggableShowHide( + id: widget.id, ++ ffi: widget.ffi, + sessionId: widget.ffi.sessionId, + dragging: _dragging, + fractionX: _fractionX, +@@ -2234,6 +2235,7 @@ class RdoMenuButton extends StatelessWidget { + + class _DraggableShowHide extends StatefulWidget { + final String id; ++ final FFI ffi; + final SessionID sessionId; + final RxDouble fractionX; + final RxBool dragging; +@@ -2246,6 +2248,7 @@ class _DraggableShowHide extends StatefulWidget { + const _DraggableShowHide({ + Key? key, + required this.id, ++ required this.ffi, + required this.sessionId, + required this.fractionX, + required this.dragging, +@@ -2357,6 +2360,7 @@ class _DraggableShowHideState extends State<_DraggableShowHide> { + mainAxisSize: MainAxisSize.min, + children: [ + _buildDraggable(context), ++ _CycleMonitorMenu(id: widget.id, ffi: widget.ffi), + Obx(() => buttonWrapper( + () { + widget.setFullscreen(!isFullscreen.value); +@@ -2463,3 +2467,50 @@ Widget _buildPointerTrackWidget(Widget child, FFI? ffi) { + ), + ); + } ++ ++class _CycleMonitorMenu extends StatelessWidget { ++ final String id; ++ final FFI ffi; ++ ++ const _CycleMonitorMenu({ ++ Key? key, ++ required this.id, ++ required this.ffi, ++ }) : super(key: key); ++ ++ @override ++ Widget build(BuildContext context) { ++ final pi = ffi.ffiModel.pi; ++ ++ //for (int i = 0; i < pi.displays.length; i++) { ++ return TextButton( ++ onPressed: () { ++ RxInt display = CurrentDisplayState.find(id); ++ display.value = display.value + 1; ++ if (display.value >= pi.displays.length) { ++ display.value = 0; ++ } ++ openMonitorInTheSameTab(display.value, ffi, pi); ++ pi.currentDisplay = display.value; ++ }, ++ child: Stack(children: [ ++ Container( ++ child: Align( ++ alignment: Alignment.center, ++ child: const Icon( ++ Icons.personal_video, ++ color: _ToolbarTheme.blueColor, ++ size: 20.0, ++ ))), ++ Container( ++ child: Align( ++ alignment: Alignment(0.0, -0.4), ++ child: Text( ++ ' ${CurrentDisplayState.find(id).value + 1}/${pi.displays.length}', ++ style: const TextStyle( ++ color: _ToolbarTheme.blueColor, fontSize: 8), ++ ))), ++ ]), ++ ); ++ } ++} diff --git a/.github/workflows/generator-windows.yml b/.github/workflows/generator-windows.yml index 85a7ad6..584c778 100644 --- a/.github/workflows/generator-windows.yml +++ b/.github/workflows/generator-windows.yml @@ -357,58 +357,7 @@ jobs: if: fromJson(inputs.extras).cycleMonitor == 'true' shell: bash run: | - #add cycle monitor button to ./flutter/lib/desktop/widgets/remote_toolbar.dart - new_code="class _CycleMonitorMenu extends StatelessWidget { - final String id; - final FFI ffi; - - const _CycleMonitorMenu({ - Key? key, - required this.id, - required this.ffi, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - final pi = ffi.ffiModel.pi; - - //for (int i = 0; i < pi.displays.length; i++) { - return TextButton( - onPressed: () { - RxInt display = CurrentDisplayState.find(id); - display.value = display.value + 1; - if (display.value >= pi.displays.length) { - display.value = 0; - } - openMonitorInTheSameTab(display.value, ffi, pi); - pi.currentDisplay = display.value; - }, - child: Stack(children: [ - Container( - child: Align( - alignment: Alignment.center, - child: const Icon( - Icons.personal_video, - color: _ToolbarTheme.blueColor, - size: 20.0, - ))), - Container( - child: Align( - alignment: Alignment(0.0, -0.4), - child: Text( - ' ${CurrentDisplayState.find(id).value + 1}/${pi.displays.length}', - style: const TextStyle( - color: _ToolbarTheme.blueColor, fontSize: 8), - ))), - ]), - ); - } - }" - echo $new_code >> ./flutter/lib/desktop/widgets/remote_toolbar.dart - sed -i '/_buildDraggable(context),/a\\ \ \ \ \ \ \ \ _CycleMonitorMenu(id: widget.id, ffi: widget.ffi),' ./flutter/lib/desktop/widgets/remote_toolbar.dart - sed -i '/dragging: _dragging,/a\\ \ \ \ \ \ \ \ \ \ \ \ \ \ ffi: widget.ffi,' ./flutter/lib/desktop/widgets/remote_toolbar.dart - sed -i '/final SessionID sessionId;/a\\ \ final FFI ffi;' ./flutter/lib/desktop/widgets/remote_toolbar.dart - sed -i '/required this.sessionId,/a\\ \ \ \ required this.ffi,' ./flutter/lib/desktop/widgets/remote_toolbar.dart + git apply .github/patches/cycle_monitor.diff - name: run as admin