Merge pull request #1622 from Kingtous/master
fix: cm window size, hide window on startup linux
This commit is contained in:
		
						commit
						2b6d396a6d
					
				| @ -19,6 +19,8 @@ const int kMobileDefaultDisplayHeight = 1280; | |||||||
| const int kDesktopDefaultDisplayWidth = 1080; | const int kDesktopDefaultDisplayWidth = 1080; | ||||||
| const int kDesktopDefaultDisplayHeight = 720; | const int kDesktopDefaultDisplayHeight = 720; | ||||||
| 
 | 
 | ||||||
|  | const Size kConnectionManagerWindowSize = Size(300, 400); | ||||||
|  | 
 | ||||||
| /// [kDefaultScrollAmountMultiplier] indicates how many rows can be scrolled after a minimum scroll action of mouse | /// [kDefaultScrollAmountMultiplier] indicates how many rows can be scrolled after a minimum scroll action of mouse | ||||||
| const kDefaultScrollAmountMultiplier = 5.0; | const kDefaultScrollAmountMultiplier = 5.0; | ||||||
| const kDefaultScrollDuration = Duration(milliseconds: 50); | const kDefaultScrollDuration = Duration(milliseconds: 50); | ||||||
|  | |||||||
| @ -103,6 +103,7 @@ void runMainApp(bool startService) async { | |||||||
|     restoreWindowPosition(WindowType.Main); |     restoreWindowPosition(WindowType.Main); | ||||||
|     await windowManager.show(); |     await windowManager.show(); | ||||||
|     await windowManager.focus(); |     await windowManager.focus(); | ||||||
|  |     await windowManager.setOpacity(1); | ||||||
|   }); |   }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -190,8 +191,13 @@ void runPortForwardScreen(Map<String, dynamic> argument) async { | |||||||
| void runConnectionManagerScreen() async { | void runConnectionManagerScreen() async { | ||||||
|   // initialize window |   // initialize window | ||||||
|   WindowOptions windowOptions = |   WindowOptions windowOptions = | ||||||
|       getHiddenTitleBarWindowOptions(size: const Size(300, 400)); |       getHiddenTitleBarWindowOptions(size: kConnectionManagerWindowSize); | ||||||
|   await initEnv(kAppTypeMain); |   // ensure initial window size to be changed | ||||||
|  |   await windowManager.setSize(kConnectionManagerWindowSize); | ||||||
|  |   await Future.wait([ | ||||||
|  |     windowManager.setAlignment(Alignment.topRight), | ||||||
|  |     initEnv(kAppTypeMain) | ||||||
|  |   ]); | ||||||
|   runApp(GetMaterialApp( |   runApp(GetMaterialApp( | ||||||
|       debugShowCheckedModeBanner: false, |       debugShowCheckedModeBanner: false, | ||||||
|       theme: MyTheme.lightTheme, |       theme: MyTheme.lightTheme, | ||||||
| @ -206,17 +212,17 @@ void runConnectionManagerScreen() async { | |||||||
|       home: const DesktopServerPage(), |       home: const DesktopServerPage(), | ||||||
|       builder: _keepScaleBuilder())); |       builder: _keepScaleBuilder())); | ||||||
|   windowManager.waitUntilReadyToShow(windowOptions, () async { |   windowManager.waitUntilReadyToShow(windowOptions, () async { | ||||||
|     await windowManager.setAlignment(Alignment.topRight); |     windowManager.show(); | ||||||
|     await windowManager.show(); |     windowManager.focus(); | ||||||
|     await windowManager.focus(); |     windowManager.setOpacity(1); | ||||||
|     await windowManager.setAlignment(Alignment.topRight); // ensure |     windowManager.setAlignment(Alignment.topRight); // ensure | ||||||
|   }); |   }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| WindowOptions getHiddenTitleBarWindowOptions({Size? size}) { | WindowOptions getHiddenTitleBarWindowOptions({Size? size}) { | ||||||
|   return WindowOptions( |   return WindowOptions( | ||||||
|     size: size, |     size: size, | ||||||
|     center: true, |     center: false, | ||||||
|     backgroundColor: Colors.transparent, |     backgroundColor: Colors.transparent, | ||||||
|     skipTaskbar: false, |     skipTaskbar: false, | ||||||
|     titleBarStyle: TitleBarStyle.hidden, |     titleBarStyle: TitleBarStyle.hidden, | ||||||
|  | |||||||
| @ -53,6 +53,7 @@ static void my_application_activate(GApplication* application) { | |||||||
|   // bdw->setCustomFrame(true);               // <-- add this line
 |   // bdw->setCustomFrame(true);               // <-- add this line
 | ||||||
|   gtk_window_set_default_size(window, 800, 600);   // <-- comment this line
 |   gtk_window_set_default_size(window, 800, 600);   // <-- comment this line
 | ||||||
|   gtk_widget_show(GTK_WIDGET(window)); |   gtk_widget_show(GTK_WIDGET(window)); | ||||||
|  |   gtk_widget_set_opacity(GTK_WIDGET(window), 0); | ||||||
| 
 | 
 | ||||||
|   g_autoptr(FlDartProject) project = fl_dart_project_new(); |   g_autoptr(FlDartProject) project = fl_dart_project_new(); | ||||||
|   fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); |   fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user