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

X11 and Ozone: Reuse WindowEventFilter setup in DWTHPlatform.

This CL removes the setup of WindowEventFilter in the DWTHX11
and uses the one already implemented in the DWTHPlatform.

However, to make move/resize work with non-Ozone X11, the
WMResizeHandler is subclassed by the X11Window instead of
X11WindowOzone now.

Bug: 990756
Change-Id: I9e95bf56adcf21267246c45264d8a801ee9f45cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1776027
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696733}
parent 375f71d3
...@@ -27,10 +27,6 @@ X11WindowOzone::X11WindowOzone(PlatformWindowDelegate* delegate, ...@@ -27,10 +27,6 @@ X11WindowOzone::X11WindowOzone(PlatformWindowDelegate* delegate,
X11WindowManagerOzone* window_manager) X11WindowManagerOzone* window_manager)
: X11Window(delegate), window_manager_(window_manager) { : X11Window(delegate), window_manager_(window_manager) {
DCHECK(window_manager_); DCHECK(window_manager_);
// Set a class property key, which allows |this| to be used for interactive
// events, e.g. move or resize.
SetWmMoveResizeHandler(this, static_cast<WmMoveResizeHandler*>(this));
} }
X11WindowOzone::~X11WindowOzone() { X11WindowOzone::~X11WindowOzone() {
...@@ -152,12 +148,6 @@ uint32_t X11WindowOzone::DispatchEvent(const PlatformEvent& event) { ...@@ -152,12 +148,6 @@ uint32_t X11WindowOzone::DispatchEvent(const PlatformEvent& event) {
return window_manager_->event_grabber()->DispatchEvent(event); return window_manager_->event_grabber()->DispatchEvent(event);
} }
void X11WindowOzone::DispatchHostWindowDragMovement(
int hittest,
const gfx::Point& pointer_location) {
XWindow::WmMoveResize(hittest, pointer_location);
}
void X11WindowOzone::SetWidget(XID xid) { void X11WindowOzone::SetWidget(XID xid) {
// In spite of being defined in Xlib as `unsigned long`, XID (|xid|'s type) // In spite of being defined in Xlib as `unsigned long`, XID (|xid|'s type)
// is fixed at 32-bits (CARD32) in X11 Protocol, therefore can't be larger // is fixed at 32-bits (CARD32) in X11 Protocol, therefore can't be larger
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "ui/events/x/x11_window_event_manager.h" #include "ui/events/x/x11_window_event_manager.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/gfx/x/x11_types.h" #include "ui/gfx/x/x11_types.h"
#include "ui/platform_window/platform_window_handler/wm_move_resize_handler.h"
#include "ui/platform_window/x11/x11_window.h" #include "ui/platform_window/x11/x11_window.h"
namespace ui { namespace ui {
...@@ -25,9 +24,7 @@ class X11WindowManagerOzone; ...@@ -25,9 +24,7 @@ class X11WindowManagerOzone;
struct PlatformWindowInitProperties; struct PlatformWindowInitProperties;
// PlatformWindow implementation for X11 Ozone. PlatformEvents are ui::Events. // PlatformWindow implementation for X11 Ozone. PlatformEvents are ui::Events.
class X11WindowOzone : public X11Window, class X11WindowOzone : public X11Window, public XEventDispatcher {
public WmMoveResizeHandler,
public XEventDispatcher {
public: public:
X11WindowOzone(PlatformWindowDelegate* delegate, X11WindowOzone(PlatformWindowDelegate* delegate,
X11WindowManagerOzone* window_manager); X11WindowManagerOzone* window_manager);
...@@ -65,11 +62,6 @@ class X11WindowOzone : public X11Window, ...@@ -65,11 +62,6 @@ class X11WindowOzone : public X11Window,
bool CanDispatchEvent(const PlatformEvent& event) override; bool CanDispatchEvent(const PlatformEvent& event) override;
uint32_t DispatchEvent(const PlatformEvent& event) override; uint32_t DispatchEvent(const PlatformEvent& event) override;
// WmMoveResizeHandler
void DispatchHostWindowDragMovement(
int hittest,
const gfx::Point& pointer_location) override;
void Init(const PlatformWindowInitProperties& params); void Init(const PlatformWindowInitProperties& params);
void SetWidget(XID xwindow); void SetWidget(XID xwindow);
void RemoveFromWindowManager(); void RemoveFromWindowManager();
......
...@@ -23,6 +23,7 @@ jumbo_component("x11") { ...@@ -23,6 +23,7 @@ jumbo_component("x11") {
"//ui/events/platform/x11", "//ui/events/platform/x11",
"//ui/gfx/x", "//ui/gfx/x",
"//ui/platform_window", "//ui/platform_window",
"//ui/platform_window/platform_window_handler",
] ]
configs += [ "//build/config/linux:x11" ] configs += [ "//build/config/linux:x11" ]
......
...@@ -74,7 +74,11 @@ ui::XWindow::Configuration ConvertInitPropertiesToXWindowConfig( ...@@ -74,7 +74,11 @@ ui::XWindow::Configuration ConvertInitPropertiesToXWindowConfig(
} // namespace } // namespace
X11Window::X11Window(PlatformWindowDelegateLinux* platform_window_delegate) X11Window::X11Window(PlatformWindowDelegateLinux* platform_window_delegate)
: platform_window_delegate_(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.
SetWmMoveResizeHandler(this, static_cast<WmMoveResizeHandler*>(this));
}
X11Window::~X11Window() { X11Window::~X11Window() {
PrepareForShutdown(); PrepareForShutdown();
...@@ -320,11 +324,6 @@ ZOrderLevel X11Window::GetZOrderLevel() const { ...@@ -320,11 +324,6 @@ ZOrderLevel X11Window::GetZOrderLevel() const {
: ui::ZOrderLevel::kNormal; : ui::ZOrderLevel::kNormal;
} }
void X11Window::SetPlatformEventDispatcher() {
DCHECK(PlatformEventSource::GetInstance());
PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
}
bool X11Window::CanDispatchEvent(const PlatformEvent& xev) { bool X11Window::CanDispatchEvent(const PlatformEvent& xev) {
#if defined(USE_X11) #if defined(USE_X11)
return XWindow::IsTargetedBy(*xev); return XWindow::IsTargetedBy(*xev);
...@@ -437,6 +436,17 @@ base::Optional<gfx::Size> X11Window::GetMaximumSizeForXWindow() { ...@@ -437,6 +436,17 @@ base::Optional<gfx::Size> X11Window::GetMaximumSizeForXWindow() {
return platform_window_delegate_->GetMaximumSizeForWindow(); return platform_window_delegate_->GetMaximumSizeForWindow();
} }
void X11Window::DispatchHostWindowDragMovement(
int hittest,
const gfx::Point& pointer_location) {
XWindow::WmMoveResize(hittest, pointer_location);
}
void X11Window::SetPlatformEventDispatcher() {
DCHECK(PlatformEventSource::GetInstance());
PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
}
gfx::Size X11Window::AdjustSizeForDisplay( gfx::Size X11Window::AdjustSizeForDisplay(
const gfx::Size& requested_size_in_pixels) { const gfx::Size& requested_size_in_pixels) {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ui/base/x/x11_window.h" #include "ui/base/x/x11_window.h"
#include "ui/events/platform/platform_event_dispatcher.h" #include "ui/events/platform/platform_event_dispatcher.h"
#include "ui/platform_window/platform_window.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_init_properties.h"
#include "ui/platform_window/x11/x11_window_export.h" #include "ui/platform_window/x11/x11_window_export.h"
...@@ -33,6 +34,7 @@ class X11_WINDOW_EXPORT XEventDelegate { ...@@ -33,6 +34,7 @@ class X11_WINDOW_EXPORT XEventDelegate {
// PlatformWindow implementation for X11. PlatformEvents are XEvents. // PlatformWindow implementation for X11. PlatformEvents are XEvents.
class X11_WINDOW_EXPORT X11Window : public PlatformWindow, class X11_WINDOW_EXPORT X11Window : public PlatformWindow,
public WmMoveResizeHandler,
public XWindow, public XWindow,
public PlatformEventDispatcher { public PlatformEventDispatcher {
public: public:
...@@ -103,6 +105,11 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindow, ...@@ -103,6 +105,11 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindow,
base::Optional<gfx::Size> GetMinimumSizeForXWindow() override; base::Optional<gfx::Size> GetMinimumSizeForXWindow() override;
base::Optional<gfx::Size> GetMaximumSizeForXWindow() override; base::Optional<gfx::Size> GetMaximumSizeForXWindow() override;
// WmMoveResizeHandler
void DispatchHostWindowDragMovement(
int hittest,
const gfx::Point& pointer_location) override;
// X11WindowOzone sets own event dispatcher now. // X11WindowOzone sets own event dispatcher now.
virtual void SetPlatformEventDispatcher(); virtual void SetPlatformEventDispatcher();
......
...@@ -6,9 +6,11 @@ ...@@ -6,9 +6,11 @@
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/display/screen.h" #include "ui/display/screen.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_init_properties.h"
#include "ui/views/linux_ui/linux_ui.h" #include "ui/views/linux_ui/linux_ui.h"
#include "ui/views/views_delegate.h" #include "ui/views/views_delegate.h"
#include "ui/views/widget/desktop_aura/window_event_filter.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
namespace views { namespace views {
...@@ -21,6 +23,12 @@ DesktopWindowTreeHostLinux::DesktopWindowTreeHostLinux( ...@@ -21,6 +23,12 @@ DesktopWindowTreeHostLinux::DesktopWindowTreeHostLinux(
DesktopWindowTreeHostLinux::~DesktopWindowTreeHostLinux() = default; DesktopWindowTreeHostLinux::~DesktopWindowTreeHostLinux() = default;
void DesktopWindowTreeHostLinux::OnNativeWidgetCreated(
const Widget::InitParams& params) {
AddNonClientEventFilter();
DesktopWindowTreeHostPlatform::OnNativeWidgetCreated(params);
}
void DesktopWindowTreeHostLinux::OnDisplayMetricsChanged( void DesktopWindowTreeHostLinux::OnDisplayMetricsChanged(
const display::Display& display, const display::Display& display,
uint32_t changed_metrics) { uint32_t changed_metrics) {
...@@ -38,6 +46,11 @@ void DesktopWindowTreeHostLinux::OnDisplayMetricsChanged( ...@@ -38,6 +46,11 @@ void DesktopWindowTreeHostLinux::OnDisplayMetricsChanged(
} }
} }
void DesktopWindowTreeHostLinux::OnClosed() {
RemoveNonClientEventFilter();
DesktopWindowTreeHostPlatform::OnClosed();
}
void DesktopWindowTreeHostLinux::AddAdditionalInitProperties( void DesktopWindowTreeHostLinux::AddAdditionalInitProperties(
const Widget::InitParams& params, const Widget::InitParams& params,
ui::PlatformWindowInitProperties* properties) { ui::PlatformWindowInitProperties* properties) {
...@@ -72,6 +85,27 @@ void DesktopWindowTreeHostLinux::AddAdditionalInitProperties( ...@@ -72,6 +85,27 @@ void DesktopWindowTreeHostLinux::AddAdditionalInitProperties(
properties->wm_role_name = params.wm_role_name; properties->wm_role_name = params.wm_role_name;
} }
void DesktopWindowTreeHostLinux::AddNonClientEventFilter() {
DCHECK(!non_client_window_event_filter_);
std::unique_ptr<WindowEventFilter> window_event_filter =
std::make_unique<WindowEventFilter>(this);
auto* wm_move_resize_handler = GetWmMoveResizeHandler(*platform_window());
if (wm_move_resize_handler)
window_event_filter->SetWmMoveResizeHandler(
GetWmMoveResizeHandler(*(platform_window())));
non_client_window_event_filter_ = std::move(window_event_filter);
window()->AddPreTargetHandler(non_client_window_event_filter_.get());
}
void DesktopWindowTreeHostLinux::RemoveNonClientEventFilter() {
if (!non_client_window_event_filter_)
return;
window()->RemovePreTargetHandler(non_client_window_event_filter_.get());
non_client_window_event_filter_.reset();
}
// As DWTHX11 subclasses DWTHPlatform through DWTHLinux now (during transition // As DWTHX11 subclasses DWTHPlatform through DWTHLinux now (during transition
// period. see https://crbug.com/990756), we need to guard this factory method. // period. see https://crbug.com/990756), we need to guard this factory method.
// TODO(msisov): remove this guard once DWTHX11 is finally merged into // TODO(msisov): remove this guard once DWTHX11 is finally merged into
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
namespace views { namespace views {
class WindowEventFilter;
// Contains Linux specific implementation. // Contains Linux specific implementation.
class VIEWS_EXPORT DesktopWindowTreeHostLinux class VIEWS_EXPORT DesktopWindowTreeHostLinux
: public DesktopWindowTreeHostPlatform { : public DesktopWindowTreeHostPlatform {
...@@ -20,6 +22,13 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux ...@@ -20,6 +22,13 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux
DesktopNativeWidgetAura* desktop_native_widget_aura); DesktopNativeWidgetAura* desktop_native_widget_aura);
~DesktopWindowTreeHostLinux() override; ~DesktopWindowTreeHostLinux() override;
protected:
// Overridden from DesktopWindowTreeHost:
void OnNativeWidgetCreated(const Widget::InitParams& params) override;
// PlatformWindowDelegateBase:
void OnClosed() override;
private: private:
// Overridden from display::DisplayObserver via aura::WindowTreeHost: // Overridden from display::DisplayObserver via aura::WindowTreeHost:
void OnDisplayMetricsChanged(const display::Display& display, void OnDisplayMetricsChanged(const display::Display& display,
...@@ -30,6 +39,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux ...@@ -30,6 +39,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux
const Widget::InitParams& params, const Widget::InitParams& params,
ui::PlatformWindowInitProperties* properties) override; ui::PlatformWindowInitProperties* properties) override;
void AddNonClientEventFilter();
void RemoveNonClientEventFilter();
// A handler for events intended for non client area.
std::unique_ptr<WindowEventFilter> non_client_window_event_filter_;
DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostLinux); DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostLinux);
}; };
......
...@@ -16,12 +16,10 @@ ...@@ -16,12 +16,10 @@
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/geometry/dip_util.h"
#include "ui/platform_window/platform_window.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_init_properties.h"
#include "ui/views/corewm/tooltip_aura.h" #include "ui/views/corewm/tooltip_aura.h"
#include "ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.h" #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
#include "ui/views/widget/desktop_aura/window_event_filter.h"
#include "ui/views/widget/widget_aura_utils.h" #include "ui/views/widget/widget_aura_utils.h"
#include "ui/views/window/native_frame_view.h" #include "ui/views/window/native_frame_view.h"
#include "ui/wm/core/window_util.h" #include "ui/wm/core/window_util.h"
...@@ -152,26 +150,11 @@ void DesktopWindowTreeHostPlatform::Init(const Widget::InitParams& params) { ...@@ -152,26 +150,11 @@ void DesktopWindowTreeHostPlatform::Init(const Widget::InitParams& params) {
void DesktopWindowTreeHostPlatform::OnNativeWidgetCreated( void DesktopWindowTreeHostPlatform::OnNativeWidgetCreated(
const Widget::InitParams& params) { const Widget::InitParams& params) {
native_widget_delegate_->OnNativeWidgetCreated();
platform_window()->SetUseNativeFrame(params.type == platform_window()->SetUseNativeFrame(params.type ==
Widget::InitParams::TYPE_WINDOW && Widget::InitParams::TYPE_WINDOW &&
!params.remove_standard_frame); !params.remove_standard_frame);
#if defined(OS_LINUX) native_widget_delegate_->OnNativeWidgetCreated();
// Setup a non_client_window_event_filter, which handles resize/move, double
// click and other events.
DCHECK(!non_client_window_event_filter_);
std::unique_ptr<WindowEventFilter> window_event_filter =
std::make_unique<WindowEventFilter>(this);
auto* wm_move_resize_handler = GetWmMoveResizeHandler(*platform_window());
if (wm_move_resize_handler)
window_event_filter->SetWmMoveResizeHandler(
GetWmMoveResizeHandler(*(platform_window())));
non_client_window_event_filter_ = std::move(window_event_filter);
window()->AddPreTargetHandler(non_client_window_event_filter_.get());
#endif
} }
void DesktopWindowTreeHostPlatform::OnWidgetInitDone() {} void DesktopWindowTreeHostPlatform::OnWidgetInitDone() {}
...@@ -674,8 +657,6 @@ void DesktopWindowTreeHostPlatform::DispatchEvent(ui::Event* event) { ...@@ -674,8 +657,6 @@ void DesktopWindowTreeHostPlatform::DispatchEvent(ui::Event* event) {
} }
void DesktopWindowTreeHostPlatform::OnClosed() { void DesktopWindowTreeHostPlatform::OnClosed() {
RemoveNonClientEventFilter();
SetPlatformWindow(nullptr); SetPlatformWindow(nullptr);
desktop_native_widget_aura_->OnHostClosed(); desktop_native_widget_aura_->OnHostClosed();
} }
...@@ -756,16 +737,6 @@ void DesktopWindowTreeHostPlatform::Relayout() { ...@@ -756,16 +737,6 @@ void DesktopWindowTreeHostPlatform::Relayout() {
} }
} }
void DesktopWindowTreeHostPlatform::RemoveNonClientEventFilter() {
#if defined(OS_LINUX)
if (!non_client_window_event_filter_)
return;
window()->RemovePreTargetHandler(non_client_window_event_filter_.get());
non_client_window_event_filter_.reset();
#endif
}
Widget* DesktopWindowTreeHostPlatform::GetWidget() { Widget* DesktopWindowTreeHostPlatform::GetWidget() {
return native_widget_delegate_->AsWidget(); return native_widget_delegate_->AsWidget();
} }
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
namespace views { namespace views {
class WindowEventFilter;
class VIEWS_EXPORT DesktopWindowTreeHostPlatform class VIEWS_EXPORT DesktopWindowTreeHostPlatform
: public aura::WindowTreeHostPlatform, : public aura::WindowTreeHostPlatform,
public DesktopWindowTreeHost { public DesktopWindowTreeHost {
...@@ -127,8 +125,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostPlatform ...@@ -127,8 +125,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostPlatform
void Relayout(); void Relayout();
void RemoveNonClientEventFilter();
Widget* GetWidget(); Widget* GetWidget();
const Widget* GetWidget() const; const Widget* GetWidget() const;
...@@ -152,11 +148,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostPlatform ...@@ -152,11 +148,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostPlatform
DesktopWindowTreeHostPlatform* window_parent_ = nullptr; DesktopWindowTreeHostPlatform* window_parent_ = nullptr;
std::set<DesktopWindowTreeHostPlatform*> window_children_; std::set<DesktopWindowTreeHostPlatform*> window_children_;
#if defined(OS_LINUX)
// A handler for events intended for non client area.
std::unique_ptr<WindowEventFilter> non_client_window_event_filter_;
#endif
// Keep track of PlatformWindow state so that we would react correctly and set // Keep track of PlatformWindow state so that we would react correctly and set
// visibility only if the window was minimized or was unminimized from the // visibility only if the window was minimized or was unminimized from the
// normal state. // normal state.
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
#include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_observer_x11.h" #include "ui/views/widget/desktop_aura/desktop_window_tree_host_observer_x11.h"
#include "ui/views/widget/desktop_aura/window_event_filter.h"
#include "ui/views/widget/desktop_aura/x11_desktop_handler.h" #include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
#include "ui/views/widget/desktop_aura/x11_desktop_window_move_client.h" #include "ui/views/widget/desktop_aura/x11_desktop_window_move_client.h"
#include "ui/views/window/native_frame_view.h" #include "ui/views/window/native_frame_view.h"
...@@ -204,21 +203,6 @@ void DesktopWindowTreeHostX11::RemoveObserver( ...@@ -204,21 +203,6 @@ void DesktopWindowTreeHostX11::RemoveObserver(
observer_list_.RemoveObserver(observer); observer_list_.RemoveObserver(observer);
} }
void DesktopWindowTreeHostX11::AddNonClientEventFilter() {
if (non_client_event_filter_)
return;
non_client_event_filter_ = std::make_unique<WindowEventFilter>(this);
non_client_event_filter_->SetWmMoveResizeHandler(this);
window()->AddPreTargetHandler(non_client_event_filter_.get());
}
void DesktopWindowTreeHostX11::RemoveNonClientEventFilter() {
if (!non_client_event_filter_)
return;
window()->RemovePreTargetHandler(non_client_event_filter_.get());
non_client_event_filter_.reset();
}
void DesktopWindowTreeHostX11::CleanUpWindowList( void DesktopWindowTreeHostX11::CleanUpWindowList(
void (*func)(aura::Window* window)) { void (*func)(aura::Window* window)) {
if (!open_windows_) if (!open_windows_)
...@@ -267,16 +251,12 @@ void DesktopWindowTreeHostX11::OnNativeWidgetCreated( ...@@ -267,16 +251,12 @@ void DesktopWindowTreeHostX11::OnNativeWidgetCreated(
// notify events. // notify events.
X11DesktopHandler::get(); X11DesktopHandler::get();
AddNonClientEventFilter();
SetUseNativeFrame(params.type == Widget::InitParams::TYPE_WINDOW &&
!params.remove_standard_frame);
x11_window_move_client_ = std::make_unique<X11DesktopWindowMoveClient>(); x11_window_move_client_ = std::make_unique<X11DesktopWindowMoveClient>();
wm::SetWindowMoveClient(window(), x11_window_move_client_.get()); wm::SetWindowMoveClient(window(), x11_window_move_client_.get());
SetWindowTransparency(); SetWindowTransparency();
native_widget_delegate()->OnNativeWidgetCreated(); DesktopWindowTreeHostLinux::OnNativeWidgetCreated(params);
} }
std::unique_ptr<aura::client::DragDropClient> std::unique_ptr<aura::client::DragDropClient>
...@@ -524,12 +504,6 @@ void DesktopWindowTreeHostX11::ReleaseCapture() { ...@@ -524,12 +504,6 @@ void DesktopWindowTreeHostX11::ReleaseCapture() {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// DesktopWindowTreeHostX11, private: // DesktopWindowTreeHostX11, private:
void DesktopWindowTreeHostX11::DispatchHostWindowDragMovement(
int hittest,
const gfx::Point& pointer_location) {
GetXWindow()->WmMoveResize(hittest, pointer_location);
}
void DesktopWindowTreeHostX11::SetUseNativeFrame(bool use_native_frame) { void DesktopWindowTreeHostX11::SetUseNativeFrame(bool use_native_frame) {
GetXWindow()->SetUseNativeFrame(use_native_frame); GetXWindow()->SetUseNativeFrame(use_native_frame);
ResetWindowRegion(); ResetWindowRegion();
...@@ -698,12 +672,8 @@ void DesktopWindowTreeHostX11::DispatchEvent(ui::Event* event) { ...@@ -698,12 +672,8 @@ void DesktopWindowTreeHostX11::DispatchEvent(ui::Event* event) {
} }
void DesktopWindowTreeHostX11::OnClosed() { void DesktopWindowTreeHostX11::OnClosed() {
// Remove the event listeners we've installed. We need to remove these
// because otherwise we get assert during ~WindowEventDispatcher().
RemoveNonClientEventFilter();
open_windows().remove(GetAcceleratedWidget()); open_windows().remove(GetAcceleratedWidget());
DesktopWindowTreeHostPlatform::OnClosed(); DesktopWindowTreeHostLinux::OnClosed();
} }
void DesktopWindowTreeHostX11::OnWindowStateChanged( void DesktopWindowTreeHostX11::OnWindowStateChanged(
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
#include "ui/gfx/x/x11_types.h" #include "ui/gfx/x/x11_types.h"
#include "ui/platform_window/platform_window_delegate.h" #include "ui/platform_window/platform_window_delegate.h"
#include "ui/platform_window/platform_window_handler/wm_move_resize_handler.h"
#include "ui/platform_window/x11/x11_window.h" #include "ui/platform_window/x11/x11_window.h"
#include "ui/views/views_export.h" #include "ui/views/views_export.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h" #include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
...@@ -44,10 +43,8 @@ namespace views { ...@@ -44,10 +43,8 @@ namespace views {
class DesktopDragDropClientAuraX11; class DesktopDragDropClientAuraX11;
class DesktopWindowTreeHostObserverX11; class DesktopWindowTreeHostObserverX11;
class X11DesktopWindowMoveClient; class X11DesktopWindowMoveClient;
class WindowEventFilter;
class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux, class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux,
public ui::WmMoveResizeHandler,
public ui::XEventDelegate { public ui::XEventDelegate {
public: public:
DesktopWindowTreeHostX11( DesktopWindowTreeHostX11(
...@@ -81,9 +78,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux, ...@@ -81,9 +78,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux,
void AddObserver(DesktopWindowTreeHostObserverX11* observer); void AddObserver(DesktopWindowTreeHostObserverX11* observer);
void RemoveObserver(DesktopWindowTreeHostObserverX11* observer); void RemoveObserver(DesktopWindowTreeHostObserverX11* observer);
void AddNonClientEventFilter();
void RemoveNonClientEventFilter();
// Runs the |func| callback for each content-window, and deallocates the // Runs the |func| callback for each content-window, and deallocates the
// internal list of open windows. // internal list of open windows.
static void CleanUpWindowList(void (*func)(aura::Window* window)); static void CleanUpWindowList(void (*func)(aura::Window* window));
...@@ -142,11 +136,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux, ...@@ -142,11 +136,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux,
private: private:
friend class DesktopWindowTreeHostX11HighDPITest; friend class DesktopWindowTreeHostX11HighDPITest;
// Overridden from WmMoveResizeHandler
void DispatchHostWindowDragMovement(
int hittest,
const gfx::Point& pointer_location) override;
// Sets whether the window's borders are provided by the window manager. // Sets whether the window's borders are provided by the window manager.
void SetUseNativeFrame(bool use_native_frame); void SetUseNativeFrame(bool use_native_frame);
...@@ -210,7 +199,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux, ...@@ -210,7 +199,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux,
DesktopDragDropClientAuraX11* drag_drop_client_ = nullptr; DesktopDragDropClientAuraX11* drag_drop_client_ = nullptr;
std::unique_ptr<WindowEventFilter> non_client_event_filter_;
std::unique_ptr<X11DesktopWindowMoveClient> x11_window_move_client_; std::unique_ptr<X11DesktopWindowMoveClient> x11_window_move_client_;
base::ObserverList<DesktopWindowTreeHostObserverX11>::Unchecked base::ObserverList<DesktopWindowTreeHostObserverX11>::Unchecked
......
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