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
|
2021-11-10 22:57:31 +01:00
|
|
|
index f3168837b4e3a..3081b8bc31d4c 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
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -605,6 +605,14 @@ float RenderWidgetHostViewBase::GetDeviceScaleFactor() {
|
|
|
|
return screen_infos_.current().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
|
|
|
+
|
2020-10-08 21:54:42 +02:00
|
|
|
void RenderWidgetHostViewBase::OnAutoscrollStart() {
|
|
|
|
if (!GetMouseWheelPhaseHandler())
|
|
|
|
return;
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git content/browser/renderer_host/render_widget_host_view_base.h content/browser/renderer_host/render_widget_host_view_base.h
|
2021-11-10 22:57:31 +01:00
|
|
|
index c7b6bc3caa831..b62989e0ff470 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
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -67,6 +67,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;
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -131,6 +132,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView {
|
2020-10-08 21:54:42 +02:00
|
|
|
const gfx::Size& max_size) override;
|
2018-04-19 17:44:42 +02:00
|
|
|
void DisableAutoResize(const gfx::Size& new_size) override;
|
2019-06-05 16:15:45 +02:00
|
|
|
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;
|
2021-11-10 22:57:31 +01:00
|
|
|
bool ShouldVirtualKeyboardOverlayContent() override;
|
|
|
|
@@ -167,6 +170,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView {
|
|
|
|
// Called when screen information or native widget bounds change.
|
|
|
|
virtual void UpdateScreenInfo();
|
|
|
|
|
|
|
|
+ // Generates the most current set of ScreenInfos from the current set of
|
|
|
|
+ // displays in the system for use in UpdateScreenInfo.
|
|
|
|
+ virtual display::ScreenInfos GetNewScreenInfosForUpdate();
|
|
|
|
+
|
|
|
|
// Called by the TextInputManager to notify the view about being removed from
|
|
|
|
// the list of registered views, i.e., TextInputManager is no longer tracking
|
|
|
|
// TextInputState from this view. The RWHV should reset |text_input_manager_|
|
|
|
|
@@ -412,6 +419,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView {
|
2021-09-20 11:06:23 +02:00
|
|
|
const gfx::Rect& bounds,
|
|
|
|
const gfx::Rect& anchor_rect) = 0;
|
2017-02-10 23:44:11 +01:00
|
|
|
|
|
|
|
+ // 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;
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -607,6 +620,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView {
|
2021-01-28 00:13:12 +01:00
|
|
|
|
2021-06-04 03:34:56 +02:00
|
|
|
TooltipObserver* tooltip_observer_for_testing_ = nullptr;
|
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,
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -626,10 +643,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView {
|
|
|
|
|
|
|
|
void SynchronizeVisualProperties();
|
|
|
|
|
|
|
|
- // Generates the most current set of ScreenInfos from the current set of
|
|
|
|
- // displays in the system for use in UpdateScreenInfo.
|
|
|
|
- display::ScreenInfos GetNewScreenInfosForUpdate();
|
|
|
|
-
|
|
|
|
// Called when display properties that need to be synchronized with the
|
|
|
|
// renderer process changes. This method is called before notifying
|
|
|
|
// RenderWidgetHostImpl in order to allow the view to allocate a new
|
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
|
2021-11-10 22:57:31 +01:00
|
|
|
index 5a7b77e313e46..d2e2dda962d63 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
|
2021-09-20 11:06:23 +02:00
|
|
|
@@ -53,6 +53,10 @@ namespace {
|
2021-07-23 18:40:13 +02:00
|
|
|
// of the border area, in percentage of the corresponding dimension.
|
|
|
|
const int kMouseLockBorderPercentage = 15;
|
2016-11-23 21:54:29 +01:00
|
|
|
|
|
|
|
+#if defined(OS_LINUX)
|
|
|
|
+#include "ui/aura/window_tree_host.h"
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#if defined(OS_WIN)
|
2021-07-23 18:40:13 +02:00
|
|
|
// A callback function for EnumThreadWindows to enumerate and dismiss
|
|
|
|
// any owned popup windows.
|
2021-09-20 11:06:23 +02:00
|
|
|
@@ -838,6 +842,14 @@ void RenderWidgetHostViewEventHandler::MoveCursorToCenter(
|
2016-11-23 21:54:29 +01:00
|
|
|
}
|
2020-08-29 00:39:23 +02:00
|
|
|
return;
|
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
|
2020-08-29 00:39:23 +02:00
|
|
|
synthetic_move_position_ = center_in_screen;
|
|
|
|
}
|
2021-09-20 11:06:23 +02:00
|
|
|
@@ -867,6 +879,17 @@ bool RenderWidgetHostViewEventHandler::MatchesSynthesizedMovePosition(
|
2020-10-27 19:43:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void RenderWidgetHostViewEventHandler::SetKeyboardFocus() {
|
|
|
|
+#if defined(OS_WIN)
|
|
|
|
+ if (host_view_->HasExternalParent() &&
|
|
|
|
+ window_ && window_->delegate()->CanFocus()) {
|
|
|
|
+ aura::WindowTreeHost* host = window_->GetHost();
|
|
|
|
+ if (host) {
|
|
|
|
+ gfx::AcceleratedWidget hwnd = host->GetAcceleratedWidget();
|
|
|
|
+ if (!(::GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_NOACTIVATE))
|
|
|
|
+ ::SetFocus(hwnd);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
// TODO(wjmaclean): can host_ ever be null?
|
|
|
|
if (host_ && set_focus_on_mouse_down_or_key_event_) {
|
|
|
|
set_focus_on_mouse_down_or_key_event_ = false;
|
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
|
2021-11-10 22:57:31 +01:00
|
|
|
index adcf1eeaa3574..0748d570624cd 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
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -253,6 +253,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
|
|
|
+
|
2020-08-29 00:39:23 +02:00
|
|
|
#if defined(OS_MAC)
|
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;
|
2021-04-21 00:52:34 +02:00
|
|
|
diff --git ui/platform_window/x11/x11_window.cc ui/platform_window/x11/x11_window.cc
|
2021-11-10 22:57:31 +01:00
|
|
|
index dd416c031e7c1..05c05ac20f6b6 100644
|
2021-04-21 00:52:34 +02:00
|
|
|
--- ui/platform_window/x11/x11_window.cc
|
|
|
|
+++ ui/platform_window/x11/x11_window.cc
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -1689,7 +1689,8 @@ void X11Window::CreateXWindow(const PlatformWindowInitProperties& properties) {
|
2020-07-08 19:23:29 +02:00
|
|
|
req.border_pixel = 0;
|
2019-09-04 17:13:32 +02:00
|
|
|
|
2021-04-21 00:52:34 +02:00
|
|
|
bounds_in_pixels_ = SanitizeBounds(bounds);
|
2020-07-08 19:23:29 +02:00
|
|
|
- req.parent = x_root_window_;
|
2021-04-21 00:52:34 +02:00
|
|
|
+ req.parent = properties.parent_widget == gfx::kNullAcceleratedWidget ?
|
|
|
|
+ x_root_window_ : static_cast<x11::Window>(properties.parent_widget);
|
2020-07-08 19:23:29 +02:00
|
|
|
req.x = bounds_in_pixels_.x();
|
|
|
|
req.y = bounds_in_pixels_.y();
|
|
|
|
req.width = bounds_in_pixels_.width();
|
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
|
2021-09-20 11:06:23 +02:00
|
|
|
index 7c352dd0d992d..516623a91b0e1 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
|
2021-06-04 03:34:56 +02:00
|
|
|
@@ -20,6 +20,8 @@ DesktopScreenWin::~DesktopScreenWin() {
|
2020-07-08 19:23:29 +02:00
|
|
|
}
|
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)
|
2021-08-20 01:40:49 +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
|
2021-10-19 00:17:16 +02:00
|
|
|
index 9c3dec8dfdd32..a523cceb5aed3 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
|
2021-10-19 00:17:16 +02:00
|
|
|
@@ -231,6 +231,18 @@ Widget::MoveLoopResult DesktopWindowTreeHostLinux::RunMoveLoop(
|
2020-08-29 00:39:23 +02:00
|
|
|
escape_behavior);
|
|
|
|
}
|
|
|
|
|
|
|
|
+gfx::Rect DesktopWindowTreeHostLinux::GetWindowBoundsInScreen() const {
|
|
|
|
+ if (!screen_bounds_.IsEmpty())
|
|
|
|
+ return screen_bounds_;
|
|
|
|
+ return DesktopWindowTreeHostPlatform::GetWindowBoundsInScreen();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+gfx::Point DesktopWindowTreeHostLinux::GetLocationOnScreenInPixels() const {
|
|
|
|
+ if (!screen_bounds_.IsEmpty())
|
|
|
|
+ return screen_bounds_.origin();
|
|
|
|
+ return DesktopWindowTreeHostPlatform::GetLocationOnScreenInPixels();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void DesktopWindowTreeHostLinux::DispatchEvent(ui::Event* event) {
|
2021-07-23 18:40:13 +02:00
|
|
|
// In Windows, the native events sent to chrome are separated into client
|
|
|
|
// and non-client versions of events, which we record on our LocatedEvent
|
2021-10-19 00:17:16 +02:00
|
|
|
@@ -370,6 +382,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
|
|
|
}
|
2020-08-29 00:39:23 +02:00
|
|
|
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h
|
2021-10-19 00:17:16 +02:00
|
|
|
index 5ac7051b4a002..84b8ceb053e75 100644
|
2020-08-29 00:39:23 +02:00
|
|
|
--- ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h
|
|
|
|
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h
|
2021-10-19 00:17:16 +02:00
|
|
|
@@ -87,6 +87,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux
|
|
|
|
ui::PinnedModeExtension* GetPinnedModeExtension();
|
|
|
|
const ui::PinnedModeExtension* GetPinnedModeExtension() const;
|
2020-08-29 00:39:23 +02:00
|
|
|
|
|
|
|
+ void set_screen_bounds(const gfx::Rect& bounds) { screen_bounds_ = bounds; }
|
|
|
|
+
|
|
|
|
protected:
|
|
|
|
// Overridden from DesktopWindowTreeHost:
|
|
|
|
void Init(const Widget::InitParams& params) override;
|
2021-10-19 00:17:16 +02:00
|
|
|
@@ -96,6 +98,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux
|
2020-08-29 00:39:23 +02:00
|
|
|
const gfx::Vector2d& drag_offset,
|
|
|
|
Widget::MoveLoopSource source,
|
|
|
|
Widget::MoveLoopEscapeBehavior escape_behavior) override;
|
|
|
|
+ gfx::Rect GetWindowBoundsInScreen() const override;
|
|
|
|
+ gfx::Point GetLocationOnScreenInPixels() const override;
|
|
|
|
|
|
|
|
// PlatformWindowDelegate:
|
|
|
|
void DispatchEvent(ui::Event* event) override;
|
2021-10-19 00:17:16 +02:00
|
|
|
@@ -152,6 +156,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux
|
2020-08-29 00:39:23 +02:00
|
|
|
// destroyed.
|
|
|
|
static std::list<gfx::AcceleratedWidget>* open_windows_;
|
|
|
|
|
|
|
|
+ // Override the screen bounds when the host is a child window.
|
|
|
|
+ gfx::Rect screen_bounds_;
|
|
|
|
+
|
|
|
|
// The display and the native X window hosting the root window.
|
|
|
|
base::WeakPtrFactory<DesktopWindowTreeHostLinux> weak_factory_{this};
|
2021-10-19 00:17:16 +02:00
|
|
|
};
|
2021-09-20 11:06:23 +02:00
|
|
|
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
|
2021-11-10 22:57:31 +01:00
|
|
|
index 9ac6427c25b68..b8ed488d2f9fe 100644
|
2021-09-20 11:06:23 +02:00
|
|
|
--- ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
|
|
|
|
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -217,8 +217,8 @@ void DesktopWindowTreeHostPlatform::Init(const Widget::InitParams& params) {
|
2021-09-20 11:06:23 +02:00
|
|
|
if (properties.parent_widget) {
|
|
|
|
window_parent_ = DesktopWindowTreeHostPlatform::GetHostForWidget(
|
|
|
|
properties.parent_widget);
|
|
|
|
- DCHECK(window_parent_);
|
|
|
|
- window_parent_->window_children_.insert(this);
|
|
|
|
+ if (window_parent_)
|
|
|
|
+ window_parent_->window_children_.insert(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calculate initial bounds.
|
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
|
2021-11-10 22:57:31 +01:00
|
|
|
index ec35385c2d39d..7d1b5569b274f 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
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -181,8 +181,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);
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -989,11 +993,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
|
2021-11-10 22:57:31 +01:00
|
|
|
index 85bf0cde4ca4f..80b967931eca7 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
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -322,6 +322,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/widget.cc ui/views/widget/widget.cc
|
2021-11-10 22:57:31 +01:00
|
|
|
index d1b197a31d078..0d3f3f2e62653 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/widget.cc
|
|
|
|
+++ ui/views/widget/widget.cc
|
2021-10-19 00:17:16 +02:00
|
|
|
@@ -360,7 +360,8 @@ void Widget::Init(InitParams params) {
|
2021-08-20 01:40:49 +02:00
|
|
|
}
|
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) {
|
2021-10-19 00:17:16 +02:00
|
|
|
@@ -436,13 +437,21 @@ void Widget::Init(InitParams params) {
|
2021-09-07 16:04:55 +02:00
|
|
|
|
|
|
|
if (show_state == ui::SHOW_STATE_MAXIMIZED) {
|
|
|
|
Maximize();
|
|
|
|
+ saved_show_state_ = ui::SHOW_STATE_MAXIMIZED;
|
|
|
|
} else if (show_state == ui::SHOW_STATE_MINIMIZED) {
|
|
|
|
Minimize();
|
|
|
|
saved_show_state_ = ui::SHOW_STATE_MINIMIZED;
|
|
|
|
+ } else if (show_state == ui::SHOW_STATE_FULLSCREEN) {
|
|
|
|
+ SetFullscreen(true);
|
2016-05-25 01:35:43 +02:00
|
|
|
}
|
2019-10-01 15:55:16 +02:00
|
|
|
} else if (delegate) {
|
2020-10-08 21:54:42 +02:00
|
|
|
SetContentsView(delegate->TransferOwnershipOfContentsView());
|
2019-10-01 15:55:16 +02:00
|
|
|
- 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
|
|
|
|
2021-06-04 03:34:56 +02:00
|
|
|
native_theme_observation_.Observe(GetNativeTheme());
|
2021-10-19 00:17:16 +02:00
|
|
|
@@ -1414,10 +1423,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
|
2021-11-10 22:57:31 +01:00
|
|
|
index a2f2c0093ffda..2e4ecffc5fc17 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/widget.h
|
|
|
|
+++ ui/views/widget/widget.h
|
2021-10-19 00:17:16 +02:00
|
|
|
@@ -329,6 +329,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
|
2021-08-20 01:40:49 +02:00
|
|
|
index 16245ed7e0b44..99592a5359fbd 100644
|
2017-08-25 23:41:30 +02:00
|
|
|
--- ui/views/widget/widget_delegate.h
|
|
|
|
+++ ui/views/widget/widget_delegate.h
|
2021-08-20 01:40:49 +02:00
|
|
|
@@ -381,6 +381,10 @@ class VIEWS_EXPORT WidgetDelegate {
|
2020-07-08 19:23:29 +02:00
|
|
|
// Returns true if the title text should be centered.
|
|
|
|
bool ShouldCenterWindowTitleText() const;
|
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; }
|
|
|
|
+
|
2020-07-08 19:23:29 +02:00
|
|
|
bool focus_traverses_out() const { return params_.focus_traverses_out; }
|
2020-12-02 23:31:49 +01:00
|
|
|
bool enable_arrow_key_traversal() const {
|
|
|
|
return params_.enable_arrow_key_traversal;
|
2017-08-04 00:55:19 +02:00
|
|
|
diff --git ui/views/widget/widget_hwnd_utils.cc ui/views/widget/widget_hwnd_utils.cc
|
2021-07-23 18:40:13 +02:00
|
|
|
index c23259757d984..450b2610e34d1 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
|
2021-11-10 22:57:31 +01:00
|
|
|
index 53815de977e86..129986b1c1051 100644
|
2016-01-19 21:09:01 +01:00
|
|
|
--- ui/views/win/hwnd_message_handler.cc
|
|
|
|
+++ ui/views/win/hwnd_message_handler.cc
|
2021-10-19 00:17:16 +02:00
|
|
|
@@ -3121,10 +3121,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*
|