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
|
2018-07-13 21:29:20 +02:00
|
|
|
index c7e802e7ac68..bf1d28904f49 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
|
2018-07-13 21:29:20 +02:00
|
|
|
@@ -468,6 +468,14 @@ float RenderWidgetHostViewBase::GetDeviceScaleFactor() const {
|
2018-03-20 21:15:08 +01:00
|
|
|
return screen_info.device_scale_factor;
|
2015-10-26 19:23:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+void RenderWidgetHostViewBase::SetHasExternalParent(bool val) {
|
|
|
|
+ has_external_parent_ = val;
|
|
|
|
+}
|
2016-11-23 21:54:29 +01:00
|
|
|
+
|
|
|
|
+bool RenderWidgetHostViewBase::HasExternalParent() const {
|
|
|
|
+ return has_external_parent_;
|
|
|
|
+}
|
2015-10-26 19:23:08 +01:00
|
|
|
+
|
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
|
2018-07-13 21:29:20 +02:00
|
|
|
index 1b2563d6bca0..cf6717aaeb98 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
|
2018-06-01 21:16:26 +02:00
|
|
|
@@ -84,6 +84,7 @@ class CursorManager;
|
2018-05-18 12:45:18 +02:00
|
|
|
class MouseWheelPhaseHandler;
|
2017-02-10 23:44:11 +01:00
|
|
|
class RenderWidgetHostImpl;
|
|
|
|
class RenderWidgetHostViewBaseObserver;
|
|
|
|
+class RenderWidgetHostViewGuest;
|
|
|
|
class SyntheticGestureTarget;
|
|
|
|
class TextInputManager;
|
2017-05-31 17:33:30 +02:00
|
|
|
class TouchSelectionControllerClientManager;
|
2018-06-01 21:16:26 +02:00
|
|
|
@@ -105,6 +106,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
|
2017-06-30 22:30:30 +02:00
|
|
|
float current_device_scale_factor() const {
|
|
|
|
return current_device_scale_factor_;
|
|
|
|
}
|
|
|
|
+ void set_current_device_scale_factor(float scale_factor) {
|
|
|
|
+ current_device_scale_factor_ = scale_factor;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// Returns the focused RenderWidgetHost inside this |view|'s RWH.
|
|
|
|
RenderWidgetHostImpl* GetFocusedWidget() const;
|
2018-06-01 21:16:26 +02:00
|
|
|
@@ -139,6 +143,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
|
2018-04-19 17:44:42 +02:00
|
|
|
void DisableAutoResize(const gfx::Size& new_size) override;
|
|
|
|
bool IsScrollOffsetAtTop() const override;
|
2018-03-20 21:15:08 +01:00
|
|
|
float GetDeviceScaleFactor() const final;
|
2015-10-26 19:23:08 +01:00
|
|
|
+ void SetHasExternalParent(bool val) override;
|
2016-11-23 21:54:29 +01:00
|
|
|
+ bool HasExternalParent() const override;
|
2017-07-27 01:19:27 +02:00
|
|
|
TouchSelectionControllerClientManager*
|
|
|
|
GetTouchSelectionControllerClientManager() override;
|
2015-10-26 19:23:08 +01:00
|
|
|
|
2018-07-02 19:11:49 +02:00
|
|
|
@@ -458,6 +464,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
|
2017-02-10 23:44:11 +01:00
|
|
|
// helps to position the full screen widget on the correct monitor.
|
|
|
|
virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0;
|
|
|
|
|
|
|
|
+ // Perform all the initialization steps necessary for this object to represent
|
|
|
|
+ // the platform widget owned by |guest_view| and embedded in
|
|
|
|
+ // |parent_host_view|.
|
|
|
|
+ virtual void InitAsGuest(RenderWidgetHostView* parent_host_view,
|
|
|
|
+ RenderWidgetHostViewGuest* guest_view) {}
|
|
|
|
+
|
2017-07-27 01:19:27 +02:00
|
|
|
// Sets the cursor for this view to the one associated with the specified
|
|
|
|
// cursor_type.
|
2017-02-10 23:44:11 +01:00
|
|
|
virtual void UpdateCursor(const WebCursor& cursor) = 0;
|
2018-07-13 21:29:20 +02:00
|
|
|
@@ -649,6 +661,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
|
2017-02-10 23:44:11 +01:00
|
|
|
|
2018-05-20 15:51:42 +02:00
|
|
|
bool use_viz_hit_test_ = false;
|
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:
|
2018-05-21 14:54:08 +02:00
|
|
|
void SynchronizeVisualProperties();
|
|
|
|
|
2016-11-23 21:54:29 +01:00
|
|
|
diff --git content/browser/renderer_host/render_widget_host_view_event_handler.cc content/browser/renderer_host/render_widget_host_view_event_handler.cc
|
2018-07-13 21:29:20 +02:00
|
|
|
index c079001bb4e5..da93acec6e60 100644
|
2016-11-23 21:54:29 +01:00
|
|
|
--- content/browser/renderer_host/render_widget_host_view_event_handler.cc
|
|
|
|
+++ content/browser/renderer_host/render_widget_host_view_event_handler.cc
|
2018-04-19 17:44:42 +02:00
|
|
|
@@ -30,6 +30,10 @@
|
2018-05-20 15:51:42 +02:00
|
|
|
#include "ui/events/keycodes/dom/dom_code.h"
|
2016-11-23 21:54:29 +01:00
|
|
|
#include "ui/touch_selection/touch_selection_controller.h"
|
|
|
|
|
|
|
|
+#if defined(OS_LINUX)
|
|
|
|
+#include "ui/aura/window_tree_host.h"
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#if defined(OS_WIN)
|
|
|
|
#include "content/browser/frame_host/render_frame_host_impl.h"
|
|
|
|
#include "content/public/common/context_menu_params.h"
|
2018-07-13 21:29:20 +02:00
|
|
|
@@ -883,6 +887,14 @@ void RenderWidgetHostViewEventHandler::SetKeyboardFocus() {
|
2017-09-06 23:40:58 +02:00
|
|
|
::SetFocus(hwnd);
|
2016-11-23 21:54:29 +01:00
|
|
|
}
|
|
|
|
}
|
2017-09-06 23:40:58 +02:00
|
|
|
+#endif
|
2016-11-23 21:54:29 +01:00
|
|
|
+#if defined(OS_LINUX)
|
|
|
|
+ if (host_view_->HasExternalParent() &&
|
|
|
|
+ window_ && window_->delegate()->CanFocus()) {
|
|
|
|
+ aura::WindowTreeHost* host = window_->GetHost();
|
|
|
|
+ if (host)
|
|
|
|
+ host->Show();
|
|
|
|
+ }
|
2017-09-06 23:40:58 +02:00
|
|
|
#endif
|
2016-11-23 21:54:29 +01:00
|
|
|
// TODO(wjmaclean): can host_ ever be null?
|
|
|
|
if (host_ && set_focus_on_mouse_down_or_key_event_) {
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git content/public/browser/render_widget_host_view.h content/public/browser/render_widget_host_view.h
|
2018-06-01 21:16:26 +02:00
|
|
|
index 0f2bbdcf4b2b..2ba0761cd680 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
|
2018-06-01 21:16:26 +02:00
|
|
|
@@ -246,6 +246,14 @@ class CONTENT_EXPORT RenderWidgetHostView {
|
2018-03-20 21:15:08 +01:00
|
|
|
// This must always return the same device scale factor as GetScreenInfo.
|
|
|
|
virtual float GetDeviceScaleFactor() const = 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;
|
2016-11-23 21:54:29 +01:00
|
|
|
+
|
|
|
|
+ // Returns true if the widget has a external parent view/window outside of the
|
|
|
|
+ // Chromium-controlled view/window hierarchy.
|
|
|
|
+ virtual bool HasExternalParent() const = 0;
|
2015-10-26 19:23:08 +01:00
|
|
|
+
|
|
|
|
#if defined(OS_MACOSX)
|
2018-02-15 01:12:09 +01:00
|
|
|
// Set the view's active state (i.e., tint state of controls).
|
|
|
|
virtual void SetActive(bool active) = 0;
|
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
|
2017-09-06 23:40:58 +02:00
|
|
|
index f772f64d656e..7d13f9f81b6c 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
|
2018-07-13 21:29:20 +02:00
|
|
|
index 9ec5fdb9bb5c..0694641f11db 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
|
2018-06-08 18:53:10 +02:00
|
|
|
@@ -87,6 +87,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) {
|
|
|
|
}
|
|
|
|
|
2018-06-08 18:53:10 +02:00
|
|
|
@@ -121,8 +122,12 @@ void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) {
|
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);
|
2018-07-13 21:29:20 +02:00
|
|
|
@@ -871,11 +876,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
|
|
|
}
|
|
|
|
|
2018-04-19 17:44:42 +02:00
|
|
|
bool DesktopWindowTreeHostWin::HandleMouseEvent(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
|
2018-07-13 21:29:20 +02:00
|
|
|
index 022de4037ff0..c54ef87f2f7f 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
|
2018-07-02 19:11:49 +02:00
|
|
|
@@ -284,6 +284,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
|
2018-07-13 21:29:20 +02:00
|
|
|
index 22a9914957a7..d315f07eca5e 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
|
2018-07-06 19:11:55 +02:00
|
|
|
@@ -145,6 +145,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),
|
2018-07-06 19:11:55 +02:00
|
|
|
@@ -157,6 +158,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
|
2016-10-17 20:14:44 +02:00
|
|
|
has_window_focus_(false),
|
|
|
|
has_pointer_focus_(false),
|
2017-03-03 23:37:23 +01:00
|
|
|
modal_dialog_counter_(0),
|
2016-10-21 21:52:29 +02:00
|
|
|
+ xwindow_destroyed_(false),
|
|
|
|
close_widget_factory_(this),
|
2017-09-06 23:40:58 +02:00
|
|
|
weak_factory_(this) {}
|
|
|
|
|
2018-07-06 19:11:55 +02:00
|
|
|
@@ -192,6 +194,8 @@ std::vector<aura::Window*> DesktopWindowTreeHostX11::GetAllOpenWindows() {
|
2017-01-23 18:36:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Rect DesktopWindowTreeHostX11::GetX11RootWindowBounds() const {
|
|
|
|
+ if (!screen_bounds_.IsEmpty())
|
|
|
|
+ return screen_bounds_;
|
|
|
|
return bounds_in_pixels_;
|
|
|
|
}
|
|
|
|
|
2018-07-13 21:29:20 +02:00
|
|
|
@@ -504,7 +508,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_);
|
2017-12-07 22:44:24 +01:00
|
|
|
xwindow_ = x11::None;
|
2014-05-22 23:01:22 +02:00
|
|
|
|
|
|
|
desktop_native_widget_aura_->OnHostClosed();
|
2018-07-13 21:29:20 +02:00
|
|
|
@@ -645,6 +650,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
|
|
|
}
|
|
|
|
|
2018-07-13 21:29:20 +02:00
|
|
|
@@ -1270,6 +1277,8 @@ void DesktopWindowTreeHostX11::SetBoundsInPixels(
|
2014-07-09 00:37:06 +02:00
|
|
|
}
|
|
|
|
|
2017-01-23 18:36:54 +01:00
|
|
|
gfx::Point DesktopWindowTreeHostX11::GetLocationOnScreenInPixels() const {
|
2014-07-09 00:37:06 +02:00
|
|
|
+ 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
|
|
|
}
|
|
|
|
|
2018-07-13 21:29:20 +02:00
|
|
|
@@ -1414,7 +1423,6 @@ void DesktopWindowTreeHostX11::InitX11Window(
|
2017-08-04 00:55:19 +02:00
|
|
|
::Atom window_type;
|
|
|
|
switch (params.type) {
|
|
|
|
case Widget::InitParams::TYPE_MENU:
|
2017-12-07 22:44:24 +01:00
|
|
|
- swa.override_redirect = x11::True;
|
2017-08-04 00:55:19 +02:00
|
|
|
window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_MENU");
|
|
|
|
break;
|
|
|
|
case Widget::InitParams::TYPE_TOOLTIP:
|
2018-07-13 21:29:20 +02:00
|
|
|
@@ -1470,9 +1478,15 @@ void DesktopWindowTreeHostX11::InitX11Window(
|
2016-10-21 21:52:29 +02:00
|
|
|
attribute_mask |= CWBorderPixel;
|
|
|
|
swa.border_pixel = 0;
|
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
|
2018-07-13 21:29:20 +02:00
|
|
|
@@ -2088,6 +2102,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
|
2014-05-22 23:01:22 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
+ case DestroyNotify:
|
|
|
|
+ xwindow_destroyed_ = true;
|
|
|
|
+ CloseNow();
|
|
|
|
+ break;
|
2018-03-20 21:15:08 +01:00
|
|
|
case x11::FocusIn:
|
|
|
|
case x11::FocusOut:
|
|
|
|
OnFocusEvent(xev->type == x11::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
|
2018-07-13 21:29:20 +02:00
|
|
|
index c5e6df7ce811..8648b49b5753 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
|
2018-05-21 14:54:08 +02:00
|
|
|
@@ -91,6 +91,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
|
|
|
// Returns a map of KeyboardEvent code to KeyboardEvent key values.
|
|
|
|
base::flat_map<std::string, std::string> GetKeyboardLayoutMap() override;
|
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:
|
2018-04-19 17:44:42 +02:00
|
|
|
void Init(const Widget::InitParams& params) override;
|
2018-07-06 19:11:55 +02:00
|
|
|
@@ -321,6 +327,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
|
2018-07-06 19:11:55 +02:00
|
|
|
@@ -365,6 +374,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_;
|
2018-07-06 19:11:55 +02:00
|
|
|
@@ -453,6 +466,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
2014-09-04 19:53:40 +02:00
|
|
|
|
2017-03-03 23:37:23 +01:00
|
|
|
uint32_t modal_dialog_counter_;
|
2014-05-22 23:01:22 +02:00
|
|
|
|
|
|
|
+ // True if the xwindow has already been destroyed.
|
|
|
|
+ bool xwindow_destroyed_;
|
|
|
|
+
|
2016-10-21 21:52:29 +02:00
|
|
|
base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_;
|
|
|
|
base::WeakPtrFactory<DesktopWindowTreeHostX11> weak_factory_;
|
2014-05-22 23:01:22 +02:00
|
|
|
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
|
2018-07-13 21:29:20 +02:00
|
|
|
index e4e7fc6ce96c..9123f688646f 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/widget.cc
|
|
|
|
+++ ui/views/widget/widget.cc
|
2018-05-20 15:51:42 +02:00
|
|
|
@@ -132,6 +132,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),
|
2018-05-20 15:51:42 +02:00
|
|
|
@@ -306,7 +307,7 @@ void Widget::Init(const InitParams& in_params) {
|
2016-05-25 01:35:43 +02:00
|
|
|
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;
|
|
|
|
|
|
|
|
if (params.opacity == views::Widget::InitParams::INFER_OPACITY &&
|
|
|
|
params.type != views::Widget::InitParams::TYPE_WINDOW &&
|
2018-05-20 15:51:42 +02:00
|
|
|
@@ -373,7 +374,12 @@ void Widget::Init(const InitParams& in_params) {
|
2016-05-25 01:35:43 +02:00
|
|
|
}
|
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
|
2018-07-02 19:11:49 +02:00
|
|
|
@@ -1103,10 +1109,16 @@ void Widget::OnNativeWidgetDestroyed() {
|
2017-08-25 23:41:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Size Widget::GetMinimumSize() const {
|
|
|
|
+ gfx::Size size;
|
|
|
|
+ if (widget_delegate_->MaybeGetMinimumSize(&size))
|
|
|
|
+ return size;
|
|
|
|
return non_client_view_ ? non_client_view_->GetMinimumSize() : gfx::Size();
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Size Widget::GetMaximumSize() const {
|
|
|
|
+ gfx::Size size;
|
|
|
|
+ if (widget_delegate_->MaybeGetMaximumSize(&size))
|
|
|
|
+ return size;
|
|
|
|
return non_client_view_ ? non_client_view_->GetMaximumSize() : gfx::Size();
|
|
|
|
}
|
|
|
|
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
|
2018-07-13 21:29:20 +02:00
|
|
|
index 482ab928bdec..d06cd234da9d 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/widget.h
|
|
|
|
+++ ui/views/widget/widget.h
|
2018-03-20 21:15:08 +01:00
|
|
|
@@ -252,6 +252,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
|
2017-03-03 23:37:23 +01:00
|
|
|
// 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
|
2017-08-25 23:41:30 +02:00
|
|
|
diff --git ui/views/widget/widget_delegate.h ui/views/widget/widget_delegate.h
|
2018-04-19 17:44:42 +02:00
|
|
|
index c1cfaebc4172..b9ee0751189d 100644
|
2017-08-25 23:41:30 +02:00
|
|
|
--- ui/views/widget/widget_delegate.h
|
|
|
|
+++ ui/views/widget/widget_delegate.h
|
2018-03-20 21:15:08 +01:00
|
|
|
@@ -183,6 +183,10 @@ class VIEWS_EXPORT WidgetDelegate {
|
2017-08-25 23:41:30 +02:00
|
|
|
// be cycled through with keyboard focus.
|
|
|
|
virtual void GetAccessiblePanes(std::vector<View*>* panes) {}
|
|
|
|
|
|
|
|
+ // CEF supports override of min/max size values.
|
|
|
|
+ virtual bool MaybeGetMinimumSize(gfx::Size* size) const { return false; }
|
|
|
|
+ virtual bool MaybeGetMaximumSize(gfx::Size* size) const { return false; }
|
|
|
|
+
|
|
|
|
protected:
|
2018-04-19 17:44:42 +02:00
|
|
|
virtual ~WidgetDelegate();
|
2017-08-25 23:41:30 +02:00
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
diff --git ui/views/widget/widget_hwnd_utils.cc ui/views/widget/widget_hwnd_utils.cc
|
2018-03-20 21:15:08 +01:00
|
|
|
index c7296fed234d..244d0034a1c4 100644
|
2017-08-04 00:55:19 +02:00
|
|
|
--- ui/views/widget/widget_hwnd_utils.cc
|
|
|
|
+++ ui/views/widget/widget_hwnd_utils.cc
|
|
|
|
@@ -73,7 +73,7 @@ void CalculateWindowStylesFromInitParams(
|
|
|
|
if (!widget_delegate->CanResize())
|
|
|
|
*style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
|
|
|
|
if (params.remove_standard_frame)
|
|
|
|
- *style &= ~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
|
|
|
|
+ *style &= ~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU);
|
|
|
|
|
|
|
|
if (native_widget_delegate->IsDialogBox()) {
|
|
|
|
*style |= DS_MODALFRAME;
|
2016-01-19 21:09:01 +01:00
|
|
|
diff --git ui/views/win/hwnd_message_handler.cc ui/views/win/hwnd_message_handler.cc
|
2018-07-06 19:11:55 +02:00
|
|
|
index 19f7ed4252dc..6acb123adc30 100644
|
2016-01-19 21:09:01 +01:00
|
|
|
--- ui/views/win/hwnd_message_handler.cc
|
|
|
|
+++ ui/views/win/hwnd_message_handler.cc
|
2018-06-01 21:16:26 +02:00
|
|
|
@@ -2809,10 +2809,13 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
2016-01-19 21:09:01 +01:00
|
|
|
} else if (event.type() == ui::ET_MOUSEWHEEL) {
|
2018-04-19 17:44:42 +02:00
|
|
|
ui::MouseWheelEvent mouse_wheel_event(msg);
|
2016-01-19 21:09:01 +01:00
|
|
|
// Reroute the mouse wheel to the window under the pointer if applicable.
|
|
|
|
- return (ui::RerouteMouseWheel(hwnd(), w_param, l_param) ||
|
2018-04-19 17:44:42 +02:00
|
|
|
- delegate_->HandleMouseEvent(&mouse_wheel_event))
|
|
|
|
- ? 0
|
|
|
|
- : 1;
|
2016-01-19 21:09:01 +01:00
|
|
|
+ if (ui::RerouteMouseWheel(hwnd(), w_param, l_param) ||
|
2018-04-19 17:44:42 +02:00
|
|
|
+ delegate_->HandleMouseEvent(&mouse_wheel_event)) {
|
2016-01-19 21:09:01 +01:00
|
|
|
+ SetMsgHandled(TRUE);
|
|
|
|
+ return 0;
|
2018-04-19 17:44:42 +02:00
|
|
|
+ } else {
|
|
|
|
+ return 1;
|
2016-01-19 21:09:01 +01:00
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
// There are cases where the code handling the message destroys the window,
|