From a5e2ea2899b9606cf626c840b31b145dac476fcf Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 7 Jul 2014 16:10:34 +0800 Subject: [PATCH] views: Make frameless window work. --- atom/browser/native_window_views.cc | 3 +-- atom/browser/ui/views/linux_frame_view.cc | 9 +++++++++ filename_rules.gypi | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 04b92145a8cd..d26a3c929b63 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -62,8 +62,7 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents, views::Widget::InitParams params; params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params.delegate = this; - params.type = has_frame_ ? views::Widget::InitParams::TYPE_WINDOW : - views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; + params.type = views::Widget::InitParams::TYPE_WINDOW; params.top_level = true; params.remove_standard_frame = true; window_->Init(params); diff --git a/atom/browser/ui/views/linux_frame_view.cc b/atom/browser/ui/views/linux_frame_view.cc index 5d9945ea30a3..3d31f5feaa43 100644 --- a/atom/browser/ui/views/linux_frame_view.cc +++ b/atom/browser/ui/views/linux_frame_view.cc @@ -140,6 +140,12 @@ int LinuxFrameView::NonClientHitTest(const gfx::Point& point) { if (!bounds().Contains(point)) return HTNOWHERE; + // Check for possible draggable region in the client area for the frameless + // window. + SkRegion* draggable_region = window_->draggable_region(); + if (draggable_region && draggable_region->contains(point.x(), point.y())) + return HTCAPTION; + int frame_component = frame_->client_view()->NonClientHitTest(point); // See if we're in the sysmenu region. (We check the ClientView first to be @@ -323,6 +329,9 @@ gfx::Rect LinuxFrameView::IconBounds() const { } bool LinuxFrameView::ShouldShowTitleBarAndBorder() const { + if (!window_->has_frame()) + return false; + if (frame_->IsFullscreen()) return false; diff --git a/filename_rules.gypi b/filename_rules.gypi index b2484cd98c07..48bccd86764e 100644 --- a/filename_rules.gypi +++ b/filename_rules.gypi @@ -32,7 +32,7 @@ ['OS!="linux" and OS!="openbsd" and OS!="freebsd"', { 'sources/': [ ['exclude', '_linux(_unittest)?\\.(h|cc)$'], - ['exclude', '(^|/)linux/'], + ['exclude', '(^|/)linux_[^/]*\\.(h|cc)$'], ['exclude', '(^|/)linux/'], ], }],