2015-10-26 19:23:08 +01:00
|
|
|
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
|
2016-10-17 20:14:44 +02:00
|
|
|
index 72004fe..ff7ba8c7 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
|
|
+++ content/browser/renderer_host/render_widget_host_view_aura.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -747,6 +747,13 @@ void RenderWidgetHostViewAura::SetKeyboardFocus() {
|
2016-02-05 01:49:19 +01:00
|
|
|
}
|
2015-10-26 19:23:08 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
+#if defined(OS_LINUX)
|
|
|
|
+ if (has_external_parent_ && CanFocus()) {
|
|
|
|
+ aura::WindowTreeHost* host = window_->GetHost();
|
|
|
|
+ if (host)
|
|
|
|
+ host->Show();
|
|
|
|
+ }
|
|
|
|
+#endif
|
2016-03-16 03:55:59 +01:00
|
|
|
// TODO(wjmaclean): can host_ ever be null?
|
2016-02-02 22:32:44 +01:00
|
|
|
if (host_ && set_focus_on_mouse_down_or_key_event_) {
|
|
|
|
set_focus_on_mouse_down_or_key_event_ = false;
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc
|
2016-10-17 20:14:44 +02:00
|
|
|
index a8e8627..2ec202f 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- content/browser/renderer_host/render_widget_host_view_base.cc
|
|
|
|
+++ content/browser/renderer_host/render_widget_host_view_base.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -44,6 +44,7 @@ RenderWidgetHostViewBase::RenderWidgetHostViewBase()
|
2016-05-25 01:35:43 +02:00
|
|
|
current_display_rotation_(display::Display::ROTATE_0),
|
2015-10-26 19:23:08 +01:00
|
|
|
pinch_zoom_enabled_(content::IsPinchToZoomEnabled()),
|
2016-06-21 00:59:23 +02:00
|
|
|
text_input_manager_(nullptr),
|
2015-10-26 19:23:08 +01:00
|
|
|
+ has_external_parent_(false),
|
|
|
|
renderer_frame_number_(0),
|
2016-08-31 13:25:56 +02:00
|
|
|
weak_factory_(this) {
|
|
|
|
}
|
|
|
|
@@ -324,6 +325,10 @@ void RenderWidgetHostViewBase::FocusedNodeTouched(
|
2016-06-21 00:59:23 +02:00
|
|
|
DVLOG(1) << "FocusedNodeTouched: " << editable;
|
2015-10-26 19:23:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+void RenderWidgetHostViewBase::SetHasExternalParent(bool val) {
|
|
|
|
+ has_external_parent_ = val;
|
|
|
|
+}
|
|
|
|
+
|
2016-01-06 20:20:54 +01:00
|
|
|
uint32_t RenderWidgetHostViewBase::RendererFrameNumber() {
|
2015-10-26 19:23:08 +01:00
|
|
|
return renderer_frame_number_;
|
|
|
|
}
|
|
|
|
diff --git content/browser/renderer_host/render_widget_host_view_base.h content/browser/renderer_host/render_widget_host_view_base.h
|
2016-10-17 20:14:44 +02:00
|
|
|
index b68718d..5b209ca 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- content/browser/renderer_host/render_widget_host_view_base.h
|
|
|
|
+++ content/browser/renderer_host/render_widget_host_view_base.h
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -107,6 +107,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
2015-10-26 19:23:08 +01:00
|
|
|
void EndFrameSubscription() override;
|
2016-06-21 00:59:23 +02:00
|
|
|
void FocusedNodeTouched(const gfx::Point& location_dips_screen,
|
|
|
|
bool editable) override;
|
2015-10-26 19:23:08 +01:00
|
|
|
+ void SetHasExternalParent(bool val) override;
|
|
|
|
|
2016-02-05 01:49:19 +01:00
|
|
|
// This only needs to be overridden by RenderWidgetHostViewBase subclasses
|
|
|
|
// that handle content embedded within other RenderWidgetHostViews.
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -468,6 +469,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
2016-06-21 00:59:23 +02:00
|
|
|
// destroyed before the RWHV is destroyed.
|
|
|
|
TextInputManager* text_input_manager_;
|
2015-10-26 19:23:08 +01:00
|
|
|
|
|
|
|
+ // True if the widget has a external parent view/window outside of the
|
|
|
|
+ // Chromium-controlled view/window hierarchy.
|
|
|
|
+ bool has_external_parent_;
|
|
|
|
+
|
|
|
|
private:
|
|
|
|
void FlushInput();
|
|
|
|
|
|
|
|
diff --git content/public/browser/render_widget_host_view.h content/public/browser/render_widget_host_view.h
|
2016-08-31 13:25:56 +02:00
|
|
|
index ff3127b..e666db1 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- content/public/browser/render_widget_host_view.h
|
|
|
|
+++ content/public/browser/render_widget_host_view.h
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -172,6 +172,10 @@ class CONTENT_EXPORT RenderWidgetHostView {
|
|
|
|
// when the value has changed. Views must initially default to false.
|
|
|
|
virtual void SetNeedsBeginFrames(bool needs_begin_frames) = 0;
|
2015-10-26 19:23:08 +01:00
|
|
|
|
|
|
|
+ // Set whether the widget has a external parent view/window outside of the
|
|
|
|
+ // Chromium-controlled view/window hierarchy.
|
|
|
|
+ virtual void SetHasExternalParent(bool val) = 0;
|
|
|
|
+
|
|
|
|
#if defined(OS_MACOSX)
|
2016-05-25 01:35:43 +02:00
|
|
|
// Return the accelerated widget which hosts the CALayers that draw the
|
|
|
|
// content of the view in GetNativeView. This may be null.
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git ui/views/widget/desktop_aura/desktop_screen_win.cc ui/views/widget/desktop_aura/desktop_screen_win.cc
|
2016-05-25 01:35:43 +02:00
|
|
|
index f772f64..7d13f9f 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/desktop_aura/desktop_screen_win.cc
|
|
|
|
+++ ui/views/widget/desktop_aura/desktop_screen_win.cc
|
2016-05-25 01:35:43 +02:00
|
|
|
@@ -32,6 +32,8 @@ display::Display DesktopScreenWin::GetDisplayMatching(
|
2013-12-07 02:55:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HWND DesktopScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const {
|
|
|
|
+ if (!window)
|
|
|
|
+ return NULL;
|
2014-04-04 18:50:38 +02:00
|
|
|
aura::WindowTreeHost* host = window->GetHost();
|
|
|
|
return host ? host->GetAcceleratedWidget() : NULL;
|
2013-12-07 02:55:22 +01:00
|
|
|
}
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
2016-10-17 20:14:44 +02:00
|
|
|
index 964fe4a..b878661 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
|
|
|
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
2016-05-25 01:35:43 +02:00
|
|
|
@@ -86,6 +86,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin(
|
2015-10-26 19:23:08 +01:00
|
|
|
should_animate_window_close_(false),
|
|
|
|
pending_close_(false),
|
|
|
|
has_non_client_view_(false),
|
|
|
|
+ has_external_parent_(false),
|
|
|
|
tooltip_(NULL) {
|
|
|
|
}
|
|
|
|
|
2016-05-25 01:35:43 +02:00
|
|
|
@@ -136,8 +137,12 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window,
|
2014-02-19 17:27:54 +01:00
|
|
|
native_widget_delegate_);
|
|
|
|
|
|
|
|
HWND parent_hwnd = NULL;
|
2014-04-04 18:50:38 +02:00
|
|
|
- if (params.parent && params.parent->GetHost())
|
2015-10-26 19:23:08 +01:00
|
|
|
+ if (params.parent_widget) {
|
2014-02-19 17:27:54 +01:00
|
|
|
+ parent_hwnd = params.parent_widget;
|
2015-10-26 19:23:08 +01:00
|
|
|
+ has_external_parent_ = true;
|
|
|
|
+ } else if (params.parent && params.parent->GetHost()) {
|
2014-04-04 18:50:38 +02:00
|
|
|
parent_hwnd = params.parent->GetHost()->GetAcceleratedWidget();
|
2015-10-26 19:23:08 +01:00
|
|
|
+ }
|
2014-04-04 18:50:38 +02:00
|
|
|
|
2016-04-27 22:38:52 +02:00
|
|
|
remove_standard_frame_ = params.remove_standard_frame;
|
|
|
|
has_non_client_view_ = Widget::RequiresNonClientView(params.type);
|
2016-07-21 23:21:32 +02:00
|
|
|
@@ -645,6 +650,10 @@ bool DesktopWindowTreeHostWin::CanActivate() const {
|
2016-01-19 21:09:01 +01:00
|
|
|
return native_widget_delegate_->CanActivate();
|
|
|
|
}
|
|
|
|
|
|
|
|
+bool DesktopWindowTreeHostWin::RemoveCaption() const {
|
|
|
|
+ return GetWidget()->remove_caption();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
bool DesktopWindowTreeHostWin::WantsMouseEventsWhenInactive() const {
|
|
|
|
return wants_mouse_events_when_inactive_;
|
|
|
|
}
|
2016-07-21 23:21:32 +02:00
|
|
|
@@ -825,11 +834,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
|
2015-08-27 23:55:48 +02:00
|
|
|
}
|
2014-06-06 21:04:21 +02:00
|
|
|
|
|
|
|
void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
|
2015-08-27 23:55:48 +02:00
|
|
|
- // TODO(beng): inform the native_widget_delegate_.
|
|
|
|
+ // See comments in CefBrowserHostImpl::PlatformSetFocus.
|
2015-10-26 19:23:08 +01:00
|
|
|
+ if (has_external_parent_ && CanActivate())
|
2015-08-27 23:55:48 +02:00
|
|
|
+ HandleActivationChanged(true);
|
2015-06-06 00:06:48 +02:00
|
|
|
}
|
2014-06-06 21:04:21 +02:00
|
|
|
|
|
|
|
void DesktopWindowTreeHostWin::HandleNativeBlur(HWND focused_window) {
|
2015-08-27 23:55:48 +02:00
|
|
|
- // TODO(beng): inform the native_widget_delegate_.
|
|
|
|
+ // See comments in CefBrowserHostImpl::PlatformSetFocus.
|
2015-10-26 19:23:08 +01:00
|
|
|
+ if (has_external_parent_ && CanActivate())
|
2015-08-27 23:55:48 +02:00
|
|
|
+ HandleActivationChanged(false);
|
2015-08-04 19:53:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) {
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
|
2016-08-31 13:25:56 +02:00
|
|
|
index 884df90..518a69c 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
|
|
|
|
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
|
2016-07-21 23:21:32 +02:00
|
|
|
@@ -138,6 +138,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
|
2016-01-19 21:09:01 +01:00
|
|
|
bool CanMaximize() const override;
|
|
|
|
bool CanMinimize() const override;
|
|
|
|
bool CanActivate() const override;
|
|
|
|
+ bool RemoveCaption() const override;
|
|
|
|
bool WantsMouseEventsWhenInactive() const override;
|
|
|
|
bool WidgetSizeIsClientSize() const override;
|
|
|
|
bool IsModal() const override;
|
2016-07-21 23:21:32 +02:00
|
|
|
@@ -252,6 +253,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
|
2016-04-27 22:38:52 +02:00
|
|
|
// True if the window should have the frame removed.
|
|
|
|
bool remove_standard_frame_;
|
2015-10-26 19:23:08 +01:00
|
|
|
|
|
|
|
+ // True if the widget has a external parent view/window outside of the
|
|
|
|
+ // Chromium-controlled view/window hierarchy.
|
|
|
|
+ bool has_external_parent_;
|
|
|
|
+
|
|
|
|
// Owned by TooltipController, but we need to forward events to it so we keep
|
|
|
|
// a reference.
|
|
|
|
corewm::TooltipWin* tooltip_;
|
|
|
|
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
|
2016-10-17 20:14:44 +02:00
|
|
|
index 38a416b..6343597 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
|
|
|
|
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
|
2016-10-17 20:14:44 +02:00
|
|
|
@@ -194,6 +194,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
|
2015-10-26 19:23:08 +01:00
|
|
|
use_native_frame_(false),
|
|
|
|
should_maximize_after_map_(false),
|
|
|
|
use_argb_visual_(false),
|
|
|
|
+ has_external_parent_(false),
|
|
|
|
drag_drop_client_(NULL),
|
|
|
|
native_widget_delegate_(native_widget_delegate),
|
|
|
|
desktop_native_widget_aura_(desktop_native_widget_aura),
|
2016-10-17 20:14:44 +02:00
|
|
|
@@ -206,7 +207,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
|
|
|
|
has_pointer_(false),
|
|
|
|
has_window_focus_(false),
|
|
|
|
has_pointer_focus_(false),
|
|
|
|
- close_widget_factory_(this) {}
|
2014-10-10 19:54:35 +02:00
|
|
|
+ close_widget_factory_(this),
|
2016-10-17 20:14:44 +02:00
|
|
|
+ xwindow_destroyed_(false) {}
|
2014-05-22 23:01:22 +02:00
|
|
|
|
|
|
|
DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() {
|
2016-10-17 20:14:44 +02:00
|
|
|
window()->ClearProperty(kHostForRootWindow);
|
|
|
|
@@ -542,7 +544,8 @@ void DesktopWindowTreeHostX11::CloseNow() {
|
2014-05-22 23:01:22 +02:00
|
|
|
// Actually free our native resources.
|
|
|
|
if (ui::PlatformEventSource::GetInstance())
|
|
|
|
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
|
|
|
- XDestroyWindow(xdisplay_, xwindow_);
|
|
|
|
+ if (!xwindow_destroyed_)
|
|
|
|
+ XDestroyWindow(xdisplay_, xwindow_);
|
|
|
|
xwindow_ = None;
|
|
|
|
|
|
|
|
desktop_native_widget_aura_->OnHostClosed();
|
2016-10-17 20:14:44 +02:00
|
|
|
@@ -683,6 +686,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement(
|
2014-07-09 00:37:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const {
|
|
|
|
+ if (!screen_bounds_.IsEmpty())
|
|
|
|
+ return screen_bounds_;
|
2015-03-04 02:00:13 +01:00
|
|
|
return ToDIPRect(bounds_in_pixels_);
|
2014-07-09 00:37:06 +02:00
|
|
|
}
|
|
|
|
|
2016-10-17 20:14:44 +02:00
|
|
|
@@ -1205,6 +1210,8 @@ void DesktopWindowTreeHostX11::HideImpl() {
|
2014-10-29 19:14:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Rect DesktopWindowTreeHostX11::GetBounds() const {
|
|
|
|
+ if (!screen_bounds_.IsEmpty())
|
|
|
|
+ return screen_bounds_;
|
2015-03-04 02:00:13 +01:00
|
|
|
return bounds_in_pixels_;
|
2014-10-29 19:14:47 +01:00
|
|
|
}
|
|
|
|
|
2016-10-17 20:14:44 +02:00
|
|
|
@@ -1264,6 +1271,8 @@ void DesktopWindowTreeHostX11::SetBounds(
|
2014-07-09 00:37:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const {
|
|
|
|
+ if (!screen_bounds_.IsEmpty())
|
|
|
|
+ return screen_bounds_.origin();
|
2015-03-04 02:00:13 +01:00
|
|
|
return bounds_in_pixels_.origin();
|
2014-07-09 00:37:06 +02:00
|
|
|
}
|
|
|
|
|
2016-10-17 20:14:44 +02:00
|
|
|
@@ -1382,9 +1391,15 @@ void DesktopWindowTreeHostX11::InitX11Window(
|
2016-07-06 21:34:09 +02:00
|
|
|
None;
|
2014-05-29 19:15:34 +02:00
|
|
|
}
|
2014-05-22 23:01:22 +02:00
|
|
|
|
|
|
|
+ gfx::AcceleratedWidget parent_widget = params.parent_widget;
|
|
|
|
+ if (parent_widget == gfx::kNullAcceleratedWidget)
|
|
|
|
+ parent_widget = x_root_window_;
|
2015-10-26 19:23:08 +01:00
|
|
|
+ else
|
|
|
|
+ has_external_parent_ = true;
|
2014-05-22 23:01:22 +02:00
|
|
|
+
|
2015-03-04 02:00:13 +01:00
|
|
|
bounds_in_pixels_ = ToPixelRect(params.bounds);
|
|
|
|
bounds_in_pixels_.set_size(AdjustSize(bounds_in_pixels_.size()));
|
|
|
|
- xwindow_ = XCreateWindow(xdisplay_, x_root_window_, bounds_in_pixels_.x(),
|
|
|
|
+ xwindow_ = XCreateWindow(xdisplay_, parent_widget, bounds_in_pixels_.x(),
|
|
|
|
bounds_in_pixels_.y(), bounds_in_pixels_.width(),
|
|
|
|
bounds_in_pixels_.height(),
|
|
|
|
0, // border width
|
2016-10-17 20:14:44 +02:00
|
|
|
@@ -2013,6 +2028,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
|
2014-05-22 23:01:22 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
+ case DestroyNotify:
|
|
|
|
+ xwindow_destroyed_ = true;
|
|
|
|
+ CloseNow();
|
|
|
|
+ break;
|
2016-10-17 20:14:44 +02:00
|
|
|
case FocusIn:
|
2014-05-22 23:01:22 +02:00
|
|
|
case FocusOut:
|
2016-10-17 20:14:44 +02:00
|
|
|
OnFocusEvent(xev->type == FocusIn, event->xfocus.mode,
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
|
2016-10-17 20:14:44 +02:00
|
|
|
index 07e35ca..7746296 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
|
|
|
|
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
|
2016-10-17 20:14:44 +02:00
|
|
|
@@ -83,6 +83,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
2016-02-05 01:49:19 +01:00
|
|
|
// internal list of open windows.
|
|
|
|
static void CleanUpWindowList(void (*func)(aura::Window* window));
|
2014-07-09 00:37:06 +02:00
|
|
|
|
|
|
|
+ void set_screen_bounds(const gfx::Rect& bounds) { screen_bounds_ = bounds; }
|
2015-10-26 19:23:08 +01:00
|
|
|
+
|
|
|
|
+ // Returns true if the widget has a external parent view/window outside of the
|
|
|
|
+ // Chromium-controlled view/window hierarchy.
|
|
|
|
+ bool has_external_parent() const { return has_external_parent_; }
|
2014-07-09 00:37:06 +02:00
|
|
|
+
|
|
|
|
protected:
|
|
|
|
// Overridden from DesktopWindowTreeHost:
|
2014-11-12 20:25:15 +01:00
|
|
|
void Init(aura::Window* content_window,
|
2016-10-17 20:14:44 +02:00
|
|
|
@@ -290,6 +296,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
2014-07-09 00:37:06 +02:00
|
|
|
// The bounds of |xwindow_|.
|
2015-03-04 02:00:13 +01:00
|
|
|
gfx::Rect bounds_in_pixels_;
|
2014-07-09 00:37:06 +02:00
|
|
|
|
|
|
|
+ // Override the screen bounds when the host is a child window.
|
|
|
|
+ gfx::Rect screen_bounds_;
|
|
|
|
+
|
|
|
|
// Whenever the bounds are set, we keep the previous set of bounds around so
|
2015-03-04 02:00:13 +01:00
|
|
|
// we can have a better chance of getting the real
|
|
|
|
// |restored_bounds_in_pixels_|. Window managers tend to send a Configure
|
2016-10-17 20:14:44 +02:00
|
|
|
@@ -329,6 +338,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
2015-10-26 19:23:08 +01:00
|
|
|
// Whether we used an ARGB visual for our window.
|
|
|
|
bool use_argb_visual_;
|
|
|
|
|
|
|
|
+ // True if the widget has a external parent view/window outside of the
|
|
|
|
+ // Chromium-controlled view/window hierarchy.
|
|
|
|
+ bool has_external_parent_;
|
|
|
|
+
|
|
|
|
DesktopDragDropClientAuraX11* drag_drop_client_;
|
|
|
|
|
2016-05-25 01:35:43 +02:00
|
|
|
std::unique_ptr<ui::EventHandler> x11_non_client_event_filter_;
|
2016-10-17 20:14:44 +02:00
|
|
|
@@ -414,6 +427,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
2014-09-04 19:53:40 +02:00
|
|
|
|
2014-10-10 19:54:35 +02:00
|
|
|
base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_;
|
2014-05-22 23:01:22 +02:00
|
|
|
|
|
|
|
+ // True if the xwindow has already been destroyed.
|
|
|
|
+ bool xwindow_destroyed_;
|
|
|
|
+
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11);
|
|
|
|
};
|
|
|
|
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
|
2016-10-17 20:14:44 +02:00
|
|
|
index 4b3db3f..103bba3 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/widget.cc
|
|
|
|
+++ ui/views/widget/widget.cc
|
2016-01-19 21:09:01 +01:00
|
|
|
@@ -126,9 +126,11 @@ Widget::InitParams::InitParams(Type type)
|
|
|
|
mirror_origin_in_rtl(false),
|
|
|
|
shadow_type(SHADOW_TYPE_DEFAULT),
|
|
|
|
remove_standard_frame(false),
|
|
|
|
+ remove_caption(false),
|
2014-11-12 20:25:15 +01:00
|
|
|
use_system_default_icon(false),
|
2014-02-06 23:33:18 +01:00
|
|
|
show_state(ui::SHOW_STATE_DEFAULT),
|
2015-12-09 17:10:16 +01:00
|
|
|
parent(nullptr),
|
2014-05-22 23:01:22 +02:00
|
|
|
+ parent_widget(gfx::kNullAcceleratedWidget),
|
2015-12-09 17:10:16 +01:00
|
|
|
native_widget(nullptr),
|
|
|
|
desktop_window_tree_host(nullptr),
|
2016-02-05 01:49:19 +01:00
|
|
|
layer_type(ui::LAYER_TEXTURED),
|
2016-05-25 01:35:43 +02:00
|
|
|
@@ -165,6 +167,7 @@ Widget::Widget()
|
2016-01-19 21:09:01 +01:00
|
|
|
auto_release_capture_(true),
|
|
|
|
root_layers_dirty_(false),
|
|
|
|
movement_disabled_(false),
|
|
|
|
+ remove_caption_(false),
|
|
|
|
observer_manager_(this) {
|
|
|
|
}
|
|
|
|
|
2016-05-25 01:35:43 +02:00
|
|
|
@@ -296,7 +299,8 @@ void Widget::Init(const InitParams& in_params) {
|
|
|
|
params.name = params.delegate->GetContentsView()->GetClassName();
|
2014-06-12 22:28:58 +02:00
|
|
|
|
|
|
|
params.child |= (params.type == InitParams::TYPE_CONTROL);
|
|
|
|
- is_top_level_ = !params.child;
|
|
|
|
+ is_top_level_ = !params.child || params.parent_widget;
|
2016-01-19 21:09:01 +01:00
|
|
|
+ remove_caption_ = params.remove_caption;
|
2014-06-12 22:28:58 +02:00
|
|
|
|
|
|
|
if (params.opacity == views::Widget::InitParams::INFER_OPACITY &&
|
|
|
|
params.type != views::Widget::InitParams::TYPE_WINDOW &&
|
2016-05-25 01:35:43 +02:00
|
|
|
@@ -360,7 +364,12 @@ void Widget::Init(const InitParams& in_params) {
|
|
|
|
}
|
2014-03-12 15:36:18 +01:00
|
|
|
} else if (params.delegate) {
|
|
|
|
SetContentsView(params.delegate->GetContentsView());
|
|
|
|
- SetInitialBoundsForFramelessWindow(params.bounds);
|
|
|
|
+ if (params.parent_widget) {
|
|
|
|
+ // Set the bounds directly instead of applying an inset.
|
|
|
|
+ SetBounds(params.bounds);
|
|
|
|
+ } else {
|
|
|
|
+ SetInitialBoundsForFramelessWindow(params.bounds);
|
|
|
|
+ }
|
|
|
|
}
|
2014-07-02 20:25:22 +02:00
|
|
|
// This must come after SetContentsView() or it might not be able to find
|
|
|
|
// the correct NativeTheme (on Linux). See http://crbug.com/384492
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
|
2016-08-31 13:25:56 +02:00
|
|
|
index a92dbce..db28032 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/widget.h
|
|
|
|
+++ ui/views/widget/widget.h
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -234,12 +234,17 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
|
2016-01-19 21:09:01 +01:00
|
|
|
// rendered, and that the client area should be equivalent to the window
|
|
|
|
// area. Only used on some platforms (Windows and Linux).
|
|
|
|
bool remove_standard_frame;
|
|
|
|
+ // Specifies that the system default caption and icon should not be
|
|
|
|
+ // rendered but the window may still have a resizable border. Only used on
|
|
|
|
+ // some platforms (Windows and Linux).
|
|
|
|
+ bool remove_caption;
|
|
|
|
// Only used by ShellWindow on Windows. Specifies that the default icon of
|
|
|
|
// packaged app should be the system default icon.
|
|
|
|
bool use_system_default_icon;
|
2014-11-12 20:25:15 +01:00
|
|
|
// Whether the widget should be maximized or minimized.
|
|
|
|
ui::WindowShowState show_state;
|
2013-12-07 02:55:22 +01:00
|
|
|
gfx::NativeView parent;
|
|
|
|
+ gfx::AcceleratedWidget parent_widget;
|
2016-05-25 01:35:43 +02:00
|
|
|
// Used only by mus and is necessitated by mus not being a NativeView.
|
2016-07-21 23:21:32 +02:00
|
|
|
ui::Window* parent_mus = nullptr;
|
2013-12-07 02:55:22 +01:00
|
|
|
// Specifies the initial bounds of the Widget. Default is empty, which means
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -756,6 +761,10 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
|
2016-01-19 21:09:01 +01:00
|
|
|
bool movement_disabled() const { return movement_disabled_; }
|
|
|
|
void set_movement_disabled(bool disabled) { movement_disabled_ = disabled; }
|
|
|
|
|
|
|
|
+ // True if the system default caption and icon should not be rendered but the
|
|
|
|
+ // window may still have a resizable border.
|
|
|
|
+ bool remove_caption() const { return remove_caption_; }
|
|
|
|
+
|
|
|
|
// Returns the work area bounds of the screen the Widget belongs to.
|
|
|
|
gfx::Rect GetWorkAreaBoundsInScreen() const;
|
|
|
|
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -974,6 +983,10 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
|
2016-01-19 21:09:01 +01:00
|
|
|
// disabled.
|
|
|
|
bool movement_disabled_;
|
|
|
|
|
|
|
|
+ // True if the system default caption and icon should not be rendered but the
|
|
|
|
+ // window may still have a resizable border.
|
|
|
|
+ bool remove_caption_;
|
|
|
|
+
|
|
|
|
ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(Widget);
|
|
|
|
diff --git ui/views/widget/widget_hwnd_utils.cc ui/views/widget/widget_hwnd_utils.cc
|
2016-05-25 01:35:43 +02:00
|
|
|
index b843416..8b81a51 100644
|
2016-01-19 21:09:01 +01:00
|
|
|
--- ui/views/widget/widget_hwnd_utils.cc
|
|
|
|
+++ ui/views/widget/widget_hwnd_utils.cc
|
2016-05-25 01:35:43 +02:00
|
|
|
@@ -114,6 +114,11 @@ void CalculateWindowStylesFromInitParams(
|
2016-01-19 21:09:01 +01:00
|
|
|
// See layered window comment above.
|
|
|
|
if (*ex_style & WS_EX_COMPOSITED)
|
|
|
|
*style &= ~(WS_THICKFRAME | WS_CAPTION);
|
|
|
|
+
|
|
|
|
+ if (params.remove_caption) {
|
|
|
|
+ *style &= ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX |
|
|
|
|
+ WS_THICKFRAME);
|
|
|
|
+ }
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Widget::InitParams::TYPE_CONTROL:
|
|
|
|
diff --git ui/views/win/hwnd_message_handler.cc ui/views/win/hwnd_message_handler.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
index ec631af..2d55a51 100644
|
2016-01-19 21:09:01 +01:00
|
|
|
--- ui/views/win/hwnd_message_handler.cc
|
|
|
|
+++ ui/views/win/hwnd_message_handler.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -851,6 +851,8 @@ void HWNDMessageHandler::SizeConstraintsChanged() {
|
2016-01-19 21:09:01 +01:00
|
|
|
} else {
|
|
|
|
style &= ~WS_MINIMIZEBOX;
|
|
|
|
}
|
|
|
|
+ if (delegate_->RemoveCaption())
|
|
|
|
+ style &= ~(WS_CAPTION | WS_SYSMENU | WS_THICKFRAME);
|
|
|
|
SetWindowLong(hwnd(), GWL_STYLE, style);
|
|
|
|
}
|
|
|
|
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -2469,8 +2471,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
2016-01-19 21:09:01 +01:00
|
|
|
active_mouse_tracking_flags_ = 0;
|
|
|
|
} else if (event.type() == ui::ET_MOUSEWHEEL) {
|
|
|
|
// Reroute the mouse wheel to the window under the pointer if applicable.
|
|
|
|
- return (ui::RerouteMouseWheel(hwnd(), w_param, l_param) ||
|
|
|
|
- delegate_->HandleMouseEvent(ui::MouseWheelEvent(msg))) ? 0 : 1;
|
|
|
|
+ if (ui::RerouteMouseWheel(hwnd(), w_param, l_param) ||
|
|
|
|
+ delegate_->HandleMouseEvent(ui::MouseWheelEvent(msg))) {
|
|
|
|
+ SetMsgHandled(TRUE);
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// There are cases where the code handling the message destroys the window,
|
|
|
|
diff --git ui/views/win/hwnd_message_handler_delegate.h ui/views/win/hwnd_message_handler_delegate.h
|
2016-08-31 13:25:56 +02:00
|
|
|
index ddf26d2..79e5db2 100644
|
2016-01-19 21:09:01 +01:00
|
|
|
--- ui/views/win/hwnd_message_handler_delegate.h
|
|
|
|
+++ ui/views/win/hwnd_message_handler_delegate.h
|
2016-04-27 22:38:52 +02:00
|
|
|
@@ -57,6 +57,10 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate {
|
2016-01-19 21:09:01 +01:00
|
|
|
virtual bool CanMinimize() const = 0;
|
|
|
|
virtual bool CanActivate() const = 0;
|
|
|
|
|
|
|
|
+ // Returns true if the system default caption and icon should not be rendered
|
|
|
|
+ // but the window may still have a resizable border.
|
|
|
|
+ virtual bool RemoveCaption() const = 0;
|
|
|
|
+
|
|
|
|
// Returns true if the delegate wants mouse events when inactive and the
|
|
|
|
// window is clicked and should not become activated. A return value of false
|
|
|
|
// indicates the mouse events will be dropped.
|