---
name: "wayland_server_xdg_popup_t"
section: "3"
platform: "linux"
package: "waylandpp-dev"
version: "1.0.0-6+b2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/wayland_server_xdg_popup_t"
---

# wayland\_server\_xdg\_popup\_t(3)

short-lived, popup surfaces for menus

## NAME

wayland::server::xdg\_popup\_t - short-lived, popup surfaces for menus

## SYNOPSIS

`#include <wayland-server-protocol-extra.hpp>`

Inherits wayland::server::resource\_t.

### Public Member Functions

std::function\< void()\> & **on\_destroy** ()\
 remove xdg\_popup interface  std::function\< void(**seat\_t**, uint32\_t)\> & **on\_grab** ()\
 make the popup take an explicit grab  std::function\< void(**xdg\_positioner\_t**, uint32\_t)\> & **on\_reposition** ()\
 recalculate the popup's location  void **configure** (int32\_t x, int32\_t y, int32\_t width, int32\_t height, bool post=true)\
 configure the popup surface  void **popup\_done** (bool post=true)\
 popup interaction is done  void **repositioned** (uint32\_t token, bool post=true)\
 signal the completion of a repositioned request  bool **can\_repositioned** () const\
 Check whether the **repositioned** function is available with the currently bound version of the protocol.  void **post\_invalid\_grab** (std::string const &msg)\
 Post error: tried to grab after being mapped.  bool **proxy\_has\_object** () const\
 Check whether this wrapper actually wraps an object.  void **post\_no\_memory** () const\
 uint32\_t **get\_id** () const\
 client\_t **get\_client** () const\
 unsigned int **get\_version** () const\
 std::string **get\_class** ()\

### Static Public Attributes

static constexpr std::uint32\_t **configure\_since\_version** = 1\
 Minimum protocol version required for the **configure** function.  static constexpr std::uint32\_t **popup\_done\_since\_version** = 1\
 Minimum protocol version required for the **popup\_done** function.  static constexpr std::uint32\_t **repositioned\_since\_version** = 3\
 Minimum protocol version required for the **repositioned** function.

## Detailed Description

short-lived, popup surfaces for menus

A popup surface is a short-lived, temporary surface. It can be used to implement for example menus, popovers, tooltips and other similar user interface concepts.

A popup can be made to take an explicit grab. See xdg\_popup.grab for details.

When the popup is dismissed, a popup\_done event will be sent out, and at the same time the surface will be unmapped. See the xdg\_popup.popup\_done event for details.

Explicitly destroying the xdg\_popup object will also dismiss the popup and unmap the surface. Clients that want to dismiss the popup when another surface of their own is clicked should dismiss the popup using the destroy request.

A newly created xdg\_popup will be stacked on top of all previously created xdg\_popup surfaces associated with the same xdg\_toplevel.

The parent of an xdg\_popup must be mapped (see the xdg\_surface description) before the xdg\_popup itself.

The client must call wl\_surface.commit on the corresponding wl\_surface for the xdg\_popup state to take effect.

Definition at line **1880** of file **wayland-server-protocol-extra.hpp**.

## Member Function Documentation

### bool xdg\_popup\_t::can\_repositioned () const

Check whether the **repositioned** function is available with the currently bound version of the protocol.

Definition at line **1476** of file **wayland-server-protocol-extra.cpp**.

### void xdg\_popup\_t::configure (int32\_t x, int32\_t y, int32\_t width, int32\_t height, bool post = `true`)

configure the popup surface

**Parameters**

*x* x position relative to parent surface window geometry \
 *y* y position relative to parent surface window geometry \
 *width* window geometry width \
 *height* window geometry height

This event asks the popup surface to configure itself given the configuration. The configured state should not be applied immediately. See xdg\_surface.configure for details.

The x and y arguments represent the position the popup was placed at given the xdg\_positioner rule, relative to the upper left corner of the window geometry of the parent surface.

For version 2 or older, the configure event for an xdg\_popup is only ever sent once for the initial configuration. Starting with version 3, it may be sent again if the popup is setup with an xdg\_positioner with set\_reactive requested, or in response to xdg\_popup.reposition requests.

Definition at line **1461** of file **wayland-server-protocol-extra.cpp**.

### std::string wayland::server::resource\_t::get\_class ()` [inherited]`

Retrieve the interface name (class) of a resource object.

**Returns**

Interface name of the resource object.

### client\_t wayland::server::resource\_t::get\_client () const` [inherited]`

Get the associated client

**Returns**

the client that owns the resource.

### uint32\_t wayland::server::resource\_t::get\_id () const` [inherited]`

Get the internal ID of the resource

**Returns**

the internal ID of the resource

### unsigned int wayland::server::resource\_t::get\_version () const` [inherited]`

Get interface version

**Returns**

Interface version this resource has been constructed with.

### std::function\< void()\> & xdg\_popup\_t::on\_destroy ()

remove xdg\_popup interface This destroys the popup. Explicitly destroying the xdg\_popup object will also dismiss the popup, and unmap the surface.

If this xdg\_popup is not the 'topmost' popup, a protocol error will be sent.

Definition at line **1443** of file **wayland-server-protocol-extra.cpp**.

### std::function\< void(seat\_t, uint32\_t)\> & xdg\_popup\_t::on\_grab ()

make the popup take an explicit grab

**Parameters**

*seat* the wl\_seat of the user event \
 *serial* the serial of the user event

This request makes the created popup take an explicit grab. An explicit grab will be dismissed when the user dismisses the popup, or when the client destroys the xdg\_popup. This can be done by the user clicking outside the surface, using the keyboard, or even locking the screen through closing the lid or a timeout.

If the compositor denies the grab, the popup will be immediately dismissed.

This request must be used in response to some sort of user action like a button press, key press, or touch down event. The serial number of the event should be passed as 'serial'.

The parent of a grabbing popup must either be an xdg\_toplevel surface or another xdg\_popup with an explicit grab. If the parent is another xdg\_popup it means that the popups are nested, with this popup now being the topmost popup.

Nested popups must be destroyed in the reverse order they were created in, e.g. the only popup you are allowed to destroy at all times is the topmost one.

When compositors choose to dismiss a popup, they may dismiss every nested grabbing popup as well. When a compositor dismisses popups, it will follow the same dismissing order as required from the client.

The parent of a grabbing popup must either be another xdg\_popup with an active explicit grab, or an xdg\_popup or xdg\_toplevel, if there are no explicit grabs already taken.

If the topmost grabbing popup is destroyed, the grab will be returned to the parent of the popup, if that parent previously had an explicit grab.

If the parent is a grabbing popup which has already been dismissed, this popup will be immediately dismissed. If the parent is a popup that did not take an explicit grab, an error will be raised.

During a popup grab, the client owning the grab will receive pointer and touch events for all their surfaces as normal (similar to an 'owner-events' grab in X11 parlance), while the top most grabbing popup will always have keyboard focus.

Definition at line **1449** of file **wayland-server-protocol-extra.cpp**.

### std::function\< void(xdg\_positioner\_t, uint32\_t)\> & xdg\_popup\_t::on\_reposition ()

recalculate the popup's location

**Parameters**

*positioner* \
 *token* reposition request token

Reposition an already-mapped popup. The popup will be placed given the details in the passed xdg\_positioner object, and a xdg\_popup.repositioned followed by xdg\_popup.configure and xdg\_surface.configure will be emitted in response. Any parameters set by the previous positioner will be discarded.

The passed token will be sent in the corresponding xdg\_popup.repositioned event. The new popup position will not take effect until the corresponding configure event is acknowledged by the client. See xdg\_popup.repositioned for details. The token itself is opaque, and has no other special meaning.

If multiple reposition requests are sent, the compositor may skip all but the last one.

If the popup is repositioned in response to a configure event for its parent, the client should send an xdg\_positioner.set\_parent\_configure and possibly an xdg\_positioner.set\_parent\_size request to allow the compositor to properly constrain the popup.

If the popup is repositioned together with a parent that is being resized, but not in response to a configure event, the client should send an xdg\_positioner.set\_parent\_size request.

Definition at line **1455** of file **wayland-server-protocol-extra.cpp**.

### void xdg\_popup\_t::popup\_done (bool post = `true`)

popup interaction is done The popup\_done event is sent out when a popup is dismissed by the compositor. The client should destroy the xdg\_popup object at this point.

Definition at line **1466** of file **wayland-server-protocol-extra.cpp**.

### void xdg\_popup\_t::post\_invalid\_grab (std::string const & msg)

Post error: tried to grab after being mapped.

Definition at line **1481** of file **wayland-server-protocol-extra.cpp**.

### void wayland::server::resource\_t::post\_no\_memory () const` [inherited]`

Post 'not enough memory' error to the client

If the compositor has not enough memory to fulfill a certail request of the client, this function can be called to notify the client of this circumstance.

### bool wayland::server::resource\_t::proxy\_has\_object () const` [inherited]`

Check whether this wrapper actually wraps an object.

**Returns**

true if there is an underlying object, false if this wrapper is empty

### void xdg\_popup\_t::repositioned (uint32\_t token, bool post = `true`)

signal the completion of a repositioned request

**Parameters**

*token* reposition request token

The repositioned event is sent as part of a popup configuration sequence, together with xdg\_popup.configure and lastly xdg\_surface.configure to notify the completion of a reposition request.

The repositioned event is to notify about the completion of a xdg\_popup.reposition request. The token argument is the token passed in the xdg\_popup.reposition request.

Immediately after this event is emitted, xdg\_popup.configure and xdg\_surface.configure will be sent with the updated size and position, as well as a new configure serial.

The client should optionally update the content of the popup, but must acknowledge the new popup configuration for the new position to take effect. See xdg\_surface.ack\_configure for details.

Definition at line **1471** of file **wayland-server-protocol-extra.cpp**.

## Member Data Documentation

### constexpr std::uint32\_t wayland::server::xdg\_popup\_t::configure\_since\_version = 1` [static]`, ` [constexpr]`

Minimum protocol version required for the **configure** function.

Definition at line **2023** of file **wayland-server-protocol-extra.hpp**.

### constexpr std::uint32\_t wayland::server::xdg\_popup\_t::popup\_done\_since\_version = 1` [static]`, ` [constexpr]`

Minimum protocol version required for the **popup\_done** function.

Definition at line **2036** of file **wayland-server-protocol-extra.hpp**.

### constexpr std::uint32\_t wayland::server::xdg\_popup\_t::repositioned\_since\_version = 3` [static]`, ` [constexpr]`

Minimum protocol version required for the **repositioned** function.

Definition at line **2062** of file **wayland-server-protocol-extra.hpp**.

## Author

Generated automatically by Doxygen for Wayland++ from the source code.
