We probably didn't use this before because IsAltModifier() was written
two years before the KeyModifiers mask was added upstream in 98ec378a.
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Fixes https://github.com/electron/electron/issues/45990
We previously made a change in https://github.com/electron/electron/pull/45868
to fix content protection being lost on hide and re-show. However, this
cause a breaking change where protected windows were made opaque black
instead of being hidden as before. This overrides relevant methods in
ElectronDesktopWindowTreeHostWin to restore the previous behavior.
without regressing the original issue.
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
build: move to new hasher function
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
refactor: use `gin_helper::Dictionary::ValueOrDefault()` (#46982)
* refactor: use ValueOrDefault() in electron_api_web_contents.cc
* refactor: use ValueOrDefault() in electron_api_url_loader.cc
* refactor: use ValueOrDefault() in electron_download_manager_delegate.cc
* refactor: use ValueOrDefault() in electron_touch_bar.mm
* refactor: use ValueOrDefault() in electron_url_loader_factory.cc
* refactor: use ValueOrDefault() in electron_browser_context.cc
* refactor: use ValueOrDefault() in electron_touch_bar.mm
* refactor: use ValueOrDefault() in blink_converter.cc
* feat: add ValueOrDefault() to PersistentDictionary
* empty commit
* refactor: use ValueOrDefault() in blink_converter.cc
* refactor: inline the rectangle base::Value::Dict
* refactor: remove has_scroll temporary
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
chore: remove deps_add_v8_object_setinternalfieldfornodecore.patch
This was a Node 20-specific workaround that's no longer needed in Node 22.
Xref: https://github.com/nodejs/node/pull/49874.
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: do not use native_widget_private() in NativeWindowViews::SetContentProtection()
refactor: do not use native_widget_private() in NativeWindowViews::IsContentProtected()
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: do not use native_widget_private() in NativeWindowViews::Show()
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: remove native_widget_private #include from native_window_views_win
Not needed since Feb 2025: 9199d5c6
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
refactor: enable hasShadow tests on Linux
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* feat: add gin_helper::Dictionary::ValueOrDefault()
A convenience function for using a default value if the
specified key isn't present in the dictionary.
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ValueOrDefault() in native_window.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ValueOrDefault() in native_window_mac.mm
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ValueOrDefault() in native_window_views.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ValueOrDefault() in electron_api_native_image.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
refactor: pass gfx::ResizeEdge by value
It is an enum class, so no reason to pass by reference
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
refactor: remove some `NativeWindow` public API (#46919)
* refactor: make NativeWindow::titlebar_overlay_height_ private
* refactor: make NativeWindow::set_has_frame() protected
* refactor: remove NativeWindow::background_material()
It's only used once, in NativeWindow, so use |background_material_| directly.
* refactor: remove NativeWindow::vibrancy()
It's only used once, in a NativeWindow method, so use |vibrancy_| directly.
* refactor: unfriend api::BrowserView
It was added in Oct 2022 by 23d4a25 for access to protected NativeWindow
methods add_inspectable_view() and remove_inspectable_view().
That dependency was removed in Nov 2022 by 184ac2b, so BrowserView
doesn't need access to NativeWindow's private fields & methods anymore.
* refactor: make NativeWindow::ContentBoundsToWindowBounds() protected
refactor: make NativeWindow::WindowBoundsToContentBounds() protected
refactor: add NativeWindow::FromWidet() helper
refactor: make kElectronNativeWindowKey a protected field
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
feat: support dip <-> screen conversion on Linux
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
* refactor: use ObserverList::Notify() in shell/browser/window_list.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/web_contents_zoom_controller.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/usb/usb_chooser_context.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/usb/electron_usb_delegate.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/ui/views/menu_delegate.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/ui/tray_icon.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/ui/electron_menu_model.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/serial/serial_chooser_context.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/native_window.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/serial/electron_serial_delegate.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/browser.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/api/electron_api_web_contents.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/hid/electron_hid_delegate.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use ObserverList::Notify() in shell/browser/hid/hid_chooser_context.cc
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: don't call RegisterDeleteDelegateCallback()
move NativeWindowViews' on-widget-delegate-destroyed callback logic to
the NativeWindowViews destructor.
Since NativeWindowViews subclasses from WidgetDelegate and |this| *is*
the delegate being destroyed, we can handle this more cleanly in
~NativeWindowViews() instead of in a separate callback.
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: remove NativeWindowViews from the grandfathered-classes-that-can-call-deprecated-views-behavior patch
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: don't call RegisterDeleteDelegateCallback()
RegisterDeleteDelegateCallback() is private upstream API, so we
shouldn't be using it.
Move the on-widget-delegate-destroyed callback logic over to our methods
NativeWindowViews::OnWidgetDestroying() and
NativeWindowViews::OnWidgetDestroyed().
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: add EmitDeprecationWarning helper
Also switches EmitWarning to using Node's ProcessEmitWarningGeneric
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
* chore: use node namespace for function call
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
* test: do not skip visibleOnAllWorkspaces tests on Windows
That feature is supported on Linux, so move the test from the
"window states (excluding Linux)" section into the
"window states" section.
* fix: nested it() calls in visibleOnAllWorkspaces specs
* test: enable accessibilitySupportEnabled tests
test: check both getters after calling each setter
fix: do not assume the default initial value of accessibilitySupportEnabled
* chore: remove redundant test case
* chore: disable accessibilitySupportEnabled tests on Linux
* test: add platform test on visibleOnAllWorkspaces tests
visibleOnAllWorkspaces is not supported on Windows
* test: do not skip visibleOnAllWorkspaces tests on Windows
That feature is supported on Linux, so move the test from the
"window states (excluding Linux)" section into the
"window states" section.
* fix: nested it() calls in visibleOnAllWorkspaces specs
* chore: make the process.platform test simpler
* fix: tests that were not run in api-app-spec due to nested it()
* fix: tests that were not run in api-browser-window-spec due to nested it()
* chore: annotate disabled test
* fix: enable `autoHideMenuBar` tests on Linux and Windows (#46818)
* fix: enable autoHideMenuBar tests
* docs: mark autoHideMenuBar as supported on Linux, Windows