diff --git desktop_aura/desktop_root_window_host_win.cc desktop_aura/desktop_root_window_host_win.cc index 938a05b..0a3184a 100644 --- desktop_aura/desktop_root_window_host_win.cc +++ desktop_aura/desktop_root_window_host_win.cc @@ -132,7 +132,9 @@ void DesktopRootWindowHostWin::Init( native_widget_delegate_); HWND parent_hwnd = NULL; - if (params.parent && params.parent->GetDispatcher()) { + if (params.parent_widget) { + parent_hwnd = params.parent_widget; + } else if (params.parent && params.parent->GetDispatcher()) { parent_hwnd = params.parent->GetDispatcher()->host()->GetAcceleratedWidget(); } @@ -757,7 +759,7 @@ void DesktopRootWindowHostWin::HandleAccelerator( void DesktopRootWindowHostWin::HandleCreate() { // TODO(beng): moar - NOTIMPLEMENTED(); + // NOTIMPLEMENTED(); native_widget_delegate_->OnNativeWidgetCreated(true); @@ -822,6 +824,7 @@ void DesktopRootWindowHostWin::HandleFrameChanged() { void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) { // TODO(beng): inform the native_widget_delegate_. + GetWidget()->GetNativeWindow()->Focus(); InputMethod* input_method = GetInputMethod(); if (input_method) input_method->OnFocus(); @@ -829,6 +832,7 @@ void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) { void DesktopRootWindowHostWin::HandleNativeBlur(HWND focused_window) { // TODO(beng): inform the native_widget_delegate_. + GetWidget()->GetNativeWindow()->Blur(); InputMethod* input_method = GetInputMethod(); if (input_method) input_method->OnBlur(); diff --git desktop_aura/desktop_screen_win.cc desktop_aura/desktop_screen_win.cc index 86823a0..1d3ebf0 100644 --- desktop_aura/desktop_screen_win.cc +++ desktop_aura/desktop_screen_win.cc @@ -54,6 +54,8 @@ gfx::Display DesktopScreenWin::GetDisplayMatching( } HWND DesktopScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const { + if (!window) + return NULL; aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); return dispatcher ? dispatcher->host()->GetAcceleratedWidget() : NULL; } diff --git widget.cc widget.cc index b050ae6..f17bc8d 100644 --- widget.cc +++ widget.cc @@ -126,6 +126,7 @@ Widget::InitParams::InitParams() show_state(ui::SHOW_STATE_DEFAULT), double_buffer(false), parent(NULL), + parent_widget(NULL), native_widget(NULL), desktop_root_window_host(NULL), top_level(false), @@ -153,6 +154,7 @@ Widget::InitParams::InitParams(Type type) show_state(ui::SHOW_STATE_DEFAULT), double_buffer(false), parent(NULL), + parent_widget(NULL), native_widget(NULL), desktop_root_window_host(NULL), top_level(false), @@ -395,7 +397,12 @@ void Widget::Init(const InitParams& in_params) { 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; } diff --git widget.h widget.h index ce14d7c..99c8063 100644 --- widget.h +++ widget.h @@ -201,6 +201,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // 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