You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v39.0.0-beta.3 resizability broken with transparent window #48554
Transparent windows don’t support resizing by dragging the borders. I need to find a machine to test the issue where transparent windows don’t work on Windows 10.
@zoy-l Electron has been supporting transparent resizable windows up until 39.0.0-beta.3 and it only broke with the change therefor I can not imagine how this can be true
@mayfield
I believe this is a conflict between the design goals and the actual behavior. From the logic of the code, a transparent window should not be resizable via dragging. As for why it worked previously, I think it was either due to a particular combination of configurations that bypassed this limitation or an incomplete implementation. Window configuration on Windows is quite fragile, and I can only make changes according to the original design intent of the code and the documentation; otherwise, it may lead to unexpected issues.
There is also another possible solution: adding the WS_THICKFRAME window style to the transparent window via a Node.js addon. Electron can obtain the native window handle, and this approach can be used as a temporary workaround until this issue is fully identified and clarified.
// main.jsconst{ app, BrowserWindow }=require('electron');app.whenReady().then(()=>{constwin=newBrowserWindow({transparent: true,frame: false,});// On Windows, this returns an HWND bufferconsthwnd=win.getNativeWindowHandle();// Pass the HWND to native addonconstaddon=require('./build/Release/window_style_addon.node');addon.addThickFrame(hwnd);});
#include<napi.h>
#include<windows.h>/** * This code was generated by an AI (Gemini). * Function: AddThickFrame * Purpose: Dynamically adds the WS_THICKFRAME style to an Electron window to * enable native resizing for frameless windows on Windows.*/voidAddThickFrame(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
// 1. Retrieve the HWND (Window Handle) from the Node.js Buffer.// getNativeWindowHandle() returns a buffer containing the memory address of the HWND.HWND hwnd = *reinterpret_cast<HWND*>(info[0].As<Napi::Buffer<char>>().Data());
// 2. Get current window styles using GetWindowLong.LONG currentStyle = GetWindowLong(hwnd, GWL_STYLE);
// 3. Apply the WS_THICKFRAME flag using a bitwise OR (|) operation.// This adds the "resizable" border style while preserving all existing styles.SetWindowLong(hwnd, GWL_STYLE, currentStyle | WS_THICKFRAME);
// 4. Force the window to recalculate its non-client area (frame).// Without SWP_FRAMECHANGED, the visual change won't take effect immediately.// SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER ensures we only refresh without moving the window.SetWindowPos(
hwnd,
NULL,
0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED
);
}
Napi::Object Init(Napi::Env env, Napi::Object exports) {
exports.Set("addThickFrame", Napi::Function::New(env, AddThickFrame));
return exports;
}
NODE_API_MODULE(window_style_addon, Init)
Thanks for commenting and offering a potential workaround.
I have learned a few more things that upset the applecart, for better or worse, but I think for the better.
I went down the path of trying to see exactly what the mechanism for resizing was and as it turns out there are two different resize modes. When the window is frame-less, a chromium/electron specific hit-test method is used instead of the operating systems native resize handling. There are two particular functions that gate this functionality based on IsResisable() and CanResize(), which is why this functionality broke for win32..
If I make no other changes but to hack those two functions to believe resizing is allowed, then it makes no difference what windows style flags are set; resize just works regardless.
With this hack..
diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc
index 5e02ef25c6..af0b8826ec 100644
--- a/shell/browser/native_window.cc+++ b/shell/browser/native_window.cc@@ -668,7 +668,7 @@ void NativeWindow::NotifyWindowMessage(UINT message,
int NativeWindow::NonClientHitTest(const gfx::Point& point) {
#if !BUILDFLAG(IS_MAC)
// We need to ensure we account for resizing borders on Windows and Linux.
- if ((!has_frame() || has_client_frame()) && IsResizable()) {+ if ((!has_frame() || has_client_frame()) && (IsResizable() || true)) { // XXX Required for resize
auto* frame =
static_cast<FramelessView*>(widget()->non_client_view()->frame_view());
int border_hit = frame->ResizingBorderHitTest(point);
diff --git a/shell/browser/ui/views/frameless_view.cc b/shell/browser/ui/views/frameless_view.cc
index 420a825f27..0b9194af8d 100644
--- a/shell/browser/ui/views/frameless_view.cc+++ b/shell/browser/ui/views/frameless_view.cc@@ -40,6 +40,8 @@ int FramelessView::ResizingBorderHitTestImpl(const gfx::Point& point,
bool can_ever_resize = frame_->widget_delegate()
? frame_->widget_delegate()->CanResize()
: false;
+ printf("Hacking ResizingBorderHitTestImpl: can_ever_resize = true\n");+ can_ever_resize = true;
// https://github.com/electron/electron/issues/611
// If window isn't resizable, we should always return HTNOWHERE, otherwise the
And this quick and dirty replacement of SetFocusable so I can toggle the WS_THICKFRAME flag at runtime easily..
And finally this bare bones electron app that changes the WS_THICKFRAME flag every 4 seconds...
electron.app.on('ready',()=>{constwin=newelectron.BrowserWindow({frame: false,transparent: true,});win.loadFile('resize-test.html');win.show();leton=true;setInterval(()=>{console.warn("OKAY, flip the bit",on ? 'ON' : 'OFF');win.setFocusable(on);on=!on;},4000);});
You can see in the video below that both, resizing still works and the WS_THICKFRAME flag, while affecting the shadows of the window, has no bearing on its' resizability.
window-9.mp4
Where the WS_THICKFRAME option does matter, is when frame:true. When the frame is present the hit-test method is not used and the operating system is expected to handle this. Without WS_THICKFRAME resize truly is disabled on win32.
My gut says the correct place to focus is on harmonizing IsResizable() and CanResize(), possibly with a unified implementation. And making it clear that setting thickFrame:false only applies when frame:true as well.
I'll sleep on this and await further comment before offering a PR, but I feel a bit more confident that this can be resolved with a fairly safe patch.
@mayfield When you’re ready, you can submit a PR directly, because that’s the only way the API team will review it. You can also discuss the API design with team members there.
Activity
zoy-l commentedon Oct 14, 2025
Transparent windows don’t support resizing by dragging the borders. I need to find a machine to test the issue where transparent windows don’t work on Windows 10.
t57ser commentedon Oct 14, 2025
@zoy-l Electron has been supporting transparent resizable windows up until 39.0.0-beta.3 and it only broke with the change therefor I can not imagine how this can be true
zoy-l commentedon Oct 14, 2025
@t57ser I tested v36 and v37.2.5, and neither of them supports resizing by dragging the window border. 😦
t57ser commentedon Oct 14, 2025
37.2.5 test:
clip0001.webm
You can reproduce this by using electron fiddle, just use the default template and add
nikwen commentedon Oct 14, 2025
I can resize the window from the testcase gist on v37.2.5. I can't resize it on v39.0.0-beta.3.
(Note that the testcase gist from the issue only makes the window resizable after 10 seconds.)
50 remaining items
zoy-l commentedon Jan 9, 2026
@mayfield
I believe this is a conflict between the design goals and the actual behavior. From the logic of the code, a transparent window should not be resizable via dragging. As for why it worked previously, I think it was either due to a particular combination of configurations that bypassed this limitation or an incomplete implementation. Window configuration on Windows is quite fragile, and I can only make changes according to the original design intent of the code and the documentation; otherwise, it may lead to unexpected issues.
zoy-l commentedon Jan 9, 2026
There is also another possible solution: adding the
WS_THICKFRAMEwindow style to the transparent window via aNode.js addon. Electron can obtain the native window handle, and this approach can be used as a temporary workaround until this issue is fully identified and clarified.mayfield commentedon Jan 9, 2026
Hello @zoy-l
Thanks for commenting and offering a potential workaround.
I have learned a few more things that upset the applecart, for better or worse, but I think for the better.
I went down the path of trying to see exactly what the mechanism for resizing was and as it turns out there are two different resize modes. When the window is frame-less, a chromium/electron specific hit-test method is used instead of the operating systems native resize handling. There are two particular functions that gate this functionality based on
IsResisable()andCanResize(), which is why this functionality broke for win32..See:
electron/shell/browser/native_window.cc
Lines 668 to 691 in 5901d8a
and:
electron/shell/browser/ui/views/frameless_view.cc
Lines 37 to 57 in 3985daa
If I make no other changes but to hack those two functions to believe resizing is allowed, then it makes no difference what windows style flags are set; resize just works regardless.
With this hack..
And this quick and dirty replacement of
SetFocusableso I can toggle theWS_THICKFRAMEflag at runtime easily..And finally this bare bones electron app that changes the WS_THICKFRAME flag every 4 seconds...
You can see in the video below that both, resizing still works and the
WS_THICKFRAMEflag, while affecting the shadows of the window, has no bearing on its' resizability.window-9.mp4
Where the
WS_THICKFRAMEoption does matter, is whenframe:true. When the frame is present the hit-test method is not used and the operating system is expected to handle this. WithoutWS_THICKFRAMEresize truly is disabled on win32.My gut says the correct place to focus is on harmonizing
IsResizable()andCanResize(), possibly with a unified implementation. And making it clear that settingthickFrame:falseonly applies whenframe:trueas well.I'll sleep on this and await further comment before offering a PR, but I feel a bit more confident that this can be resolved with a fairly safe patch.
zoy-l commentedon Jan 9, 2026
@mayfield When you’re ready, you can submit a PR directly, because that’s the only way the API team will review it. You can also discuss the API design with team members there.
fix: prevent transparent windows from using Win11 background material
Fix for user resizable transparent windows on win32
fix: transparent window rendering on Windows
fix: post SetIsTranslucent(false) as task for transparent windows
fix: allow resizable translucent windows to keep WS_THICKFRAME
fix: combine WS_THICKFRAME patch with SetIsTranslucent(false)
fix: synchronous SetIsTranslucent for transparent windows
Fix for user resizable transparent windows on win32
fix(selection): upgrade electron to 41.2.1 and drop resize workaround
fix(selection): upgrade electron to 41.2.1 and drop resize workaround