Merge pull request 'windows: .ico and app name and menu name' (#148) from winnameicon into trunk
continuous-integration/drone/push Build is passing Details

Reviewed-on: #148
This commit is contained in:
Sarah Jamie Lewis 2021-06-03 15:44:19 -07:00
commit d45dedc76b
16 changed files with 77 additions and 22 deletions

View File

@ -1,6 +1,6 @@
# flwtch
A new Flutter application.
A Flutter based Cwtch UI
## Getting Started
@ -8,13 +8,19 @@ click the play button in android studio
### Linux
- libCwtch-go: the result of `make linux`, `libCwtch.so` should be in the link path
- libCwtch-go: required to be on the link path (linux/cwtch.destktop demonstrates with `env LD_LIBRARY_PATH=./lib/` on the front of the comman)
- fetch-libcwtch-go.sh will fetch a prebuilt version
- or compile from source from libcwtch-go with `make linux`
- `tor` should be in the PATH
### Windows
- libCwtch-go: the result of `make windows`, `libCwtch.dll` should be placed in the source root
- tor is bundled in `windors/Tor`
- run `fetch-libcwtch-go.ps1` to get `libCwtch.dll` which is required to run
- run `fetch-tor-win.ps1` to fetch Tor for windows
#### Issues
- Flutter engine has a [known bug](https://github.com/flutter/flutter/issues/75675) around the Right Shift key being sticky. We have implemented the mostly work around, but until it is fixed, right shift occasionally acts permenent. If this happens, just tap left shift and it will reset
## l10n

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.15)
project(flutter_app LANGUAGES CXX)
project(cwtch LANGUAGES CXX)
set(BINARY_NAME "flutter_app")
set(BINARY_NAME "cwtch")
cmake_policy(SET CMP0063 NEW)

View File

@ -2,10 +2,11 @@
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
#include <window_size/window_size_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
WindowSizePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowSizePlugin"));
}

View File

@ -2,8 +2,6 @@
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_

View File

@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
window_size
)
set(PLUGIN_BUNDLED_LIBRARIES)

View File

@ -52,7 +52,16 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APP_ICON ICON "resources\\app_icon.ico"
IDI_APP_ICON_LG ICON "resources\\knot_256.ico"
IDI_APP_ICON_SM ICON "resources\\knot_64.ico"
IDI_APP_ICON_256 ICON "resources\\knot_256.ico"
IDI_APP_ICON_128 ICON "resources\\knot_128.ico"
IDI_APP_ICON_64 ICON "resources\\knot_64.ico"
IDI_APP_ICON_48 ICON "resources\\knot_48.ico"
IDI_APP_ICON_32 ICON "resources\\knot_32.ico"
IDI_APP_ICON_16 ICON "resources\\knot_16.ico"
/////////////////////////////////////////////////////////////////////////////
@ -89,13 +98,13 @@ BEGIN
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "com.example" "\0"
VALUE "FileDescription", "A new Flutter project." "\0"
VALUE "CompanyName", "Open Privacy Research Society" "\0"
VALUE "FileDescription", "Cwtch Instant Messenger" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "flutter_app" "\0"
VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0"
VALUE "OriginalFilename", "flutter_app.exe" "\0"
VALUE "ProductName", "flutter_app" "\0"
VALUE "InternalName", "cwtch" "\0"
VALUE "LegalCopyright", "Copyright (C) 2021 Open Privacy Research Society. All rights reserved." "\0"
VALUE "OriginalFilename", "cwtch.exe" "\0"
VALUE "ProductName", "Cwtch" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0"
END
END

View File

@ -30,7 +30,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
FlutterWindow window(&run_loop, project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720);
if (!window.CreateAndShow(L"flutter_app", origin, size)) {
if (!window.CreateAndShow(L"cwtch", origin, size)) {
return EXIT_FAILURE;
}
window.SetQuitOnClose(true);

View File

@ -2,7 +2,16 @@
// Microsoft Visual C++ generated include file.
// Used by Runner.rc
//
#define IDI_APP_ICON 101
#define IDI_APP_ICON_LG 101
#define IDI_APP_ICON_SM 102
#define IDI_APP_ICON_256 103
#define IDI_APP_ICON_128 104
#define IDI_APP_ICON_64 105
#define IDI_APP_ICON_48 106
#define IDI_APP_ICON_32 107
#define IDI_APP_ICON_16 108
// Next default values for new objects
//

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,4 +1,5 @@
#include "win32_window.h"
#include "winuser.h"
#include <flutter_windows.h>
@ -70,19 +71,49 @@ WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr;
const wchar_t* WindowClassRegistrar::GetWindowClass() {
if (!class_registered_) {
WNDCLASS window_class{};
WNDCLASSEX window_class{};
window_class.cbSize = sizeof(WNDCLASSEX);
window_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
window_class.lpszClassName = kWindowClassName;
window_class.style = CS_HREDRAW | CS_VREDRAW;
window_class.cbClsExtra = 0;
window_class.cbWndExtra = 0;
window_class.hInstance = GetModuleHandle(nullptr);
int icon_sz = GetSystemMetrics(SM_CXICON);
int iconh_id = IDI_APP_ICON_32;
if (icon_sz > 128) {
iconh_id = IDI_APP_ICON_256;
} else if (icon_sz > 64) {
iconh_id = IDI_APP_ICON_128;
} else if (icon_sz > 48) {
iconh_id = IDI_APP_ICON_64;
} else if (icon_sz > 32) {
iconh_id = IDI_APP_ICON_48;
}
window_class.hIcon =
LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
LoadIcon(window_class.hInstance, MAKEINTRESOURCE(iconh_id));
int icon_sm_sz = GetSystemMetrics(SM_CXSMICON);
int iconsmh_id = IDI_APP_ICON_16;
if (icon_sm_sz > 128) {
iconsmh_id = IDI_APP_ICON_256;
} else if (icon_sm_sz > 64) {
iconsmh_id = IDI_APP_ICON_128;
} else if (icon_sm_sz > 48) {
iconsmh_id = IDI_APP_ICON_64;
} else if (icon_sm_sz > 32) {
iconsmh_id = IDI_APP_ICON_48;
} else if (icon_sm_sz > 16) {
iconsmh_id = IDI_APP_ICON_32;
}
window_class.hIconSm =
LoadIcon(window_class.hInstance, MAKEINTRESOURCE(iconsmh_id));
window_class.hbrBackground = 0;
window_class.lpszMenuName = nullptr;
window_class.lpfnWndProc = Win32Window::WndProc;
RegisterClass(&window_class);
RegisterClassEx(&window_class);
class_registered_ = true;
}
return kWindowClassName;