SDL 2.0
The wl_shell_surface interface

Data Structures

struct  wl_shell_surface_listener
 

Macros

#define WL_SHELL_SURFACE_PING_SINCE_VERSION   1
 
#define WL_SHELL_SURFACE_CONFIGURE_SINCE_VERSION   1
 
#define WL_SHELL_SURFACE_POPUP_DONE_SINCE_VERSION   1
 
#define WL_SHELL_SURFACE_PONG_SINCE_VERSION   1
 
#define WL_SHELL_SURFACE_MOVE_SINCE_VERSION   1
 
#define WL_SHELL_SURFACE_RESIZE_SINCE_VERSION   1
 
#define WL_SHELL_SURFACE_SET_TOPLEVEL_SINCE_VERSION   1
 
#define WL_SHELL_SURFACE_SET_TRANSIENT_SINCE_VERSION   1
 
#define WL_SHELL_SURFACE_SET_FULLSCREEN_SINCE_VERSION   1
 
#define WL_SHELL_SURFACE_SET_POPUP_SINCE_VERSION   1
 
#define WL_SHELL_SURFACE_SET_MAXIMIZED_SINCE_VERSION   1
 
#define WL_SHELL_SURFACE_SET_TITLE_SINCE_VERSION   1
 
#define WL_SHELL_SURFACE_SET_CLASS_SINCE_VERSION   1
 

Enumerations

enum  wl_shell_surface_resize {
  WL_SHELL_SURFACE_RESIZE_NONE = 0 ,
  WL_SHELL_SURFACE_RESIZE_TOP = 1 ,
  WL_SHELL_SURFACE_RESIZE_BOTTOM = 2 ,
  WL_SHELL_SURFACE_RESIZE_LEFT = 4 ,
  WL_SHELL_SURFACE_RESIZE_TOP_LEFT = 5 ,
  WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT = 6 ,
  WL_SHELL_SURFACE_RESIZE_RIGHT = 8 ,
  WL_SHELL_SURFACE_RESIZE_TOP_RIGHT = 9 ,
  WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT = 10
}
 
enum  wl_shell_surface_transient { WL_SHELL_SURFACE_TRANSIENT_INACTIVE = 0x1 }
 
enum  wl_shell_surface_fullscreen_method {
  WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT = 0 ,
  WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE = 1 ,
  WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER = 2 ,
  WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL = 3
}
 

Functions

static int wl_shell_surface_add_listener (struct wl_shell_surface *wl_shell_surface, const struct wl_shell_surface_listener *listener, void *data)
 
static void wl_shell_surface_set_user_data (struct wl_shell_surface *wl_shell_surface, void *user_data)
 
static voidwl_shell_surface_get_user_data (struct wl_shell_surface *wl_shell_surface)
 
static void wl_shell_surface_destroy (struct wl_shell_surface *wl_shell_surface)
 
static void wl_shell_surface_pong (struct wl_shell_surface *wl_shell_surface, uint32_t serial)
 
static void wl_shell_surface_move (struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial)
 
static void wl_shell_surface_resize (struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges)
 
static void wl_shell_surface_set_toplevel (struct wl_shell_surface *wl_shell_surface)
 
static void wl_shell_surface_set_transient (struct wl_shell_surface *wl_shell_surface, struct wl_surface *parent, int32_t x, int32_t y, uint32_t flags)
 
static void wl_shell_surface_set_fullscreen (struct wl_shell_surface *wl_shell_surface, uint32_t method, uint32_t framerate, struct wl_output *output)
 
static void wl_shell_surface_set_popup (struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial, struct wl_surface *parent, int32_t x, int32_t y, uint32_t flags)
 
static void wl_shell_surface_set_maximized (struct wl_shell_surface *wl_shell_surface, struct wl_output *output)
 
static void wl_shell_surface_set_title (struct wl_shell_surface *wl_shell_surface, const char *title)
 
static void wl_shell_surface_set_class (struct wl_shell_surface *wl_shell_surface, const char *class_)
 

Detailed Description

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 toplevel, fullscreen or popup windows, move, resize or maximize them, associate metadata like title and class, etc.

On the server side the object is automatically destroyed when the related wl_surface is destroyed. On the client side, wl_shell_surface_destroy() must be called before destroying the wl_surface object.

Macro Definition Documentation

◆ WL_SHELL_SURFACE_CONFIGURE_SINCE_VERSION

#define WL_SHELL_SURFACE_CONFIGURE_SINCE_VERSION   1

Definition at line 3009 of file wayland-client-protocol.h.

◆ WL_SHELL_SURFACE_MOVE_SINCE_VERSION

#define WL_SHELL_SURFACE_MOVE_SINCE_VERSION   1

Definition at line 3022 of file wayland-client-protocol.h.

◆ WL_SHELL_SURFACE_PING_SINCE_VERSION

#define WL_SHELL_SURFACE_PING_SINCE_VERSION   1

Definition at line 3005 of file wayland-client-protocol.h.

◆ WL_SHELL_SURFACE_PONG_SINCE_VERSION

#define WL_SHELL_SURFACE_PONG_SINCE_VERSION   1

Definition at line 3018 of file wayland-client-protocol.h.

◆ WL_SHELL_SURFACE_POPUP_DONE_SINCE_VERSION

#define WL_SHELL_SURFACE_POPUP_DONE_SINCE_VERSION   1

Definition at line 3013 of file wayland-client-protocol.h.

◆ WL_SHELL_SURFACE_RESIZE_SINCE_VERSION

#define WL_SHELL_SURFACE_RESIZE_SINCE_VERSION   1

Definition at line 3026 of file wayland-client-protocol.h.

◆ WL_SHELL_SURFACE_SET_CLASS_SINCE_VERSION

#define WL_SHELL_SURFACE_SET_CLASS_SINCE_VERSION   1

Definition at line 3054 of file wayland-client-protocol.h.

◆ WL_SHELL_SURFACE_SET_FULLSCREEN_SINCE_VERSION

#define WL_SHELL_SURFACE_SET_FULLSCREEN_SINCE_VERSION   1

Definition at line 3038 of file wayland-client-protocol.h.

◆ WL_SHELL_SURFACE_SET_MAXIMIZED_SINCE_VERSION

#define WL_SHELL_SURFACE_SET_MAXIMIZED_SINCE_VERSION   1

Definition at line 3046 of file wayland-client-protocol.h.

◆ WL_SHELL_SURFACE_SET_POPUP_SINCE_VERSION

#define WL_SHELL_SURFACE_SET_POPUP_SINCE_VERSION   1

Definition at line 3042 of file wayland-client-protocol.h.

◆ WL_SHELL_SURFACE_SET_TITLE_SINCE_VERSION

#define WL_SHELL_SURFACE_SET_TITLE_SINCE_VERSION   1

Definition at line 3050 of file wayland-client-protocol.h.

◆ WL_SHELL_SURFACE_SET_TOPLEVEL_SINCE_VERSION

#define WL_SHELL_SURFACE_SET_TOPLEVEL_SINCE_VERSION   1

Definition at line 3030 of file wayland-client-protocol.h.

◆ WL_SHELL_SURFACE_SET_TRANSIENT_SINCE_VERSION

#define WL_SHELL_SURFACE_SET_TRANSIENT_SINCE_VERSION   1

Definition at line 3034 of file wayland-client-protocol.h.

Enumeration Type Documentation

◆ wl_shell_surface_fullscreen_method

different method to set the surface fullscreen

Hints to indicate to the compositor how to deal with a conflict between the dimensions of the surface and the dimensions of the output. The compositor is free to ignore this parameter.

Enumerator
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT 

no preference, apply default policy

WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE 

scale, preserve the surface's aspect ratio and center on output

WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER 

switch output mode to the smallest mode that can fit the surface, add black borders to compensate size mismatch

WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL 

no upscaling, center on output and add black borders to compensate size mismatch

Definition at line 2905 of file wayland-client-protocol.h.

2905 {
2906 /**
2907 * no preference, apply default policy
2908 */
2910 /**
2911 * scale, preserve the surface's aspect ratio and center on output
2912 */
2914 /**
2915 * switch output mode to the smallest mode that can fit the surface, add black borders to compensate size mismatch
2916 */
2918 /**
2919 * no upscaling, center on output and add black borders to compensate size mismatch
2920 */
2922};
@ WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT
@ WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE
@ WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL
@ WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER

◆ wl_shell_surface_resize

edge values for resizing

These values are used to indicate which edge of a surface is being dragged in a resize operation. The server may use this information to adapt its behavior, e.g. choose an appropriate cursor image.

Enumerator
WL_SHELL_SURFACE_RESIZE_NONE 

no edge

WL_SHELL_SURFACE_RESIZE_TOP 

top edge

WL_SHELL_SURFACE_RESIZE_BOTTOM 

bottom edge

WL_SHELL_SURFACE_RESIZE_LEFT 

left edge

WL_SHELL_SURFACE_RESIZE_TOP_LEFT 

top and left edges

WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT 

bottom and left edges

WL_SHELL_SURFACE_RESIZE_RIGHT 

right edge

WL_SHELL_SURFACE_RESIZE_TOP_RIGHT 

top and right edges

WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT 

bottom and right edges

Definition at line 2838 of file wayland-client-protocol.h.

2838 {
2839 /**
2840 * no edge
2841 */
2843 /**
2844 * top edge
2845 */
2847 /**
2848 * bottom edge
2849 */
2851 /**
2852 * left edge
2853 */
2855 /**
2856 * top and left edges
2857 */
2859 /**
2860 * bottom and left edges
2861 */
2863 /**
2864 * right edge
2865 */
2867 /**
2868 * top and right edges
2869 */
2871 /**
2872 * bottom and right edges
2873 */
2875};
@ WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT
@ WL_SHELL_SURFACE_RESIZE_BOTTOM
@ WL_SHELL_SURFACE_RESIZE_LEFT
@ WL_SHELL_SURFACE_RESIZE_TOP
@ WL_SHELL_SURFACE_RESIZE_RIGHT
@ WL_SHELL_SURFACE_RESIZE_TOP_RIGHT
@ WL_SHELL_SURFACE_RESIZE_TOP_LEFT
@ WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT
@ WL_SHELL_SURFACE_RESIZE_NONE

◆ wl_shell_surface_transient

details of transient behaviour

These flags specify details of the expected behaviour of transient surfaces. Used in the set_transient request.

Enumerator
WL_SHELL_SURFACE_TRANSIENT_INACTIVE 

do not set keyboard focus

Definition at line 2887 of file wayland-client-protocol.h.

2887 {
2888 /**
2889 * do not set keyboard focus
2890 */
2892};
@ WL_SHELL_SURFACE_TRANSIENT_INACTIVE

Function Documentation

◆ wl_shell_surface_add_listener()

static int wl_shell_surface_add_listener ( struct wl_shell_surface *  wl_shell_surface,
const struct wl_shell_surface_listener listener,
void data 
)
inlinestatic

Definition at line 2984 of file wayland-client-protocol.h.

2986{
2987 return wl_proxy_add_listener((struct wl_proxy *) wl_shell_surface,
2988 (void (**)(void)) listener, data);
2989}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974

◆ wl_shell_surface_destroy()

static void wl_shell_surface_destroy ( struct wl_shell_surface *  wl_shell_surface)
inlinestatic

Definition at line 3078 of file wayland-client-protocol.h.

3079{
3080 wl_proxy_destroy((struct wl_proxy *) wl_shell_surface);
3081}

◆ wl_shell_surface_get_user_data()

static void * wl_shell_surface_get_user_data ( struct wl_shell_surface *  wl_shell_surface)
inlinestatic

Definition at line 3065 of file wayland-client-protocol.h.

3066{
3067 return wl_proxy_get_user_data((struct wl_proxy *) wl_shell_surface);
3068}

◆ wl_shell_surface_move()

static void wl_shell_surface_move ( struct wl_shell_surface *  wl_shell_surface,
struct wl_seat *  seat,
uint32_t  serial 
)
inlinestatic

Start a pointer-driven move of the surface.

This request must be used in response to a button press event. The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized).

Definition at line 3106 of file wayland-client-protocol.h.

3107{
3108 wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3109 WL_SHELL_SURFACE_MOVE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, seat, serial);
3110}
#define NULL
Definition: begin_code.h:167
#define WL_SHELL_SURFACE_MOVE

References NULL, and WL_SHELL_SURFACE_MOVE.

◆ wl_shell_surface_pong()

static void wl_shell_surface_pong ( struct wl_shell_surface *  wl_shell_surface,
uint32_t  serial 
)
inlinestatic

A client must respond to a ping event with a pong request or the client may be deemed unresponsive.

Definition at line 3090 of file wayland-client-protocol.h.

3091{
3092 wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3093 WL_SHELL_SURFACE_PONG, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, serial);
3094}
#define WL_SHELL_SURFACE_PONG

References NULL, and WL_SHELL_SURFACE_PONG.

◆ wl_shell_surface_resize()

static void wl_shell_surface_resize ( struct wl_shell_surface *  wl_shell_surface,
struct wl_seat *  seat,
uint32_t  serial,
uint32_t  edges 
)
inlinestatic

Start a pointer-driven resizing of the surface.

This request must be used in response to a button press event. The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized).

Definition at line 3122 of file wayland-client-protocol.h.

3123{
3124 wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3125 WL_SHELL_SURFACE_RESIZE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, seat, serial, edges);
3126}
#define WL_SHELL_SURFACE_RESIZE

References NULL, and WL_SHELL_SURFACE_RESIZE.

◆ wl_shell_surface_set_class()

static void wl_shell_surface_set_class ( struct wl_shell_surface *  wl_shell_surface,
const char *  class_ 
)
inlinestatic

Set a class for the surface.

The surface class identifies the general class of applications to which the surface belongs. A common convention is to use the file name (or the full path if it is a non-standard location) of the application's .desktop file as the class.

Definition at line 3292 of file wayland-client-protocol.h.

3293{
3294 wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3295 WL_SHELL_SURFACE_SET_CLASS, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, class_);
3296}
#define WL_SHELL_SURFACE_SET_CLASS

References NULL, and WL_SHELL_SURFACE_SET_CLASS.

◆ wl_shell_surface_set_fullscreen()

static void wl_shell_surface_set_fullscreen ( struct wl_shell_surface *  wl_shell_surface,
uint32_t  method,
uint32_t  framerate,
struct wl_output *  output 
)
inlinestatic

Map the surface as a fullscreen surface.

If an output parameter is given then the surface will be made fullscreen on that output. If the client does not specify the output then the compositor will apply its policy - usually choosing the output on which the surface has the biggest surface area.

The client may specify a method to resolve a size conflict between the output size and the surface size - this is provided through the method parameter.

The framerate parameter is used only when the method is set to "driver", to indicate the preferred framerate. A value of 0 indicates that the client does not care about framerate. The framerate is specified in mHz, that is framerate of 60000 is 60Hz.

A method of "scale" or "driver" implies a scaling operation of the surface, either via a direct scaling operation or a change of the output mode. This will override any kind of output scaling, so that mapping a surface with a buffer size equal to the mode can fill the screen independent of buffer_scale.

A method of "fill" means we don't scale up the buffer, however any output scale is applied. This means that you may run into an edge case where the application maps a buffer with the same size of the output mode but buffer_scale 1 (thus making a surface larger than the output). In this case it is allowed to downscale the results to fit the screen.

The compositor must reply to this request with a configure event with the dimensions for the output on which the surface will be made fullscreen.

Definition at line 3198 of file wayland-client-protocol.h.

3199{
3200 wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3201 WL_SHELL_SURFACE_SET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, method, framerate, output);
3202}
#define WL_SHELL_SURFACE_SET_FULLSCREEN

References NULL, sort_controllers::output, and WL_SHELL_SURFACE_SET_FULLSCREEN.

◆ wl_shell_surface_set_maximized()

static void wl_shell_surface_set_maximized ( struct wl_shell_surface *  wl_shell_surface,
struct wl_output *  output 
)
inlinestatic

Map the surface as a maximized surface.

If an output parameter is given then the surface will be maximized on that output. If the client does not specify the output then the compositor will apply its policy - usually choosing the output on which the surface has the biggest surface area.

The compositor will reply with a configure event telling the expected new surface size. The operation is completed on the next buffer attach to this surface.

A maximized surface typically fills the entire output it is bound to, except for desktop elements such as panels. This is the main difference between a maximized shell surface and a fullscreen shell surface.

The details depend on the compositor implementation.

Definition at line 3257 of file wayland-client-protocol.h.

3258{
3259 wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3260 WL_SHELL_SURFACE_SET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, output);
3261}
#define WL_SHELL_SURFACE_SET_MAXIMIZED

References NULL, sort_controllers::output, and WL_SHELL_SURFACE_SET_MAXIMIZED.

◆ wl_shell_surface_set_popup()

static void wl_shell_surface_set_popup ( struct wl_shell_surface *  wl_shell_surface,
struct wl_seat *  seat,
uint32_t  serial,
struct wl_surface *  parent,
int32_t  x,
int32_t  y,
uint32_t  flags 
)
inlinestatic

Map the surface as a popup.

A popup surface is a transient surface with an added pointer grab.

An existing implicit grab will be changed to owner-events mode, and the popup grab will continue after the implicit grab ends (i.e. releasing the mouse button does not cause the popup to be unmapped).

The popup grab continues until the window is destroyed or a mouse button is pressed in any other client's window. A click in any of the client's surfaces is reported as normal, however, clicks in other clients' surfaces will be discarded and trigger the callback.

The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the parent surface, in surface-local coordinates.

Definition at line 3228 of file wayland-client-protocol.h.

3229{
3230 wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3231 WL_SHELL_SURFACE_SET_POPUP, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, seat, serial, parent, x, y, flags);
3232}
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
GLbitfield flags
#define WL_SHELL_SURFACE_SET_POPUP

References NULL, and WL_SHELL_SURFACE_SET_POPUP.

◆ wl_shell_surface_set_title()

static void wl_shell_surface_set_title ( struct wl_shell_surface *  wl_shell_surface,
const char *  title 
)
inlinestatic

Set a short title for the surface.

This string may be used to identify the surface in a task bar, window list, or other user interface elements provided by the compositor.

The string must be encoded in UTF-8.

Definition at line 3275 of file wayland-client-protocol.h.

3276{
3277 wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3278 WL_SHELL_SURFACE_SET_TITLE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, title);
3279}
#define WL_SHELL_SURFACE_SET_TITLE

References NULL, and WL_SHELL_SURFACE_SET_TITLE.

◆ wl_shell_surface_set_toplevel()

static void wl_shell_surface_set_toplevel ( struct wl_shell_surface *  wl_shell_surface)
inlinestatic

Map the surface as a toplevel surface.

A toplevel surface is not fullscreen, maximized or transient.

Definition at line 3136 of file wayland-client-protocol.h.

3137{
3138 wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3139 WL_SHELL_SURFACE_SET_TOPLEVEL, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0);
3140}
#define WL_SHELL_SURFACE_SET_TOPLEVEL

References NULL, and WL_SHELL_SURFACE_SET_TOPLEVEL.

◆ wl_shell_surface_set_transient()

static void wl_shell_surface_set_transient ( struct wl_shell_surface *  wl_shell_surface,
struct wl_surface *  parent,
int32_t  x,
int32_t  y,
uint32_t  flags 
)
inlinestatic

Map the surface relative to an existing surface.

The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the parent surface, in surface-local coordinates.

The flags argument controls details of the transient behaviour.

Definition at line 3154 of file wayland-client-protocol.h.

3155{
3156 wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3157 WL_SHELL_SURFACE_SET_TRANSIENT, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, parent, x, y, flags);
3158}
#define WL_SHELL_SURFACE_SET_TRANSIENT

References NULL, and WL_SHELL_SURFACE_SET_TRANSIENT.

◆ wl_shell_surface_set_user_data()

static void wl_shell_surface_set_user_data ( struct wl_shell_surface *  wl_shell_surface,
void user_data 
)
inlinestatic

Definition at line 3058 of file wayland-client-protocol.h.

3059{
3060 wl_proxy_set_user_data((struct wl_proxy *) wl_shell_surface, user_data);
3061}