This commit is contained in:
Alessandro Autiero
2023-08-24 19:28:31 +02:00
parent cd7db4cf71
commit 69f2dcd527
70 changed files with 677 additions and 1087 deletions

View File

@@ -8,6 +8,7 @@
#include <app_links/app_links_plugin_c_api.h>
#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
#include <flutter_acrylic/flutter_acrylic_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <system_theme/system_theme_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
@@ -18,6 +19,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
BitsdojoWindowPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("BitsdojoWindowPlugin"));
FlutterAcrylicPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterAcrylicPlugin"));
ScreenRetrieverPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenRetrieverPlugin"));
SystemThemePluginRegisterWithRegistrar(

View File

@@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
app_links
bitsdojo_window_windows
flutter_acrylic
screen_retriever
system_theme
url_launcher_windows

View File

@@ -0,0 +1,36 @@
[Setup]
AppId={{APP_ID}}
AppVersion={{APP_VERSION}}
AppName={{DISPLAY_NAME}}
AppPublisher={{PUBLISHER_NAME}}
AppPublisherURL={{PUBLISHER_URL}}
AppSupportURL={{PUBLISHER_URL}}
AppUpdatesURL={{PUBLISHER_URL}}
DefaultDirName={{INSTALL_DIR_NAME}}
DisableProgramGroupPage=yes
OutputBaseFilename={{OUTPUT_BASE_FILENAME}}
Compression=lzma
SolidCompression=yes
SetupIconFile={{SETUP_ICON_FILE}}
WizardStyle=modern
PrivilegesRequired=admin
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkedonce
Name: "launchAtStartup"; Description: "{cm:AutoStartProgram,{{DISPLAY_NAME}}}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "reboot_launcher-8.1.0+8.1.0-windows-setup_exe\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Run]
Filename: "{app}\\{{EXECUTABLE_NAME}}"; Description: "{cm:LaunchProgram,{{DISPLAY_NAME}}}"; Flags: runascurrentuser nowait postinstall skipifsilent
[Icons]
Name: "{autoprograms}\{{DISPLAY_NAME}}"; Filename: "{app}\{{EXECUTABLE_NAME}}"
Name: "{autodesktop}\{{DISPLAY_NAME}}"; Filename: "{app}\{{EXECUTABLE_NAME}}"; Tasks: desktopicon
Name: "{userstartup}\{{DISPLAY_NAME}}"; Filename: "{app}\{{EXECUTABLE_NAME}}"; WorkingDir: "{app}"; Tasks: launchAtStartup

View File

@@ -1,6 +1,9 @@
script_template: "custom-inno-setup-script.iss"
app_id: 31868Auties00.RebootLauncher
publisher_name: Auties00
publisher_url: https://github.com/Auties00
display_name: Reboot Launcher
install_dir_name: Reboot Launcher
create_desktop_icon: true
locales:
- en

View File

@@ -1,5 +1,5 @@
#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
auto bdw = bitsdojo_window_configure(BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP);
auto bdw = bitsdojo_window_configure(BDW_CUSTOM_FRAME);
#include <cstdlib>
@@ -15,19 +15,20 @@ auto bdw = bitsdojo_window_configure(BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP);
#include <stdio.h>
#include <fcntl.h>
bool CheckOneInstance()
{
HANDLE m_hStartEvent = CreateEventW( NULL, FALSE, FALSE, L"reboot_launcher");
if(m_hStartEvent == NULL)
{
CloseHandle( m_hStartEvent );
bool CheckOneInstance(){
HANDLE hMutex = CreateMutexW(NULL, TRUE, L"RebootLauncherMutex");
if (hMutex == NULL) {
return false;
}
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
CloseHandle( m_hStartEvent );
m_hStartEvent = NULL;
if (GetLastError() == ERROR_ALREADY_EXISTS) {
HWND hwndExisting = FindWindowW(NULL, L"Reboot Launcher");
if (hwndExisting != NULL) {
ShowWindow(hwndExisting, SW_RESTORE);
SetForegroundWindow(hwndExisting);
}
CloseHandle(hMutex);
return false;
}
@@ -58,7 +59,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
FlutterWindow window(project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720);
if (!window.CreateAndShow(L"reboot_launcher", origin, size)) {
if (!window.CreateAndShow(L"Reboot Launcher", origin, size)) {
return EXIT_FAILURE;
}

View File

@@ -4,6 +4,8 @@
#include "resource.h"
#include <dwmapi.h>
namespace {
constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW";
@@ -108,7 +110,7 @@ bool Win32Window::CreateAndShow(const std::wstring& title,
Destroy();
const wchar_t* window_class =
WindowClassRegistrar::GetInstance()->GetWindowClass();
WindowClassRegistrar::GetInstance()->GetWindowClass();
const POINT target_point = {static_cast<LONG>(origin.x),
static_cast<LONG>(origin.y)};
@@ -117,10 +119,18 @@ bool Win32Window::CreateAndShow(const std::wstring& title,
double scale_factor = dpi / 96.0;
HWND window = CreateWindow(
window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE,
Scale(origin.x, scale_factor), Scale(origin.y, scale_factor),
Scale(size.width, scale_factor), Scale(size.height, scale_factor),
nullptr, nullptr, GetModuleHandle(nullptr), this);
window_class,
title.c_str(),
WS_OVERLAPPED & ~WS_VISIBLE,
Scale(origin.x, scale_factor),
Scale(origin.y, scale_factor),
Scale(size.width, scale_factor),
Scale(size.height, scale_factor),
nullptr,
nullptr,
GetModuleHandle(nullptr),
this
);
if (!window) {
return false;