Merge pull request #1797 from Kingtous/master

fix: windows cm popup issue & close button color & multi window
This commit is contained in:
RustDesk 2022-10-24 17:18:46 +08:00 committed by GitHub
commit 90172c4f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 32 deletions

View File

@ -171,6 +171,7 @@ class DesktopTabController {
class TabThemeConf {
double iconSize;
TabThemeConf({required this.iconSize});
}
@ -199,6 +200,7 @@ class DesktopTab extends StatelessWidget {
final Color? unSelectedTabBackgroundColor;
final DesktopTabController controller;
Rx<DesktopTabState> get state => controller.state;
final isMaximized = false.obs;
final _scrollDebounce = Debouncer(delay: Duration(milliseconds: 50));
@ -606,7 +608,8 @@ Future<bool> closeConfirmDialog() async {
setState(() => confirm = v);
},
)
]), // confirm checkbox
]),
// confirm checkbox
actions: [
TextButton(onPressed: close, child: Text(translate("Cancel"))),
ElevatedButton(onPressed: submit, child: Text(translate("OK"))),
@ -864,13 +867,14 @@ class _CloseButton extends StatelessWidget {
}
}
class ActionIcon extends StatelessWidget {
class ActionIcon extends StatefulWidget {
final String? message;
final IconData icon;
final Function() onTap;
final bool isClose;
final double iconSize;
final double boxSize;
const ActionIcon(
{Key? key,
this.message,
@ -881,31 +885,45 @@ class ActionIcon extends StatelessWidget {
this.boxSize = _kTabBarHeight - 1})
: super(key: key);
@override
State<ActionIcon> createState() => _ActionIconState();
}
class _ActionIconState extends State<ActionIcon> {
var hover = false.obs;
@override
void initState() {
super.initState();
hover.value = false;
}
@override
Widget build(BuildContext context) {
RxBool hover = false.obs;
return Obx(() => Tooltip(
message: message != null ? translate(message!) : "",
waitDuration: const Duration(seconds: 1),
child: InkWell(
hoverColor: isClose
? const Color.fromARGB(255, 196, 43, 28)
: MyTheme.tabbar(context).hoverColor,
onHover: (value) => hover.value = value,
onTap: onTap,
child: SizedBox(
height: boxSize,
width: boxSize,
child: Icon(
icon,
color: hover.value && isClose
? Colors.white
: MyTheme.tabbar(context).unSelectedIconColor,
size: iconSize,
),
return Tooltip(
message: widget.message != null ? translate(widget.message!) : "",
waitDuration: const Duration(seconds: 1),
child: Obx(
() => InkWell(
hoverColor: widget.isClose
? const Color.fromARGB(255, 196, 43, 28)
: MyTheme.tabbar(context).hoverColor,
onHover: (value) => hover.value = value,
onTap: widget.onTap,
child: SizedBox(
height: widget.boxSize,
width: widget.boxSize,
child: Icon(
widget.icon,
color: hover.value && widget.isClose
? Colors.white
: MyTheme.tabbar(context).unSelectedIconColor,
size: widget.iconSize,
),
),
));
),
),
);
}
}

View File

@ -64,7 +64,7 @@ dependencies:
desktop_multi_window:
git:
url: https://github.com/Kingtous/rustdesk_desktop_multi_window
ref: 541f05f766c3f72984ff40b70dd3c7d061f2ce61
ref: cbc172f02cf3ac136c7503015037e9867e594150
freezed_annotation: ^2.0.3
tray_manager:
git:

View File

@ -47,16 +47,18 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
std::vector<std::string> rust_args(c_args, c_args + args_len);
free_c_args(c_args, args_len);
// uni links dispatch
HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"rustdesk");
if (hwnd != NULL) {
DispatchToUniLinksDesktop(hwnd);
// uni links dispatch
// only do uni links when dispatch a rustdesk links
if (!rust_args.empty() && rust_args.front().compare("rustdesk://") == 0) {
HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"rustdesk");
if (hwnd != NULL) {
DispatchToUniLinksDesktop(hwnd);
::ShowWindow(hwnd, SW_NORMAL);
::SetForegroundWindow(hwnd);
return EXIT_FAILURE;
::ShowWindow(hwnd, SW_NORMAL);
::SetForegroundWindow(hwnd);
return EXIT_FAILURE;
}
}
// Attach to console when present (e.g., 'flutter run') or create a
// new console when running with a debugger.
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent())