Skip to content

Commit

Permalink
Fix compile issue and other changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jigar-f committed Dec 25, 2024
1 parent 69626b0 commit 2aef673
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 35 deletions.
2 changes: 1 addition & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ github.com/getlantern/fdcount v0.0.0-20210503151800-5decd65b3731/go.mod h1:XZwE+
github.com/getlantern/filepersist v0.0.0-20160317154340-c5f0cd24e799/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8=
github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c h1:mcz27xtAkb1OuOLBct/uFfL1p3XxAIcFct82GbT+UZM=
github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8=
github.com/getlantern/flashlight/v7 v7.6.173 h1:JvFMZlysbBcURai0JsuIrnlku6EUsbWuqcSn3aTbcYI=
github.com/getlantern/flashlight/v7 v7.6.173 h1:xb/F7mTjI+w1yXht/P2bNnVluRvg5tz537e1gdv7+28=
github.com/getlantern/flashlight/v7 v7.6.173/go.mod h1:2HDjD6lx7W5hbTh3Vg572bHVFd9YZ4YODLl2b+d7JBw=
github.com/getlantern/framed v0.0.0-20190601192238-ceb6431eeede h1:yrU6Px3ZkvCsDLPryPGi6FN+2iqFPq+JeCb7EFoDBhw=
github.com/getlantern/framed v0.0.0-20190601192238-ceb6431eeede/go.mod h1:nhnoiS6DE6zfe+BaCMU4YI01UpsuiXnDqM5S8jxHuuI=
Expand Down
Binary file added liblantern.dll
Binary file not shown.
2 changes: 2 additions & 0 deletions windows/packaging/msix/make_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ msix_version: 2.1.5.0
publisher_display_name: lantern
identity_name: org.getlantern.lantern
logo_path: windows/runner/resources/app_icon.ico
protocol_activation: https
app_uri_handler_hosts: www.lantern.io, lantern.io # Add the app uri handler hosts. You
capabilities: internetClient, internetClientServer, privateNetworkClientServer
install_certificate: "false"
70 changes: 36 additions & 34 deletions windows/runner/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,42 @@
#include "app_links/app_links_plugin_c_api.h"


bool SendAppLinkToInstance(const std::wstring& title) {
// Find our exact window
HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", title.c_str());

if (hwnd) {
// Dispatch new link to current window
SendAppLink(hwnd);

// (Optional) Restore our window to front in same state
WINDOWPLACEMENT place = { sizeof(WINDOWPLACEMENT) };
GetWindowPlacement(hwnd, &place);

switch(place.showCmd) {
case SW_SHOWMAXIMIZED:
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
break;
case SW_SHOWMINIMIZED:
ShowWindow(hwnd, SW_RESTORE);
break;
default:
ShowWindow(hwnd, SW_NORMAL);
break;
}

SetWindowPos(0, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE);
SetForegroundWindow(hwnd);
// END (Optional) Restore

// Window has been found, don't create another one.
return true;
}

return false;
}


int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
// You may ignore the result if you need to create another window.
Expand Down Expand Up @@ -49,37 +85,3 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
return EXIT_SUCCESS;
}

bool SendAppLinkToInstance(const std::wstring& title) {
// Find our exact window
HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", title.c_str());

if (hwnd) {
// Dispatch new link to current window
SendAppLink(hwnd);

// (Optional) Restore our window to front in same state
WINDOWPLACEMENT place = { sizeof(WINDOWPLACEMENT) };
GetWindowPlacement(hwnd, &place);

switch(place.showCmd) {
case SW_SHOWMAXIMIZED:
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
break;
case SW_SHOWMINIMIZED:
ShowWindow(hwnd, SW_RESTORE);
break;
default:
ShowWindow(hwnd, SW_NORMAL);
break;
}

SetWindowPos(0, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE);
SetForegroundWindow(hwnd);
// END (Optional) Restore

// Window has been found, don't create another one.
return true;
}

return false;
}

0 comments on commit 2aef673

Please sign in to comment.