diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/components/exo/wayland/wayland_positioner.h | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/exo/wayland/wayland_positioner.h')
-rw-r--r-- | chromium/components/exo/wayland/wayland_positioner.h | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/chromium/components/exo/wayland/wayland_positioner.h b/chromium/components/exo/wayland/wayland_positioner.h index a623e0d4326..ccd5427838f 100644 --- a/chromium/components/exo/wayland/wayland_positioner.h +++ b/chromium/components/exo/wayland/wayland_positioner.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_EXO_WAYLAND_WAYLAND_POSITIONER_H_ #define COMPONENTS_EXO_WAYLAND_WAYLAND_POSITIONER_H_ -#include <xdg-shell-unstable-v6-server-protocol.h> +#include <xdg-shell-server-protocol.h> #include "base/macros.h" #include "ui/gfx/geometry/point.h" @@ -26,7 +26,14 @@ class WaylandPositioner { bool y_flipped; }; - WaylandPositioner() = default; + // Represents the 1-dimensional projection of the gravity/anchor values. + enum Direction { kNegative = -1, kNeutral = 0, kPositive = 1 }; + + // Controls whether anchor and gravity are set using the unstable bitfields or + // the stable enums. + enum Version { UNSTABLE, STABLE }; + + WaylandPositioner(Version v) : version_(v) {} // Calculate and return position from current state. Result CalculatePosition(const gfx::Rect& work_area, @@ -39,27 +46,31 @@ class WaylandPositioner { anchor_rect_ = std::move(anchor_rect); } - void SetAnchor(uint32_t anchor) { anchor_ = anchor; } + void SetAnchor(uint32_t anchor); - void SetGravity(uint32_t gravity) { gravity_ = gravity; } + void SetGravity(uint32_t gravity); void SetAdjustment(uint32_t adjustment) { adjustment_ = adjustment; } void SetOffset(gfx::Vector2d offset) { offset_ = std::move(offset); } private: + Version version_; + gfx::Size size_; gfx::Rect anchor_rect_; - uint32_t anchor_ = ZXDG_POSITIONER_V6_ANCHOR_NONE; + Direction anchor_x_ = kNeutral; + Direction anchor_y_ = kNeutral; - uint32_t gravity_ = ZXDG_POSITIONER_V6_GRAVITY_NONE; + Direction gravity_x_ = kNeutral; + Direction gravity_y_ = kNeutral; // A bitmask that defines the subset of modifications to the position/size // that are allowed, see zxdg_positioner.constraint_adjustment() for more // details. - uint32_t adjustment_ = ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_NONE; + uint32_t adjustment_ = XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE; // Defines an absolute translation (i.e. unaffected by flipping, scaling or // resizing) for the placement of the window relative to the |anchor_rect_|. |