Commit 82211234 authored by Maksim Sisov's avatar Maksim Sisov Committed by Commit Bot

X11 and Ozone: Add ShouldUseNativeFrame method to PlatformWindow.

Some platforms might not support that, but still would like to provide
a default value.

In case of Wayland, it depends on xdg decoration extension protocol,
support for which will be added later.

Bug: 990756
Change-Id: I550104522a729ae154711e4fb61b80b8878007ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1834347Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Cr-Commit-Position: refs/heads/master@{#702792}
parent 72035347
......@@ -124,6 +124,10 @@ void DrmWindowHost::Deactivate() {
void DrmWindowHost::SetUseNativeFrame(bool use_native_frame) {}
bool DrmWindowHost::ShouldUseNativeFrame() const {
return false;
}
void DrmWindowHost::SetCursor(PlatformCursor cursor) {
cursor_->SetCursor(widget_, cursor);
}
......
......@@ -77,6 +77,7 @@ class DrmWindowHost : public PlatformWindow,
void Activate() override;
void Deactivate() override;
void SetUseNativeFrame(bool use_native_frame) override;
bool ShouldUseNativeFrame() const override;
void SetCursor(PlatformCursor cursor) override;
void MoveCursorTo(const gfx::Point& location) override;
void ConfineCursorToBounds(const gfx::Rect& bounds) override;
......
......@@ -158,6 +158,11 @@ void ScenicWindow::Deactivate() {
void ScenicWindow::SetUseNativeFrame(bool use_native_frame) {}
bool ScenicWindow::ShouldUseNativeFrame() const {
NOTIMPLEMENTED_LOG_ONCE();
return false;
}
void ScenicWindow::SetCursor(PlatformCursor cursor) {
NOTIMPLEMENTED_LOG_ONCE();
}
......
......@@ -66,6 +66,7 @@ class COMPONENT_EXPORT(OZONE) ScenicWindow
void Activate() override;
void Deactivate() override;
void SetUseNativeFrame(bool use_native_frame) override;
bool ShouldUseNativeFrame() const override;
void SetCursor(PlatformCursor cursor) override;
void MoveCursorTo(const gfx::Point& location) override;
void ConfineCursorToBounds(const gfx::Rect& bounds) override;
......
......@@ -498,7 +498,16 @@ void WaylandWindow::Deactivate() {
NOTIMPLEMENTED_LOG_ONCE();
}
void WaylandWindow::SetUseNativeFrame(bool use_native_frame) {}
void WaylandWindow::SetUseNativeFrame(bool use_native_frame) {
// See comment below in ShouldUseNativeFrame.
NOTIMPLEMENTED_LOG_ONCE();
}
bool WaylandWindow::ShouldUseNativeFrame() const {
// This depends on availability of XDG-Decoration protocol extension.
NOTIMPLEMENTED_LOG_ONCE();
return false;
}
void WaylandWindow::SetCursor(PlatformCursor cursor) {
scoped_refptr<BitmapCursorOzone> bitmap =
......
......@@ -132,6 +132,7 @@ class WaylandWindow : public PlatformWindow,
void Activate() override;
void Deactivate() override;
void SetUseNativeFrame(bool use_native_frame) override;
bool ShouldUseNativeFrame() const override;
void SetCursor(PlatformCursor cursor) override;
void MoveCursorTo(const gfx::Point& location) override;
void ConfineCursorToBounds(const gfx::Rect& bounds) override;
......
......@@ -69,6 +69,7 @@ class PlatformWindowBase : public PropertyHandler {
// changed by the user at any time via 'Show system title bar' option in the
// tab strip menu.
virtual void SetUseNativeFrame(bool use_native_frame) = 0;
virtual bool ShouldUseNativeFrame() const = 0;
virtual void SetCursor(PlatformCursor cursor) = 0;
......
......@@ -79,6 +79,11 @@ void StubWindow::Deactivate() {
void StubWindow::SetUseNativeFrame(bool use_native_frame) {}
bool StubWindow::ShouldUseNativeFrame() const {
NOTIMPLEMENTED_LOG_ONCE();
return false;
}
void StubWindow::SetCursor(PlatformCursor cursor) {}
void StubWindow::MoveCursorTo(const gfx::Point& location) {}
......
......@@ -47,6 +47,7 @@ class STUB_WINDOW_EXPORT StubWindow : public PlatformWindow {
void Activate() override;
void Deactivate() override;
void SetUseNativeFrame(bool use_native_frame) override;
bool ShouldUseNativeFrame() const override;
void SetCursor(PlatformCursor cursor) override;
void MoveCursorTo(const gfx::Point& location) override;
void ConfineCursorToBounds(const gfx::Rect& bounds) override;
......
......@@ -139,6 +139,11 @@ void WinWindow::Deactivate() {
void WinWindow::SetUseNativeFrame(bool use_native_frame) {}
bool WinWindow::ShouldUseNativeFrame() const {
NOTIMPLEMENTED_LOG_ONCE();
return false;
}
void WinWindow::SetCursor(PlatformCursor cursor) {
::SetCursor(cursor);
}
......
......@@ -46,6 +46,7 @@ class WIN_WINDOW_EXPORT WinWindow : public PlatformWindow,
void Activate() override;
void Deactivate() override;
void SetUseNativeFrame(bool use_native_frame) override;
bool ShouldUseNativeFrame() const override;
void SetCursor(PlatformCursor cursor) override;
void MoveCursorTo(const gfx::Point& location) override;
void ConfineCursorToBounds(const gfx::Rect& bounds) override;
......
......@@ -319,6 +319,10 @@ void X11Window::SetUseNativeFrame(bool use_native_frame) {
XWindow::SetUseNativeFrame(use_native_frame);
}
bool X11Window::ShouldUseNativeFrame() const {
return XWindow::use_native_frame();
}
void X11Window::SetCursor(PlatformCursor cursor) {
// X11PlatformWindowOzone has different type of PlatformCursor. Thus, use this
// only for X11 and Ozone will manage this by itself.
......
......@@ -77,6 +77,7 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindow,
bool IsSyncExtensionAvailable() const override;
void OnCompleteSwapAfterResize() override;
void SetUseNativeFrame(bool use_native_frame) override;
bool ShouldUseNativeFrame() const override;
void SetCursor(PlatformCursor cursor) override;
void MoveCursorTo(const gfx::Point& location) override;
void ConfineCursorToBounds(const gfx::Rect& bounds) override;
......
......@@ -56,6 +56,7 @@ class FakePlatformWindow : public ui::PlatformWindow, public ui::WmDragHandler {
void SetRestoredBoundsInPixels(const gfx::Rect& bounds) override {}
gfx::Rect GetRestoredBoundsInPixels() const override { return gfx::Rect(); }
void SetUseNativeFrame(bool use_native_frame) override {}
bool ShouldUseNativeFrame() const override { return false; }
// ui::WmDragHandler
void StartDrag(const OSExchangeData& data,
......
......@@ -506,7 +506,7 @@ NonClientFrameView* DesktopWindowTreeHostPlatform::CreateNonClientFrameView() {
}
bool DesktopWindowTreeHostPlatform::ShouldUseNativeFrame() const {
return false;
return platform_window()->ShouldUseNativeFrame();
}
bool DesktopWindowTreeHostPlatform::ShouldWindowContentsBeTransparent() const {
......
......@@ -255,10 +255,6 @@ void DesktopWindowTreeHostX11::SetVisibilityChangedAnimationsEnabled(
// Much like the previous NativeWidgetGtk, we don't have anything to do here.
}
bool DesktopWindowTreeHostX11::ShouldUseNativeFrame() const {
return GetXWindow()->use_native_frame();
}
void DesktopWindowTreeHostX11::FrameTypeChanged() {
Widget::FrameType new_type =
native_widget_delegate()->AsWidget()->frame_type();
......
......@@ -98,7 +98,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux,
Widget::MoveLoopEscapeBehavior escape_behavior) override;
void EndMoveLoop() override;
void SetVisibilityChangedAnimationsEnabled(bool value) override;
bool ShouldUseNativeFrame() const override;
void FrameTypeChanged() override;
void SetOpacity(float opacity) override;
void SetAspectRatio(const gfx::SizeF& aspect_ratio) override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment