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
|
2020-06-09 19:48:00 +02:00
|
|
|
index 403a8c870a59..da2ced627c2f 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
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -558,6 +558,14 @@ float RenderWidgetHostViewBase::GetDeviceScaleFactor() {
|
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
|
2020-06-09 19:48:00 +02:00
|
|
|
index 39f1c8d6ee46..503fe5668de3 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
|
2020-03-30 22:13:42 +02:00
|
|
|
@@ -65,6 +65,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;
|
2020-03-30 22:13:42 +02:00
|
|
|
@@ -82,6 +83,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;
|
2020-03-30 22:13:42 +02:00
|
|
|
@@ -116,6 +120,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
|
2018-04-19 17:44:42 +02:00
|
|
|
void DisableAutoResize(const gfx::Size& new_size) override;
|
2019-06-05 16:15:45 +02:00
|
|
|
bool IsScrollOffsetAtTop() override;
|
|
|
|
float GetDeviceScaleFactor() 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;
|
2020-03-04 01:29:39 +01:00
|
|
|
void SetRecordContentToVisibleTimeRequest(
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -435,6 +441,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;
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -600,6 +612,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
|
2017-02-10 23:44:11 +01:00
|
|
|
|
2018-10-02 14:14:11 +02:00
|
|
|
bool is_currently_scrolling_viewport_ = 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.
|
2019-10-01 15:55:16 +02:00
|
|
|
+ bool has_external_parent_ = false;
|
2015-10-26 19:23:08 +01:00
|
|
|
+
|
|
|
|
private:
|
2018-11-30 23:21:07 +01:00
|
|
|
FRIEND_TEST_ALL_PREFIXES(
|
|
|
|
BrowserSideFlingBrowserTest,
|
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
|
2020-06-09 19:48:00 +02:00
|
|
|
index a21600fc77a3..08bc5f01702b 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
|
2019-11-12 17:11:44 +01:00
|
|
|
@@ -33,6 +33,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"
|
2020-03-30 22:13:42 +02:00
|
|
|
#include "ui/aura/window_tree_host.h"
|
2020-04-14 21:31:00 +02:00
|
|
|
@@ -928,6 +932,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
|
2020-04-14 21:31:00 +02:00
|
|
|
index 3e5bf09f1cf7..bc8ea335d501 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
|
2020-04-14 21:31:00 +02:00
|
|
|
@@ -243,6 +243,14 @@ class CONTENT_EXPORT RenderWidgetHostView {
|
2018-03-20 21:15:08 +01:00
|
|
|
// This must always return the same device scale factor as GetScreenInfo.
|
2019-06-05 16:15:45 +02:00
|
|
|
virtual float GetDeviceScaleFactor() = 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;
|
2019-09-04 17:13:32 +02:00
|
|
|
diff --git ui/base/x/x11_window.cc ui/base/x/x11_window.cc
|
2020-06-09 19:48:00 +02:00
|
|
|
index 70f520bccd47..361e99d462a1 100644
|
2019-09-04 17:13:32 +02:00
|
|
|
--- ui/base/x/x11_window.cc
|
|
|
|
+++ ui/base/x/x11_window.cc
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -255,8 +255,12 @@ void XWindow::Init(const Configuration& config) {
|
2019-09-04 17:13:32 +02:00
|
|
|
attribute_mask |= CWBorderPixel;
|
|
|
|
swa.border_pixel = 0;
|
|
|
|
|
|
|
|
+ gfx::AcceleratedWidget parent_widget = config.parent_widget;
|
|
|
|
+ if (parent_widget == gfx::kNullAcceleratedWidget)
|
|
|
|
+ parent_widget = x_root_window_;
|
|
|
|
+
|
|
|
|
bounds_in_pixels_ = SanitizeBounds(config.bounds);
|
|
|
|
- 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
|
|
|
|
diff --git ui/base/x/x11_window.h ui/base/x/x11_window.h
|
2020-06-09 19:48:00 +02:00
|
|
|
index feec9b62e6d7..62a509218b57 100644
|
2019-09-04 17:13:32 +02:00
|
|
|
--- ui/base/x/x11_window.h
|
|
|
|
+++ ui/base/x/x11_window.h
|
2020-03-30 22:13:42 +02:00
|
|
|
@@ -19,6 +19,7 @@
|
2019-09-04 17:13:32 +02:00
|
|
|
#include "ui/gfx/geometry/rect.h"
|
|
|
|
#include "ui/gfx/geometry/size.h"
|
|
|
|
#include "ui/gfx/geometry/size_f.h"
|
|
|
|
+#include "ui/gfx/native_widget_types.h"
|
|
|
|
#include "ui/gfx/x/x11.h"
|
|
|
|
#include "ui/gfx/x/x11_types.h"
|
|
|
|
|
2020-04-14 21:31:00 +02:00
|
|
|
@@ -86,6 +87,7 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
|
2020-03-04 01:29:39 +01:00
|
|
|
std::string wm_class_name;
|
2019-09-04 17:13:32 +02:00
|
|
|
std::string wm_class_class;
|
|
|
|
std::string wm_role_name;
|
2019-10-01 15:55:16 +02:00
|
|
|
+ gfx::AcceleratedWidget parent_widget = gfx::kNullAcceleratedWidget;
|
2019-09-04 17:13:32 +02:00
|
|
|
};
|
|
|
|
|
2019-10-01 15:55:16 +02:00
|
|
|
XWindow();
|
|
|
|
diff --git ui/platform_window/x11/x11_window.cc ui/platform_window/x11/x11_window.cc
|
2020-06-09 19:48:00 +02:00
|
|
|
index c9fc5e2670dd..b3d591e516d4 100644
|
2019-10-01 15:55:16 +02:00
|
|
|
--- ui/platform_window/x11/x11_window.cc
|
|
|
|
+++ ui/platform_window/x11/x11_window.cc
|
2020-03-30 22:13:42 +02:00
|
|
|
@@ -85,6 +85,7 @@ ui::XWindow::Configuration ConvertInitPropertiesToXWindowConfig(
|
2020-03-04 01:29:39 +01:00
|
|
|
config.wm_class_class = properties.wm_class_class;
|
2019-10-01 15:55:16 +02:00
|
|
|
config.wm_role_name = properties.wm_role_name;
|
|
|
|
config.activatable = properties.activatable;
|
|
|
|
+ config.parent_widget = properties.parent_widget;
|
2020-02-10 18:10:17 +01:00
|
|
|
config.prefer_dark_theme = properties.prefer_dark_theme;
|
|
|
|
config.background_color = properties.background_color;
|
2019-10-01 15:55:16 +02:00
|
|
|
return config;
|
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
|
2020-06-09 19:48:00 +02:00
|
|
|
index 963e7053e7ac..b734cbef7c81 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
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -16,6 +16,8 @@ DesktopScreenWin::DesktopScreenWin() = default;
|
|
|
|
DesktopScreenWin::~DesktopScreenWin() = default;
|
2013-12-07 02:55:22 +01:00
|
|
|
|
2020-06-09 19:48:00 +02:00
|
|
|
HWND DesktopScreenWin::GetHWNDFromNativeWindow(gfx::NativeWindow window) const {
|
2013-12-07 02:55:22 +01:00
|
|
|
+ if (!window)
|
2020-06-09 19:48:00 +02:00
|
|
|
+ return nullptr;
|
2014-04-04 18:50:38 +02:00
|
|
|
aura::WindowTreeHost* host = window->GetHost();
|
2019-04-16 16:38:48 +02:00
|
|
|
return host ? host->GetAcceleratedWidget() : nullptr;
|
2013-12-07 02:55:22 +01:00
|
|
|
}
|
2019-10-01 15:55:16 +02:00
|
|
|
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_linux.cc ui/views/widget/desktop_aura/desktop_window_tree_host_linux.cc
|
2020-06-09 19:48:00 +02:00
|
|
|
index 4168fa1a51f1..98367686fba0 100644
|
2019-10-01 15:55:16 +02:00
|
|
|
--- ui/views/widget/desktop_aura/desktop_window_tree_host_linux.cc
|
|
|
|
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_linux.cc
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -332,6 +332,8 @@ void DesktopWindowTreeHostLinux::AddAdditionalInitProperties(
|
2020-03-04 01:29:39 +01:00
|
|
|
properties->wm_class_class = params.wm_class_class;
|
|
|
|
properties->wm_role_name = params.wm_role_name;
|
2020-02-10 18:10:17 +01:00
|
|
|
|
2019-10-01 15:55:16 +02:00
|
|
|
+ properties->parent_widget = params.parent_widget;
|
2020-02-10 18:10:17 +01:00
|
|
|
+
|
|
|
|
DCHECK(!properties->x11_extension_delegate);
|
|
|
|
properties->x11_extension_delegate = this;
|
2019-10-01 15:55:16 +02: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
|
2020-06-09 19:48:00 +02:00
|
|
|
index 6051aadee62e..fc5b7a2f64b7 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
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -134,8 +134,12 @@ void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) {
|
2014-02-19 17:27:54 +01:00
|
|
|
native_widget_delegate_);
|
|
|
|
|
2019-04-16 16:38:48 +02:00
|
|
|
HWND parent_hwnd = nullptr;
|
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);
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -912,11 +916,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
|
2020-06-09 19:48:00 +02:00
|
|
|
index 75ca9e99f2ca..416fe48ff90a 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
|
2019-07-16 19:59:21 +02:00
|
|
|
@@ -288,6 +288,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.
|
2019-10-01 15:55:16 +02:00
|
|
|
+ bool has_external_parent_ = false;
|
2015-10-26 19:23:08 +01:00
|
|
|
+
|
|
|
|
// 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
|
2020-06-09 19:48:00 +02:00
|
|
|
index 44e9eef3492e..ddf197d53b8c 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
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -77,6 +77,9 @@ DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() = default;
|
2019-11-12 17:11:44 +01:00
|
|
|
// DesktopWindowTreeHostX11, DesktopWindowTreeHost implementation:
|
2017-01-23 18:36:54 +01:00
|
|
|
|
2019-11-12 17:11:44 +01:00
|
|
|
void DesktopWindowTreeHostX11::Init(const Widget::InitParams& params) {
|
2019-10-01 15:55:16 +02:00
|
|
|
+ if (params.parent_widget != gfx::kNullAcceleratedWidget)
|
|
|
|
+ has_external_parent_ = true;
|
|
|
|
+
|
2019-11-12 17:11:44 +01:00
|
|
|
DesktopWindowTreeHostLinux::Init(params);
|
2017-01-23 18:36:54 +01:00
|
|
|
|
2019-10-01 15:55:16 +02:00
|
|
|
// Set XEventDelegate to receive selection, drag&drop and raw key events.
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -101,6 +104,18 @@ DesktopWindowTreeHostX11::CreateDragDropClient(
|
2020-03-04 01:29:39 +01:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// DesktopWindowTreeHostX11 implementation:
|
2014-07-09 00:37:06 +02:00
|
|
|
|
2019-10-01 15:55:16 +02:00
|
|
|
+gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const {
|
2014-07-09 00:37:06 +02:00
|
|
|
+ if (!screen_bounds_.IsEmpty())
|
|
|
|
+ return screen_bounds_;
|
2019-10-01 15:55:16 +02:00
|
|
|
+ return DesktopWindowTreeHostLinux::GetWindowBoundsInScreen();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+gfx::Point DesktopWindowTreeHostX11::GetLocationOnScreenInPixels() const {
|
2014-07-09 00:37:06 +02:00
|
|
|
+ if (!screen_bounds_.IsEmpty())
|
|
|
|
+ return screen_bounds_.origin();
|
2019-10-01 15:55:16 +02:00
|
|
|
+ return DesktopWindowTreeHostLinux::GetLocationOnScreenInPixels();
|
|
|
|
+}
|
2019-09-04 17:13:32 +02:00
|
|
|
+
|
2019-11-12 17:11:44 +01:00
|
|
|
void DesktopWindowTreeHostX11::OnXWindowSelectionEvent(XEvent* xev) {
|
|
|
|
DCHECK(xev);
|
|
|
|
DCHECK(drag_drop_client_);
|
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
|
2020-06-09 19:48:00 +02:00
|
|
|
index 8cd6b80ee1ea..442c33c77d92 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
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -30,12 +30,21 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux,
|
2020-03-04 01:29:39 +01:00
|
|
|
DesktopNativeWidgetAura* desktop_native_widget_aura);
|
|
|
|
~DesktopWindowTreeHostX11() 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;
|
2020-06-09 19:48:00 +02:00
|
|
|
std::unique_ptr<aura::client::DragDropClient> CreateDragDropClient(
|
|
|
|
DesktopNativeCursorManager* cursor_manager) override;
|
|
|
|
|
2019-10-01 15:55:16 +02:00
|
|
|
+ gfx::Rect GetWindowBoundsInScreen() const override;
|
|
|
|
+ gfx::Point GetLocationOnScreenInPixels() const override;
|
2020-06-09 19:48:00 +02:00
|
|
|
+
|
2020-03-04 01:29:39 +01:00
|
|
|
private:
|
|
|
|
friend class DesktopWindowTreeHostX11HighDPITest;
|
2020-06-09 19:48:00 +02:00
|
|
|
|
|
|
|
@@ -49,8 +58,18 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux,
|
2019-11-12 17:11:44 +01:00
|
|
|
// directly. See https://crbug.com/990756.
|
|
|
|
const ui::XWindow* GetXWindow() const;
|
2014-07-09 00:37:06 +02:00
|
|
|
|
|
|
|
+ // Override the screen bounds when the host is a child window.
|
|
|
|
+ gfx::Rect screen_bounds_;
|
|
|
|
+
|
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.
|
2019-06-05 16:15:45 +02:00
|
|
|
+ bool has_external_parent_ = false;
|
2015-10-26 19:23:08 +01:00
|
|
|
+
|
2019-06-05 16:15:45 +02:00
|
|
|
DesktopDragDropClientAuraX11* drag_drop_client_ = nullptr;
|
2015-10-26 19:23:08 +01:00
|
|
|
|
2019-10-01 15:55:16 +02:00
|
|
|
+ // True if the xwindow has already been destroyed.
|
|
|
|
+ bool xwindow_destroyed_ = false;
|
|
|
|
+
|
2020-02-10 18:10:17 +01:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11);
|
|
|
|
};
|
2019-11-12 17:11:44 +01:00
|
|
|
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
|
2020-06-09 19:48:00 +02:00
|
|
|
index ecd7be9185fd..d03a5bcf8e7c 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/widget.cc
|
|
|
|
+++ ui/views/widget/widget.cc
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -287,7 +287,8 @@ void Widget::Init(InitParams 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;
|
2019-10-01 15:55:16 +02:00
|
|
|
+ is_top_level_ = !params.child ||
|
|
|
|
+ params.parent_widget != gfx::kNullAcceleratedWidget;
|
2014-06-12 22:28:58 +02:00
|
|
|
|
2020-02-10 18:10:17 +01:00
|
|
|
if (params.opacity == views::Widget::InitParams::WindowOpacity::kInferred &&
|
2019-01-17 10:56:52 +01:00
|
|
|
params.type != views::Widget::InitParams::TYPE_WINDOW) {
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -369,7 +370,12 @@ void Widget::Init(InitParams params) {
|
2016-05-25 01:35:43 +02:00
|
|
|
}
|
2019-10-01 15:55:16 +02:00
|
|
|
} else if (delegate) {
|
|
|
|
SetContentsView(delegate->GetContentsView());
|
|
|
|
- SetInitialBoundsForFramelessWindow(bounds);
|
|
|
|
+ if (params.parent_widget != gfx::kNullAcceleratedWidget) {
|
2014-03-12 15:36:18 +01:00
|
|
|
+ // Set the bounds directly instead of applying an inset.
|
2019-10-01 15:55:16 +02:00
|
|
|
+ SetBounds(bounds);
|
2014-03-12 15:36:18 +01:00
|
|
|
+ } else {
|
2019-10-01 15:55:16 +02:00
|
|
|
+ SetInitialBoundsForFramelessWindow(bounds);
|
2014-03-12 15:36:18 +01:00
|
|
|
+ }
|
|
|
|
}
|
2020-03-30 22:13:42 +02:00
|
|
|
|
|
|
|
observer_manager_.Add(GetNativeTheme());
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -1154,10 +1160,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
|
2020-06-09 19:48:00 +02:00
|
|
|
index 0cbc349dd3d1..3dd288962851 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/widget.h
|
|
|
|
+++ ui/views/widget/widget.h
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -311,6 +311,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
|
2020-04-14 21:31:00 +02:00
|
|
|
// the concept with bubble anchoring a la BubbleDialogDelegateView.
|
2019-10-01 15:55:16 +02:00
|
|
|
gfx::NativeView parent = nullptr;
|
|
|
|
|
|
|
|
+ gfx::AcceleratedWidget parent_widget = gfx::kNullAcceleratedWidget;
|
|
|
|
+
|
2013-12-07 02:55:22 +01:00
|
|
|
// 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
|
2020-06-09 19:48:00 +02:00
|
|
|
index 23396ad8c3a9..d30f71cedc1c 100644
|
2017-08-25 23:41:30 +02:00
|
|
|
--- ui/views/widget/widget_delegate.h
|
|
|
|
+++ ui/views/widget/widget_delegate.h
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -263,6 +263,10 @@ class VIEWS_EXPORT WidgetDelegate {
|
|
|
|
|
|
|
|
bool focus_traverses_out() const { return params_.focus_traverses_out; }
|
2017-08-25 23:41:30 +02:00
|
|
|
|
|
|
|
+ // 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
|
2020-02-10 18:10:17 +01:00
|
|
|
index 40e66a212e3e..08ee8523ab15 100644
|
2017-08-04 00:55:19 +02:00
|
|
|
--- ui/views/widget/widget_hwnd_utils.cc
|
|
|
|
+++ ui/views/widget/widget_hwnd_utils.cc
|
2019-11-12 17:11:44 +01:00
|
|
|
@@ -67,7 +67,7 @@ void CalculateWindowStylesFromInitParams(
|
2017-08-04 00:55:19 +02:00
|
|
|
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
|
2020-06-09 19:48:00 +02:00
|
|
|
index c981cfc6b0ac..2b0dafd7b2ab 100644
|
2016-01-19 21:09:01 +01:00
|
|
|
--- ui/views/win/hwnd_message_handler.cc
|
|
|
|
+++ ui/views/win/hwnd_message_handler.cc
|
2020-06-09 19:48:00 +02:00
|
|
|
@@ -3034,10 +3034,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
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
2019-11-12 17:11:44 +01:00
|
|
|
// Suppress |ET_MOUSE_MOVED| and |ET_MOUSE_DRAGGED| events from WM_MOUSE*
|