The xdg_popup interface

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. More...

## Data Structures

struct | xdg_popup_listener

## Macros

#define | XDG_POPUP_CONFIGURE_SINCE_VERSION 1
#define | XDG_POPUP_POPUP_DONE_SINCE_VERSION 1
#define | XDG_POPUP_DESTROY_SINCE_VERSION 1
#define | XDG_POPUP_GRAB_SINCE_VERSION 1

## Functions

static int | xdg_popup_add_listener (struct xdg_popup *xdg_popup, const struct xdg_popup_listener *listener, void *data)
static void | xdg_popup_set_user_data (struct xdg_popup *xdg_popup, void *user_data)
static void * | xdg_popup_get_user_data (struct xdg_popup *xdg_popup)
static void | xdg_popup_destroy (struct xdg_popup *xdg_popup)
static void | xdg_popup_grab (struct xdg_popup *xdg_popup, struct wl_seat *seat, uint32_t serial)

## Detailed Description

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.

The parent surface must have either the xdg_toplevel or xdg_popup surface role.

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 x and y arguments passed when creating the popup object specify where the top left of the popup should be placed, relative to the local surface coordinates of the parent surface. See xdg_surface.get_popup. An xdg_popup must intersect with or be at least partially adjacent to its parent surface.

The client must call wl_surface.commit on the corresponding wl_surface for the xdg_popup state to take effect.

## Macro Definition Documentation

## XDG_POPUP_CONFIGURE_SINCE_VERSION

#define XDG_POPUP_CONFIGURE_SINCE_VERSION 1

Definition at line 1705 of file xdg-shell-client-protocol.h.

## XDG_POPUP_DESTROY_SINCE_VERSION

#define XDG_POPUP_DESTROY_SINCE_VERSION 1

Definition at line 1714 of file xdg-shell-client-protocol.h.

## XDG_POPUP_GRAB_SINCE_VERSION

#define XDG_POPUP_GRAB_SINCE_VERSION 1

Definition at line 1718 of file xdg-shell-client-protocol.h.

## XDG_POPUP_POPUP_DONE_SINCE_VERSION

#define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1

Definition at line 1709 of file xdg-shell-client-protocol.h.

## Function Documentation

## xdg_popup_add_listener()

static int xdg_popup_add_listener | ( | struct xdg_popup * | xdg_popup,
|  | const struct xdg_popup_listener * | listener,
|  | void * | data
| ) |  |

inline static

Definition at line 1692 of file xdg-shell-client-protocol.h.

{
return wl_proxy_add_listener((struct wl_proxy *) xdg_popup,
(void (**)(void)) listener, data);
}

## xdg_popup_destroy()

static void xdg_popup_destroy | ( | struct xdg_popup * | xdg_popup | ) |

inline static

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 1750 of file xdg-shell-client-protocol.h.

{
wl_proxy_marshal((struct wl_proxy *) xdg_popup,
XDG_POPUP_DESTROY);
wl_proxy_destroy((struct wl_proxy *) xdg_popup);
}

References XDG_POPUP_DESTROY.

## xdg_popup_get_user_data()

static void* xdg_popup_get_user_data | ( | struct xdg_popup * | xdg_popup | ) |

inline static

Definition at line 1729 of file xdg-shell-client-protocol.h.

{
return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup);
}

## xdg_popup_grab()

static void xdg_popup_grab | ( | struct xdg_popup * | xdg_popup,
|  | struct wl_seat * | seat,
|  | uint32_t | serial
| ) |  |

inline static

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 1804 of file xdg-shell-client-protocol.h.

{
wl_proxy_marshal((struct wl_proxy *) xdg_popup,
XDG_POPUP_GRAB, seat, serial);
}

References XDG_POPUP_GRAB.

## xdg_popup_set_user_data()

static void xdg_popup_set_user_data | ( | struct xdg_popup * | xdg_popup,
|  | void * | user_data
| ) |  |

inline static

Definition at line 1722 of file xdg-shell-client-protocol.h.

{
wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data);
}
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
XDG_POPUP_GRAB
#define XDG_POPUP_GRAB
Definition: xdg-shell-client-protocol.h:1700
XDG_POPUP_DESTROY
#define XDG_POPUP_DESTROY
Definition: xdg-shell-client-protocol.h:1699