2014-05-22 23:01:22 +02:00
|
|
|
diff --git desktop_aura/desktop_screen_win.cc desktop_aura/desktop_screen_win.cc
|
|
|
|
index c5edf76..9389662 100644
|
|
|
|
--- desktop_aura/desktop_screen_win.cc
|
|
|
|
+++ desktop_aura/desktop_screen_win.cc
|
|
|
|
@@ -54,6 +54,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
|
|
|
}
|
2014-05-22 23:01:22 +02:00
|
|
|
diff --git desktop_aura/desktop_window_tree_host_win.cc desktop_aura/desktop_window_tree_host_win.cc
|
|
|
|
index 2fc499b..6fa63b5 100644
|
|
|
|
--- desktop_aura/desktop_window_tree_host_win.cc
|
|
|
|
+++ desktop_aura/desktop_window_tree_host_win.cc
|
|
|
|
@@ -130,7 +130,9 @@ 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())
|
|
|
|
+ if (params.parent_widget)
|
2014-02-19 17:27:54 +01:00
|
|
|
+ parent_hwnd = params.parent_widget;
|
2014-04-04 18:50:38 +02:00
|
|
|
+ else if (params.parent && params.parent->GetHost())
|
|
|
|
parent_hwnd = params.parent->GetHost()->GetAcceleratedWidget();
|
|
|
|
|
|
|
|
message_handler_->set_remove_standard_frame(params.remove_standard_frame);
|
2014-05-22 23:01:22 +02:00
|
|
|
diff --git desktop_aura/desktop_window_tree_host_win.h desktop_aura/desktop_window_tree_host_win.h
|
|
|
|
index dc8a218..84680cf 100644
|
|
|
|
--- desktop_aura/desktop_window_tree_host_win.h
|
|
|
|
+++ desktop_aura/desktop_window_tree_host_win.h
|
|
|
|
@@ -214,6 +214,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
|
2014-04-05 00:26:39 +02:00
|
|
|
LPARAM l_param) OVERRIDE;
|
|
|
|
virtual bool HandleScrollEvent(const ui::ScrollEvent& event) OVERRIDE;
|
|
|
|
|
|
|
|
+ public:
|
|
|
|
Widget* GetWidget();
|
|
|
|
const Widget* GetWidget() const;
|
|
|
|
HWND GetHWND() const;
|
2014-05-22 23:01:22 +02:00
|
|
|
diff --git desktop_aura/desktop_window_tree_host_x11.cc desktop_aura/desktop_window_tree_host_x11.cc
|
|
|
|
index 028b6f5..e8b4bd2 100644
|
|
|
|
--- desktop_aura/desktop_window_tree_host_x11.cc
|
|
|
|
+++ desktop_aura/desktop_window_tree_host_x11.cc
|
|
|
|
@@ -138,7 +138,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
|
|
|
|
content_window_(NULL),
|
|
|
|
window_parent_(NULL),
|
|
|
|
custom_window_shape_(NULL),
|
|
|
|
- urgency_hint_set_(false) {
|
|
|
|
+ urgency_hint_set_(false),
|
|
|
|
+ xwindow_destroyed_(false) {
|
|
|
|
}
|
|
|
|
|
|
|
|
DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() {
|
|
|
|
@@ -315,7 +316,8 @@ void DesktopWindowTreeHostX11::CloseNow() {
|
|
|
|
// 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();
|
|
|
|
@@ -968,9 +970,13 @@ void DesktopWindowTreeHostX11::InitX11Window(
|
|
|
|
if (swa.override_redirect)
|
|
|
|
attribute_mask |= CWOverrideRedirect;
|
|
|
|
|
|
|
|
+ gfx::AcceleratedWidget parent_widget = params.parent_widget;
|
|
|
|
+ if (parent_widget == gfx::kNullAcceleratedWidget)
|
|
|
|
+ parent_widget = x_root_window_;
|
|
|
|
+
|
|
|
|
bounds_ = params.bounds;
|
|
|
|
xwindow_ = XCreateWindow(
|
|
|
|
- xdisplay_, x_root_window_,
|
|
|
|
+ xdisplay_, parent_widget,
|
|
|
|
bounds_.x(), bounds_.y(),
|
|
|
|
bounds_.width(), bounds_.height(),
|
|
|
|
0, // border width
|
|
|
|
@@ -1378,6 +1384,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
+ case DestroyNotify:
|
|
|
|
+ xwindow_destroyed_ = true;
|
|
|
|
+ CloseNow();
|
|
|
|
+ break;
|
|
|
|
case FocusOut:
|
|
|
|
if (xev->xfocus.mode != NotifyGrab) {
|
|
|
|
ReleaseCapture();
|
|
|
|
diff --git desktop_aura/desktop_window_tree_host_x11.h desktop_aura/desktop_window_tree_host_x11.h
|
|
|
|
index bc20464..63527ae 100644
|
|
|
|
--- desktop_aura/desktop_window_tree_host_x11.h
|
|
|
|
+++ desktop_aura/desktop_window_tree_host_x11.h
|
|
|
|
@@ -299,6 +299,9 @@ private:
|
|
|
|
// the frame when |xwindow_| gains focus or handles a mouse button event.
|
|
|
|
bool urgency_hint_set_;
|
|
|
|
|
|
|
|
+ // True if the xwindow has already been destroyed.
|
|
|
|
+ bool xwindow_destroyed_;
|
|
|
|
+
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11);
|
|
|
|
};
|
|
|
|
|
|
|
|
diff --git widget.cc widget.cc
|
|
|
|
index e05db49..a936235 100644
|
|
|
|
--- widget.cc
|
|
|
|
+++ widget.cc
|
|
|
|
@@ -122,6 +122,7 @@ Widget::InitParams::InitParams()
|
2014-02-07 00:36:29 +01:00
|
|
|
show_state(ui::SHOW_STATE_DEFAULT),
|
|
|
|
double_buffer(false),
|
|
|
|
parent(NULL),
|
2014-05-22 23:01:22 +02:00
|
|
|
+ parent_widget(gfx::kNullAcceleratedWidget),
|
2014-02-07 00:36:29 +01:00
|
|
|
native_widget(NULL),
|
2014-02-19 17:27:54 +01:00
|
|
|
desktop_window_tree_host(NULL),
|
2014-02-07 00:36:29 +01:00
|
|
|
top_level(false),
|
2014-05-22 23:01:22 +02:00
|
|
|
@@ -148,6 +149,7 @@ Widget::InitParams::InitParams(Type type)
|
2014-02-06 23:33:18 +01:00
|
|
|
show_state(ui::SHOW_STATE_DEFAULT),
|
|
|
|
double_buffer(false),
|
|
|
|
parent(NULL),
|
2014-05-22 23:01:22 +02:00
|
|
|
+ parent_widget(gfx::kNullAcceleratedWidget),
|
2014-02-06 23:33:18 +01:00
|
|
|
native_widget(NULL),
|
2014-02-19 17:27:54 +01:00
|
|
|
desktop_window_tree_host(NULL),
|
2014-02-06 23:33:18 +01:00
|
|
|
top_level(false),
|
2014-05-22 23:01:22 +02:00
|
|
|
@@ -386,7 +388,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);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
native_widget_initialized_ = true;
|
|
|
|
}
|
2014-05-22 23:01:22 +02:00
|
|
|
diff --git widget.h widget.h
|
|
|
|
index 640b140..43feff7 100644
|
|
|
|
--- widget.h
|
|
|
|
+++ widget.h
|
|
|
|
@@ -200,6 +200,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
|
2013-12-07 02:55:22 +01:00
|
|
|
// Should the widget be double buffered? Default is false.
|
|
|
|
bool double_buffer;
|
|
|
|
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
|