Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Pull in fixes for frameless window from upsteam electron #191

Merged
merged 1 commit into from
May 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/win/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ executable("electron_exe") {
]

configs -= [ "//build/config/win:console" ]
configs += [ "//build/config/win:windowed" ]

data_deps = [
":external_binaries",
Expand Down Expand Up @@ -133,6 +132,10 @@ executable("electron_exe") {
"/DELAYLOAD:esent.dll",
"/DELAYLOAD:API-MS-WIN-CORE-WINRT-L1-1-0.DLL",
"/DELAYLOAD:API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL",
# Chrome builds with this minimum environment which makes e.g.
# GetSystemMetrics(SM_CXSIZEFRAME) return Windows XP/2003
# compatible metrics. See: https://crbug.com/361720
"/SUBSYSTEM:WINDOWS,5.02",
]

if (is_official_build) {
Expand Down
2 changes: 0 additions & 2 deletions atom/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ source_set("browser") {
"ui/views/menu_bar.h",
"ui/views/menu_delegate.cc",
"ui/views/menu_delegate.h",
"ui/views/menu_layout.cc",
"ui/views/menu_layout.h",
"ui/views/menu_model_adapter.cc",
"ui/views/menu_model_adapter.h",
"ui/views/native_frame_view.cc",
Expand Down
19 changes: 15 additions & 4 deletions atom/browser/native_window_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <vector>

#include "atom/browser/ui/views/menu_bar.h"
#include "atom/browser/ui/views/menu_layout.h"
#include "atom/browser/window_list.h"
#include "atom/common/color_util.h"
#include "atom/common/native_mate_converters/image_converter.h"
Expand Down Expand Up @@ -287,9 +286,6 @@ NativeWindowViews::NativeWindowViews(
SetWindowType(GetAcceleratedWidget(), window_type);
#endif

// Add web view.
SetLayoutManager(new MenuLayout(this, kMenuBarHeight));

AddChildView(web_view_);

#if defined(OS_WIN)
Expand Down Expand Up @@ -1278,6 +1274,21 @@ void NativeWindowViews::HandleKeyboardEvent(
}
}

void NativeWindowViews::Layout() {
const auto size = GetContentsBounds().size();
const auto menu_bar_bounds =
menu_bar_ ? gfx::Rect(0, 0, size.width(), kMenuBarHeight) : gfx::Rect();
if (menu_bar_) {
menu_bar_->SetBoundsRect(menu_bar_bounds);
}

if (web_view_) {
web_view_->SetBoundsRect(
gfx::Rect(0, menu_bar_bounds.height(), size.width(),
size.height() - menu_bar_bounds.height()));
}
}

gfx::Size NativeWindowViews::GetMinimumSize() {
return NativeWindow::GetMinimumSize();
}
Expand Down
1 change: 1 addition & 0 deletions atom/browser/native_window_views.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ class NativeWindowViews : public NativeWindow,
const content::NativeWebKeyboardEvent& event) override;

// views::View:
void Layout() override;
gfx::Size GetMinimumSize() override;
gfx::Size GetMaximumSize() override;
bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
Expand Down
92 changes: 0 additions & 92 deletions atom/browser/ui/views/menu_layout.cc

This file was deleted.

36 changes: 0 additions & 36 deletions atom/browser/ui/views/menu_layout.h

This file was deleted.

1 change: 0 additions & 1 deletion atom/browser/ui/views/win_frame_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ WinFrameView::WinFrameView() {
WinFrameView::~WinFrameView() {
}


gfx::Rect WinFrameView::GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const {
return views::GetWindowBoundsForClientBounds(
Expand Down
8 changes: 0 additions & 8 deletions atom/browser/ui/win/atom_desktop_window_tree_host_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,4 @@ bool AtomDesktopWindowTreeHostWin::PreHandleMSG(
return delegate_->PreHandleMSG(message, w_param, l_param, result);
}

/** Override the client area inset
* Returning true forces a border of 0 for frameless windows
*/
bool AtomDesktopWindowTreeHostWin::GetClientAreaInsets(
gfx::Insets* insets) const {
return !HasFrame();
}

} // namespace atom
1 change: 0 additions & 1 deletion atom/browser/ui/win/atom_desktop_window_tree_host_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class AtomDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin {
protected:
bool PreHandleMSG(
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) override;
bool GetClientAreaInsets(gfx::Insets* insets) const override;

private:
MessageHandlerDelegate* delegate_; // weak ref
Expand Down