0

PlatformWindow: Add X11Extension.

As stated in https://crrev.com/c/1917765, to provide more
flexibility and avoid casts to PlatformWindowLinux, the extension
interfaces were added instead. This fixes the crash when
Ozone for Linux is run with --ozone-platform=headless.

Please note that the most x11 specific interfaces will
be removed as soon as there are no callers for them.

Bug: 1016556
Change-Id: I90591fc6e2e2fd776685384a05cc3f9bdd770fc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1917536
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Robert Kroeger <rjkroege@chromium.org>
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718615}
This commit is contained in:
Maksim Sisov
2019-11-25 13:20:58 +00:00
committed by Commit Bot
parent f25d9a08eb
commit 08b20ec1fa
63 changed files with 483 additions and 546 deletions
ash/host
chrome/browser/vr/testapp
components/viz
gpu/vulkan/demo
ui
aura
compositor
gl
ozone
platform_window
views

@ -25,7 +25,7 @@
#include "ui/gfx/transform.h"
#include "ui/ozone/public/input_controller.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_init_properties.h"
namespace ash {

@ -65,7 +65,7 @@ AshWindowTreeHostUnified::AshWindowTreeHostUnified(
AshWindowTreeHostMirroringDelegate* delegate)
: AshWindowTreeHostPlatform(), delegate_(delegate) {
DCHECK(delegate);
std::unique_ptr<ui::PlatformWindowBase> window(new ui::StubWindow(this));
std::unique_ptr<ui::PlatformWindow> window(new ui::StubWindow(this));
window->SetBounds(initial_bounds);
SetPlatformWindow(std::move(window));
}

@ -32,7 +32,7 @@
#include "ui/ozone/public/cursor_factory_ozone.h"
#include "ui/ozone/public/ozone_gpu_test_helper.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
#include "ui/platform_window/platform_window_init_properties.h"
@ -166,7 +166,7 @@ class AppWindow : public ui::PlatformWindowDelegate {
std::unique_ptr<vr::GlRenderer> renderer_;
// Window-related state.
std::unique_ptr<ui::PlatformWindowBase> platform_window_;
std::unique_ptr<ui::PlatformWindow> platform_window_;
gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget;
base::WeakPtrFactory<AppWindow> weak_ptr_factory_;

@ -21,7 +21,7 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
#include "ui/platform_window/platform_window_init_properties.h"
@ -114,7 +114,7 @@ class DemoWindow : public ui::PlatformWindowDelegate {
}
private:
std::unique_ptr<ui::PlatformWindowBase> CreatePlatformWindow(
std::unique_ptr<ui::PlatformWindow> CreatePlatformWindow(
const gfx::Rect& bounds) {
ui::PlatformWindowInitProperties props(bounds);
#if defined(USE_OZONE)
@ -184,7 +184,7 @@ class DemoWindow : public ui::PlatformWindowDelegate {
std::unique_ptr<demo::DemoHost> host_;
std::unique_ptr<demo::DemoService> service_;
std::unique_ptr<ui::PlatformWindowBase> platform_window_;
std::unique_ptr<ui::PlatformWindow> platform_window_;
gfx::AcceleratedWidget widget_;
DISALLOW_COPY_AND_ASSIGN(DemoWindow);

@ -21,7 +21,7 @@
#include "ui/ozone/public/platform_window_surface.h"
#include "ui/ozone/public/surface_factory_ozone.h"
#include "ui/ozone/public/surface_ozone_canvas.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
#include "ui/platform_window/platform_window_init_properties.h"

@ -12,7 +12,7 @@
#include "gpu/vulkan/vulkan_swap_chain.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "ui/gfx/geometry/size.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
class SkCanvas;
@ -66,7 +66,7 @@ class VulkanDemo : public ui::PlatformWindowDelegate {
scoped_refptr<viz::VulkanContextProvider> vulkan_context_provider_;
gfx::AcceleratedWidget accelerated_widget_ = gfx::kNullAcceleratedWidget;
std::unique_ptr<ui::PlatformEventSource> event_source_;
std::unique_ptr<ui::PlatformWindowBase> window_;
std::unique_ptr<ui::PlatformWindow> window_;
std::unique_ptr<VulkanSurface> vulkan_surface_;
base::Optional<VulkanSwapChain::ScopedWrite> scoped_write_;
sk_sp<SkSurface> sk_surface_;

@ -23,7 +23,7 @@
#include "ui/events/event.h"
#include "ui/events/keyboard_hook.h"
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_init_properties.h"
#if defined(USE_OZONE)
@ -86,7 +86,7 @@ void WindowTreeHostPlatform::CreateAndSetPlatformWindow(
}
void WindowTreeHostPlatform::SetPlatformWindow(
std::unique_ptr<ui::PlatformWindowBase> window) {
std::unique_ptr<ui::PlatformWindow> window) {
platform_window_ = std::move(window);
}

@ -18,7 +18,7 @@
namespace ui {
enum class DomCode;
class PlatformWindowBase;
class PlatformWindow;
class KeyboardHook;
struct PlatformWindowInitProperties;
} // namespace ui
@ -62,9 +62,9 @@ class AURA_EXPORT WindowTreeHostPlatform : public WindowTreeHost,
// installs it at as the PlatformWindow for this WindowTreeHostPlatform.
void CreateAndSetPlatformWindow(ui::PlatformWindowInitProperties properties);
void SetPlatformWindow(std::unique_ptr<ui::PlatformWindowBase> window);
ui::PlatformWindowBase* platform_window() { return platform_window_.get(); }
const ui::PlatformWindowBase* platform_window() const {
void SetPlatformWindow(std::unique_ptr<ui::PlatformWindow> window);
ui::PlatformWindow* platform_window() { return platform_window_.get(); }
const ui::PlatformWindow* platform_window() const {
return platform_window_.get();
}
@ -90,7 +90,7 @@ class AURA_EXPORT WindowTreeHostPlatform : public WindowTreeHost,
private:
gfx::AcceleratedWidget widget_;
std::unique_ptr<ui::PlatformWindowBase> platform_window_;
std::unique_ptr<ui::PlatformWindow> platform_window_;
gfx::NativeCursor current_cursor_;
gfx::Rect bounds_in_pixels_;

@ -22,7 +22,7 @@ class TestWindowTreeHost : public WindowTreeHostPlatform {
CreateCompositor();
}
ui::PlatformWindowBase* platform_window() {
ui::PlatformWindow* platform_window() {
return WindowTreeHostPlatform::platform_window();
}
@ -37,7 +37,7 @@ class TestWindowTreeHost : public WindowTreeHostPlatform {
class TestWindowTreeHostObserver : public aura::WindowTreeHostObserver {
public:
TestWindowTreeHostObserver(WindowTreeHostPlatform* host,
ui::PlatformWindowBase* platform_window)
ui::PlatformWindow* platform_window)
: host_(host), platform_window_(platform_window) {
host_->AddObserver(this);
}
@ -70,7 +70,7 @@ class TestWindowTreeHostObserver : public aura::WindowTreeHostObserver {
private:
WindowTreeHostPlatform* host_;
ui::PlatformWindowBase* platform_window_;
ui::PlatformWindow* platform_window_;
bool should_change_bounds_in_on_resized_ = true;
int on_host_will_process_bounds_change_count_ = 0;
int on_host_did_process_bounds_change_count_ = 0;

@ -18,7 +18,7 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
#include "ui/platform_window/platform_window_init_properties.h"
@ -72,7 +72,7 @@ class TestCompositorHostOzone : public TestCompositorHost {
gfx::Rect bounds_;
ui::Compositor compositor_;
std::unique_ptr<PlatformWindowBase> window_;
std::unique_ptr<PlatformWindow> window_;
StubPlatformWindowDelegate window_delegate_;
viz::ParentLocalSurfaceIdAllocator allocator_;

@ -589,7 +589,7 @@ class DirectCompositionPixelTest : public DirectCompositionSurfaceTest {
protected:
void SetUp() override {
static_cast<ui::PlatformWindowBase*>(&window_)->Show();
static_cast<ui::PlatformWindow*>(&window_)->Show();
DirectCompositionSurfaceTest::SetUp();
}

@ -13,7 +13,7 @@
#include "ui/ozone/demo/renderer_factory.h"
#include "ui/ozone/demo/window_manager.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_init_properties.h"
#if defined(OS_FUCHSIA)

@ -10,7 +10,7 @@
#include "base/memory/weak_ptr.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
namespace ui {
@ -58,7 +58,7 @@ class DemoWindow : public PlatformWindowDelegate {
std::unique_ptr<Renderer> renderer_;
// Window-related state.
std::unique_ptr<PlatformWindowBase> platform_window_;
std::unique_ptr<PlatformWindow> platform_window_;
gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget;
base::WeakPtrFactory<DemoWindow> weak_ptr_factory_{this};

@ -98,7 +98,7 @@ class OzonePlatformCast : public OzonePlatform {
std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override {
return event_factory_ozone_->CreateSystemInputInjector();
}
std::unique_ptr<PlatformWindowBase> CreatePlatformWindow(
std::unique_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
PlatformWindowInitProperties properties) override {
return std::make_unique<PlatformWindowCast>(delegate, properties.bounds);

@ -15,7 +15,7 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/platform/drm/host/gpu_thread_observer.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
namespace ui {
@ -37,7 +37,7 @@ class GpuThreadAdapter;
// State propagation needs to happen before the state change is acknowledged to
// |delegate_| as |delegate_| is responsible for initializing the surface
// associated with the window (the surface is created on the GPU process).
class DrmWindowHost : public PlatformWindowBase,
class DrmWindowHost : public PlatformWindow,
public PlatformEventDispatcher,
public GpuThreadObserver {
public:

@ -150,7 +150,7 @@ class OzonePlatformGbm : public OzonePlatform {
drm_thread_started_ = true;
}
std::unique_ptr<PlatformWindowBase> CreatePlatformWindow(
std::unique_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
PlatformWindowInitProperties properties) override {
GpuThreadAdapter* adapter = gpu_platform_support_host_.get();

@ -75,7 +75,7 @@ class OzonePlatformHeadless : public OzonePlatform {
std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override {
return nullptr; // no input injection support.
}
std::unique_ptr<PlatformWindowBase> CreatePlatformWindow(
std::unique_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
PlatformWindowInitProperties properties) override {
return std::make_unique<HeadlessWindow>(delegate, window_manager_.get(),

@ -91,7 +91,7 @@ class OzonePlatformScenic
return nullptr;
}
std::unique_ptr<PlatformWindowBase> CreatePlatformWindow(
std::unique_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
PlatformWindowInitProperties properties) override {
if (!properties.view_token.value) {

@ -21,7 +21,7 @@
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/size_f.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
namespace ui {
@ -29,7 +29,7 @@ namespace ui {
class ScenicWindowManager;
class COMPONENT_EXPORT(OZONE) ScenicWindow
: public PlatformWindowBase,
: public PlatformWindow,
public InputEventDispatcherDelegate {
public:
// Both |window_manager| and |delegate| must outlive the ScenicWindow.

@ -17,11 +17,11 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/platform/wayland/common/wayland_object.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
#include "ui/platform_window/platform_window_handler/wm_drag_handler.h"
#include "ui/platform_window/platform_window_handler/wm_move_resize_handler.h"
#include "ui/platform_window/platform_window_init_properties.h"
#include "ui/platform_window/platform_window_linux.h"
namespace gfx {
class PointF;
@ -39,7 +39,7 @@ namespace {
class XDGShellObjectFactory;
} // namespace
class WaylandWindow : public PlatformWindowLinux,
class WaylandWindow : public PlatformWindow,
public PlatformEventDispatcher,
public WmMoveResizeHandler,
public WmDragHandler {

@ -104,7 +104,7 @@ class OzonePlatformWayland : public OzonePlatform {
return nullptr;
}
std::unique_ptr<PlatformWindowBase> CreatePlatformWindow(
std::unique_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
PlatformWindowInitProperties properties) override {
auto window = std::make_unique<WaylandWindow>(delegate, connection_.get());

@ -67,7 +67,7 @@ class OzonePlatformWindows : public OzonePlatform {
std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override {
return nullptr; // no input injection support.
}
std::unique_ptr<PlatformWindowBase> CreatePlatformWindow(
std::unique_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
PlatformWindowInitProperties properties) override {
return std::make_unique<WindowsWindow>(delegate, properties.bounds);

@ -25,7 +25,7 @@
#include "ui/ozone/public/input_controller.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/system_input_injector.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_init_properties.h"
#if defined(OS_CHROMEOS)
@ -80,7 +80,7 @@ class OzonePlatformX11 : public OzonePlatform {
return gpu_platform_support_host_.get();
}
std::unique_ptr<PlatformWindowBase> CreatePlatformWindow(
std::unique_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
PlatformWindowInitProperties properties) override {
std::unique_ptr<X11WindowOzone> window =

@ -100,7 +100,7 @@ class X11WindowOzoneTest : public testing::Test {
}
protected:
std::unique_ptr<PlatformWindowBase> CreatePlatformWindow(
std::unique_ptr<PlatformWindow> CreatePlatformWindow(
MockPlatformWindowDelegate* delegate,
const gfx::Rect& bounds,
gfx::AcceleratedWidget* widget) {

@ -14,7 +14,7 @@
#include "base/message_loop/message_pump_type.h"
#include "mojo/public/cpp/bindings/binder_map.h"
#include "ui/gfx/buffer_types.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
namespace display {
@ -150,7 +150,7 @@ class COMPONENT_EXPORT(OZONE) OzonePlatform {
virtual IPC::MessageFilter* GetGpuMessageFilter();
virtual ui::GpuPlatformSupportHost* GetGpuPlatformSupportHost() = 0;
virtual std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() = 0;
virtual std::unique_ptr<PlatformWindowBase> CreatePlatformWindow(
virtual std::unique_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
PlatformWindowInitProperties properties) = 0;
virtual std::unique_ptr<display::NativeDisplayDelegate>

@ -6,11 +6,10 @@ import("//build/config/ui.gni")
component("platform_window") {
sources = [
"platform_window_base.cc",
"platform_window_base.h",
"platform_window.cc",
"platform_window.h",
"platform_window_delegate.cc",
"platform_window_delegate.h",
"platform_window_delegate_base.cc",
"platform_window_delegate_base.h",
"platform_window_init_properties.cc",
"platform_window_init_properties.h",
]
@ -36,19 +35,6 @@ component("platform_window") {
"//third_party/fuchsia-sdk/sdk:ui_views",
]
}
if (is_linux) {
sources += [
"platform_window_delegate_linux.cc",
"platform_window_delegate_linux.h",
"platform_window_linux.cc",
"platform_window_linux.h",
]
}
if (is_win) {
sources += [ "platform_window_win.h" ]
}
}
group("platform_impls") {

@ -18,4 +18,12 @@ source_set("extensions") {
"//ui/base",
"//ui/platform_window",
]
if (is_linux) {
sources += [
"x11_extension.cc",
"x11_extension.h",
"x11_extension_delegate.h",
]
}
}

@ -5,7 +5,7 @@
#include "ui/platform_window/extensions/workspace_extension.h"
#include "ui/base/class_property.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
DEFINE_UI_CLASS_PROPERTY_TYPE(ui::WorkspaceExtension*)
@ -18,13 +18,13 @@ DEFINE_UI_CLASS_PROPERTY_KEY(WorkspaceExtension*,
WorkspaceExtension::~WorkspaceExtension() = default;
void WorkspaceExtension::SetWorkspaceExtension(
PlatformWindowBase* platform_window,
PlatformWindow* platform_window,
WorkspaceExtension* workspace_extension) {
platform_window->SetProperty(kWorkspaceExtensionKey, workspace_extension);
}
WorkspaceExtension* GetWorkspaceExtension(
const PlatformWindowBase& platform_window) {
const PlatformWindow& platform_window) {
return platform_window.GetProperty(kWorkspaceExtensionKey);
}

@ -11,7 +11,7 @@
namespace ui {
class PlatformWindowBase;
class PlatformWindow;
class WorkspaceExtensionDelegate;
// A workspace extension that platforms can use to add support for workspaces.
@ -40,13 +40,13 @@ class COMPONENT_EXPORT(EXTENSIONS) WorkspaceExtension {
virtual ~WorkspaceExtension();
// Sets the pointer to the extension as a property of the PlatformWindow.
void SetWorkspaceExtension(PlatformWindowBase* platform_window,
void SetWorkspaceExtension(PlatformWindow* platform_window,
WorkspaceExtension* workspace_extension);
};
COMPONENT_EXPORT(EXTENSIONS)
WorkspaceExtension* GetWorkspaceExtension(
const PlatformWindowBase& platform_window);
const PlatformWindow& platform_window);
} // namespace ui

@ -0,0 +1,27 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/platform_window/extensions/x11_extension.h"
#include "ui/base/class_property.h"
#include "ui/platform_window/platform_window.h"
DEFINE_UI_CLASS_PROPERTY_TYPE(ui::X11Extension*)
namespace ui {
DEFINE_UI_CLASS_PROPERTY_KEY(X11Extension*, kX11ExtensionKey, nullptr)
X11Extension::~X11Extension() = default;
void X11Extension::SetX11Extension(PlatformWindow* platform_window,
X11Extension* x11_extension) {
platform_window->SetProperty(kX11ExtensionKey, x11_extension);
}
X11Extension* GetX11Extension(const PlatformWindow& platform_window) {
return platform_window.GetProperty(kX11ExtensionKey);
}
} // namespace ui

@ -0,0 +1,55 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_PLATFORM_WINDOW_EXTENSIONS_X11_EXTENSION_H_
#define UI_PLATFORM_WINDOW_EXTENSIONS_X11_EXTENSION_H_
#include "base/component_export.h"
#include "ui/gfx/geometry/rect.h"
namespace ui {
class PlatformWindow;
class X11ExtensionDelegate;
// Linux extensions that linux platforms can use to extend the platform windows
// APIs. Please refer to README for more details.
class COMPONENT_EXPORT(EXTENSIONS) X11Extension {
public:
// X11-specific. Returns whether an XSync extension is available at the
// current platform.
virtual bool IsSyncExtensionAvailable() const = 0;
// X11-specific. Handles CompleteSwapAfterResize event coming from the
// compositor observer.
virtual void OnCompleteSwapAfterResize() = 0;
// X11-specific. Returns the current bounds in terms of the X11 Root Window
// including the borders provided by the window manager (if any).
virtual gfx::Rect GetXRootWindowOuterBounds() const = 0;
// X11-specific. Says if the X11 Root Window contains the point within its
// set shape. If shape is not set, returns true.
virtual bool ContainsPointInXRegion(const gfx::Point& point) const = 0;
// X11-specific. Asks X11 to lower the Xwindow down the stack so that it does
// not obscure any sibling windows.
virtual void LowerXWindow() = 0;
virtual void SetX11ExtensionDelegate(X11ExtensionDelegate* delegate) = 0;
protected:
virtual ~X11Extension();
// Sets the pointer to the extension as a property of the PlatformWindow.
void SetX11Extension(PlatformWindow* platform_window,
X11Extension* x11_extensions);
};
COMPONENT_EXPORT(EXTENSIONS)
X11Extension* GetX11Extension(const PlatformWindow& platform_window);
} // namespace ui
#endif // UI_PLATFORM_WINDOW_EXTENSIONS_X11_EXTENSION_H_

@ -0,0 +1,52 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_PLATFORM_WINDOW_EXTENSIONS_X11_EXTENSION_DELEGATE_H_
#define UI_PLATFORM_WINDOW_EXTENSIONS_X11_EXTENSION_DELEGATE_H_
#include "base/component_export.h"
#include "ui/base/buildflags.h"
#if BUILDFLAG(USE_ATK)
using AtkKeyEventStruct = struct _AtkKeyEventStruct;
#endif
class SkPath;
namespace gfx {
class Size;
}
namespace ui {
class COMPONENT_EXPORT(EXTENSIONS) X11ExtensionDelegate {
public:
// Notifies the delegate that the window got mapped in the X server. Wayland
// does not support this interface.
virtual void OnXWindowMapped() = 0;
virtual void OnXWindowUnmapped() = 0;
// Notifies if the PlatformWindow looses a mouse grab. This can be useful
// for Wayland or X11. Both of them provide pointer enter and leave
// notifications, which non-ozone X11 (just an example) use to be using to
// notify about lost pointer grab along with explicit grabs. Wayland also
// has this technique. However, explicit grab is available only for popup
// (menu) windows.
virtual void OnLostMouseGrab() = 0;
// Returns a mask to be used to clip the window for the given
// size. This is used to create the non-rectangular window shape.
virtual void GetWindowMask(const gfx::Size& size, SkPath* window_mask) = 0;
#if BUILDFLAG(USE_ATK)
virtual bool OnAtkKeyEvent(AtkKeyEventStruct* atk_key_event) = 0;
#endif
protected:
virtual ~X11ExtensionDelegate() = default;
};
} // namespace ui
#endif // UI_PLATFORM_WINDOW_EXTENSIONS_X11_EXTENSION_DELEGATE_H_

@ -0,0 +1,51 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/platform_window/platform_window.h"
#include "ui/gfx/geometry/rect.h"
namespace ui {
PlatformWindow::PlatformWindow() = default;
PlatformWindow::~PlatformWindow() = default;
bool PlatformWindow::ShouldWindowContentsBeTransparent() const {
return false;
}
void PlatformWindow::SetZOrderLevel(ZOrderLevel order) {}
ZOrderLevel PlatformWindow::GetZOrderLevel() const {
return ZOrderLevel::kNormal;
}
void PlatformWindow::StackAbove(gfx::AcceleratedWidget widget) {}
void PlatformWindow::StackAtTop() {}
void PlatformWindow::FlashFrame(bool flash_frame) {}
void PlatformWindow::SetShape(std::unique_ptr<ShapeRects> native_shape,
const gfx::Transform& transform) {}
void PlatformWindow::SetAspectRatio(const gfx::SizeF& aspect_ratio) {}
void PlatformWindow::SetWindowIcons(const gfx::ImageSkia& window_icon,
const gfx::ImageSkia& app_icon) {}
bool PlatformWindow::IsAnimatingClosed() const {
return false;
}
bool PlatformWindow::IsTranslucentWindowOpacitySupported() const {
return false;
}
void PlatformWindow::SetOpacity(float opacity) {}
void PlatformWindow::SetVisibilityChangedAnimationsEnabled(bool enabled) {}
} // namespace ui

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_BASE_H_
#define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_BASE_H_
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_H_
#define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_H_
#include <memory>
@ -25,15 +25,12 @@ class Transform;
namespace ui {
// Platform window.
//
// Each instance of PlatformWindowBase represents a single window in the
// underlying platform windowing system (i.e. X11/Win/OSX).
class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowBase
// Generic PlatformWindow interface.
class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindow
: public PropertyHandler {
public:
PlatformWindowBase();
~PlatformWindowBase() override;
PlatformWindow();
~PlatformWindow() override;
// PlatformWindow may be called with the |inactive| set to true in some cases.
// That means that the Window Manager must not activate the window when it is
@ -136,8 +133,15 @@ class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowBase
// Returns true if the window supports translucency.
virtual bool IsTranslucentWindowOpacitySupported() const;
// Sets opacity of the platform window.
virtual void SetOpacity(float opacity);
// Enables or disables platform provided animations of the PlatformWindow.
// If |enabled| is set to false, animations are disabled.
virtual void SetVisibilityChangedAnimationsEnabled(bool enabled);
};
} // namespace ui
#endif // UI_PLATFORM_WINDOW_PLATFORM_WINDOW_BASE_H_
#endif // UI_PLATFORM_WINDOW_PLATFORM_WINDOW_H_

@ -1,47 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/platform_window/platform_window_base.h"
#include "ui/gfx/geometry/rect.h"
namespace ui {
PlatformWindowBase::PlatformWindowBase() = default;
PlatformWindowBase::~PlatformWindowBase() = default;
bool PlatformWindowBase::ShouldWindowContentsBeTransparent() const {
return false;
}
void PlatformWindowBase::SetZOrderLevel(ZOrderLevel order) {}
ZOrderLevel PlatformWindowBase::GetZOrderLevel() const {
return ZOrderLevel::kNormal;
}
void PlatformWindowBase::StackAbove(gfx::AcceleratedWidget widget) {}
void PlatformWindowBase::StackAtTop() {}
void PlatformWindowBase::FlashFrame(bool flash_frame) {}
void PlatformWindowBase::SetShape(std::unique_ptr<ShapeRects> native_shape,
const gfx::Transform& transform) {}
void PlatformWindowBase::SetAspectRatio(const gfx::SizeF& aspect_ratio) {}
void PlatformWindowBase::SetWindowIcons(const gfx::ImageSkia& window_icon,
const gfx::ImageSkia& app_icon) {}
bool PlatformWindowBase::IsAnimatingClosed() const {
return false;
}
bool PlatformWindowBase::IsTranslucentWindowOpacitySupported() const {
return false;
}
} // namespace ui

@ -0,0 +1,23 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/platform_window/platform_window_delegate.h"
#include "ui/gfx/geometry/size.h"
namespace ui {
PlatformWindowDelegate::PlatformWindowDelegate() = default;
PlatformWindowDelegate::~PlatformWindowDelegate() = default;
base::Optional<gfx::Size> PlatformWindowDelegate::GetMinimumSizeForWindow() {
return base::nullopt;
}
base::Optional<gfx::Size> PlatformWindowDelegate::GetMaximumSizeForWindow() {
return base::nullopt;
}
} // namespace ui

@ -1,27 +1,70 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_H_
#define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_H_
#include "build/build_config.h"
#include "base/component_export.h"
#include "base/optional.h"
#include "ui/gfx/native_widget_types.h"
// By default, PlatformWindowDelegateBase is used. However, different platforms
// should specify what delegate they would like to use if needed.
#if defined(OS_LINUX)
#include "ui/platform_window/platform_window_delegate_linux.h"
#else
#include "ui/platform_window/platform_window_delegate_base.h"
#endif
namespace gfx {
class Rect;
class Size;
} // namespace gfx
namespace ui {
#if defined(OS_LINUX)
using PlatformWindowDelegate = PlatformWindowDelegateLinux;
#else
using PlatformWindowDelegate = PlatformWindowDelegateBase;
#endif
class Event;
enum class PlatformWindowState {
kUnknown,
kMaximized,
kMinimized,
kNormal,
kFullScreen,
};
class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowDelegate {
public:
PlatformWindowDelegate();
virtual ~PlatformWindowDelegate();
// Note that |new_bounds| is in physical screen coordinates.
virtual void OnBoundsChanged(const gfx::Rect& new_bounds) = 0;
// Note that |damaged_region| is in the platform-window's coordinates, in
// physical pixels.
virtual void OnDamageRect(const gfx::Rect& damaged_region) = 0;
virtual void DispatchEvent(Event* event) = 0;
virtual void OnCloseRequest() = 0;
virtual void OnClosed() = 0;
virtual void OnWindowStateChanged(PlatformWindowState new_state) = 0;
virtual void OnLostCapture() = 0;
virtual void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) = 0;
// Notifies the delegate that the widget cannot be used anymore until
// a new widget is made available through OnAcceleratedWidgetAvailable().
// Must not be called when the PlatformWindow is being destroyed.
virtual void OnAcceleratedWidgetDestroyed() = 0;
virtual void OnActivationChanged(bool active) = 0;
// Requests size constraints for the PlatformWindow.
virtual base::Optional<gfx::Size> GetMinimumSizeForWindow();
virtual base::Optional<gfx::Size> GetMaximumSizeForWindow();
// Called when the location of mouse pointer entered the window. This is
// different from ui::ET_MOUSE_ENTERED which may not be generated when mouse
// is captured either by implicitly or explicitly.
virtual void OnMouseEnter() = 0;
};
} // namespace ui

@ -1,25 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/platform_window/platform_window_delegate_base.h"
#include "ui/gfx/geometry/size.h"
namespace ui {
PlatformWindowDelegateBase::PlatformWindowDelegateBase() = default;
PlatformWindowDelegateBase::~PlatformWindowDelegateBase() = default;
base::Optional<gfx::Size>
PlatformWindowDelegateBase::GetMinimumSizeForWindow() {
return base::nullopt;
}
base::Optional<gfx::Size>
PlatformWindowDelegateBase::GetMaximumSizeForWindow() {
return base::nullopt;
}
} // namespace ui

@ -1,74 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_BASE_H_
#define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_BASE_H_
#include "base/component_export.h"
#include "base/optional.h"
#include "ui/gfx/native_widget_types.h"
namespace gfx {
class Rect;
class Size;
} // namespace gfx
namespace ui {
class Event;
enum class PlatformWindowState {
kUnknown,
kMaximized,
kMinimized,
kNormal,
kFullScreen,
};
// This is the bare minimum for PlatformWindowDeelegate, but some platforms may
// require more, and should do so in a subclass. Please refer to
// PlatformWindowDelegateLinux for an example.
class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowDelegateBase {
public:
PlatformWindowDelegateBase();
virtual ~PlatformWindowDelegateBase();
// Note that |new_bounds| is in physical screen coordinates.
virtual void OnBoundsChanged(const gfx::Rect& new_bounds) = 0;
// Note that |damaged_region| is in the platform-window's coordinates, in
// physical pixels.
virtual void OnDamageRect(const gfx::Rect& damaged_region) = 0;
virtual void DispatchEvent(Event* event) = 0;
virtual void OnCloseRequest() = 0;
virtual void OnClosed() = 0;
virtual void OnWindowStateChanged(PlatformWindowState new_state) = 0;
virtual void OnLostCapture() = 0;
virtual void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) = 0;
// Notifies the delegate that the widget cannot be used anymore until
// a new widget is made available through OnAcceleratedWidgetAvailable().
// Must not be called when the PlatformWindow is being destroyed.
virtual void OnAcceleratedWidgetDestroyed() = 0;
virtual void OnActivationChanged(bool active) = 0;
// Requests size constraints for the PlatformWindow.
virtual base::Optional<gfx::Size> GetMinimumSizeForWindow();
virtual base::Optional<gfx::Size> GetMaximumSizeForWindow();
// Called when the location of mouse pointer entered the window. This is
// different from ui::ET_MOUSE_ENTERED which may not be generated when mouse
// is captured either by implicitly or explicitly.
virtual void OnMouseEnter() = 0;
};
} // namespace ui
#endif // UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_BASE_H_

@ -1,39 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/platform_window/platform_window_delegate_linux.h"
#include "base/logging.h"
namespace ui {
PlatformWindowDelegateLinux::PlatformWindowDelegateLinux() = default;
PlatformWindowDelegateLinux::~PlatformWindowDelegateLinux() = default;
void PlatformWindowDelegateLinux::OnXWindowMapped() {
NOTIMPLEMENTED_LOG_ONCE();
}
void PlatformWindowDelegateLinux::OnXWindowUnmapped() {
NOTIMPLEMENTED_LOG_ONCE();
}
void PlatformWindowDelegateLinux::OnLostMouseGrab() {
NOTIMPLEMENTED_LOG_ONCE();
}
void PlatformWindowDelegateLinux::GetWindowMask(const gfx::Size& size,
SkPath* window_mask) {
NOTIMPLEMENTED_LOG_ONCE();
}
#if BUILDFLAG(USE_ATK)
bool PlatformWindowDelegateLinux::OnAtkKeyEvent(AtkKeyEventStruct* atk_event) {
NOTIMPLEMENTED_LOG_ONCE();
return false;
}
#endif
} // namespace ui

@ -1,56 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_LINUX_H_
#define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_LINUX_H_
#include "base/component_export.h"
#include "ui/base/buildflags.h"
#include "ui/platform_window/platform_window_delegate_base.h"
#if BUILDFLAG(USE_ATK)
using AtkKeyEventStruct = struct _AtkKeyEventStruct;
#endif
class SkPath;
namespace gfx {
class Size;
}
namespace ui {
// This is an optional linux delegate interface, which should be implemented by
// linux-based platforms. It contains both Wayland and X11 specific and common
// interfaces.
class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowDelegateLinux
: public PlatformWindowDelegateBase {
public:
PlatformWindowDelegateLinux();
~PlatformWindowDelegateLinux() override;
// Notifies the delegate that the window got mapped in the X server. Wayland
// does not support this interface.
virtual void OnXWindowMapped();
virtual void OnXWindowUnmapped();
// Notifies if the PlatformWindow looses a mouse grab. This can be useful for
// Wayland or X11. Both of them provide pointer enter and leave notifications,
// which non-ozone X11 (just an example) use to be using to notify about lost
// pointer grab along with explicit grabs. Wayland also has this technique.
// However, explicit grab is available only for popup (menu) windows.
virtual void OnLostMouseGrab();
// Returns a mask to be used to clip the window for the given
// size. This is used to create the non-rectangular window shape.
virtual void GetWindowMask(const gfx::Size& size, SkPath* window_mask);
#if BUILDFLAG(USE_ATK)
virtual bool OnAtkKeyEvent(AtkKeyEventStruct* atk_key_event);
#endif
};
} // namespace ui
#endif // UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_LINUX_H_

@ -1,4 +1,4 @@
include_rules = [
"+ui/base/class_property.h",
"+ui/platform_window/platform_window_base.h",
"+ui/platform_window/platform_window.h",
]

@ -5,7 +5,7 @@
#include "ui/platform_window/platform_window_handler/wm_drag_handler.h"
#include "ui/base/class_property.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
DEFINE_UI_CLASS_PROPERTY_TYPE(ui::WmDragHandler*)
@ -13,12 +13,12 @@ namespace ui {
DEFINE_UI_CLASS_PROPERTY_KEY(WmDragHandler*, kWmDragHandlerKey, nullptr)
void SetWmDragHandler(PlatformWindowBase* platform_window,
void SetWmDragHandler(PlatformWindow* platform_window,
WmDragHandler* drag_handler) {
platform_window->SetProperty(kWmDragHandlerKey, drag_handler);
}
WmDragHandler* GetWmDragHandler(const PlatformWindowBase& platform_window) {
WmDragHandler* GetWmDragHandler(const PlatformWindow& platform_window) {
return platform_window.GetProperty(kWmDragHandlerKey);
}

@ -10,7 +10,7 @@
#include "ui/platform_window/platform_window_handler/wm_platform_export.h"
namespace ui {
class PlatformWindowBase;
class PlatformWindow;
class OSExchangeData;
class WM_PLATFORM_EXPORT WmDragHandler {
@ -29,10 +29,10 @@ class WM_PLATFORM_EXPORT WmDragHandler {
virtual ~WmDragHandler() {}
};
WM_PLATFORM_EXPORT void SetWmDragHandler(PlatformWindowBase* platform_window,
WM_PLATFORM_EXPORT void SetWmDragHandler(PlatformWindow* platform_window,
WmDragHandler* drag_handler);
WM_PLATFORM_EXPORT WmDragHandler* GetWmDragHandler(
const PlatformWindowBase& platform_window);
const PlatformWindow& platform_window);
} // namespace ui

@ -5,7 +5,7 @@
#include "ui/platform_window/platform_window_handler/wm_drop_handler.h"
#include "ui/base/class_property.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
DEFINE_UI_CLASS_PROPERTY_TYPE(ui::WmDropHandler*)
@ -13,12 +13,12 @@ namespace ui {
DEFINE_UI_CLASS_PROPERTY_KEY(WmDropHandler*, kWmDropHandlerKey, nullptr)
void SetWmDropHandler(PlatformWindowBase* platform_window,
void SetWmDropHandler(PlatformWindow* platform_window,
WmDropHandler* drop_handler) {
platform_window->SetProperty(kWmDropHandlerKey, drop_handler);
}
WmDropHandler* GetWmDropHandler(const PlatformWindowBase& platform_window) {
WmDropHandler* GetWmDropHandler(const PlatformWindow& platform_window) {
return platform_window.GetProperty(kWmDropHandlerKey);
}

@ -15,7 +15,7 @@ class PointF;
}
namespace ui {
class PlatformWindowBase;
class PlatformWindow;
class OSExchangeData;
class WM_PLATFORM_EXPORT WmDropHandler {
@ -45,10 +45,10 @@ class WM_PLATFORM_EXPORT WmDropHandler {
virtual ~WmDropHandler() {}
};
WM_PLATFORM_EXPORT void SetWmDropHandler(PlatformWindowBase* platform_window,
WM_PLATFORM_EXPORT void SetWmDropHandler(PlatformWindow* platform_window,
WmDropHandler* drop_handler);
WM_PLATFORM_EXPORT WmDropHandler* GetWmDropHandler(
const PlatformWindowBase& platform_window);
const PlatformWindow& platform_window);
} // namespace ui

@ -5,7 +5,7 @@
#include "ui/platform_window/platform_window_handler/wm_move_resize_handler.h"
#include "ui/base/class_property.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
DEFINE_UI_CLASS_PROPERTY_TYPE(WmMoveResizeHandler*)
@ -15,13 +15,13 @@ DEFINE_UI_CLASS_PROPERTY_KEY(WmMoveResizeHandler*,
kWmMoveResizeHandlerKey,
nullptr)
void SetWmMoveResizeHandler(PlatformWindowBase* platform_window,
void SetWmMoveResizeHandler(PlatformWindow* platform_window,
WmMoveResizeHandler* move_resize_handler) {
platform_window->SetProperty(kWmMoveResizeHandlerKey, move_resize_handler);
}
WmMoveResizeHandler* GetWmMoveResizeHandler(
const PlatformWindowBase& platform_window) {
const PlatformWindow& platform_window) {
return platform_window.GetProperty(kWmMoveResizeHandlerKey);
}

@ -13,7 +13,7 @@ class Point;
namespace ui {
class PlatformWindowBase;
class PlatformWindow;
class WmMoveResizeHandler {
public:
@ -53,10 +53,10 @@ class WmMoveResizeHandler {
};
WM_PLATFORM_EXPORT void SetWmMoveResizeHandler(
PlatformWindowBase* platform_window,
PlatformWindow* platform_window,
WmMoveResizeHandler* move_resize_handler);
WM_PLATFORM_EXPORT WmMoveResizeHandler* GetWmMoveResizeHandler(
const PlatformWindowBase& platform_window);
const PlatformWindow& platform_window);
} // namespace ui

@ -41,6 +41,10 @@ enum class PlatformWindowOpacity {
class WorkspaceExtensionDelegate;
#if defined(OS_LINUX)
class X11ExtensionDelegate;
#endif
// Initial properties which are passed to PlatformWindow to be initialized
// with a desired set of properties.
struct COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowInitProperties {
@ -92,6 +96,8 @@ struct COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowInitProperties {
// Stores visual id for the system tray in X11.
base::Optional<int> x_visual_id;
X11ExtensionDelegate* x11_extension_delegate = nullptr;
#endif
};

@ -1,32 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/platform_window/platform_window_linux.h"
namespace ui {
PlatformWindowLinux::PlatformWindowLinux() = default;
PlatformWindowLinux::~PlatformWindowLinux() = default;
bool PlatformWindowLinux::IsSyncExtensionAvailable() const {
return false;
}
void PlatformWindowLinux::OnCompleteSwapAfterResize() {}
gfx::Rect PlatformWindowLinux::GetXRootWindowOuterBounds() const {
return {};
}
bool PlatformWindowLinux::ContainsPointInXRegion(
const gfx::Point& point) const {
return false;
}
void PlatformWindowLinux::SetOpacityForXWindow(float opacity) {}
void PlatformWindowLinux::LowerXWindow() {}
} // namespace ui

@ -1,48 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_LINUX_H_
#define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_LINUX_H_
#include "base/component_export.h"
#include "base/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/platform_window/platform_window_base.h"
namespace ui {
// Linux extensions to the PlatformWindowBase.
class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowLinux
: public PlatformWindowBase {
public:
PlatformWindowLinux();
~PlatformWindowLinux() override;
// X11-specific. Returns whether an XSync extension is available at the
// current platform.
virtual bool IsSyncExtensionAvailable() const;
// X11-specific. Handles CompleteSwapAfterResize event coming from the
// compositor observer.
virtual void OnCompleteSwapAfterResize();
// X11-specific. Returns the current bounds in terms of the X11 Root Window
// including the borders provided by the window manager (if any).
virtual gfx::Rect GetXRootWindowOuterBounds() const;
// X11-specific. Says if the X11 Root Window contains the point within its
// set shape. If shape is not set, returns true.
virtual bool ContainsPointInXRegion(const gfx::Point& point) const;
// X11-specific. Asks X11 to set transparency of the X11 Root Window. Not
// used for Wayland as it uses alpha channel to blend a window instead.
virtual void SetOpacityForXWindow(float opacity);
// X11-specific. Asks X11 to lower the Xwindow down the stack so that it does
// not obscure any sibling windows.
virtual void LowerXWindow();
};
} // namespace ui
#endif // UI_PLATFORM_WINDOW_PLATFORM_WINDOW_LINUX_H_

@ -1,27 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_WIN_H_
#define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_WIN_H_
#include "base/component_export.h"
#include "ui/platform_window/platform_window_base.h"
namespace ui {
// Windows extensions to the PlatformWindowBase.
class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowWin
: public PlatformWindowBase {
public:
PlatformWindowWin() = default;
~PlatformWindowWin() override = default;
// Enables or disables platform provided animations of the PlatformWindow.
// If |enabled| is set to false, animations must be disabled.
virtual void SetVisibilityChangedAnimationsEnabled(bool enabled) = 0;
};
} // namespace ui
#endif // UI_PLATFORM_WINDOW_PLATFORM_WINDOW_WIN_H_

@ -8,7 +8,7 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
#include "ui/platform_window/stub/stub_window_export.h"
@ -16,7 +16,7 @@ namespace ui {
// StubWindow is useful for tests, as well as implementations that only care
// about bounds.
class STUB_WINDOW_EXPORT StubWindow : public PlatformWindowBase {
class STUB_WINDOW_EXPORT StubWindow : public PlatformWindow {
public:
explicit StubWindow(PlatformWindowDelegate* delegate,
bool use_default_accelerated_widget = true,

@ -9,15 +9,15 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "ui/gfx/win/window_impl.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
#include "ui/platform_window/platform_window_win.h"
#include "ui/platform_window/win/win_window_export.h"
#include <windows.h>
namespace ui {
class WIN_WINDOW_EXPORT WinWindow : public PlatformWindowWin,
class WIN_WINDOW_EXPORT WinWindow : public PlatformWindow,
public gfx::WindowImpl {
public:
WinWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds);

@ -18,7 +18,7 @@
#include "ui/gfx/x/x11.h"
#include "ui/platform_window/common/platform_window_defaults.h"
#include "ui/platform_window/extensions/workspace_extension_delegate.h"
#include "ui/platform_window/platform_window_delegate_linux.h"
#include "ui/platform_window/extensions/x11_extension_delegate.h"
#include "ui/platform_window/x11/x11_window_manager.h"
#if defined(USE_OZONE)
@ -91,7 +91,7 @@ ui::XWindow::Configuration ConvertInitPropertiesToXWindowConfig(
} // namespace
X11Window::X11Window(PlatformWindowDelegateLinux* platform_window_delegate)
X11Window::X11Window(PlatformWindowDelegate* platform_window_delegate)
: platform_window_delegate_(platform_window_delegate) {
// Set a class property key, which allows |this| to be used for interactive
// events, e.g. move or resize.
@ -100,6 +100,7 @@ X11Window::X11Window(PlatformWindowDelegateLinux* platform_window_delegate)
// Set extensions property key that extends the interface of this platform
// implementation.
SetWorkspaceExtension(this, static_cast<WorkspaceExtension*>(this));
SetX11Extension(this, static_cast<X11Extension*>(this));
}
X11Window::~X11Window() {
@ -116,6 +117,7 @@ void X11Window::Initialize(PlatformWindowInitProperties properties) {
config.bounds.set_size(adjusted_size_in_pixels);
workspace_extension_delegate_ = properties.workspace_extension_delegate;
x11_extension_delegate_ = properties.x11_extension_delegate;
Init(config);
}
@ -325,14 +327,6 @@ void X11Window::Deactivate() {
XWindow::Deactivate();
}
bool X11Window::IsSyncExtensionAvailable() const {
return ui::IsSyncExtensionAvailable();
}
void X11Window::OnCompleteSwapAfterResize() {
XWindow::NotifySwapAfterResize();
}
void X11Window::SetUseNativeFrame(bool use_native_frame) {
XWindow::SetUseNativeFrame(use_native_frame);
}
@ -404,23 +398,11 @@ void X11Window::FlashFrame(bool flash_frame) {
XWindow::SetFlashFrameHint(flash_frame);
}
gfx::Rect X11Window::GetXRootWindowOuterBounds() const {
return XWindow::GetOutterBounds();
}
bool X11Window::ContainsPointInXRegion(const gfx::Point& point) const {
return XWindow::ContainsPointInRegion(point);
}
void X11Window::SetShape(std::unique_ptr<ShapeRects> native_shape,
const gfx::Transform& transform) {
return XWindow::SetXWindowShape(std::move(native_shape), transform);
}
void X11Window::SetOpacityForXWindow(float opacity) {
XWindow::SetXWindowOpacity(opacity);
}
void X11Window::SetAspectRatio(const gfx::SizeF& aspect_ratio) {
XWindow::SetXWindowAspectRatio(aspect_ratio);
}
@ -441,8 +423,8 @@ bool X11Window::IsTranslucentWindowOpacitySupported() const {
return ui::XVisualManager::GetInstance()->ArgbVisualAvailable();
}
void X11Window::LowerXWindow() {
XWindow::LowerWindow();
void X11Window::SetOpacity(float opacity) {
XWindow::SetXWindowOpacity(opacity);
}
std::string X11Window::GetWorkspace() const {
@ -464,6 +446,30 @@ void X11Window::SetWorkspaceExtensionDelegate(
workspace_extension_delegate_ = delegate;
}
bool X11Window::IsSyncExtensionAvailable() const {
return ui::IsSyncExtensionAvailable();
}
void X11Window::OnCompleteSwapAfterResize() {
XWindow::NotifySwapAfterResize();
}
gfx::Rect X11Window::GetXRootWindowOuterBounds() const {
return XWindow::GetOutterBounds();
}
bool X11Window::ContainsPointInXRegion(const gfx::Point& point) const {
return XWindow::ContainsPointInRegion(point);
}
void X11Window::LowerXWindow() {
XWindow::LowerWindow();
}
void X11Window::SetX11ExtensionDelegate(X11ExtensionDelegate* delegate) {
x11_extension_delegate_ = delegate;
}
bool X11Window::HandleAsAtkEvent(XEvent* xev) {
#if !BUILDFLAG(USE_ATK)
// TODO(crbug.com/1014934): Support ATK in Ozone/X11.
@ -471,10 +477,11 @@ bool X11Window::HandleAsAtkEvent(XEvent* xev) {
return false;
#else
DCHECK(xev);
if (xev->type != KeyPress && xev->type != KeyRelease)
if (!x11_extension_delegate_ ||
(xev->type != KeyPress && xev->type != KeyRelease))
return false;
auto atk_key_event = AtkKeyEventFromXEvent(xev);
return platform_window_delegate_->OnAtkKeyEvent(atk_key_event.get());
return x11_extension_delegate_->OnAtkKeyEvent(atk_key_event.get());
#endif
}
@ -553,11 +560,13 @@ void X11Window::OnXWindowIsActiveChanged(bool active) {
}
void X11Window::OnXWindowMapped() {
platform_window_delegate_->OnXWindowMapped();
if (x11_extension_delegate_)
x11_extension_delegate_->OnXWindowMapped();
}
void X11Window::OnXWindowUnmapped() {
platform_window_delegate_->OnXWindowUnmapped();
if (x11_extension_delegate_)
x11_extension_delegate_->OnXWindowUnmapped();
}
void X11Window::OnXWindowWorkspaceChanged() {
@ -566,7 +575,8 @@ void X11Window::OnXWindowWorkspaceChanged() {
}
void X11Window::OnXWindowLostPointerGrab() {
platform_window_delegate_->OnLostMouseGrab();
if (x11_extension_delegate_)
x11_extension_delegate_->OnLostMouseGrab();
}
void X11Window::OnXWindowEvent(ui::Event* event) {
@ -623,7 +633,8 @@ base::Optional<gfx::Size> X11Window::GetMaximumSizeForXWindow() {
void X11Window::GetWindowMaskForXWindow(const gfx::Size& size,
SkPath* window_mask) {
platform_window_delegate_->GetWindowMask(size, window_mask);
if (x11_extension_delegate_)
x11_extension_delegate_->GetWindowMask(size, window_mask);
}
void X11Window::DispatchHostWindowDragMovement(

@ -9,13 +9,15 @@
#include "ui/base/x/x11_window.h"
#include "ui/events/platform/platform_event_dispatcher.h"
#include "ui/platform_window/extensions/workspace_extension.h"
#include "ui/platform_window/extensions/x11_extension.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_handler/wm_move_resize_handler.h"
#include "ui/platform_window/platform_window_init_properties.h"
#include "ui/platform_window/platform_window_linux.h"
#include "ui/platform_window/x11/x11_window_export.h"
namespace ui {
class X11ExtensionDelegate;
class LocatedEvent;
class WorkspaceExtensionDelegate;
@ -32,13 +34,14 @@ class X11_WINDOW_EXPORT XEventDelegate {
};
// PlatformWindow implementation for X11. PlatformEvents are XEvents.
class X11_WINDOW_EXPORT X11Window : public PlatformWindowLinux,
class X11_WINDOW_EXPORT X11Window : public PlatformWindow,
public WmMoveResizeHandler,
public XWindow,
public PlatformEventDispatcher,
public WorkspaceExtension {
public WorkspaceExtension,
public X11Extension {
public:
explicit X11Window(PlatformWindowDelegateLinux* platform_window_delegate);
explicit X11Window(PlatformWindowDelegate* platform_window_delegate);
~X11Window() override;
void Initialize(PlatformWindowInitProperties properties);
@ -72,8 +75,6 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindowLinux,
PlatformWindowState GetPlatformWindowState() const override;
void Activate() override;
void Deactivate() override;
bool IsSyncExtensionAvailable() const override;
void OnCompleteSwapAfterResize() override;
void SetUseNativeFrame(bool use_native_frame) override;
bool ShouldUseNativeFrame() const override;
void SetCursor(PlatformCursor cursor) override;
@ -87,17 +88,14 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindowLinux,
void StackAbove(gfx::AcceleratedWidget widget) override;
void StackAtTop() override;
void FlashFrame(bool flash_frame) override;
gfx::Rect GetXRootWindowOuterBounds() const override;
bool ContainsPointInXRegion(const gfx::Point& point) const override;
void SetShape(std::unique_ptr<ShapeRects> native_shape,
const gfx::Transform& transform) override;
void SetOpacityForXWindow(float opacity) override;
void SetAspectRatio(const gfx::SizeF& aspect_ratio) override;
void SetWindowIcons(const gfx::ImageSkia& window_icon,
const gfx::ImageSkia& app_icon) override;
void SizeConstraintsChanged() override;
bool IsTranslucentWindowOpacitySupported() const override;
void LowerXWindow() override;
void SetOpacity(float opacity) override;
// WorkspaceExtension:
std::string GetWorkspace() const override;
@ -106,8 +104,16 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindowLinux,
void SetWorkspaceExtensionDelegate(
WorkspaceExtensionDelegate* delegate) override;
// X11Extension:
bool IsSyncExtensionAvailable() const override;
void OnCompleteSwapAfterResize() override;
gfx::Rect GetXRootWindowOuterBounds() const override;
bool ContainsPointInXRegion(const gfx::Point& point) const override;
void LowerXWindow() override;
void SetX11ExtensionDelegate(X11ExtensionDelegate* delegate) override;
protected:
PlatformWindowDelegateLinux* platform_window_delegate() const {
PlatformWindowDelegate* platform_window_delegate() const {
return platform_window_delegate_;
}
@ -164,12 +170,14 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindowLinux,
// Stores current state of this window.
PlatformWindowState state_ = PlatformWindowState::kUnknown;
PlatformWindowDelegateLinux* const platform_window_delegate_;
PlatformWindowDelegate* const platform_window_delegate_;
XEventDelegate* x_event_delegate_ = nullptr;
WorkspaceExtensionDelegate* workspace_extension_delegate_ = nullptr;
X11ExtensionDelegate* x11_extension_delegate_ = nullptr;
// Tells if the window got a ::Close call.
bool is_shutting_down_ = false;

@ -13,7 +13,7 @@
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_handler/wm_drag_handler.h"
#include "ui/platform_window/platform_window_handler/wm_drop_handler.h"
#include "ui/views/test/views_test_base.h"
@ -25,8 +25,7 @@
namespace views {
namespace {
class FakePlatformWindow : public ui::PlatformWindowBase,
public ui::WmDragHandler {
class FakePlatformWindow : public ui::PlatformWindow, public ui::WmDragHandler {
public:
FakePlatformWindow() { SetWmDragHandler(this, this); }
~FakePlatformWindow() override = default;

@ -11,9 +11,9 @@
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/events/event.h"
#include "ui/platform_window/extensions/x11_extension.h"
#include "ui/platform_window/platform_window_handler/wm_move_resize_handler.h"
#include "ui/platform_window/platform_window_init_properties.h"
#include "ui/platform_window/platform_window_linux.h"
#include "ui/views/linux_ui/linux_ui.h"
#include "ui/views/views_delegate.h"
#include "ui/views/widget/desktop_aura/window_event_filter_linux.h"
@ -124,16 +124,25 @@ void DesktopWindowTreeHostLinux::SetPendingXVisualId(int x_visual_id) {
}
gfx::Rect DesktopWindowTreeHostLinux::GetXRootWindowOuterBounds() const {
return GetPlatformWindowLinux()->GetXRootWindowOuterBounds();
// TODO(msisov): must be removed as soon as all X11 low-level bits are moved
// to Ozone.
DCHECK(GetX11Extension());
return GetX11Extension()->GetXRootWindowOuterBounds();
}
bool DesktopWindowTreeHostLinux::ContainsPointInXRegion(
const gfx::Point& point) const {
return GetPlatformWindowLinux()->ContainsPointInXRegion(point);
// TODO(msisov): must be removed as soon as all X11 low-level bits are moved
// to Ozone.
DCHECK(GetX11Extension());
return GetX11Extension()->ContainsPointInXRegion(point);
}
void DesktopWindowTreeHostLinux::LowerXWindow() {
GetPlatformWindowLinux()->LowerXWindow();
// TODO(msisov): must be removed as soon as all X11 low-level bits are moved
// to Ozone.
DCHECK(GetX11Extension());
GetX11Extension()->LowerXWindow();
}
base::OnceClosure DesktopWindowTreeHostLinux::DisableEventListening() {
@ -153,7 +162,7 @@ base::OnceClosure DesktopWindowTreeHostLinux::DisableEventListening() {
void DesktopWindowTreeHostLinux::Init(const Widget::InitParams& params) {
DesktopWindowTreeHostPlatform::Init(params);
if (GetPlatformWindowLinux()->IsSyncExtensionAvailable()) {
if (GetX11Extension() && GetX11Extension()->IsSyncExtensionAvailable()) {
compositor_observer_ = std::make_unique<SwapWithNewSizeObserverHelper>(
compositor(),
base::BindRepeating(
@ -170,12 +179,6 @@ void DesktopWindowTreeHostLinux::OnNativeWidgetCreated(
DesktopWindowTreeHostPlatform::OnNativeWidgetCreated(params);
}
void DesktopWindowTreeHostLinux::SetOpacity(float opacity) {
DesktopWindowTreeHostPlatform::SetOpacity(opacity);
// Note that this is no-op for Wayland.
GetPlatformWindowLinux()->SetOpacityForXWindow(opacity);
}
base::flat_map<std::string, std::string>
DesktopWindowTreeHostLinux::GetKeyboardLayoutMap() {
if (views::LinuxUI::instance())
@ -338,23 +341,31 @@ void DesktopWindowTreeHostLinux::AddAdditionalInitProperties(
properties->wm_role_name = params.wm_role_name;
properties->x_visual_id = pending_x_visual_id_;
DCHECK(!properties->x11_extension_delegate);
properties->x11_extension_delegate = this;
}
void DesktopWindowTreeHostLinux::OnCompleteSwapWithNewSize(
const gfx::Size& size) {
GetPlatformWindowLinux()->OnCompleteSwapAfterResize();
if (GetX11Extension())
GetX11Extension()->OnCompleteSwapAfterResize();
}
void DesktopWindowTreeHostLinux::CreateNonClientEventFilter() {
DCHECK(!non_client_window_event_filter_);
non_client_window_event_filter_ = std::make_unique<WindowEventFilterLinux>(
this, GetWmMoveResizeHandler(*GetPlatformWindowLinux()));
this, GetWmMoveResizeHandler(*platform_window()));
}
void DesktopWindowTreeHostLinux::DestroyNonClientEventFilter() {
non_client_window_event_filter_.reset();
}
void DesktopWindowTreeHostLinux::OnXWindowMapped() {}
void DesktopWindowTreeHostLinux::OnXWindowUnmapped() {}
void DesktopWindowTreeHostLinux::GetWindowMask(const gfx::Size& size,
SkPath* window_mask) {
DCHECK(window_mask);
@ -376,13 +387,12 @@ void DesktopWindowTreeHostLinux::EnableEventListening() {
targeter_for_modal_.reset();
}
const ui::PlatformWindowLinux*
DesktopWindowTreeHostLinux::GetPlatformWindowLinux() const {
return static_cast<const ui::PlatformWindowLinux*>(platform_window());
ui::X11Extension* DesktopWindowTreeHostLinux::GetX11Extension() {
return ui::GetX11Extension(*(platform_window()));
}
ui::PlatformWindowLinux* DesktopWindowTreeHostLinux::GetPlatformWindowLinux() {
return static_cast<ui::PlatformWindowLinux*>(platform_window());
const ui::X11Extension* DesktopWindowTreeHostLinux::GetX11Extension() const {
return ui::GetX11Extension(*(platform_window()));
}
std::list<gfx::AcceleratedWidget>& DesktopWindowTreeHostLinux::open_windows() {

@ -10,6 +10,7 @@
#include "ui/aura/scoped_window_targeter.h"
#include "ui/base/buildflags.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/platform_window/extensions/x11_extension_delegate.h"
#include "ui/views/views_export.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h"
@ -20,7 +21,7 @@ class ScopedWindowTargeter;
} // namespace aura
namespace ui {
class PlatformWindowLinux;
class X11Extension;
} // namespace ui
namespace views {
@ -29,7 +30,8 @@ class WindowEventFilterLinux;
// Contains Linux specific implementation.
class VIEWS_EXPORT DesktopWindowTreeHostLinux
: public DesktopWindowTreeHostPlatform {
: public DesktopWindowTreeHostPlatform,
public ui::X11ExtensionDelegate {
public:
DesktopWindowTreeHostLinux(
internal::NativeWidgetDelegate* native_widget_delegate,
@ -77,18 +79,14 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux
// Overridden from DesktopWindowTreeHost:
void Init(const Widget::InitParams& params) override;
void OnNativeWidgetCreated(const Widget::InitParams& params) override;
void SetOpacity(float opacity) override;
base::flat_map<std::string, std::string> GetKeyboardLayoutMap() override;
void InitModalType(ui::ModalType modal_type) override;
// PlatformWindowDelegateBase:
// PlatformWindowDelegate:
void DispatchEvent(ui::Event* event) override;
void OnClosed() override;
void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override;
void OnActivationChanged(bool active) override;
#if BUILDFLAG(USE_ATK)
bool OnAtkKeyEvent(AtkKeyEventStruct* atk_key_event) override;
#endif
private:
FRIEND_TEST_ALL_PREFIXES(DesktopWindowTreeHostLinuxTest, HitTest);
@ -108,15 +106,20 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux
void CreateNonClientEventFilter();
void DestroyNonClientEventFilter();
// PlatformWindowDelegateLinux overrides:
// X11ExtensionDelegate overrides:
void OnXWindowMapped() override;
void OnXWindowUnmapped() override;
void GetWindowMask(const gfx::Size& size, SkPath* window_mask) override;
void OnLostMouseGrab() override;
#if BUILDFLAG(USE_ATK)
bool OnAtkKeyEvent(AtkKeyEventStruct* atk_key_event) override;
#endif
// Enables event listening after closing |dialog|.
void EnableEventListening();
const ui::PlatformWindowLinux* GetPlatformWindowLinux() const;
ui::PlatformWindowLinux* GetPlatformWindowLinux();
ui::X11Extension* GetX11Extension();
const ui::X11Extension* GetX11Extension() const;
// See comment for variable open_windows_.
static std::list<gfx::AcceleratedWidget>& open_windows();

@ -7,7 +7,7 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window_tree_host_platform.h"
#include "ui/base/hit_test.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_handler/wm_move_resize_handler.h"
#include "ui/views/test/views_interactive_ui_test_base.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
@ -41,7 +41,7 @@ bool IsNonClientComponent(int hittest) {
class FakeWmMoveResizeHandler : public ui::WmMoveResizeHandler {
public:
using SetBoundsCallback = base::RepeatingCallback<void(gfx::Rect)>;
explicit FakeWmMoveResizeHandler(ui::PlatformWindowBase* window)
explicit FakeWmMoveResizeHandler(ui::PlatformWindow* window)
: platform_window_(window), hittest_(-1) {}
~FakeWmMoveResizeHandler() override = default;
@ -66,7 +66,7 @@ class FakeWmMoveResizeHandler : public ui::WmMoveResizeHandler {
}
private:
ui::PlatformWindowBase* platform_window_;
ui::PlatformWindow* platform_window_;
gfx::Rect bounds_;
int hittest_ = -1;
@ -157,7 +157,7 @@ class TestDesktopWindowTreeHostLinux : public DesktopWindowTreeHostLinux {
desktop_native_widget_aura) {}
~TestDesktopWindowTreeHostLinux() override = default;
// PlatformWindowDelegateBase:
// PlatformWindowDelegate:
// Instead of making these tests friends of the host, override the dispatch
// method to make it public and nothing else.
void DispatchEvent(ui::Event* event) override {

@ -16,7 +16,7 @@
#include "ui/display/screen.h"
#include "ui/gfx/geometry/dip_util.h"
#include "ui/platform_window/extensions/workspace_extension.h"
#include "ui/platform_window/platform_window_base.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_init_properties.h"
#include "ui/views/corewm/tooltip_aura.h"
#include "ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.h"
@ -516,9 +516,7 @@ void DesktopWindowTreeHostPlatform::EndMoveLoop() {
void DesktopWindowTreeHostPlatform::SetVisibilityChangedAnimationsEnabled(
bool value) {
#if defined(OS_WIN)
platform_window()->SetVisibilityChangedAnimationsEnabled(value);
#endif
}
NonClientFrameView* DesktopWindowTreeHostPlatform::CreateNonClientFrameView() {
@ -574,6 +572,7 @@ bool DesktopWindowTreeHostPlatform::IsFullscreen() const {
void DesktopWindowTreeHostPlatform::SetOpacity(float opacity) {
GetContentWindow()->layer()->SetOpacity(opacity);
platform_window()->SetOpacity(opacity);
}
void DesktopWindowTreeHostPlatform::SetAspectRatio(

@ -102,7 +102,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostPlatform
void ShowImpl() override;
void HideImpl() override;
// PlatformWindowDelegateBase:
// PlatformWindowDelegate:
void OnClosed() override;
void OnWindowStateChanged(ui::PlatformWindowState new_state) override;
void OnCloseRequest() override;

@ -51,11 +51,11 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux,
private:
friend class DesktopWindowTreeHostX11HighDPITest;
// PlatformWindowDelegate overrides:
// X11ExtensionDelegate overrides:
//
// DWTHX11 temporarily overrides the PlatformWindowDelegate methods instead of
// underlying DWTHPlatform and WTHPlatform. Eventually, these will be removed
// from here as we progress in https://crbug.com/990756.
// DWTHX11 temporarily overrides the X11ExtensionDelegate
// methods instead of underlying DWTHPlatform and WTHPlatform. Eventually,
// these will be removed from here as we progress in https://crbug.com/990756.
void OnXWindowMapped() override;
void OnXWindowUnmapped() override;