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-02-05 01:49:19 +01:00
|
|
|
index d06fde4..329432e 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-02-05 01:49:19 +01:00
|
|
|
@@ -776,6 +776,13 @@ void RenderWidgetHostViewAura::SetKeyboardFocus() {
|
|
|
|
}
|
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-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
|
|
|
host_->Focus();
|
|
|
|
diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc
|
2016-02-05 01:49:19 +01:00
|
|
|
index 780ced5..9409858 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-02-05 01:49:19 +01:00
|
|
|
@@ -376,6 +376,7 @@ RenderWidgetHostViewBase::RenderWidgetHostViewBase()
|
2015-10-26 19:23:08 +01:00
|
|
|
current_device_scale_factor_(0),
|
|
|
|
current_display_rotation_(gfx::Display::ROTATE_0),
|
|
|
|
pinch_zoom_enabled_(content::IsPinchToZoomEnabled()),
|
|
|
|
+ has_external_parent_(false),
|
|
|
|
renderer_frame_number_(0),
|
|
|
|
weak_factory_(this) {
|
|
|
|
}
|
2016-01-06 20:20:54 +01:00
|
|
|
@@ -569,6 +570,10 @@ void RenderWidgetHostViewBase::EndFrameSubscription() {
|
2015-10-26 19:23:08 +01:00
|
|
|
NOTREACHED();
|
|
|
|
}
|
|
|
|
|
|
|
|
+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-02-05 01:49:19 +01:00
|
|
|
index 9a2e25b..dd753a5 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-02-05 01:49:19 +01:00
|
|
|
@@ -95,6 +95,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
2015-10-26 19:23:08 +01:00
|
|
|
void BeginFrameSubscription(
|
|
|
|
scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override;
|
|
|
|
void EndFrameSubscription() override;
|
|
|
|
+ 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.
|
|
|
|
@@ -445,6 +446,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
2015-10-26 19:23:08 +01:00
|
|
|
// renderer.
|
|
|
|
bool pinch_zoom_enabled_;
|
|
|
|
|
|
|
|
+ // 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-02-05 01:49:19 +01:00
|
|
|
index 7c749a2..df2a254 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-02-05 01:49:19 +01:00
|
|
|
@@ -159,6 +159,10 @@ class CONTENT_EXPORT RenderWidgetHostView {
|
2015-10-26 19:23:08 +01:00
|
|
|
// deleted after this call.
|
|
|
|
virtual void EndFrameSubscription() = 0;
|
|
|
|
|
|
|
|
+ // 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)
|
|
|
|
// Set the view's active state (i.e., tint state of controls).
|
|
|
|
virtual void SetActive(bool active) = 0;
|
|
|
|
diff --git ui/views/widget/desktop_aura/desktop_screen_win.cc ui/views/widget/desktop_aura/desktop_screen_win.cc
|
2014-11-12 20:25:15 +01:00
|
|
|
index a8e088c..838b6a0 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
|
2014-11-12 20:25:15 +01:00
|
|
|
@@ -32,6 +32,8 @@ gfx::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-02-05 01:49:19 +01:00
|
|
|
index f79b3c4..f585bea 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-02-02 22:32:44 +01:00
|
|
|
@@ -84,6 +84,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-02-05 01:49:19 +01:00
|
|
|
@@ -134,8 +135,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
|
|
|
|
|
|
|
message_handler_->set_remove_standard_frame(params.remove_standard_frame);
|
2015-10-26 19:23:08 +01:00
|
|
|
|
2016-02-05 01:49:19 +01:00
|
|
|
@@ -800,11 +805,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-02-05 01:49:19 +01:00
|
|
|
index 963658a..36c8d63 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-02-02 22:32:44 +01:00
|
|
|
@@ -244,6 +244,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
|
2015-10-26 19:23:08 +01:00
|
|
|
// Init time, before the Widget has created the NonClientView.
|
|
|
|
bool has_non_client_view_;
|
|
|
|
|
|
|
|
+ // 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-02-05 01:49:19 +01:00
|
|
|
index e2eaf14..0652daa 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-02-05 01:49:19 +01:00
|
|
|
@@ -167,6 +167,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-02-05 01:49:19 +01:00
|
|
|
@@ -175,7 +176,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
|
|
|
|
custom_window_shape_(false),
|
2014-10-10 19:54:35 +02:00
|
|
|
urgency_hint_set_(false),
|
2015-11-10 21:18:16 +01:00
|
|
|
activatable_(true),
|
2014-10-10 19:54:35 +02:00
|
|
|
- close_widget_factory_(this) {
|
|
|
|
+ close_widget_factory_(this),
|
2014-05-22 23:01:22 +02:00
|
|
|
+ xwindow_destroyed_(false) {
|
|
|
|
}
|
|
|
|
|
|
|
|
DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() {
|
2016-02-05 01:49:19 +01:00
|
|
|
@@ -386,7 +388,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-02-05 01:49:19 +01:00
|
|
|
@@ -535,6 +538,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-02-05 01:49:19 +01:00
|
|
|
@@ -972,6 +977,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-02-05 01:49:19 +01:00
|
|
|
@@ -1029,6 +1036,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-02-05 01:49:19 +01:00
|
|
|
@@ -1137,9 +1146,15 @@ void DesktopWindowTreeHostX11::InitX11Window(
|
2015-12-09 17:10:16 +01:00
|
|
|
use_argb_visual_ = true;
|
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-02-05 01:49:19 +01:00
|
|
|
@@ -1767,6 +1782,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
|
2014-05-22 23:01:22 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
+ case DestroyNotify:
|
|
|
|
+ xwindow_destroyed_ = true;
|
|
|
|
+ CloseNow();
|
|
|
|
+ break;
|
|
|
|
case FocusOut:
|
|
|
|
if (xev->xfocus.mode != NotifyGrab) {
|
|
|
|
ReleaseCapture();
|
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-02-05 01:49:19 +01:00
|
|
|
index 759194f..13af979 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-02-05 01:49:19 +01:00
|
|
|
@@ -87,6 +87,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
|
|
|
// 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-02-05 01:49:19 +01:00
|
|
|
@@ -263,6 +269,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-02-05 01:49:19 +01:00
|
|
|
@@ -299,6 +308,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_;
|
|
|
|
|
|
|
|
scoped_ptr<ui::EventHandler> x11_non_client_event_filter_;
|
2016-02-05 01:49:19 +01:00
|
|
|
@@ -351,6 +364,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/desktop_aura/x11_desktop_handler.cc ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
2016-02-05 01:49:19 +01:00
|
|
|
index 5ab84f9..c4095fa 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
|
|
|
+++ ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
|
|
|
@@ -31,6 +31,30 @@ views::X11DesktopHandler* g_handler = NULL;
|
|
|
|
|
|
|
|
namespace views {
|
|
|
|
|
|
|
|
+namespace {
|
|
|
|
+
|
|
|
|
+bool IsParentOfWindow(XDisplay* xdisplay,
|
|
|
|
+ ::Window potential_parent,
|
|
|
|
+ ::Window window) {
|
|
|
|
+ ::Window parent_win, root_win;
|
|
|
|
+ Window* child_windows;
|
|
|
|
+ unsigned int num_child_windows;
|
|
|
|
+ while (window) {
|
|
|
|
+ if (!XQueryTree(xdisplay, window, &root_win, &parent_win,
|
|
|
|
+ &child_windows, &num_child_windows)) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ if(child_windows)
|
|
|
|
+ XFree(child_windows);
|
|
|
|
+ if (parent_win == potential_parent)
|
|
|
|
+ return true;
|
|
|
|
+ window = parent_win;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+} // namespace
|
|
|
|
+
|
|
|
|
// static
|
|
|
|
X11DesktopHandler* X11DesktopHandler::get() {
|
|
|
|
if (!g_handler)
|
|
|
|
@@ -86,7 +110,11 @@ void X11DesktopHandler::ActivateWindow(::Window window) {
|
|
|
|
// in an active X window.
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (wm_supports_active_window_) {
|
|
|
|
+ DesktopWindowTreeHostX11* host =
|
|
|
|
+ DesktopWindowTreeHostX11::GetHostForXID(window);
|
|
|
|
+ const bool has_external_parent = host && host->has_external_parent();
|
|
|
|
+
|
|
|
|
+ if (wm_supports_active_window_ && !has_external_parent) {
|
|
|
|
DCHECK_EQ(gfx::GetXDisplay(), xdisplay_);
|
|
|
|
|
|
|
|
// If the window is not already active, send a hint to activate it
|
|
|
|
@@ -175,8 +203,10 @@ uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) {
|
|
|
|
::Window window;
|
|
|
|
if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) &&
|
|
|
|
window) {
|
|
|
|
- x_active_window_ = window;
|
|
|
|
- OnActiveWindowChanged(window, ACTIVE);
|
|
|
|
+ if (!IsParentOfWindow(xdisplay_, window, current_window_)) {
|
|
|
|
+ x_active_window_ = window;
|
|
|
|
+ OnActiveWindowChanged(window, ACTIVE);
|
|
|
|
+ }
|
|
|
|
} else {
|
|
|
|
x_active_window_ = None;
|
|
|
|
}
|
|
|
|
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
|
2016-02-05 01:49:19 +01:00
|
|
|
index 88a68da..faf4da6 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/widget.cc
|
|
|
|
+++ ui/views/widget/widget.cc
|
2016-02-05 01:49:19 +01:00
|
|
|
@@ -128,6 +128,7 @@ Widget::InitParams::InitParams(Type type)
|
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),
|
|
|
|
@@ -303,7 +304,7 @@ void Widget::Init(const InitParams& in_params) {
|
2014-06-12 22:28:58 +02:00
|
|
|
InitParams params = in_params;
|
|
|
|
|
|
|
|
params.child |= (params.type == InitParams::TYPE_CONTROL);
|
|
|
|
- is_top_level_ = !params.child;
|
|
|
|
+ is_top_level_ = !params.child || params.parent_widget;
|
|
|
|
|
|
|
|
if (params.opacity == views::Widget::InitParams::INFER_OPACITY &&
|
|
|
|
params.type != views::Widget::InitParams::TYPE_WINDOW &&
|
2016-02-05 01:49:19 +01:00
|
|
|
@@ -365,7 +366,12 @@ void Widget::Init(const InitParams& in_params) {
|
2014-03-12 15:36:18 +01:00
|
|
|
Minimize();
|
|
|
|
} 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-02-05 01:49:19 +01:00
|
|
|
index 8c92b90..869a7b8 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/widget.h
|
|
|
|
+++ ui/views/widget/widget.h
|
2016-02-05 01:49:19 +01:00
|
|
|
@@ -233,6 +233,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
|
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;
|
|
|
|
// Specifies the initial bounds of the Widget. Default is empty, which means
|
|
|
|
// the NativeWidget may specify a default size. If the parent is specified,
|
|
|
|
// |bounds| is in the parent's coordinate system. If the parent is not
|