-
Notifications
You must be signed in to change notification settings - Fork 15.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix for Window hidden behind taskbar after maximize #7672 #7765
Conversation
FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); | ||
thick_frame_ = !thick_frame_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this flag only gets reversed if it's true
would it possibly better to set it explicitly to false
?
Kicked off another Appveyor build, in case it was a flaky failure. |
FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); | ||
thick_frame_ = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the right approach here, calling setResizable
twice, first with false
and then with true
will not re-enable the thick frame style so window animations won't work as expected.
Another approach could be to check the window style instead of thick_frame_
other places so that custom logic for maximize/unmaximize checks something like has_thick_frame()
instead of thick_frame_
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Window style should be checked instead of initial thick frame setting.
@kevinsawicki I was experimenting and noticed that we cannot replace all existing |
@@ -571,8 +571,8 @@ void NativeWindowViews::SetContentSizeConstraints( | |||
|
|||
void NativeWindowViews::SetResizable(bool resizable) { | |||
#if defined(OS_WIN) | |||
if (thick_frame_) | |||
FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); | |||
FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you create a window with thickFrame
option set to false
, won't this enable it the first time you call setResizable
with true
?
Thanks @kevinsawicki I realized that I did not consider the case of frameless window at all. Corrected now. |
@@ -571,8 +571,9 @@ void NativeWindowViews::SetContentSizeConstraints( | |||
|
|||
void NativeWindowViews::SetResizable(bool resizable) { | |||
#if defined(OS_WIN) | |||
if (thick_frame_) | |||
if(has_frame()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if
needs a space after it.
atom/browser/native_window_views.cc:574: Missing space before ( in if( [whitespace/parens] [5]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(That is what is causing the current CI failure)
@kevinsawicki I have made requested changes. Please let me know if anything else is needed :) |
Sorry about the delay, just need to test this out and then I'll merge it 👍 |
@liusy182 sorry for the delay, I tried out the this branch and am still seeing an issue, can you confirm? With the following app, I'm seeing the window expand over the taskbar when maximized. const {app, BrowserWindow} = require('electron')
let window
app.once('ready', function () {
window = new BrowserWindow({
show: true,
frame: false
});
browserWindow.loadURL('about:blank')
}) Then open the dev tools in the window and run the following: w = require('electron').remote.getCurrentWindow()
w.setResizable(false);
w.setMinimumSize(500, 500);
w.maximize(); This maximizes the window over the taskbar for me on Windows 10. |
thanks @kevinsawicki You are right. I checked for all the places that still refer to the old
|
is this issue related to what i have noticed? simple app, as described @kevinsawicki
after that, if i unmaximize window, and maximize it again, white glow is back Windows7 64bit, electron prebuilt 1.4.12 |
@@ -486,19 +486,6 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) { | |||
NotifyWindowLeaveFullScreen(); | |||
} | |||
|
|||
// For window without WS_THICKFRAME style, we can not call SetFullscreen(). | |||
if (!thick_frame_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might still be needed (or some other fix).
On this branch, with the following app, the window becomes unusable once full screen state is left:
const {app, BrowserWindow} = require('electron')
let browserWindow
app.once('ready', function () {
browserWindow = new BrowserWindow({
show: true,
fullscreen: true,
transparent: true,
thickFrame: false
});
browserWindow.loadURL(`about:blank`)
})
Then open the dev tools and run:
require('electron').remote.getCurrentWindow().setFullScreen(false)
The window does resize but if you click on it, it isn't usable and will disappear from the taskbar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this might be #6036 happening now since this block is removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do I find atom/browser/native_window_views.cc ?
Thanks for this @liusy182, I really appreciate you taking the time to look into this so thoroughly 👍 |
Where do I fine atom/browser/native_window_views.cc ? |
@kevinsawicki @liusy182 Has the issue with the frameless window going under the task bar been fixed? I am running into the same issue right now and if you can help I would appreciate that. |
Fix for issue #7672
This bug is because boolean
thick_frame_
is not updated in line with windows styleWS_THICKFRAME
.NativeWindowViews::Maxmize()
uses a different routine when it findsthick_frame_
is not set.