summaryrefslogtreecommitdiff
path: root/chromium/components/exo/wayland/wayland_positioner.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/exo/wayland/wayland_positioner.h')
-rw-r--r--chromium/components/exo/wayland/wayland_positioner.h25
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_|.