linux: Share code on frameless window with Windows.
This commit is contained in:
parent
9afc2daf75
commit
2a2fc4903d
4 changed files with 7 additions and 27 deletions
|
@ -395,7 +395,7 @@ views::NonClientFrameView* NativeWindowViews::CreateNonClientFrameView(
|
|||
views::Widget* widget) {
|
||||
#if defined(USE_X11)
|
||||
LinuxFrameView* frame_view = new LinuxFrameView;
|
||||
#else defined(OS_WIN)
|
||||
#else
|
||||
WinFrameView* frame_view = new WinFrameView;
|
||||
#endif
|
||||
frame_view->Init(this, widget);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "atom/browser/native_window_views.h"
|
||||
#include "ui/aura/window.h"
|
||||
#include "ui/base/hit_test.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
#include "ui/views/widget/widget_delegate.h"
|
||||
|
||||
|
|
|
@ -76,9 +76,7 @@ const gfx::FontList& GetTitleFontList() {
|
|||
// LinuxFrameView, public:
|
||||
|
||||
LinuxFrameView::LinuxFrameView()
|
||||
: window_(NULL),
|
||||
frame_(NULL),
|
||||
window_icon_(NULL),
|
||||
: window_icon_(NULL),
|
||||
minimize_button_(NULL),
|
||||
maximize_button_(NULL),
|
||||
restore_button_(NULL),
|
||||
|
@ -117,12 +115,6 @@ void LinuxFrameView::Init(NativeWindowViews* window, views::Widget* frame) {
|
|||
}
|
||||
}
|
||||
|
||||
int LinuxFrameView::ResizingBorderHitTest(const gfx::Point& point) {
|
||||
return GetHTComponentForFrame(point, FrameBorderThickness(),
|
||||
FrameBorderThickness() + kClientEdgeThickness, kResizeAreaCornerSize,
|
||||
kResizeAreaCornerSize, true);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LinuxFrameView, NonClientFrameView implementation:
|
||||
|
||||
|
@ -141,23 +133,13 @@ gfx::Rect LinuxFrameView::GetWindowBoundsForClientBounds(
|
|||
}
|
||||
|
||||
int LinuxFrameView::NonClientHitTest(const gfx::Point& point) {
|
||||
if (!window_->has_frame())
|
||||
return FramelessView::NonClientHitTest(point);
|
||||
|
||||
// Sanity check.
|
||||
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;
|
||||
|
||||
// Support resizing frameless window by dragging the border.
|
||||
if (!window_->has_frame() && frame_->widget_delegate()->CanResize()) {
|
||||
int window_component = ResizingBorderHitTest(point);
|
||||
if (window_component != HTNOWHERE)
|
||||
return window_component;
|
||||
}
|
||||
|
||||
int frame_component = frame_->client_view()->NonClientHitTest(point);
|
||||
|
||||
// See if we're in the sysmenu region. (We check the ClientView first to be
|
||||
|
|
|
@ -21,7 +21,7 @@ class ImageButton;
|
|||
|
||||
namespace atom {
|
||||
|
||||
class LinuxFrameView : public FramelessView
|
||||
class LinuxFrameView : public FramelessView,
|
||||
public views::ButtonListener {
|
||||
public:
|
||||
LinuxFrameView();
|
||||
|
@ -51,9 +51,6 @@ class LinuxFrameView : public FramelessView
|
|||
virtual void ButtonPressed(views::Button* sender,
|
||||
const ui::Event& event) OVERRIDE;
|
||||
|
||||
// Returns whether the |point| is on frameless window's resizing border.
|
||||
int ResizingBorderHitTest(const gfx::Point& point);
|
||||
|
||||
private:
|
||||
// Returns the thickness of the border that makes up the window frame edges.
|
||||
// This does not include any client edge.
|
||||
|
|
Loading…
Reference in a new issue