2024-01-29 19:38:25 +01:00
|
|
|
diff --git chrome/browser/extensions/api/sessions/sessions_api.cc chrome/browser/extensions/api/sessions/sessions_api.cc
|
2024-05-23 03:52:35 +02:00
|
|
|
index 23722ce395352..e7e7d70dd312c 100644
|
2024-01-29 19:38:25 +01:00
|
|
|
--- chrome/browser/extensions/api/sessions/sessions_api.cc
|
|
|
|
+++ chrome/browser/extensions/api/sessions/sessions_api.cc
|
|
|
|
@@ -333,6 +333,7 @@ SessionsGetDevicesFunction::CreateWindowModel(
|
|
|
|
state = api::windows::WindowState::kNormal;
|
|
|
|
break;
|
|
|
|
case ui::SHOW_STATE_MINIMIZED:
|
|
|
|
+ case ui::SHOW_STATE_HIDDEN:
|
|
|
|
state = api::windows::WindowState::kMinimized;
|
|
|
|
break;
|
|
|
|
case ui::SHOW_STATE_MAXIMIZED:
|
|
|
|
diff --git chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc
|
|
|
|
index cef40af382b1e..a2cf4691edc37 100644
|
|
|
|
--- chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc
|
|
|
|
+++ chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc
|
|
|
|
@@ -43,6 +43,7 @@ ChromeNativeAppWindowViewsAura::GetRestorableState(
|
|
|
|
|
|
|
|
case ui::SHOW_STATE_DEFAULT:
|
|
|
|
case ui::SHOW_STATE_MINIMIZED:
|
|
|
|
+ case ui::SHOW_STATE_HIDDEN:
|
|
|
|
case ui::SHOW_STATE_INACTIVE:
|
|
|
|
case ui::SHOW_STATE_END:
|
|
|
|
return ui::SHOW_STATE_NORMAL;
|
|
|
|
diff --git components/sessions/core/session_service_commands.cc components/sessions/core/session_service_commands.cc
|
2024-05-23 03:52:35 +02:00
|
|
|
index 124bf0bf470e5..30845be4a6a88 100644
|
2024-01-29 19:38:25 +01:00
|
|
|
--- components/sessions/core/session_service_commands.cc
|
|
|
|
+++ components/sessions/core/session_service_commands.cc
|
|
|
|
@@ -165,9 +165,10 @@ enum PersistedWindowShowState {
|
|
|
|
PERSISTED_SHOW_STATE_MAXIMIZED = 3,
|
|
|
|
// SHOW_STATE_INACTIVE (4) never persisted.
|
|
|
|
PERSISTED_SHOW_STATE_FULLSCREEN = 5,
|
|
|
|
- PERSISTED_SHOW_STATE_DETACHED_DEPRECATED = 6,
|
|
|
|
- PERSISTED_SHOW_STATE_DOCKED_DEPRECATED = 7,
|
|
|
|
- PERSISTED_SHOW_STATE_END = 8,
|
|
|
|
+ // SHOW_STATE_HIDDEN (6) never persisted.
|
|
|
|
+ PERSISTED_SHOW_STATE_DETACHED_DEPRECATED = 7,
|
|
|
|
+ PERSISTED_SHOW_STATE_DOCKED_DEPRECATED = 8,
|
|
|
|
+ PERSISTED_SHOW_STATE_END = 9,
|
|
|
|
};
|
|
|
|
|
2024-05-23 03:52:35 +02:00
|
|
|
// TODO(crbug.com/40946710): Remove this around December 2024. This is part of a
|
2024-01-29 19:38:25 +01:00
|
|
|
@@ -191,6 +192,7 @@ PersistedWindowShowState ShowStateToPersistedShowState(
|
|
|
|
case ui::SHOW_STATE_NORMAL:
|
|
|
|
return PERSISTED_SHOW_STATE_NORMAL;
|
|
|
|
case ui::SHOW_STATE_MINIMIZED:
|
|
|
|
+ case ui::SHOW_STATE_HIDDEN:
|
|
|
|
return PERSISTED_SHOW_STATE_MINIMIZED;
|
|
|
|
case ui::SHOW_STATE_MAXIMIZED:
|
|
|
|
return PERSISTED_SHOW_STATE_MAXIMIZED;
|
|
|
|
diff --git components/sessions/core/tab_restore_service_impl.cc components/sessions/core/tab_restore_service_impl.cc
|
2024-05-23 03:52:35 +02:00
|
|
|
index 552bf87379e34..b37e04b676de7 100644
|
2024-01-29 19:38:25 +01:00
|
|
|
--- components/sessions/core/tab_restore_service_impl.cc
|
|
|
|
+++ components/sessions/core/tab_restore_service_impl.cc
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -197,6 +197,7 @@ int SerializeWindowShowState(ui::WindowShowState show_state) {
|
2024-01-29 19:38:25 +01:00
|
|
|
case ui::SHOW_STATE_NORMAL:
|
|
|
|
return kSerializedShowStateNormal;
|
|
|
|
case ui::SHOW_STATE_MINIMIZED:
|
|
|
|
+ case ui::SHOW_STATE_HIDDEN:
|
|
|
|
return kSerializedShowStateMinimized;
|
|
|
|
case ui::SHOW_STATE_MAXIMIZED:
|
|
|
|
return kSerializedShowStateMaximized;
|
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
|
2024-05-23 03:52:35 +02:00
|
|
|
index 60d2748ffebf8..cb16f27ee8d5f 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
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -674,6 +674,14 @@ float RenderWidgetHostViewBase::GetScaleOverrideForCapture() const {
|
2022-06-17 15:28:55 +02:00
|
|
|
return scale_override_for_capture_;
|
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
|
2024-05-23 03:52:35 +02:00
|
|
|
index 36ed537b555aa..2cf5fe3b03f0d 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
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -72,6 +72,7 @@ class CursorManager;
|
|
|
|
class DevicePosturePlatformProvider;
|
2018-05-18 12:45:18 +02:00
|
|
|
class MouseWheelPhaseHandler;
|
2017-02-10 23:44:11 +01:00
|
|
|
class RenderWidgetHostImpl;
|
|
|
|
+class RenderWidgetHostViewGuest;
|
2024-05-23 03:52:35 +02:00
|
|
|
class RenderWidgetHostViewInputObserver;
|
2024-03-19 22:11:42 +01:00
|
|
|
class ScopedViewTransitionResources;
|
2017-02-10 23:44:11 +01:00
|
|
|
class TextInputManager;
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -194,6 +195,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
|
2021-12-16 23:35:54 +01:00
|
|
|
float GetDeviceScaleFactor() const final;
|
2024-04-23 22:06:00 +02:00
|
|
|
bool IsPointerLocked() override;
|
|
|
|
|
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;
|
2024-04-23 22:06:00 +02:00
|
|
|
+
|
|
|
|
// Identical to `CopyFromSurface()`, except that this method issues the
|
|
|
|
// `viz::CopyOutputRequest` against the exact `viz::Surface` currently
|
|
|
|
// embedded by this View, while `CopyFromSurface()` may return a copy of any
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -255,6 +259,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
|
2021-11-10 22:57:31 +01:00
|
|
|
// 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_|
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -383,6 +391,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
|
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) {}
|
|
|
|
+
|
2024-04-23 22:06:00 +02:00
|
|
|
// Indicates whether the page has finished loading.
|
|
|
|
virtual void SetIsLoading(bool is_loading) = 0;
|
2023-01-30 18:43:54 +01:00
|
|
|
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -645,6 +659,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
|
2022-02-21 23:23:40 +01:00
|
|
|
// to all displays.
|
|
|
|
gfx::Size system_cursor_size_;
|
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,
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -666,10 +684,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
|
2021-11-10 22:57:31 +01:00
|
|
|
|
|
|
|
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
|
2024-05-23 03:52:35 +02:00
|
|
|
index d1df19bfcb6c9..c55b89a119046 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
|
2022-01-25 21:26:51 +01:00
|
|
|
@@ -52,6 +52,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
|
|
|
|
2022-01-25 21:26:51 +01:00
|
|
|
+#if BUILDFLAG(IS_LINUX)
|
2016-11-23 21:54:29 +01:00
|
|
|
+#include "ui/aura/window_tree_host.h"
|
|
|
|
+#endif
|
|
|
|
+
|
2022-01-25 21:26:51 +01:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2021-07-23 18:40:13 +02:00
|
|
|
// A callback function for EnumThreadWindows to enumerate and dismiss
|
|
|
|
// any owned popup windows.
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -821,6 +825,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
|
2022-01-25 21:26:51 +01:00
|
|
|
+#if BUILDFLAG(IS_LINUX)
|
2016-11-23 21:54:29 +01:00
|
|
|
+ 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;
|
|
|
|
}
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -851,6 +863,17 @@ bool RenderWidgetHostViewEventHandler::MatchesSynthesizedMovePosition(
|
2020-10-27 19:43:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void RenderWidgetHostViewEventHandler::SetKeyboardFocus() {
|
2022-01-25 21:26:51 +01:00
|
|
|
+#if BUILDFLAG(IS_WIN)
|
2020-10-27 19:43:10 +01:00
|
|
|
+ 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
|
2024-04-23 22:06:00 +02:00
|
|
|
index b4ff7c11d8e3c..b21417f89e6e1 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
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -254,6 +254,14 @@ class CONTENT_EXPORT RenderWidgetHostView {
|
2018-03-20 21:15:08 +01:00
|
|
|
// This must always return the same device scale factor as GetScreenInfo.
|
2021-12-16 23:35:54 +01:00
|
|
|
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
|
|
|
+
|
2022-01-25 21:26:51 +01:00
|
|
|
#if BUILDFLAG(IS_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;
|
2024-02-05 22:24:27 +01:00
|
|
|
diff --git ui/aura/native_window_occlusion_tracker_win.cc ui/aura/native_window_occlusion_tracker_win.cc
|
2024-05-23 03:52:35 +02:00
|
|
|
index 0893f87550cc9..2a52012e5059d 100644
|
2024-02-05 22:24:27 +01:00
|
|
|
--- ui/aura/native_window_occlusion_tracker_win.cc
|
|
|
|
+++ ui/aura/native_window_occlusion_tracker_win.cc
|
2024-03-19 22:11:42 +01:00
|
|
|
@@ -101,6 +101,13 @@ void NativeWindowOcclusionTrackerWin::Enable(Window* window) {
|
2024-02-05 22:24:27 +01:00
|
|
|
// when it's no longer true that all windows are minimized, and when the
|
|
|
|
// window is destroyed.
|
|
|
|
HWND root_window_hwnd = window->GetHost()->GetAcceleratedWidget();
|
|
|
|
+
|
|
|
|
+ // Delay occlusion tracking for initially-minimized windows.
|
|
|
|
+ // See CEF issue #3638.
|
|
|
|
+ if (IsIconic(root_window_hwnd)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
window->AddObserver(this);
|
|
|
|
// Remember this mapping from hwnd to Window*.
|
|
|
|
hwnd_root_window_map_[root_window_hwnd] = window;
|
2024-01-29 19:38:25 +01:00
|
|
|
diff --git ui/base/mojom/ui_base_types_mojom_traits.h ui/base/mojom/ui_base_types_mojom_traits.h
|
|
|
|
index 1d79fc2dc34cc..ce5bf0ebf531f 100644
|
|
|
|
--- ui/base/mojom/ui_base_types_mojom_traits.h
|
|
|
|
+++ ui/base/mojom/ui_base_types_mojom_traits.h
|
|
|
|
@@ -172,6 +172,7 @@ struct EnumTraits<ui::mojom::WindowShowState, ui::WindowShowState> {
|
|
|
|
case ui::SHOW_STATE_INACTIVE:
|
|
|
|
return ui::mojom::WindowShowState::SHOW_STATE_INACTIVE;
|
|
|
|
case ui::SHOW_STATE_MINIMIZED:
|
|
|
|
+ case ui::SHOW_STATE_HIDDEN:
|
|
|
|
return ui::mojom::WindowShowState::SHOW_STATE_MINIMIZED;
|
|
|
|
case ui::SHOW_STATE_MAXIMIZED:
|
|
|
|
return ui::mojom::WindowShowState::SHOW_STATE_MAXIMIZED;
|
|
|
|
diff --git ui/base/ui_base_types.h ui/base/ui_base_types.h
|
2024-05-23 03:52:35 +02:00
|
|
|
index 2cf9330a4e24b..4bf0890ae000b 100644
|
2024-01-29 19:38:25 +01:00
|
|
|
--- ui/base/ui_base_types.h
|
|
|
|
+++ ui/base/ui_base_types.h
|
|
|
|
@@ -26,7 +26,8 @@ enum WindowShowState {
|
|
|
|
SHOW_STATE_MAXIMIZED = 3,
|
|
|
|
SHOW_STATE_INACTIVE = 4, // Views only, not persisted.
|
|
|
|
SHOW_STATE_FULLSCREEN = 5,
|
|
|
|
- SHOW_STATE_END = 6 // The end of show state enum.
|
|
|
|
+ SHOW_STATE_HIDDEN = 6, // Views and MacOS only.
|
|
|
|
+ SHOW_STATE_END = 7 // The end of show state enum.
|
|
|
|
};
|
|
|
|
|
|
|
|
// Specifies which edges of the window are tiled.
|
2022-02-21 23:23:40 +01:00
|
|
|
diff --git ui/ozone/platform/x11/x11_window.cc ui/ozone/platform/x11/x11_window.cc
|
2024-06-25 15:37:09 +02:00
|
|
|
index 049ca2852542d..a1c6796dccaab 100644
|
2022-02-21 23:23:40 +01:00
|
|
|
--- ui/ozone/platform/x11/x11_window.cc
|
|
|
|
+++ ui/ozone/platform/x11/x11_window.cc
|
2024-06-20 15:35:33 +02:00
|
|
|
@@ -1865,7 +1865,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
|
|
|
|
2024-02-22 19:36:15 +01: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);
|
2024-02-22 19:36:15 +01: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
|
2024-02-22 19:36:15 +01:00
|
|
|
index e31c5b4cb6726..1b724948c2868 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
|
2022-06-17 15:28:55 +02:00
|
|
|
@@ -23,6 +23,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
|
2024-05-23 03:52:35 +02:00
|
|
|
index 87179d2dfc301..92d31c96bb0b1 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
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -194,6 +194,18 @@ Widget::MoveLoopResult DesktopWindowTreeHostLinux::RunMoveLoop(
|
2022-02-21 23:23:40 +01:00
|
|
|
return result;
|
2020-08-29 00:39:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+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
|
2022-06-17 15:28:55 +02:00
|
|
|
// and non-client versions of events, which we record on our LocatedEvent
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -329,6 +341,8 @@ void DesktopWindowTreeHostLinux::AddAdditionalInitProperties(
|
2022-01-25 21:26:51 +01:00
|
|
|
|
|
|
|
properties->wayland_app_id = params.wayland_app_id;
|
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
|
2024-05-23 03:52:35 +02:00
|
|
|
index e698f71577c51..8a6e28128564d 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
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -62,6 +62,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux
|
|
|
|
// client-drawn shadow.
|
|
|
|
virtual void UpdateFrameHints();
|
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;
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -71,6 +73,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:
|
2022-06-17 15:28:55 +02:00
|
|
|
void DispatchEvent(ui::Event* event) override;
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -120,6 +124,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux
|
2022-05-19 12:28:44 +02:00
|
|
|
|
|
|
|
uint32_t modal_dialog_counter_ = 0;
|
2020-08-29 00:39:23 +02:00
|
|
|
|
|
|
|
+ // 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
|
2024-07-17 17:05:59 +02:00
|
|
|
index fef32675148d1..ac0f316f475f6 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
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -281,8 +281,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
|
2024-05-23 03:52:35 +02:00
|
|
|
index 288a76d86ed87..1fd024d1645c3 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
|
2024-03-19 22:11:42 +01:00
|
|
|
@@ -20,6 +20,7 @@
|
2024-02-05 22:24:27 +01:00
|
|
|
#include "ui/aura/client/aura_constants.h"
|
|
|
|
#include "ui/aura/client/cursor_client.h"
|
|
|
|
#include "ui/aura/client/focus_client.h"
|
|
|
|
+#include "ui/aura/native_window_occlusion_tracker.h"
|
|
|
|
#include "ui/aura/window_event_dispatcher.h"
|
|
|
|
#include "ui/base/class_property.h"
|
|
|
|
#include "ui/base/cursor/cursor.h"
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -183,22 +184,42 @@ void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) {
|
2022-11-15 18:50:53 +01:00
|
|
|
native_widget_delegate_.get());
|
2014-02-19 17:27:54 +01:00
|
|
|
|
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);
|
2022-10-25 01:47:04 +02:00
|
|
|
z_order_ = params.EffectiveZOrderLevel();
|
|
|
|
|
|
|
|
- // We don't have an HWND yet, so scale relative to the nearest screen.
|
|
|
|
- gfx::Rect pixel_bounds =
|
|
|
|
- display::win::ScreenWin::DIPToScreenRect(nullptr, params.bounds);
|
|
|
|
+ gfx::Rect pixel_bounds;
|
2023-01-06 21:51:22 +01:00
|
|
|
+ if (has_external_parent_ && params.type != Widget::InitParams::TYPE_MENU) {
|
2022-10-25 01:47:04 +02:00
|
|
|
+ // Scale relative to the screen that contains the parent window.
|
|
|
|
+ // Child windows always have origin (0,0).
|
|
|
|
+ pixel_bounds.set_size(display::win::ScreenWin::DIPToScreenSize(
|
|
|
|
+ parent_hwnd, params.bounds.size()));
|
|
|
|
+ } else {
|
|
|
|
+ // We don't have an HWND yet, so scale relative to the nearest screen.
|
|
|
|
+ pixel_bounds =
|
|
|
|
+ display::win::ScreenWin::DIPToScreenRect(nullptr, params.bounds);
|
|
|
|
+ }
|
2023-11-21 20:17:55 +01:00
|
|
|
+
|
|
|
|
message_handler_->Init(parent_hwnd, pixel_bounds);
|
2022-10-25 01:47:04 +02:00
|
|
|
CreateCompositor(params.force_software_compositing);
|
|
|
|
OnAcceleratedWidgetAvailable();
|
2024-02-05 22:24:27 +01:00
|
|
|
InitHost();
|
|
|
|
window()->Show();
|
|
|
|
|
|
|
|
+ if (params.show_state == ui::SHOW_STATE_MINIMIZED) {
|
|
|
|
+ // Delay enablement of native occlusion tracking until the
|
|
|
|
+ // initially-minimized window is restored for the first time.
|
|
|
|
+ // See CEF issue #3638.
|
|
|
|
+ initially_minimized_first_restore_pending_ = true;
|
|
|
|
+ }
|
|
|
|
+
|
2024-03-19 22:11:42 +01:00
|
|
|
// Stack immediately above its parent so that it does not cover other
|
|
|
|
// root-level windows, with the exception of menus, to allow them to be
|
|
|
|
// displayed on top of other windows.
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -1025,10 +1046,23 @@ void DesktopWindowTreeHostWin::HandleWindowMinimizedOrRestored(bool restored) {
|
2024-02-05 22:24:27 +01:00
|
|
|
if (!native_widget_delegate_->IsNativeWidgetInitialized())
|
|
|
|
return;
|
|
|
|
|
|
|
|
- if (restored)
|
|
|
|
+ if (restored) {
|
|
|
|
window()->Show();
|
|
|
|
- else
|
|
|
|
+
|
|
|
|
+ if (initially_minimized_first_restore_pending_) {
|
|
|
|
+ initially_minimized_first_restore_pending_ = false;
|
|
|
|
+
|
|
|
|
+ // Enable native occlusion tracking for initially-minimized windows here
|
|
|
|
+ // to avoid incorrect hidden state after restore. See CEF issue #3638.
|
|
|
|
+ if (aura::NativeWindowOcclusionTracker::
|
|
|
|
+ IsNativeWindowOcclusionTrackingAlwaysEnabled(this)) {
|
|
|
|
+ aura::NativeWindowOcclusionTracker::
|
|
|
|
+ EnableNativeWindowOcclusionTracking(this);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
window()->Hide();
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
void DesktopWindowTreeHostWin::HandleClientSizeChanged(
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -1045,11 +1079,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_.
|
2022-08-10 19:52:39 +02:00
|
|
|
+ // See comments in CefBrowserPlatformDelegateNativeWin::SetFocus.
|
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_.
|
2022-08-10 19:52:39 +02:00
|
|
|
+ // See comments in CefBrowserPlatformDelegateNativeWin::SetFocus.
|
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) {
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -1057,6 +1095,12 @@ bool DesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) {
|
2022-08-10 19:52:39 +02:00
|
|
|
if (ui::PlatformEventSource::ShouldIgnoreNativePlatformEvents())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
+ // See comments in CefBrowserPlatformDelegateNativeWin::SetFocus.
|
|
|
|
+ if (has_external_parent_ && CanActivate() && event->IsAnyButton() &&
|
|
|
|
+ ::GetFocus() != GetHWND()) {
|
|
|
|
+ ::SetFocus(GetHWND());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
SendEventToSink(event);
|
|
|
|
return event->handled();
|
|
|
|
}
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -1235,8 +1279,16 @@ void DesktopWindowTreeHostWin::SetBoundsInDIP(const gfx::Rect& bounds) {
|
2022-10-25 01:47:04 +02:00
|
|
|
// positions in variable-DPI situations. See https://crbug.com/1224715 for
|
|
|
|
// details.
|
|
|
|
aura::Window* root = nullptr;
|
|
|
|
- const gfx::Rect bounds_in_pixels =
|
|
|
|
+ if (has_external_parent_) {
|
|
|
|
+ // Scale relative to the screen that contains the parent window.
|
|
|
|
+ root = AsWindowTreeHost()->window();
|
|
|
|
+ }
|
|
|
|
+ gfx::Rect bounds_in_pixels =
|
|
|
|
display::Screen::GetScreen()->DIPToScreenRectInWindow(root, bounds);
|
|
|
|
+ if (has_external_parent_) {
|
|
|
|
+ // Child windows always have origin (0,0).
|
|
|
|
+ bounds_in_pixels.set_origin(gfx::Point(0, 0));
|
|
|
|
+ }
|
|
|
|
AsWindowTreeHost()->SetBoundsInPixels(bounds_in_pixels);
|
|
|
|
}
|
|
|
|
|
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
|
2024-02-22 19:36:15 +01:00
|
|
|
index 8d5b01098915d..ae5b6a2193031 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
|
2024-02-05 22:24:27 +01:00
|
|
|
@@ -322,6 +322,14 @@ 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;
|
2024-02-05 22:24:27 +01:00
|
|
|
+
|
|
|
|
+ // True if the first call to HandleWindowMinimizedOrRestored for an initially-
|
|
|
|
+ // minimized window is pending.
|
|
|
|
+ bool initially_minimized_first_restore_pending_ = false;
|
2015-10-26 19:23:08 +01:00
|
|
|
+
|
2023-01-30 18:43:54 +01:00
|
|
|
// Visibility of the cursor. On Windows we can have multiple root windows and
|
|
|
|
// the implementation of ::ShowCursor() is based on a counter, so making this
|
|
|
|
// member static ensures that ::ShowCursor() is always called exactly once
|
2024-01-29 19:38:25 +01:00
|
|
|
diff --git ui/views/widget/native_widget_mac.mm ui/views/widget/native_widget_mac.mm
|
2024-04-23 22:06:00 +02:00
|
|
|
index 6383110804d44..e5bc85f63fab9 100644
|
2024-01-29 19:38:25 +01:00
|
|
|
--- ui/views/widget/native_widget_mac.mm
|
|
|
|
+++ ui/views/widget/native_widget_mac.mm
|
|
|
|
@@ -640,6 +640,7 @@ void NativeWidgetMac::Show(ui::WindowShowState show_state,
|
|
|
|
break;
|
|
|
|
case ui::SHOW_STATE_MAXIMIZED:
|
|
|
|
case ui::SHOW_STATE_FULLSCREEN:
|
|
|
|
+ case ui::SHOW_STATE_HIDDEN:
|
|
|
|
NOTIMPLEMENTED();
|
|
|
|
break;
|
|
|
|
case ui::SHOW_STATE_END:
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
|
2024-06-13 21:21:21 +02:00
|
|
|
index e113e926b324c..572eccab19085 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/widget.cc
|
|
|
|
+++ ui/views/widget/widget.cc
|
2024-06-13 21:21:21 +02:00
|
|
|
@@ -410,7 +410,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;
|
2023-12-06 21:16:15 +01:00
|
|
|
is_headless_ = params.ShouldInitAsHeadless();
|
2024-04-23 22:06:00 +02:00
|
|
|
is_autosized_ = params.autosize;
|
2014-06-12 22:28:58 +02:00
|
|
|
|
2024-06-13 21:21:21 +02:00
|
|
|
@@ -502,9 +503,14 @@ 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);
|
2024-01-29 19:38:25 +01:00
|
|
|
+ } else if (show_state == ui::SHOW_STATE_HIDDEN) {
|
|
|
|
+ Hide();
|
2016-05-25 01:35:43 +02:00
|
|
|
}
|
2024-02-22 19:36:15 +01:00
|
|
|
|
|
|
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
2024-06-13 21:21:21 +02:00
|
|
|
@@ -518,7 +524,12 @@ void Widget::Init(InitParams params) {
|
2019-10-01 15:55:16 +02:00
|
|
|
} else if (delegate) {
|
2020-10-08 21:54:42 +02:00
|
|
|
SetContentsView(delegate->TransferOwnershipOfContentsView());
|
2023-10-19 20:08:48 +02:00
|
|
|
if (should_set_initial_bounds) {
|
|
|
|
- SetInitialBoundsForFramelessWindow(bounds);
|
|
|
|
+ if (params.parent_widget != gfx::kNullAcceleratedWidget) {
|
|
|
|
+ // Set the bounds directly instead of applying an inset.
|
|
|
|
+ SetBounds(bounds);
|
|
|
|
+ } else {
|
|
|
|
+ SetInitialBoundsForFramelessWindow(bounds);
|
|
|
|
+ }
|
|
|
|
}
|
2014-03-12 15:36:18 +01:00
|
|
|
}
|
2020-03-30 22:13:42 +02:00
|
|
|
|
2024-06-13 21:21:21 +02:00
|
|
|
@@ -1704,10 +1715,16 @@ void Widget::OnNativeWidgetParentChanged(gfx::NativeView parent) {
|
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();
|
|
|
|
}
|
|
|
|
|
2024-06-13 21:21:21 +02:00
|
|
|
@@ -1958,7 +1975,8 @@ bool Widget::SetInitialFocus(ui::WindowShowState show_state) {
|
2024-01-29 19:38:25 +01:00
|
|
|
return false;
|
|
|
|
View* v = widget_delegate_->GetInitiallyFocusedView();
|
|
|
|
if (!focus_on_creation_ || show_state == ui::SHOW_STATE_INACTIVE ||
|
|
|
|
- show_state == ui::SHOW_STATE_MINIMIZED) {
|
|
|
|
+ show_state == ui::SHOW_STATE_MINIMIZED ||
|
|
|
|
+ show_state == ui::SHOW_STATE_HIDDEN) {
|
|
|
|
// If not focusing the window now, tell the focus manager which view to
|
|
|
|
// focus when the window is restored.
|
|
|
|
if (v)
|
2015-10-26 19:23:08 +01:00
|
|
|
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
|
2024-05-23 03:52:35 +02:00
|
|
|
index 68c2ac9da74ac..94f75266c6917 100644
|
2015-10-26 19:23:08 +01:00
|
|
|
--- ui/views/widget/widget.h
|
|
|
|
+++ ui/views/widget/widget.h
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -358,6 +358,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
|
2020-04-14 21:31:00 +02:00
|
|
|
// the concept with bubble anchoring a la BubbleDialogDelegateView.
|
2023-06-26 12:13:38 +02:00
|
|
|
gfx::NativeView parent = gfx::NativeView();
|
2019-10-01 15:55:16 +02:00
|
|
|
|
|
|
|
+ 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
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -764,7 +766,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
|
2023-11-14 18:16:43 +01:00
|
|
|
void ShowInactive();
|
|
|
|
|
|
|
|
// Activates the widget, assuming it already exists and is visible.
|
|
|
|
- void Activate();
|
|
|
|
+ virtual void Activate();
|
|
|
|
|
|
|
|
// Deactivates the widget, making the next window in the Z order the active
|
|
|
|
// window.
|
2017-08-25 23:41:30 +02:00
|
|
|
diff --git ui/views/widget/widget_delegate.h ui/views/widget/widget_delegate.h
|
2024-05-23 03:52:35 +02:00
|
|
|
index d1f6be37fcf45..ca2fd8ce00561 100644
|
2017-08-25 23:41:30 +02:00
|
|
|
--- ui/views/widget/widget_delegate.h
|
|
|
|
+++ ui/views/widget/widget_delegate.h
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -402,6 +402,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
|
2023-02-27 19:52:38 +01:00
|
|
|
index 3b9b00b7d79ae..e759e3c1a9f34 100644
|
2017-08-04 00:55:19 +02:00
|
|
|
--- ui/views/widget/widget_hwnd_utils.cc
|
|
|
|
+++ ui/views/widget/widget_hwnd_utils.cc
|
2023-01-30 18:43:54 +01:00
|
|
|
@@ -63,7 +63,8 @@ void CalculateWindowStylesFromInitParams(
|
2017-08-04 00:55:19 +02:00
|
|
|
if (!widget_delegate->CanResize())
|
2022-08-23 03:37:40 +02:00
|
|
|
*style &= static_cast<DWORD>(~(WS_THICKFRAME | WS_MAXIMIZEBOX));
|
2017-08-04 00:55:19 +02:00
|
|
|
if (params.remove_standard_frame)
|
2022-08-23 03:37:40 +02:00
|
|
|
- *style &= static_cast<DWORD>(~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX));
|
|
|
|
+ *style &= static_cast<DWORD>(~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX |
|
|
|
|
+ WS_CAPTION | WS_SYSMENU));
|
2017-08-04 00:55:19 +02:00
|
|
|
|
|
|
|
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
|
2024-05-23 03:52:35 +02:00
|
|
|
index 3bfc5b2257908..0d4437e091daa 100644
|
2016-01-19 21:09:01 +01:00
|
|
|
--- ui/views/win/hwnd_message_handler.cc
|
|
|
|
+++ ui/views/win/hwnd_message_handler.cc
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -772,7 +772,11 @@ bool HWNDMessageHandler::IsVisible() const {
|
2023-11-21 20:17:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool HWNDMessageHandler::IsActive() const {
|
|
|
|
- return ::GetActiveWindow() == hwnd();
|
2022-06-02 11:49:50 +02:00
|
|
|
+ // This active state is checked via FocusManager::SetFocusedViewWithReason.
|
|
|
|
+ // With CEF external parent hwnd() may be a child window, whereas
|
|
|
|
+ // GetActiveWindow() will return the root window, so make sure that we always
|
|
|
|
+ // compare root windows.
|
2023-11-21 20:17:55 +01:00
|
|
|
+ return ::GetActiveWindow() == ::GetAncestor(hwnd(), GA_ROOT);
|
2022-06-02 11:49:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool HWNDMessageHandler::IsMinimized() const {
|
2024-05-23 03:52:35 +02:00
|
|
|
@@ -3225,10 +3229,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*
|