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

X11 and Ozone: Fix LowerWindow feature.

The feature was accidentaly removed by crrev.com/c/1772537

This CL adds it back by adding necessary interfaces to
DWTHLinux, PlatformWindowLinux and X11Window.

The method is X11 specific and not in use for Wayland as long as
Wayland does not allow to manipulate clients' windows.

Bug: 1002358
Change-Id: Id43d5991f662f8986670ebef45f2443472806590
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1899464
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712692}
parent b732c861
...@@ -1559,6 +1559,10 @@ void XWindow::ConfineCursorTo(const gfx::Rect& bounds) { ...@@ -1559,6 +1559,10 @@ void XWindow::ConfineCursorTo(const gfx::Rect& bounds) {
has_pointer_barriers_ = true; has_pointer_barriers_ = true;
} }
void XWindow::LowerWindow() {
XLowerWindow(xdisplay_, xwindow_);
}
bool XWindow::ContainsPointInRegion(const gfx::Point& point) const { bool XWindow::ContainsPointInRegion(const gfx::Point& point) const {
if (!shape()) if (!shape())
return true; return true;
......
...@@ -139,6 +139,7 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow { ...@@ -139,6 +139,7 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
void CancelResize(); void CancelResize();
void NotifySwapAfterResize(); void NotifySwapAfterResize();
void ConfineCursorTo(const gfx::Rect& bounds); void ConfineCursorTo(const gfx::Rect& bounds);
void LowerWindow();
// Returns if the point is within XWindow shape. If shape is not set, always // Returns if the point is within XWindow shape. If shape is not set, always
// returns true. // returns true.
......
...@@ -37,4 +37,6 @@ bool PlatformWindowLinux::ContainsPointInXRegion( ...@@ -37,4 +37,6 @@ bool PlatformWindowLinux::ContainsPointInXRegion(
void PlatformWindowLinux::SetOpacityForXWindow(float opacity) {} void PlatformWindowLinux::SetOpacityForXWindow(float opacity) {}
void PlatformWindowLinux::LowerXWindow() {}
} // namespace ui } // namespace ui
...@@ -45,6 +45,10 @@ class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowLinux ...@@ -45,6 +45,10 @@ class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowLinux
// X11-specific. Asks X11 to set transparency of the X11 Root Window. Not // 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. // used for Wayland as it uses alpha channel to blend a window instead.
virtual void SetOpacityForXWindow(float opacity); 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 } // namespace ui
......
...@@ -443,6 +443,10 @@ bool X11Window::IsTranslucentWindowOpacitySupported() const { ...@@ -443,6 +443,10 @@ bool X11Window::IsTranslucentWindowOpacitySupported() const {
return ui::XVisualManager::GetInstance()->ArgbVisualAvailable(); return ui::XVisualManager::GetInstance()->ArgbVisualAvailable();
} }
void X11Window::LowerXWindow() {
XWindow::LowerWindow();
}
bool X11Window::HandleAsAtkEvent(XEvent* xev) { bool X11Window::HandleAsAtkEvent(XEvent* xev) {
#if !BUILDFLAG(USE_ATK) #if !BUILDFLAG(USE_ATK)
// TODO(crbug.com/1014934): Support ATK in Ozone/X11. // TODO(crbug.com/1014934): Support ATK in Ozone/X11.
......
...@@ -97,6 +97,7 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindowLinux, ...@@ -97,6 +97,7 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindowLinux,
const gfx::ImageSkia& app_icon) override; const gfx::ImageSkia& app_icon) override;
void SizeConstraintsChanged() override; void SizeConstraintsChanged() override;
bool IsTranslucentWindowOpacitySupported() const override; bool IsTranslucentWindowOpacitySupported() const override;
void LowerXWindow() override;
protected: protected:
PlatformWindowDelegateLinux* platform_window_delegate() const { PlatformWindowDelegateLinux* platform_window_delegate() const {
......
...@@ -132,6 +132,10 @@ bool DesktopWindowTreeHostLinux::ContainsPointInXRegion( ...@@ -132,6 +132,10 @@ bool DesktopWindowTreeHostLinux::ContainsPointInXRegion(
return GetPlatformWindowLinux()->ContainsPointInXRegion(point); return GetPlatformWindowLinux()->ContainsPointInXRegion(point);
} }
void DesktopWindowTreeHostLinux::LowerXWindow() {
GetPlatformWindowLinux()->LowerXWindow();
}
base::OnceClosure DesktopWindowTreeHostLinux::DisableEventListening() { base::OnceClosure DesktopWindowTreeHostLinux::DisableEventListening() {
// Allows to open multiple file-pickers. See https://crbug.com/678982 // Allows to open multiple file-pickers. See https://crbug.com/678982
modal_dialog_counter_++; modal_dialog_counter_++;
......
...@@ -65,6 +65,11 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux ...@@ -65,6 +65,11 @@ class VIEWS_EXPORT DesktopWindowTreeHostLinux
// Wayland. // Wayland.
bool ContainsPointInXRegion(const gfx::Point& point) const; bool ContainsPointInXRegion(const gfx::Point& point) const;
// Tells the X server to lower the |platform_window()| owned by this host down
// the stack so that it does not obscure any sibling windows. Not in use for
// Wayland.
void LowerXWindow();
// Disables event listening to make |dialog| modal. // Disables event listening to make |dialog| modal.
base::OnceClosure DisableEventListening(); base::OnceClosure DisableEventListening();
......
...@@ -149,7 +149,9 @@ void WindowEventFilterLinux::ToggleMaximizedState() { ...@@ -149,7 +149,9 @@ void WindowEventFilterLinux::ToggleMaximizedState() {
desktop_window_tree_host_->Maximize(); desktop_window_tree_host_->Maximize();
} }
void WindowEventFilterLinux::LowerWindow() {} void WindowEventFilterLinux::LowerWindow() {
desktop_window_tree_host_->LowerXWindow();
}
void WindowEventFilterLinux::MaybeDispatchHostWindowDragMovement( void WindowEventFilterLinux::MaybeDispatchHostWindowDragMovement(
int hittest, int hittest,
......
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