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

ozone/Wayland: extract toplevel surface methods into WaylandSurface.

WaylandWindow handles too many things and confuses developers that
are not familiar with it. To make things better, extract
surface methods into WaylandSurface.

This change does not bring any functional changes except removed
is_active() method that was only used by tests. Instead, tests
just rely on the PlatformWindowDelegate::OnActivationChanged calls.

Test: ozone_unittests
Bug: 1028919
Change-Id: Ia58577f86d8e31ec93b113d887b34166fbe19cf0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1954478
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722592}
parent c61c6764
...@@ -91,6 +91,8 @@ source_set("wayland") { ...@@ -91,6 +91,8 @@ source_set("wayland") {
"host/wayland_shm.h", "host/wayland_shm.h",
"host/wayland_shm_buffer.cc", "host/wayland_shm_buffer.cc",
"host/wayland_shm_buffer.h", "host/wayland_shm_buffer.h",
"host/wayland_surface.cc",
"host/wayland_surface.h",
"host/wayland_touch.cc", "host/wayland_touch.cc",
"host/wayland_touch.h", "host/wayland_touch.h",
"host/wayland_window.cc", "host/wayland_window.cc",
......
This diff is collapsed.
// 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_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_SURFACE_H_
#define UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_SURFACE_H_
#include "ui/ozone/platform/wayland/host/wayland_window.h"
#include "ui/platform_window/platform_window_handler/wm_drag_handler.h"
#include "ui/platform_window/platform_window_handler/wm_move_resize_handler.h"
namespace ui {
class ShellSurfaceWrapper;
class WaylandSurface : public WaylandWindow,
public WmMoveResizeHandler,
public WmDragHandler {
public:
WaylandSurface(PlatformWindowDelegate* delegate,
WaylandConnection* connection);
~WaylandSurface() override;
ShellSurfaceWrapper* shell_surface() const { return shell_surface_.get(); }
// Apply the bounds specified in the most recent configure event. This should
// be called after processing all pending events in the wayland connection.
void ApplyPendingBounds();
// WmMoveResizeHandler
void DispatchHostWindowDragMovement(
int hittest,
const gfx::Point& pointer_location_in_px) override;
// WmDragHandler
void StartDrag(const ui::OSExchangeData& data,
int operation,
gfx::NativeCursor cursor,
base::OnceCallback<void(int)> callback) override;
// PlatformWindow
void Show(bool inactive) override;
void Hide() override;
bool IsVisible() const override;
void SetTitle(const base::string16& title) override;
void ToggleFullscreen() override;
void Maximize() override;
void Minimize() override;
void Restore() override;
PlatformWindowState GetPlatformWindowState() const override;
void SizeConstraintsChanged() override;
private:
// WaylandWindow overrides:
void HandleSurfaceConfigure(int32_t widht,
int32_t height,
bool is_maximized,
bool is_fullscreen,
bool is_activated) override;
void OnDragEnter(const gfx::PointF& point,
std::unique_ptr<OSExchangeData> data,
int operation) override;
int OnDragMotion(const gfx::PointF& point,
uint32_t time,
int operation) override;
void OnDragDrop(std::unique_ptr<OSExchangeData> data) override;
void OnDragLeave() override;
void OnDragSessionClose(uint32_t dnd_action) override;
bool OnInitialize(PlatformWindowInitProperties properties) override;
bool IsMinimized() const;
bool IsMaximized() const;
bool IsFullscreen() const;
void MaybeTriggerPendingStateChange();
// Creates a surface window, which is visible as a main window.
void CreateShellSurface();
WmMoveResizeHandler* AsWmMoveResizeHandler();
// Wrappers around shell surface.
std::unique_ptr<ShellSurfaceWrapper> shell_surface_;
base::OnceCallback<void(int)> drag_closed_callback_;
// These bounds attributes below have suffices that indicate units used.
// Wayland operates in DIP but the platform operates in physical pixels so
// our WaylandSurface is the link that has to translate the units. See also
// comments in the implementation.
//
// Bounds that will be applied when the window state is finalized. The window
// may get several configuration events that update the pending bounds, and
// only upon finalizing the state is the latest value stored as the current
// bounds via |ApplyPendingBounds|. Measured in DIP because updated in the
// handler that receives DIP from Wayland.
gfx::Rect pending_bounds_dip_;
// Stores current states of the window.
PlatformWindowState state_;
// Stores a pending state of the window, which is used before the surface is
// activated.
PlatformWindowState pending_state_;
bool is_active_ = false;
bool is_minimizing_ = false;
DISALLOW_COPY_AND_ASSIGN(WaylandSurface);
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_SURFACE_H_
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include "ui/ozone/platform/wayland/common/wayland_object.h" #include "ui/ozone/platform/wayland/common/wayland_object.h"
#include "ui/platform_window/platform_window.h" #include "ui/platform_window/platform_window.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_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_init_properties.h"
namespace gfx { namespace gfx {
...@@ -33,12 +31,8 @@ class BitmapCursorOzone; ...@@ -33,12 +31,8 @@ class BitmapCursorOzone;
class OSExchangeData; class OSExchangeData;
class WaylandConnection; class WaylandConnection;
class ShellPopupWrapper; class ShellPopupWrapper;
class ShellSurfaceWrapper;
class WaylandWindow : public PlatformWindow, class WaylandWindow : public PlatformWindow, public PlatformEventDispatcher {
public PlatformEventDispatcher,
public WmMoveResizeHandler,
public WmDragHandler {
public: public:
~WaylandWindow() override; ~WaylandWindow() override;
...@@ -59,17 +53,12 @@ class WaylandWindow : public PlatformWindow, ...@@ -59,17 +53,12 @@ class WaylandWindow : public PlatformWindow,
void UpdateBufferScale(bool update_bounds); void UpdateBufferScale(bool update_bounds);
wl_surface* surface() const { return surface_.get(); } wl_surface* surface() const { return surface_.get(); }
ShellSurfaceWrapper* shell_surface() const { return shell_surface_.get(); }
ShellPopupWrapper* shell_popup() const { return shell_popup_.get(); } ShellPopupWrapper* shell_popup() const { return shell_popup_.get(); }
WaylandWindow* parent_window() const { return parent_window_; } WaylandWindow* parent_window() const { return parent_window_; }
gfx::AcceleratedWidget GetWidget() const; gfx::AcceleratedWidget GetWidget() const;
// Apply the bounds specified in the most recent configure event. This should
// be called after processing all pending events in the wayland connection.
void ApplyPendingBounds();
// Set whether this window has pointer focus and should dispatch mouse events. // Set whether this window has pointer focus and should dispatch mouse events.
void SetPointerFocus(bool focus); void SetPointerFocus(bool focus);
bool has_pointer_focus() const { return has_pointer_focus_; } bool has_pointer_focus() const { return has_pointer_focus_; }
...@@ -94,23 +83,10 @@ class WaylandWindow : public PlatformWindow, ...@@ -94,23 +83,10 @@ class WaylandWindow : public PlatformWindow,
int32_t buffer_scale() const { return buffer_scale_; } int32_t buffer_scale() const { return buffer_scale_; }
bool is_active() const { return is_active_; }
const base::flat_set<uint32_t>& entered_outputs_ids() const { const base::flat_set<uint32_t>& entered_outputs_ids() const {
return entered_outputs_ids_; return entered_outputs_ids_;
} }
// WmMoveResizeHandler
void DispatchHostWindowDragMovement(
int hittest,
const gfx::Point& pointer_location_in_px) override;
// WmDragHandler
void StartDrag(const ui::OSExchangeData& data,
int operation,
gfx::NativeCursor cursor,
base::OnceCallback<void(int)> callback) override;
// PlatformWindow // PlatformWindow
void Show(bool inactive) override; void Show(bool inactive) override;
void Hide() override; void Hide() override;
...@@ -147,49 +123,49 @@ class WaylandWindow : public PlatformWindow, ...@@ -147,49 +123,49 @@ class WaylandWindow : public PlatformWindow,
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;
// Handles the configuration events coming from the surface (see // Handles the configuration events coming from the shell objects.
// |XDGSurfaceWrapperStable::ConfigureTopLevel| and // The width and height come in DIP of the output that the surface is
// |XDGSurfaceWrapperV6::ConfigureTopLevel|. The width and height come in // currently bound to.
// DIP of the output that the surface is currently bound to. virtual void HandleSurfaceConfigure(int32_t widht,
void HandleSurfaceConfigure(int32_t widht, int32_t height,
int32_t height, bool is_maximized,
bool is_maximized, bool is_fullscreen,
bool is_fullscreen, bool is_activated);
bool is_activated);
void HandlePopupConfigure(const gfx::Rect& bounds); void HandlePopupConfigure(const gfx::Rect& bounds);
void OnCloseRequest(); void OnCloseRequest();
void OnDragEnter(const gfx::PointF& point, // Notifies about drag/drop session events.
std::unique_ptr<OSExchangeData> data, virtual void OnDragEnter(const gfx::PointF& point,
int operation); std::unique_ptr<OSExchangeData> data,
int OnDragMotion(const gfx::PointF& point, uint32_t time, int operation); int operation);
void OnDragDrop(std::unique_ptr<OSExchangeData> data); virtual int OnDragMotion(const gfx::PointF& point,
void OnDragLeave(); uint32_t time,
void OnDragSessionClose(uint32_t dnd_action); int operation);
virtual void OnDragDrop(std::unique_ptr<OSExchangeData> data);
virtual void OnDragLeave();
virtual void OnDragSessionClose(uint32_t dnd_action);
protected:
WaylandWindow(PlatformWindowDelegate* delegate,
WaylandConnection* connection);
WaylandConnection* connection() { return connection_; }
PlatformWindowDelegate* delegate() { return delegate_; }
// Sets bounds in dip.
void SetBoundsDip(const gfx::Rect& bounds_dip);
private: private:
FRIEND_TEST_ALL_PREFIXES(WaylandScreenTest, SetBufferScale); FRIEND_TEST_ALL_PREFIXES(WaylandScreenTest, SetBufferScale);
WaylandWindow(PlatformWindowDelegate* delegate,
WaylandConnection* connection);
// Initializes the WaylandWindow with supplied properties. // Initializes the WaylandWindow with supplied properties.
bool Initialize(PlatformWindowInitProperties properties); bool Initialize(PlatformWindowInitProperties properties);
void SetBoundsDip(const gfx::Rect& bounds_dip);
void SetBufferScale(int32_t scale, bool update_bounds); void SetBufferScale(int32_t scale, bool update_bounds);
bool IsMinimized() const;
bool IsMaximized() const;
bool IsFullscreen() const;
void MaybeTriggerPendingStateChange();
// Creates a popup window, which is visible as a menu window. // Creates a popup window, which is visible as a menu window.
void CreateShellPopup(); void CreateShellPopup();
// Creates a surface window, which is visible as a main window.
void CreateShellSurface();
// Creates (if necessary) and show subsurface window, to host // Creates (if necessary) and show subsurface window, to host
// tooltip's content. // tooltip's content.
void CreateAndShowTooltipSubSurface(); void CreateAndShowTooltipSubSurface();
...@@ -200,8 +176,6 @@ class WaylandWindow : public PlatformWindow, ...@@ -200,8 +176,6 @@ class WaylandWindow : public PlatformWindow,
// Returns a root parent window. // Returns a root parent window.
WaylandWindow* GetRootParentWindow(); WaylandWindow* GetRootParentWindow();
WmMoveResizeHandler* AsWmMoveResizeHandler();
// Install a surface listener and start getting wl_output enter/leave events. // Install a surface listener and start getting wl_output enter/leave events.
void AddSurfaceListener(); void AddSurfaceListener();
...@@ -221,6 +195,9 @@ class WaylandWindow : public PlatformWindow, ...@@ -221,6 +195,9 @@ class WaylandWindow : public PlatformWindow,
bool IsOpaqueWindow() const; bool IsOpaqueWindow() const;
// Additional initialization of derived classes.
virtual bool OnInitialize(PlatformWindowInitProperties properties);
// wl_surface_listener // wl_surface_listener
static void Enter(void* data, static void Enter(void* data,
struct wl_surface* wl_surface, struct wl_surface* wl_surface,
...@@ -239,25 +216,11 @@ class WaylandWindow : public PlatformWindow, ...@@ -239,25 +216,11 @@ class WaylandWindow : public PlatformWindow,
// Wrappers around xdg v5 and xdg v6 objects. WaylandWindow doesn't // Wrappers around xdg v5 and xdg v6 objects. WaylandWindow doesn't
// know anything about the version. // know anything about the version.
std::unique_ptr<ShellSurfaceWrapper> shell_surface_;
std::unique_ptr<ShellPopupWrapper> shell_popup_; std::unique_ptr<ShellPopupWrapper> shell_popup_;
// The current cursor bitmap (immutable). // The current cursor bitmap (immutable).
scoped_refptr<BitmapCursorOzone> bitmap_; scoped_refptr<BitmapCursorOzone> bitmap_;
base::OnceCallback<void(int)> drag_closed_callback_;
// These bounds attributes below have suffices that indicate units used.
// Wayland operates in DIP but the platform operates in physical pixels so
// our WaylandWindow is the link that has to translate the units. See also
// comments in the implementation.
//
// Bounds that will be applied when the window state is finalized. The window
// may get several configuration events that update the pending bounds, and
// only upon finalizing the state is the latest value stored as the current
// bounds via |ApplyPendingBounds|. Measured in DIP because updated in the
// handler that receives DIP from Wayland.
gfx::Rect pending_bounds_dip_;
// Current bounds of the platform window. // Current bounds of the platform window.
gfx::Rect bounds_px_; gfx::Rect bounds_px_;
// The bounds of the platform window before it went maximized or fullscreen. // The bounds of the platform window before it went maximized or fullscreen.
...@@ -275,18 +238,9 @@ class WaylandWindow : public PlatformWindow, ...@@ -275,18 +238,9 @@ class WaylandWindow : public PlatformWindow,
// We need it to place and size the menus properly. // We need it to place and size the menus properly.
float ui_scale_ = 1.0; float ui_scale_ = 1.0;
// Stores current states of the window.
PlatformWindowState state_;
// Stores a pending state of the window, which is used before the surface is
// activated.
PlatformWindowState pending_state_;
// Stores current opacity of the window. Set on ::Initialize call. // Stores current opacity of the window. Set on ::Initialize call.
ui::PlatformWindowOpacity opacity_; ui::PlatformWindowOpacity opacity_;
bool is_active_ = false;
bool is_minimizing_ = false;
bool is_tooltip_ = false; bool is_tooltip_ = false;
// For top level window, stores IDs of outputs that the window is currently // For top level window, stores IDs of outputs that the window is currently
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <memory> #include <memory>
#include "ui/ozone/platform/wayland/host/wayland_surface.h"
#include "ui/ozone/platform/wayland/host/wayland_window.h" #include "ui/ozone/platform/wayland/host/wayland_window.h"
namespace ui { namespace ui {
...@@ -15,12 +16,30 @@ std::unique_ptr<WaylandWindow> WaylandWindow::Create( ...@@ -15,12 +16,30 @@ std::unique_ptr<WaylandWindow> WaylandWindow::Create(
PlatformWindowDelegate* delegate, PlatformWindowDelegate* delegate,
WaylandConnection* connection, WaylandConnection* connection,
PlatformWindowInitProperties properties) { PlatformWindowInitProperties properties) {
// TODO(msisov): once WaylandWindow becomes a base class, add switch cases to std::unique_ptr<WaylandWindow> window;
// create different Wayland windows. switch (properties.type) {
std::unique_ptr<WaylandWindow> window( case PlatformWindowType::kMenu:
new WaylandWindow(delegate, connection)); case PlatformWindowType::kPopup:
return window->Initialize(std::move(properties)) ? std::move(window) // TODO(msisov): Add WaylandPopup.
: nullptr; window.reset(new WaylandWindow(delegate, connection));
break;
case PlatformWindowType::kTooltip:
// TODO(msisov): Add WaylandSubsurface.
window.reset(new WaylandWindow(delegate, connection));
break;
case PlatformWindowType::kWindow:
case PlatformWindowType::kBubble:
case PlatformWindowType::kDrag:
// TODO(msisov): Figure out what kind of surface we need to create for
// bubble and drag windows.
window.reset(new WaylandSurface(delegate, connection));
break;
default:
NOTREACHED();
break;
}
return window && window->Initialize(std::move(properties)) ? std::move(window)
: nullptr;
} }
} // namespace ui } // namespace ui
\ No newline at end of file
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "ui/ozone/platform/wayland/test/test_wayland_server_thread.h" #include "ui/ozone/platform/wayland/test/test_wayland_server_thread.h"
#include "ui/ozone/platform/wayland/test/wayland_test.h" #include "ui/ozone/platform/wayland/test/wayland_test.h"
#include "ui/ozone/test/mock_platform_window_delegate.h" #include "ui/ozone/test/mock_platform_window_delegate.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"
using ::testing::_; using ::testing::_;
...@@ -249,7 +250,6 @@ TEST_P(WaylandWindowTest, MaximizeAndRestore) { ...@@ -249,7 +250,6 @@ TEST_P(WaylandWindowTest, MaximizeAndRestore) {
SendConfigureEvent(kMaximizedBounds.width(), kMaximizedBounds.height(), 2, SendConfigureEvent(kMaximizedBounds.width(), kMaximizedBounds.height(), 2,
inactive_maximized.get()); inactive_maximized.get());
Sync(); Sync();
EXPECT_FALSE(window_->is_active());
VerifyAndClearExpectations(); VerifyAndClearExpectations();
EXPECT_CALL(*xdg_surface_, SetWindowGeometry(0, 0, kMaximizedBounds.width(), EXPECT_CALL(*xdg_surface_, SetWindowGeometry(0, 0, kMaximizedBounds.width(),
...@@ -259,7 +259,6 @@ TEST_P(WaylandWindowTest, MaximizeAndRestore) { ...@@ -259,7 +259,6 @@ TEST_P(WaylandWindowTest, MaximizeAndRestore) {
SendConfigureEvent(kMaximizedBounds.width(), kMaximizedBounds.height(), 3, SendConfigureEvent(kMaximizedBounds.width(), kMaximizedBounds.height(), 3,
active_maximized.get()); active_maximized.get());
Sync(); Sync();
EXPECT_TRUE(window_->is_active());
VerifyAndClearExpectations(); VerifyAndClearExpectations();
EXPECT_CALL(*xdg_surface_, SetWindowGeometry(0, 0, kNormalBounds.width(), EXPECT_CALL(*xdg_surface_, SetWindowGeometry(0, 0, kNormalBounds.width(),
...@@ -703,21 +702,17 @@ TEST_P(WaylandWindowTest, ConfigureEventWithNulledSize) { ...@@ -703,21 +702,17 @@ TEST_P(WaylandWindowTest, ConfigureEventWithNulledSize) {
} }
TEST_P(WaylandWindowTest, OnActivationChanged) { TEST_P(WaylandWindowTest, OnActivationChanged) {
EXPECT_FALSE(window_->is_active());
{ {
ScopedWlArray states = InitializeWlArrayWithActivatedState(); ScopedWlArray states = InitializeWlArrayWithActivatedState();
EXPECT_CALL(delegate_, OnActivationChanged(Eq(true))); EXPECT_CALL(delegate_, OnActivationChanged(Eq(true)));
SendConfigureEvent(0, 0, 1, states.get()); SendConfigureEvent(0, 0, 1, states.get());
Sync(); Sync();
EXPECT_TRUE(window_->is_active());
} }
ScopedWlArray states; ScopedWlArray states;
EXPECT_CALL(delegate_, OnActivationChanged(Eq(false))); EXPECT_CALL(delegate_, OnActivationChanged(Eq(false)));
SendConfigureEvent(0, 0, 2, states.get()); SendConfigureEvent(0, 0, 2, states.get());
Sync(); Sync();
EXPECT_FALSE(window_->is_active());
} }
TEST_P(WaylandWindowTest, OnAcceleratedWidgetDestroy) { TEST_P(WaylandWindowTest, OnAcceleratedWidgetDestroy) {
...@@ -847,7 +842,7 @@ TEST_P(WaylandWindowTest, CanDispatchEventToMenuWindowNested) { ...@@ -847,7 +842,7 @@ TEST_P(WaylandWindowTest, CanDispatchEventToMenuWindowNested) {
TEST_P(WaylandWindowTest, DispatchWindowMove) { TEST_P(WaylandWindowTest, DispatchWindowMove) {
EXPECT_CALL(*GetXdgSurface(), Move(_)); EXPECT_CALL(*GetXdgSurface(), Move(_));
window_->DispatchHostWindowDragMovement(HTCAPTION, gfx::Point()); ui::GetWmMoveResizeHandler(*window_)->DispatchHostWindowDragMovement(HTCAPTION, gfx::Point());
} }
// Makes sure hit tests are converted into right edges. // Makes sure hit tests are converted into right edges.
...@@ -855,11 +850,14 @@ TEST_P(WaylandWindowTest, DispatchWindowResize) { ...@@ -855,11 +850,14 @@ TEST_P(WaylandWindowTest, DispatchWindowResize) {
std::vector<int> hit_test_values; std::vector<int> hit_test_values;
InitializeWithSupportedHitTestValues(&hit_test_values); InitializeWithSupportedHitTestValues(&hit_test_values);
auto* wm_move_resize_handler = ui::GetWmMoveResizeHandler(*window_);
for (const int value : hit_test_values) { for (const int value : hit_test_values) {
{ {
uint32_t direction = wl::IdentifyDirection(*(connection_.get()), value); uint32_t direction = wl::IdentifyDirection(*(connection_.get()), value);
EXPECT_CALL(*GetXdgSurface(), Resize(_, Eq(direction))); EXPECT_CALL(*GetXdgSurface(), Resize(_, Eq(direction)));
window_->DispatchHostWindowDragMovement(value, gfx::Point()); wm_move_resize_handler->DispatchHostWindowDragMovement(value,
gfx::Point());
} }
} }
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h" #include "ui/ozone/platform/wayland/host/wayland_connection.h"
#include "ui/ozone/platform/wayland/host/wayland_pointer.h" #include "ui/ozone/platform/wayland/host/wayland_pointer.h"
#include "ui/ozone/platform/wayland/host/wayland_surface.h"
#include "ui/ozone/platform/wayland/host/wayland_window.h" #include "ui/ozone/platform/wayland/host/wayland_window.h"
#include "ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.h" #include "ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.h"
...@@ -290,8 +291,10 @@ bool XDGPopupWrapperImpl::InitializeStable(WaylandConnection* connection, ...@@ -290,8 +291,10 @@ bool XDGPopupWrapperImpl::InitializeStable(WaylandConnection* connection,
wayland_window_->parent_window()->shell_popup()); wayland_window_->parent_window()->shell_popup());
parent_xdg_surface = popup->xdg_surface(); parent_xdg_surface = popup->xdg_surface();
} else { } else {
WaylandSurface* wayland_surface =
static_cast<WaylandSurface*>(wayland_window_->parent_window());
parent_xdg_surface = reinterpret_cast<XDGSurfaceWrapperImpl*>( parent_xdg_surface = reinterpret_cast<XDGSurfaceWrapperImpl*>(
wayland_window_->parent_window()->shell_surface()); wayland_surface->shell_surface());
} }
if (!parent_xdg_surface) if (!parent_xdg_surface)
...@@ -405,8 +408,10 @@ bool XDGPopupWrapperImpl::InitializeV6(WaylandConnection* connection, ...@@ -405,8 +408,10 @@ bool XDGPopupWrapperImpl::InitializeV6(WaylandConnection* connection,
wayland_window_->parent_window()->shell_popup()); wayland_window_->parent_window()->shell_popup());
parent_xdg_surface = popup->xdg_surface(); parent_xdg_surface = popup->xdg_surface();
} else { } else {
WaylandSurface* wayland_surface =
static_cast<WaylandSurface*>(wayland_window_->parent_window());
parent_xdg_surface = reinterpret_cast<XDGSurfaceWrapperImpl*>( parent_xdg_surface = reinterpret_cast<XDGSurfaceWrapperImpl*>(
wayland_window_->parent_window()->shell_surface()); wayland_surface->shell_surface());
} }
if (!parent_xdg_surface) if (!parent_xdg_surface)
......
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