views: Initial implementation of win.setParentWindow(parent)
But it doesn't work, aparrently Chromium doesn't support changing parent window dynamically on desktop.
This commit is contained in:
parent
f2cbd7cb36
commit
473413e874
1 changed files with 16 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
||||||
#include "ui/views/window/client_view.h"
|
#include "ui/views/window/client_view.h"
|
||||||
#include "ui/views/widget/native_widget_private.h"
|
#include "ui/views/widget/native_widget_private.h"
|
||||||
#include "ui/views/widget/widget.h"
|
#include "ui/views/widget/widget.h"
|
||||||
|
#include "ui/wm/core/window_util.h"
|
||||||
#include "ui/wm/core/shadow_types.h"
|
#include "ui/wm/core/shadow_types.h"
|
||||||
|
|
||||||
#if defined(USE_X11)
|
#if defined(USE_X11)
|
||||||
|
@ -783,6 +784,21 @@ void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowViews::SetParentWindow(NativeWindow* parent) {
|
void NativeWindowViews::SetParentWindow(NativeWindow* parent) {
|
||||||
|
// Should work, but does not, it seems that the views toolkit doesn't support
|
||||||
|
// reparenting on desktop.
|
||||||
|
#if defined(DEBUG)
|
||||||
|
if (parent) {
|
||||||
|
::SetParent(GetAcceleratedWidget(), parent->GetAcceleratedWidget());
|
||||||
|
views::Widget::ReparentNativeView(GetNativeWindow(),
|
||||||
|
parent->GetNativeWindow());
|
||||||
|
wm::AddTransientChild(parent->GetNativeWindow(), GetNativeWindow());
|
||||||
|
} else {
|
||||||
|
if (!GetNativeWindow()->parent())
|
||||||
|
return;
|
||||||
|
views::Widget::ReparentNativeView(GetNativeWindow(), nullptr);
|
||||||
|
wm::RemoveTransientChild(GetNativeWindow()->parent(), GetNativeWindow());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::NativeWindow NativeWindowViews::GetNativeWindow() {
|
gfx::NativeWindow NativeWindowViews::GetNativeWindow() {
|
||||||
|
|
Loading…
Reference in a new issue