Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
win32ss committed Sep 24, 2023
2 parents e1d6379 + 401fc1d commit 202fe04
Show file tree
Hide file tree
Showing 34 changed files with 2,751 additions and 76 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
This is a custom build of the Electron framework based on the Supermium browser codebase, coming soon. This will be used to run Electron-based web applications that otherwise require Electron binaries that are incompatible with Windows Vista/7/8.x. Instructions for end-users will be provided once the project is stabilized. The original readme follows below.

[![Electron Logo](https://electronjs.org/images/electron-logo.svg)](https://electronjs.org)

[![CircleCI Build Status](https://circleci.com/gh/electron/electron/tree/main.svg?style=shield)](https://circleci.com/gh/electron/electron/tree/main)
Expand Down Expand Up @@ -39,7 +41,9 @@ For more installation options and troubleshooting tips, see
Each Electron release provides binaries for macOS, Windows, and Linux.

* macOS (High Sierra and up): Electron provides 64-bit Intel and ARM binaries for macOS. Apple Silicon support was added in Electron 11.
* Windows (Windows 10 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8. Support for Windows 7, 8 and 8.1 was [removed in Electron 23, in line with Chromium's Windows deprecation policy](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice).

* Windows (Windows 7 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8.

* Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on:
* Ubuntu 14.04 and newer
* Fedora 24 and newer
Expand Down
6 changes: 0 additions & 6 deletions docs/breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,6 @@ Additionally, the `customButtonsOnHover` BrowserWindow property previously creat

As a result, if your app uses a frameless window with draggable regions on macOS, the regions which are draggable in your app may change in Electron 23.

### Removed: Windows 7 / 8 / 8.1 support

[Windows 7, Windows 8, and Windows 8.1 are no longer supported](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice). Electron follows the planned Chromium deprecation policy, which will [deprecate Windows 7 support beginning in Chromium 109](https://support.google.com/chrome/thread/185534985/sunsetting-support-for-windows-7-8-8-1-in-early-2023?hl=en).

Older versions of Electron will continue to run on these operating systems, but Windows 10 or later will be required to run Electron v23.0.0 and higher.

### Removed: BrowserWindow `scroll-touch-*` events

The deprecated `scroll-touch-begin`, `scroll-touch-end` and `scroll-touch-edge`
Expand Down
23 changes: 19 additions & 4 deletions docs/tutorial/notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,18 @@ are subtle differences.

### Windows

For notifications on Windows, your Electron app needs to have a Start Menu shortcut with an
[AppUserModelID][app-user-model-id] and a corresponding [ToastActivatorCLSID][toast-activator-clsid].
* On Windows 10, a shortcut to your app with an
[Application User Model ID][app-user-model-id] must be installed to the
Start Menu. This can be overkill during development, so adding
`node_modules\electron\dist\electron.exe` to your Start Menu also does the
trick. Navigate to the file in Explorer, right-click and 'Pin to Start Menu'.
You will then need to add the line `app.setAppUserModelId(process.execPath)` to
your main process to see notifications.
* On Windows 8.1 and Windows 8, a shortcut to your app with an [Application User
Model ID][app-user-model-id] must be installed to the Start screen. Note,
however, that it does not need to be pinned to the Start screen.
* On Windows 7, notifications work via a custom implementation which visually
resembles the native one on newer systems.

Electron attempts to automate the work around the AppUserModelID and ToastActivatorCLSID. When
Electron is used together with Squirrel.Windows (e.g. if you're using electron-winstaller),
Expand All @@ -87,7 +97,13 @@ In production, Electron will also detect that Squirrel was used and will automat
`app.setAppUserModelId()` with the correct value. During development, you may have
to call [`app.setAppUserModelId()`][set-app-user-model-id] yourself.

:::info Notifications in development
Furthermore, in Windows 8, the maximum length for the notification body is 250
characters, with the Windows team recommending that notifications should be kept
to 200 characters. That said, that limitation has been removed in Windows 10, with
the Windows team asking developers to be reasonable. Attempting to send gigantic
amounts of text to the API (thousands of characters) might result in instability.

#### Advanced Notifications

To quickly bootstrap notifications during development, adding
`node_modules\electron\dist\electron.exe` to your Start Menu also does the
Expand Down Expand Up @@ -145,7 +161,6 @@ GNOME, and KDE.
[app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
[set-app-user-model-id]: ../api/app.md#appsetappusermodelidid-windows
[squirrel-events]: https://github.com/electron/windows-installer/blob/main/README.md#handling-squirrel-events
[toast-activator-clsid]: https://learn.microsoft.com/en-us/windows/win32/properties/props-system-appusermodel-toastactivatorclsid
[apple-notification-guidelines]: https://developer.apple.com/design/human-interface-guidelines/notifications
[windows-notification-state]: https://github.com/felixrieseberg/windows-notification-state
[macos-notification-state]: https://github.com/felixrieseberg/macos-notification-state
11 changes: 11 additions & 0 deletions filenames.gni
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ filenames = {
"shell/browser/native_window_views_win.cc",
"shell/browser/notifications/win/notification_presenter_win.cc",
"shell/browser/notifications/win/notification_presenter_win.h",
"shell/browser/notifications/win/notification_presenter_win7.cc",
"shell/browser/notifications/win/notification_presenter_win7.h",
"shell/browser/notifications/win/win32_desktop_notifications/common.h",
"shell/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.cc",
"shell/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.h",
"shell/browser/notifications/win/win32_desktop_notifications/toast_uia.cc",
"shell/browser/notifications/win/win32_desktop_notifications/toast_uia.h",
"shell/browser/notifications/win/win32_desktop_notifications/toast.cc",
"shell/browser/notifications/win/win32_desktop_notifications/toast.h",
"shell/browser/notifications/win/win32_notification.cc",
"shell/browser/notifications/win/win32_notification.h",
"shell/browser/notifications/win/windows_toast_notification.cc",
"shell/browser/notifications/win/windows_toast_notification.h",
"shell/browser/relauncher_win.cc",
Expand Down
7 changes: 1 addition & 6 deletions patches/chromium/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ render_widget_host_view_base.patch
render_widget_host_view_mac.patch
webview_cross_drag.patch
gin_enable_disable_v8_platform.patch
enable_reset_aspect_ratio.patch
boringssl_build_gn.patch
pepper_plugin_support.patch
gtk_visibility.patch
Expand All @@ -36,15 +35,13 @@ printing.patch
support_mixed_sandbox_with_zygote.patch
unsandboxed_ppapi_processes_skip_zygote.patch
build_add_electron_tracing_category.patch
worker_context_will_destroy.patch
frame_host_manager.patch
crashpad_pid_check.patch
network_service_allow_remote_certificate_verification_logic.patch
disable_color_correct_rendering.patch
add_contentgpuclient_precreatemessageloop_callback.patch
picture-in-picture.patch
disable_compositor_recycling.patch
allow_new_privileges_in_unsandboxed_child_processes.patch
expose_setuseragent_on_networkcontext.patch
feat_add_set_theme_source_to_allow_apps_to.patch
add_webmessageportconverter_entangleandinjectmessageportchannel.patch
Expand Down Expand Up @@ -82,7 +79,6 @@ hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch
logging_win32_only_create_a_console_if_logging_to_stderr.patch
fix_media_key_usage_with_globalshortcuts.patch
feat_expose_raw_response_headers_from_urlloader.patch
process_singleton.patch
add_ui_scopedcliboardwriter_writeunsaferawdata.patch
feat_add_data_parameter_to_processsingleton.patch
load_v8_snapshot_in_browser_process.patch
Expand All @@ -102,7 +98,6 @@ fix_allow_guest_webcontents_to_enter_fullscreen.patch
disable_freezing_flags_after_init_in_node.patch
short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch
chore_add_electron_deps_to_gitignores.patch
chore_allow_chromium_to_handle_synthetic_mouse_events_for_touch.patch
add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
add_electron_deps_to_license_credits_file.patch
fix_crash_loading_non-standard_schemes_in_iframes.patch
Expand All @@ -111,7 +106,6 @@ feat_configure_launch_options_for_service_process.patch
feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch
fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch
preconnect_manager.patch
fix_remove_caption-removing_style_call.patch
build_allow_electron_to_use_exec_script.patch
build_only_use_the_mas_build_config_in_the_required_components.patch
chore_introduce_blocking_api_for_electron.patch
Expand All @@ -129,3 +123,4 @@ fix_harden_blink_scriptstate_maybefrom.patch
chore_add_buildflag_guard_around_new_include.patch
fix_use_delegated_generic_capturer_when_available.patch
build_remove_ent_content_analysis_assert.patch
build_remove_ent_content_analysis_assert.patch
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ index 2e4bacce52a45b5d9d7829c1f88f82aa0bb1b4bb..f3537e89191bd2c6d9b06c9b741a1680

Widget* GetWidget();
const Widget* GetWidget() const;
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 7a913d4714ae571505111d5fdf8303793bde629b..ec7a05ac5c261c0292684b47db275f7b1ef5daa4 100644
index aacb580a7506f2c86769251ad00d8679870a454a..400278ab26a4e095fd837fcf84c952a1297b173d 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -3253,15 +3253,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
@@ -3140,15 +3140,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
SetMsgHandled(FALSE);
// We must let Windows handle the caption buttons if it's drawing them, or
// they won't work.
Expand All @@ -60,12 +59,12 @@ index 7a913d4714ae571505111d5fdf8303793bde629b..ec7a05ac5c261c0292684b47db275f7b
}

diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h
index fde18715e33ee67f64740ebda7c641954360483c..cf1ea75f8e9dd1d95045736959c4f3ca1a27a1ab 100644
index 233dd12f86c20a7f5169caab998993f614e8bc7e..3bf6fc95a653f1783510378ffeef5b18da42e559 100644
--- a/ui/views/win/hwnd_message_handler_delegate.h
+++ b/ui/views/win/hwnd_message_handler_delegate.h
@@ -255,6 +255,10 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate {
// Called when the headless window bounds has changed.
virtual void HandleHeadlessWindowBoundsChanged(const gfx::Rect& bounds) = 0;
@@ -258,6 +258,10 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate {
// Called when the window scale factor has changed.
virtual void HandleWindowScaleFactorChanged(float window_scale_factor) = 0;

+ // Called when synthetic mouse event is generated for touch event on
+ // caption buttons.
Expand Down
78 changes: 78 additions & 0 deletions patches/chromium/disable-redraw-lock.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Heilig Benedek <benecene@gmail.com>
Date: Thu, 20 Sep 2018 17:47:54 -0700
Subject: disable-redraw-lock.patch

Chromium uses a custom window titlebar implementation on Windows when DWM
is disabled (Windows 7 and earlier, non Aero theme). The native titlebar
sometimes painted over this custom titlebar, so a workaround was put in
place to lock redraws in reaction to certain events if DWM is disabled,
since the code assumes that in that case, the custom titlebar is painted.
Electron forces the use of the native titlebar, which the workaround doesn't
take into account, and still locks redraws, causing weird repainting issues
in electron (and other applications). This patch provides a way to disable
the redraw locking mechanism, which fixes these issues. The electron issue
can be found at https://github.com/electron/electron/issues/1821

diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index ec39cb0d15c80f051e89bf4d0f05368dff897fa7..472090adb19411366c50ed8e5a2f1276bc0a47eb 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -311,6 +311,10 @@ constexpr int kSynthesizedMouseMessagesTimeDifference = 500;

} // namespace

+bool HWNDMessageHandlerDelegate::HasNativeFrame() const {
+ return false;
+}
+
// A scoping class that prevents a window from being able to redraw in response
// to invalidations that may occur within it for the lifetime of the object.
//
@@ -361,7 +365,8 @@ class HWNDMessageHandler::ScopedRedrawLock {
hwnd_(owner_->hwnd()),
cancel_unlock_(false),
should_lock_(owner_->IsVisible() && !owner->HasChildRenderingWindow() &&
- ::IsWindow(hwnd_) && !owner_->IsHeadless() &&
+ ::IsWindow(hwnd_) && !owner_->HasNativeFrame() &&
+ !owner_->IsHeadless() &&
(!(GetWindowLong(hwnd_, GWL_STYLE) & WS_CAPTION) ||
!ui::win::IsAeroGlassEnabled())) {
if (should_lock_)
@@ -1057,6 +1062,10 @@ HWNDMessageHandler::RegisterUnadjustedMouseEvent() {
return scoped_enable;
}

+bool HWNDMessageHandler::HasNativeFrame() {
+ return delegate_->HasNativeFrame();
+}
+
////////////////////////////////////////////////////////////////////////////////
// HWNDMessageHandler, gfx::WindowImpl overrides:

diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h
index e93d1727cbd8263d3b68e539856a577585a6092c..6d0adb7b5febc5625073312e7f1d557f89927ac8 100644
--- a/ui/views/win/hwnd_message_handler.h
+++ b/ui/views/win/hwnd_message_handler.h
@@ -210,6 +210,8 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl,
using TouchIDs = std::set<DWORD>;
enum class DwmFrameState { kOff, kOn };

+ bool HasNativeFrame();
+
// Overridden from WindowImpl:
HICON GetDefaultWindowIcon() const override;
HICON GetSmallWindowIcon() const override;
diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h
index 08e46c7b92f6cbe95c9cb524d09a6ed9e89ecf00..233dd12f86c20a7f5169caab998993f614e8bc7e 100644
--- a/ui/views/win/hwnd_message_handler_delegate.h
+++ b/ui/views/win/hwnd_message_handler_delegate.h
@@ -46,6 +46,8 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate {
// True if the widget associated with this window has a non-client view.
virtual bool HasNonClientView() const = 0;

+ virtual bool HasNativeFrame() const;
+
// Returns who we want to be drawing the frame. Either the system (Windows)
// will handle it or Chrome will custom draw it.
virtual FrameMode GetFrameMode() const = 0;
5 changes: 3 additions & 2 deletions patches/chromium/enable_reset_aspect_ratio.patch
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ index 53c1d25e3f56daa9d7929089620c9df7971ceda6..d90c652d7c572686bf54c4d282960ea4
excluded_margin);
}
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index a386fb0594530afb6d842551c487fda7ae565085..825ee88f8375d726466d9967393b77065723fabd 100644
index 472090adb19411366c50ed8e5a2f1276bc0a47eb..9f2b240b0c053a10d4543f0ffb9809fd735d7b6d 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -1154,8 +1154,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen,
@@ -1007,8 +1007,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen,
}

void HWNDMessageHandler::SetAspectRatio(float aspect_ratio,
const gfx::Size& excluded_margin) {
Expand Down
4 changes: 2 additions & 2 deletions patches/chromium/fix_aspect_ratio_with_max_size.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ enlarge window above dimensions set during creation of the
BrowserWindow.

diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 825ee88f8375d726466d9967393b77065723fabd..7a913d4714ae571505111d5fdf8303793bde629b 100644
index 9f2b240b0c053a10d4543f0ffb9809fd735d7b6d..aacb580a7506f2c86769251ad00d8679870a454a 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -3805,14 +3805,29 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param,
@@ -3707,6 +3707,21 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param,
delegate_->GetMinMaxSize(&min_window_size, &max_window_size);
min_window_size = delegate_->DIPToScreenSize(min_window_size);
max_window_size = delegate_->DIPToScreenSize(max_window_size);
Expand Down
4 changes: 2 additions & 2 deletions patches/chromium/fix_remove_caption-removing_style_call.patch
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ or resizing, but Electron does not seem to run into that issue
for opaque frameless windows even with that block commented out.

diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index ec7a05ac5c261c0292684b47db275f7b1ef5daa4..13268bd89c710690eed5296f4b2157e9476f195e 100644
index 400278ab26a4e095fd837fcf84c952a1297b173d..55afa69870f27b877826ea8a442ab20a8b336d74 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -1873,7 +1873,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) {
@@ -1731,7 +1731,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) {
SendMessage(hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS),
0);

Expand Down
1 change: 1 addition & 0 deletions patches/node/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fix_handle_boringssl_and_openssl_incompatibilities.patch
fix_crypto_tests_to_run_with_bssl.patch
fix_account_for_debugger_agent_race_condition.patch
fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch
fix_crash_caused_by_gethostnamew_on_windows_7.patch
fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch
fix_serdes_test.patch
feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch
Expand Down
Loading

0 comments on commit 202fe04

Please sign in to comment.