SDL  2.0
The zxdg_positioner_v6 interface

The xdg_positioner provides a collection of rules for the placement of a child surface relative to a parent surface. Rules can be defined to ensure the child surface remains within the visible area's borders, and to specify how the child surface changes its position, such as sliding along an axis, or flipping around a rectangle. These positioner-created rules are constrained by the requirement that a child surface must intersect with or be at least partially adjacent to its parent surface. More...

Macros

#define ZXDG_POSITIONER_V6_DESTROY_SINCE_VERSION   1
 
#define ZXDG_POSITIONER_V6_SET_SIZE_SINCE_VERSION   1
 
#define ZXDG_POSITIONER_V6_SET_ANCHOR_RECT_SINCE_VERSION   1
 
#define ZXDG_POSITIONER_V6_SET_ANCHOR_SINCE_VERSION   1
 
#define ZXDG_POSITIONER_V6_SET_GRAVITY_SINCE_VERSION   1
 
#define ZXDG_POSITIONER_V6_SET_CONSTRAINT_ADJUSTMENT_SINCE_VERSION   1
 
#define ZXDG_POSITIONER_V6_SET_OFFSET_SINCE_VERSION   1
 

Enumerations

enum  zxdg_positioner_v6_constraint_adjustment {
  ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_NONE = 0,
  ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_X = 1,
  ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_Y = 2,
  ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_X = 4,
  ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_Y = 8,
  ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_X = 16,
  ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 32
}
 

Functions

static void zxdg_positioner_v6_set_user_data (struct zxdg_positioner_v6 *zxdg_positioner_v6, void *user_data)
 
static voidzxdg_positioner_v6_get_user_data (struct zxdg_positioner_v6 *zxdg_positioner_v6)
 
static void zxdg_positioner_v6_destroy (struct zxdg_positioner_v6 *zxdg_positioner_v6)
 
static void zxdg_positioner_v6_set_size (struct zxdg_positioner_v6 *zxdg_positioner_v6, int32_t width, int32_t height)
 
static void zxdg_positioner_v6_set_anchor_rect (struct zxdg_positioner_v6 *zxdg_positioner_v6, int32_t x, int32_t y, int32_t width, int32_t height)
 
static void zxdg_positioner_v6_set_anchor (struct zxdg_positioner_v6 *zxdg_positioner_v6, uint32_t anchor)
 
static void zxdg_positioner_v6_set_gravity (struct zxdg_positioner_v6 *zxdg_positioner_v6, uint32_t gravity)
 
static void zxdg_positioner_v6_set_constraint_adjustment (struct zxdg_positioner_v6 *zxdg_positioner_v6, uint32_t constraint_adjustment)
 
static void zxdg_positioner_v6_set_offset (struct zxdg_positioner_v6 *zxdg_positioner_v6, int32_t x, int32_t y)
 

Detailed Description

The xdg_positioner provides a collection of rules for the placement of a child surface relative to a parent surface. Rules can be defined to ensure the child surface remains within the visible area's borders, and to specify how the child surface changes its position, such as sliding along an axis, or flipping around a rectangle. These positioner-created rules are constrained by the requirement that a child surface must intersect with or be at least partially adjacent to its parent surface.

See the various requests for details about possible rules.

At the time of the request, the compositor makes a copy of the rules specified by the xdg_positioner. Thus, after the request is complete the xdg_positioner object can be destroyed or reused; further changes to the object will have no effect on previous usages.

For an xdg_positioner object to be considered complete, it must have a non-zero size set by set_size, and a non-zero anchor rectangle set by set_anchor_rect. Passing an incomplete xdg_positioner object when positioning a surface raises an error.

Macro Definition Documentation

◆ ZXDG_POSITIONER_V6_DESTROY_SINCE_VERSION

#define ZXDG_POSITIONER_V6_DESTROY_SINCE_VERSION   1

Definition at line 683 of file xdg-shell-unstable-v6-client-protocol.h.

◆ ZXDG_POSITIONER_V6_SET_ANCHOR_RECT_SINCE_VERSION

#define ZXDG_POSITIONER_V6_SET_ANCHOR_RECT_SINCE_VERSION   1

Definition at line 691 of file xdg-shell-unstable-v6-client-protocol.h.

◆ ZXDG_POSITIONER_V6_SET_ANCHOR_SINCE_VERSION

#define ZXDG_POSITIONER_V6_SET_ANCHOR_SINCE_VERSION   1

Definition at line 695 of file xdg-shell-unstable-v6-client-protocol.h.

◆ ZXDG_POSITIONER_V6_SET_CONSTRAINT_ADJUSTMENT_SINCE_VERSION

#define ZXDG_POSITIONER_V6_SET_CONSTRAINT_ADJUSTMENT_SINCE_VERSION   1

Definition at line 703 of file xdg-shell-unstable-v6-client-protocol.h.

◆ ZXDG_POSITIONER_V6_SET_GRAVITY_SINCE_VERSION

#define ZXDG_POSITIONER_V6_SET_GRAVITY_SINCE_VERSION   1

Definition at line 699 of file xdg-shell-unstable-v6-client-protocol.h.

◆ ZXDG_POSITIONER_V6_SET_OFFSET_SINCE_VERSION

#define ZXDG_POSITIONER_V6_SET_OFFSET_SINCE_VERSION   1

Definition at line 707 of file xdg-shell-unstable-v6-client-protocol.h.

◆ ZXDG_POSITIONER_V6_SET_SIZE_SINCE_VERSION

#define ZXDG_POSITIONER_V6_SET_SIZE_SINCE_VERSION   1

Definition at line 687 of file xdg-shell-unstable-v6-client-protocol.h.

Enumeration Type Documentation

◆ zxdg_positioner_v6_constraint_adjustment

constraint adjustments

The constraint adjustment value define ways the compositor will adjust the position of the surface, if the unadjusted position would result in the surface being partly constrained.

Whether a surface is considered 'constrained' is left to the compositor to determine. For example, the surface may be partly outside the compositor's defined 'work area', thus necessitating the child surface's position be adjusted until it is entirely inside the work area.

The adjustments can be combined, according to a defined precedence: 1) Flip, 2) Slide, 3) Resize.

Enumerator
ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_NONE 

don't move the child surface when constrained

Don't alter the surface position even if it is constrained on some axis, for example partially outside the edge of a monitor.

ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_X 

move along the x axis until unconstrained

Slide the surface along the x axis until it is no longer constrained.

First try to slide towards the direction of the gravity on the x axis until either the edge in the opposite direction of the gravity is unconstrained or the edge in the direction of the gravity is constrained.

Then try to slide towards the opposite direction of the gravity on the x axis until either the edge in the direction of the gravity is unconstrained or the edge in the opposite direction of the gravity is constrained.

ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_Y 

move along the y axis until unconstrained

Slide the surface along the y axis until it is no longer constrained.

First try to slide towards the direction of the gravity on the y axis until either the edge in the opposite direction of the gravity is unconstrained or the edge in the direction of the gravity is constrained.

Then try to slide towards the opposite direction of the gravity on the y axis until either the edge in the direction of the gravity is unconstrained or the edge in the opposite direction of the gravity is constrained.

ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_X 

invert the anchor and gravity on the x axis

Invert the anchor and gravity on the x axis if the surface is constrained on the x axis. For example, if the left edge of the surface is constrained, the gravity is 'left' and the anchor is 'left', change the gravity to 'right' and the anchor to 'right'.

If the adjusted position also ends up being constrained, the resulting position of the flip_x adjustment will be the one before the adjustment.

ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_Y 

invert the anchor and gravity on the y axis

Invert the anchor and gravity on the y axis if the surface is constrained on the y axis. For example, if the bottom edge of the surface is constrained, the gravity is 'bottom' and the anchor is 'bottom', change the gravity to 'top' and the anchor to 'top'.

If the adjusted position also ends up being constrained, the resulting position of the flip_y adjustment will be the one before the adjustment.

ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_X 

horizontally resize the surface

Resize the surface horizontally so that it is completely unconstrained.

ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_Y 

vertically resize the surface

Resize the surface vertically so that it is completely unconstrained.

Definition at line 585 of file xdg-shell-unstable-v6-client-protocol.h.

585  {
586  /**
587  * don't move the child surface when constrained
588  *
589  * Don't alter the surface position even if it is constrained on
590  * some axis, for example partially outside the edge of a monitor.
591  */
593  /**
594  * move along the x axis until unconstrained
595  *
596  * Slide the surface along the x axis until it is no longer
597  * constrained.
598  *
599  * First try to slide towards the direction of the gravity on the x
600  * axis until either the edge in the opposite direction of the
601  * gravity is unconstrained or the edge in the direction of the
602  * gravity is constrained.
603  *
604  * Then try to slide towards the opposite direction of the gravity
605  * on the x axis until either the edge in the direction of the
606  * gravity is unconstrained or the edge in the opposite direction
607  * of the gravity is constrained.
608  */
610  /**
611  * move along the y axis until unconstrained
612  *
613  * Slide the surface along the y axis until it is no longer
614  * constrained.
615  *
616  * First try to slide towards the direction of the gravity on the y
617  * axis until either the edge in the opposite direction of the
618  * gravity is unconstrained or the edge in the direction of the
619  * gravity is constrained.
620  *
621  * Then try to slide towards the opposite direction of the gravity
622  * on the y axis until either the edge in the direction of the
623  * gravity is unconstrained or the edge in the opposite direction
624  * of the gravity is constrained.
625  */
627  /**
628  * invert the anchor and gravity on the x axis
629  *
630  * Invert the anchor and gravity on the x axis if the surface is
631  * constrained on the x axis. For example, if the left edge of the
632  * surface is constrained, the gravity is 'left' and the anchor is
633  * 'left', change the gravity to 'right' and the anchor to 'right'.
634  *
635  * If the adjusted position also ends up being constrained, the
636  * resulting position of the flip_x adjustment will be the one
637  * before the adjustment.
638  */
640  /**
641  * invert the anchor and gravity on the y axis
642  *
643  * Invert the anchor and gravity on the y axis if the surface is
644  * constrained on the y axis. For example, if the bottom edge of
645  * the surface is constrained, the gravity is 'bottom' and the
646  * anchor is 'bottom', change the gravity to 'top' and the anchor
647  * to 'top'.
648  *
649  * If the adjusted position also ends up being constrained, the
650  * resulting position of the flip_y adjustment will be the one
651  * before the adjustment.
652  */
654  /**
655  * horizontally resize the surface
656  *
657  * Resize the surface horizontally so that it is completely
658  * unconstrained.
659  */
661  /**
662  * vertically resize the surface
663  *
664  * Resize the surface vertically so that it is completely
665  * unconstrained.
666  */
668 };

Function Documentation

◆ zxdg_positioner_v6_destroy()

static void zxdg_positioner_v6_destroy ( struct zxdg_positioner_v6 *  zxdg_positioner_v6)
inlinestatic

Notify the compositor that the xdg_positioner will no longer be used.

Definition at line 735 of file xdg-shell-unstable-v6-client-protocol.h.

736 {
737  wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
738  ZXDG_POSITIONER_V6_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), WL_MARSHAL_FLAG_DESTROY);
739 }

References NULL, and ZXDG_POSITIONER_V6_DESTROY.

◆ zxdg_positioner_v6_get_user_data()

static void* zxdg_positioner_v6_get_user_data ( struct zxdg_positioner_v6 *  zxdg_positioner_v6)
inlinestatic

Definition at line 718 of file xdg-shell-unstable-v6-client-protocol.h.

719 {
720  return wl_proxy_get_user_data((struct wl_proxy *) zxdg_positioner_v6);
721 }

◆ zxdg_positioner_v6_set_anchor()

static void zxdg_positioner_v6_set_anchor ( struct zxdg_positioner_v6 *  zxdg_positioner_v6,
uint32_t  anchor 
)
inlinestatic

Defines a set of edges for the anchor rectangle. These are used to derive an anchor point that the child surface will be positioned relative to. If two orthogonal edges are specified (e.g. 'top' and 'left'), then the anchor point will be the intersection of the edges (e.g. the top left position of the rectangle); otherwise, the derived anchor point will be centered on the specified edge, or in the center of the anchor rectangle if no edge is specified.

If two parallel anchor edges are specified (e.g. 'left' and 'right'), the invalid_input error is raised.

Definition at line 793 of file xdg-shell-unstable-v6-client-protocol.h.

794 {
795  wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
796  ZXDG_POSITIONER_V6_SET_ANCHOR, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), 0, anchor);
797 }

References NULL, and ZXDG_POSITIONER_V6_SET_ANCHOR.

◆ zxdg_positioner_v6_set_anchor_rect()

static void zxdg_positioner_v6_set_anchor_rect ( struct zxdg_positioner_v6 *  zxdg_positioner_v6,
int32_t  x,
int32_t  y,
int32_t  width,
int32_t  height 
)
inlinestatic

Specify the anchor rectangle within the parent surface that the child surface will be placed relative to. The rectangle is relative to the window geometry as defined by xdg_surface.set_window_geometry of the parent surface. The rectangle must be at least 1x1 large.

When the xdg_positioner object is used to position a child surface, the anchor rectangle may not extend outside the window geometry of the positioned child's parent surface.

If a zero or negative size is set the invalid_input error is raised.

Definition at line 772 of file xdg-shell-unstable-v6-client-protocol.h.

773 {
774  wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
775  ZXDG_POSITIONER_V6_SET_ANCHOR_RECT, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), 0, x, y, width, height);
776 }

References NULL, and ZXDG_POSITIONER_V6_SET_ANCHOR_RECT.

◆ zxdg_positioner_v6_set_constraint_adjustment()

static void zxdg_positioner_v6_set_constraint_adjustment ( struct zxdg_positioner_v6 *  zxdg_positioner_v6,
uint32_t  constraint_adjustment 
)
inlinestatic

Specify how the window should be positioned if the originally intended position caused the surface to be constrained, meaning at least partially outside positioning boundaries set by the compositor. The adjustment is set by constructing a bitmask describing the adjustment to be made when the surface is constrained on that axis.

If no bit for one axis is set, the compositor will assume that the child surface should not change its position on that axis when constrained.

If more than one bit for one axis is set, the order of how adjustments are applied is specified in the corresponding adjustment descriptions.

The default adjustment is none.

Definition at line 837 of file xdg-shell-unstable-v6-client-protocol.h.

838 {
839  wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
840  ZXDG_POSITIONER_V6_SET_CONSTRAINT_ADJUSTMENT, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), 0, constraint_adjustment);
841 }

References NULL, and ZXDG_POSITIONER_V6_SET_CONSTRAINT_ADJUSTMENT.

◆ zxdg_positioner_v6_set_gravity()

static void zxdg_positioner_v6_set_gravity ( struct zxdg_positioner_v6 *  zxdg_positioner_v6,
uint32_t  gravity 
)
inlinestatic

Defines in what direction a surface should be positioned, relative to the anchor point of the parent surface. If two orthogonal gravities are specified (e.g. 'bottom' and 'right'), then the child surface will be placed in the specified direction; otherwise, the child surface will be centered over the anchor point on any axis that had no gravity specified.

If two parallel gravities are specified (e.g. 'left' and 'right'), the invalid_input error is raised.

Definition at line 813 of file xdg-shell-unstable-v6-client-protocol.h.

814 {
815  wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
816  ZXDG_POSITIONER_V6_SET_GRAVITY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), 0, gravity);
817 }

References NULL, and ZXDG_POSITIONER_V6_SET_GRAVITY.

◆ zxdg_positioner_v6_set_offset()

static void zxdg_positioner_v6_set_offset ( struct zxdg_positioner_v6 *  zxdg_positioner_v6,
int32_t  x,
int32_t  y 
)
inlinestatic

Specify the surface position offset relative to the position of the anchor on the anchor rectangle and the anchor on the surface. For example if the anchor of the anchor rectangle is at (x, y), the surface has the gravity bottom|right, and the offset is (ox, oy), the calculated surface position will be (x + ox, y + oy). The offset position of the surface is the one used for constraint testing. See set_constraint_adjustment.

An example use case is placing a popup menu on top of a user interface element, while aligning the user interface element of the parent surface with some user interface element placed somewhere in the popup surface.

Definition at line 859 of file xdg-shell-unstable-v6-client-protocol.h.

860 {
861  wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
862  ZXDG_POSITIONER_V6_SET_OFFSET, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), 0, x, y);
863 }

References NULL, and ZXDG_POSITIONER_V6_SET_OFFSET.

◆ zxdg_positioner_v6_set_size()

static void zxdg_positioner_v6_set_size ( struct zxdg_positioner_v6 *  zxdg_positioner_v6,
int32_t  width,
int32_t  height 
)
inlinestatic

Set the size of the surface that is to be positioned with the positioner object. The size is in surface-local coordinates and corresponds to the window geometry. See xdg_surface.set_window_geometry.

If a zero or negative size is set the invalid_input error is raised.

Definition at line 751 of file xdg-shell-unstable-v6-client-protocol.h.

752 {
753  wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
754  ZXDG_POSITIONER_V6_SET_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), 0, width, height);
755 }

References NULL, and ZXDG_POSITIONER_V6_SET_SIZE.

◆ zxdg_positioner_v6_set_user_data()

static void zxdg_positioner_v6_set_user_data ( struct zxdg_positioner_v6 *  zxdg_positioner_v6,
void user_data 
)
inlinestatic

Definition at line 711 of file xdg-shell-unstable-v6-client-protocol.h.

712 {
713  wl_proxy_set_user_data((struct wl_proxy *) zxdg_positioner_v6, user_data);
714 }
ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_NONE
@ ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_NONE
Definition: xdg-shell-unstable-v6-client-protocol.h:592
NULL
#define NULL
Definition: begin_code.h:167
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
ZXDG_POSITIONER_V6_SET_ANCHOR_RECT
#define ZXDG_POSITIONER_V6_SET_ANCHOR_RECT
Definition: xdg-shell-unstable-v6-client-protocol.h:673
ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_X
@ ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_X
Definition: xdg-shell-unstable-v6-client-protocol.h:609
ZXDG_POSITIONER_V6_SET_OFFSET
#define ZXDG_POSITIONER_V6_SET_OFFSET
Definition: xdg-shell-unstable-v6-client-protocol.h:677
ZXDG_POSITIONER_V6_SET_GRAVITY
#define ZXDG_POSITIONER_V6_SET_GRAVITY
Definition: xdg-shell-unstable-v6-client-protocol.h:675
ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_X
@ ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_X
Definition: xdg-shell-unstable-v6-client-protocol.h:639
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_Y
@ ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_Y
Definition: xdg-shell-unstable-v6-client-protocol.h:626
ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_X
@ ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_X
Definition: xdg-shell-unstable-v6-client-protocol.h:660
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
ZXDG_POSITIONER_V6_SET_CONSTRAINT_ADJUSTMENT
#define ZXDG_POSITIONER_V6_SET_CONSTRAINT_ADJUSTMENT
Definition: xdg-shell-unstable-v6-client-protocol.h:676
ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_Y
@ ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_Y
Definition: xdg-shell-unstable-v6-client-protocol.h:667
ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_Y
@ ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_Y
Definition: xdg-shell-unstable-v6-client-protocol.h:653
ZXDG_POSITIONER_V6_SET_ANCHOR
#define ZXDG_POSITIONER_V6_SET_ANCHOR
Definition: xdg-shell-unstable-v6-client-protocol.h:674
ZXDG_POSITIONER_V6_DESTROY
#define ZXDG_POSITIONER_V6_DESTROY
Definition: xdg-shell-unstable-v6-client-protocol.h:671
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
ZXDG_POSITIONER_V6_SET_SIZE
#define ZXDG_POSITIONER_V6_SET_SIZE
Definition: xdg-shell-unstable-v6-client-protocol.h:672