xdg_surface_listener Struct Reference

A desktop window. More...

`#include <xdg-shell-client-protocol.h>`

## Data Fields

void(* | configure )(void *data, struct xdg_surface *xdg_surface, int32_t width, int32_t height, struct wl_array *states, uint32_t serial)
| Suggest a surface change.
void(* | close )(void *data, struct xdg_surface *xdg_surface)
| Surface wants to be closed.

## Detailed Description

A desktop window.

An interface that may be implemented by a wl_surface, for implementations that provide a desktop-style user interface.

It provides requests to treat surfaces like windows, allowing to set properties like maximized, fullscreen, minimized, and to move and resize them, and associate metadata like title and app id.

The client must call wl_surface.commit on the corresponding wl_surface for the xdg_surface state to take effect. Prior to committing the new state, it can set up initial configuration, such as maximizing or setting a window geometry.

Even without attaching a buffer the compositor must respond to initial committed configuration, for instance sending a configure event with expected window geometry if the client maximized its surface during initialization.

For a surface to be mapped by the compositor the client must have committed both an xdg_surface state and a buffer.

## Field Documentation

## configure

void(* xdg_surface_listener::configure) (void *data, struct xdg_surface *xdg_surface, int32_t width, int32_t height, struct wl_array *states, uint32_t serial)

Suggest a surface change.

The configure event asks the client to resize its surface or to change its state.

The width and height arguments specify a hint to the window about how its surface should be resized in window geometry coordinates. See set_window_geometry.

If the width or height arguments are zero, it means the client should decide its own window dimension. This may happen when the compositor need to configure the state of the surface but doesn't have any information about any previous or expected dimension.

The states listed in the event specify how the width/height arguments should be interpreted, and possibly how it should be drawn.

Clients should arrange their surface for the new size and states, and then send a ack_configure request with the serial sent in this configure event at some point before committing the new surface.

If the client receives multiple configure events before it can respond to one, it is free to discard all but the last event it received.

## close

void(* xdg_surface_listener::close) (void *data, struct xdg_surface *xdg_surface)

Surface wants to be closed.

The close event is sent by the compositor when the user wants the surface to be closed. This should be equivalent to the user clicking the close button in client-side decorations, if your application has any...

This is only a request that the user intends to close your window. The client may choose to ignore this request, or show a dialog to ask the user to save their data...