.TH "wayland::server::xdg_toplevel_t" 3 "Wed May 1 2024 17:27:19" "Version 1.0.0" "Wayland++" \" -*- nroff -*- .ad l .nh .SH NAME wayland::server::xdg_toplevel_t \- toplevel surface .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits wayland::server::resource_t\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "std::function< void()> & \fBon_destroy\fP ()" .br .RI "destroy the xdg_toplevel " .ti -1c .RI "std::function< void(\fBxdg_toplevel_t\fP)> & \fBon_set_parent\fP ()" .br .RI "set the parent of this surface " .ti -1c .RI "std::function< void(std::string)> & \fBon_set_title\fP ()" .br .RI "set surface title " .ti -1c .RI "std::function< void(std::string)> & \fBon_set_app_id\fP ()" .br .RI "set application ID " .ti -1c .RI "std::function< void(\fBseat_t\fP, uint32_t, int32_t, int32_t)> & \fBon_show_window_menu\fP ()" .br .RI "show the window menu " .ti -1c .RI "std::function< void(\fBseat_t\fP, uint32_t)> & \fBon_move\fP ()" .br .RI "start an interactive move " .ti -1c .RI "std::function< void(\fBseat_t\fP, uint32_t, \fBxdg_toplevel_resize_edge\fP)> & \fBon_resize\fP ()" .br .RI "start an interactive resize " .ti -1c .RI "std::function< void(int32_t, int32_t)> & \fBon_set_max_size\fP ()" .br .RI "set the maximum size " .ti -1c .RI "std::function< void(int32_t, int32_t)> & \fBon_set_min_size\fP ()" .br .RI "set the minimum size " .ti -1c .RI "std::function< void()> & \fBon_set_maximized\fP ()" .br .RI "maximize the window " .ti -1c .RI "std::function< void()> & \fBon_unset_maximized\fP ()" .br .RI "unmaximize the window " .ti -1c .RI "std::function< void(\fBoutput_t\fP)> & \fBon_set_fullscreen\fP ()" .br .RI "set the window as fullscreen on an output " .ti -1c .RI "std::function< void()> & \fBon_unset_fullscreen\fP ()" .br .RI "unset the window as fullscreen " .ti -1c .RI "std::function< void()> & \fBon_set_minimized\fP ()" .br .RI "set the window as minimized " .ti -1c .RI "void \fBconfigure\fP (int32_t width, int32_t height, array_t const &states, bool post=true)" .br .RI "suggest a surface change " .ti -1c .RI "void \fBclose\fP (bool post=true)" .br .RI "surface wants to be closed " .ti -1c .RI "void \fBconfigure_bounds\fP (int32_t width, int32_t height, bool post=true)" .br .RI "recommended window geometry bounds " .ti -1c .RI "bool \fBcan_configure_bounds\fP () const" .br .RI "Check whether the \fBconfigure_bounds\fP function is available with the currently bound version of the protocol\&. " .ti -1c .RI "void \fBpost_invalid_resize_edge\fP (std::string const &msg)" .br .RI "Post error: provided value is not a valid variant of the resize_edge enum\&. " .ti -1c .RI "bool \fBproxy_has_object\fP () const" .br .RI "Check whether this wrapper actually wraps an object\&. " .ti -1c .RI "void \fBpost_no_memory\fP () const" .br .ti -1c .RI "uint32_t \fBget_id\fP () const" .br .ti -1c .RI "client_t \fBget_client\fP () const" .br .ti -1c .RI "unsigned int \fBget_version\fP () const" .br .ti -1c .RI "std::string \fBget_class\fP ()" .br .in -1c .SS "Static Public Attributes" .in +1c .ti -1c .RI "static constexpr std::uint32_t \fBconfigure_since_version\fP = 1" .br .RI "Minimum protocol version required for the \fBconfigure\fP function\&. " .ti -1c .RI "static constexpr std::uint32_t \fBclose_since_version\fP = 1" .br .RI "Minimum protocol version required for the \fBclose\fP function\&. " .ti -1c .RI "static constexpr std::uint32_t \fBconfigure_bounds_since_version\fP = 4" .br .RI "Minimum protocol version required for the \fBconfigure_bounds\fP function\&. " .in -1c .SH "Detailed Description" .PP toplevel surface This interface defines an xdg_surface role which allows a surface to, among other things, set window-like properties such as maximize, fullscreen, and minimize, set application-specific metadata like title and id, and well as trigger user interactive operations such as interactive resize and move\&. .PP Unmapping an xdg_toplevel means that the surface cannot be shown by the compositor until it is explicitly mapped again\&. All active operations (e\&.g\&., move, resize) are canceled and all attributes (e\&.g\&. title, state, stacking, \&.\&.\&.) are discarded for an xdg_toplevel surface when it is unmapped\&. The xdg_toplevel returns to the state it had right after xdg_surface\&.get_toplevel\&. The client can re-map the toplevel by perfoming a commit without any buffer attached, waiting for a configure event and handling it as usual (see xdg_surface description)\&. .PP Attaching a null buffer to a toplevel unmaps the surface\&. .PP Definition at line \fB1300\fP of file \fBwayland\-server\-protocol\-extra\&.hpp\fP\&. .SH "Member Function Documentation" .PP .SS "bool xdg_toplevel_t::can_configure_bounds () const" .PP Check whether the \fBconfigure_bounds\fP function is available with the currently bound version of the protocol\&. .PP Definition at line \fB1351\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "void xdg_toplevel_t::close (bool post = \fCtrue\fP)" .PP 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\&. .PP This is only a request that the user intends to close the window\&. The client may choose to ignore this request, or show a dialog to ask the user to save their data, etc\&. .PP Definition at line \fB1341\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "void xdg_toplevel_t::configure (int32_t width, int32_t height, array_t const & states, bool post = \fCtrue\fP)" .PP suggest a surface change .PP \fBParameters\fP .RS 4 \fIwidth\fP .br \fIheight\fP .br \fIstates\fP .RE .PP This configure event asks the client to resize its toplevel surface or to change its state\&. The configured state should not be applied immediately\&. See xdg_surface\&.configure for details\&. .PP 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\&. .PP If the width or height arguments are zero, it means the client should decide its own window dimension\&. This may happen when the compositor needs to configure the state of the surface but doesn't have any information about any previous or expected dimension\&. .PP The states listed in the event specify how the width/height arguments should be interpreted, and possibly how it should be drawn\&. .PP Clients must send an ack_configure in response to this event\&. See xdg_surface\&.configure and xdg_surface\&.ack_configure for details\&. .PP Definition at line \fB1336\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "void xdg_toplevel_t::configure_bounds (int32_t width, int32_t height, bool post = \fCtrue\fP)" .PP recommended window geometry bounds .PP \fBParameters\fP .RS 4 \fIwidth\fP .br \fIheight\fP .RE .PP The configure_bounds event may be sent prior to a xdg_toplevel\&.configure event to communicate the bounds a window geometry size is recommended to constrain to\&. .PP The passed width and height are in surface coordinate space\&. If width and height are 0, it means bounds is unknown and equivalent to as if no configure_bounds event was ever sent for this surface\&. .PP The bounds can for example correspond to the size of a monitor excluding any panels or other shell components, so that a surface isn't created in a way that it cannot fit\&. .PP The bounds may change at any point, and in such a case, a new xdg_toplevel\&.configure_bounds will be sent, followed by xdg_toplevel\&.configure and xdg_surface\&.configure\&. .PP Definition at line \fB1346\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::string wayland::server::resource_t::get_class ()\fC [inherited]\fP" Retrieve the interface name (class) of a resource object\&. .PP \fBReturns\fP .RS 4 Interface name of the resource object\&. .RE .PP .SS "client_t wayland::server::resource_t::get_client () const\fC [inherited]\fP" Get the associated client .PP \fBReturns\fP .RS 4 the client that owns the resource\&. .RE .PP .SS "uint32_t wayland::server::resource_t::get_id () const\fC [inherited]\fP" Get the internal ID of the resource .PP \fBReturns\fP .RS 4 the internal ID of the resource .RE .PP .SS "unsigned int wayland::server::resource_t::get_version () const\fC [inherited]\fP" Get interface version .PP \fBReturns\fP .RS 4 Interface version this resource has been constructed with\&. .RE .PP .SS "std::function< void()> & xdg_toplevel_t::on_destroy ()" .PP destroy the xdg_toplevel This request destroys the role surface and unmaps the surface; see 'Unmapping' behavior in interface section for details\&. .PP Definition at line \fB1252\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void(\fBseat_t\fP, uint32_t)> & xdg_toplevel_t::on_move ()" .PP start an interactive move .PP \fBParameters\fP .RS 4 \fIseat\fP the wl_seat of the user event .br \fIserial\fP the serial of the user event .RE .PP Start an interactive, user-driven move of the surface\&. .PP This request must be used in response to some sort of user action like a button press, key press, or touch down event\&. The passed serial is used to determine the type of interactive move (touch, pointer, etc)\&. .PP The server may ignore move requests depending on the state of the surface (e\&.g\&. fullscreen or maximized), or if the passed serial is no longer valid\&. .PP If triggered, the surface will lose the focus of the device (wl_pointer, wl_touch, etc) used for the move\&. It is up to the compositor to visually indicate that the move is taking place, such as updating a pointer cursor, during the move\&. There is no guarantee that the device focus will return when the move is completed\&. .PP Definition at line \fB1282\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void(\fBseat_t\fP, uint32_t, \fBxdg_toplevel_resize_edge\fP)> & xdg_toplevel_t::on_resize ()" .PP start an interactive resize .PP \fBParameters\fP .RS 4 \fIseat\fP the wl_seat of the user event .br \fIserial\fP the serial of the user event .br \fIedges\fP which edge or corner is being dragged .RE .PP Start a user-driven, interactive resize of the surface\&. .PP This request must be used in response to some sort of user action like a button press, key press, or touch down event\&. The passed serial is used to determine the type of interactive resize (touch, pointer, etc)\&. .PP The server may ignore resize requests depending on the state of the surface (e\&.g\&. fullscreen or maximized)\&. .PP If triggered, the client will receive configure events with the 'resize' state enum value and the expected sizes\&. See the 'resize' enum value for more details about what is required\&. The client must also acknowledge configure events using 'ack_configure'\&. After the resize is completed, the client will receive another 'configure' event without the resize state\&. .PP If triggered, the surface also will lose the focus of the device (wl_pointer, wl_touch, etc) used for the resize\&. It is up to the compositor to visually indicate that the resize is taking place, such as updating a pointer cursor, during the resize\&. There is no guarantee that the device focus will return when the resize is completed\&. .PP The edges parameter specifies how the surface should be resized, and is one of the values of the resize_edge enum\&. Values not matching a variant of the enum will cause a protocol error\&. The compositor may use this information to update the surface position for example when dragging the top left corner\&. The compositor may also use this information to adapt its behavior, e\&.g\&. choose an appropriate cursor image\&. .PP Definition at line \fB1288\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void(std::string)> & xdg_toplevel_t::on_set_app_id ()" .PP set application ID .PP \fBParameters\fP .RS 4 \fIapp_id\fP .RE .PP Set an application identifier for the surface\&. .PP The app ID identifies the general class of applications to which the surface belongs\&. The compositor can use this to group multiple surfaces together, or to determine how to launch a new application\&. .PP For D-Bus activatable applications, the app ID is used as the D-Bus service name\&. .PP The compositor shell will try to group application surfaces together by their app ID\&. As a best practice, it is suggested to select app ID's that match the basename of the application's \&.desktop file\&. For example, 'org\&.freedesktop\&.FooViewer' where the \&.desktop file is 'org\&.freedesktop\&.FooViewer\&.desktop'\&. .PP Like other properties, a set_app_id request can be sent after the xdg_toplevel has been mapped to update the property\&. .PP See the desktop-entry specification [0] for more details on application identifiers and how they relate to well-known D-Bus names and \&.desktop files\&. .PP [0] http://standards.freedesktop.org/desktop-entry-spec/ .PP Definition at line \fB1270\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void(\fBoutput_t\fP)> & xdg_toplevel_t::on_set_fullscreen ()" .PP set the window as fullscreen on an output .PP \fBParameters\fP .RS 4 \fIoutput\fP .RE .PP Make the surface fullscreen\&. .PP After requesting that the surface should be fullscreened, the compositor will respond by emitting a configure event\&. Whether the client is actually put into a fullscreen state is subject to compositor policies\&. The client must also acknowledge the configure when committing the new content (see ack_configure)\&. .PP The output passed by the request indicates the client's preference as to which display it should be set fullscreen on\&. If this value is NULL, it's up to the compositor to choose which display will be used to map this surface\&. .PP If the surface doesn't cover the whole output, the compositor will position the surface in the center of the output and compensate with with border fill covering the rest of the output\&. The content of the border fill is undefined, but should be assumed to be in some way that attempts to blend into the surrounding area (e\&.g\&. solid black)\&. .PP If the fullscreened surface is not opaque, the compositor must make sure that other screen content not part of the same surface tree (made up of subsurfaces, popups or similarly coupled surfaces) are not visible below the fullscreened surface\&. .PP Definition at line \fB1318\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void(int32_t, int32_t)> & xdg_toplevel_t::on_set_max_size ()" .PP set the maximum size .PP \fBParameters\fP .RS 4 \fIwidth\fP .br \fIheight\fP .RE .PP Set a maximum size for the window\&. .PP The client can specify a maximum size so that the compositor does not try to configure the window beyond this size\&. .PP The width and height arguments are in window geometry coordinates\&. See xdg_surface\&.set_window_geometry\&. .PP Values set in this way are double-buffered\&. They will get applied on the next commit\&. .PP The compositor can use this information to allow or disallow different states like maximize or fullscreen and draw accurate animations\&. .PP Similarly, a tiling window manager may use this information to place and resize client windows in a more effective way\&. .PP The client should not rely on the compositor to obey the maximum size\&. The compositor may decide to ignore the values set by the client and request a larger size\&. .PP If never set, or a value of zero in the request, means that the client has no expected maximum size in the given dimension\&. As a result, a client wishing to reset the maximum size to an unspecified state can use zero for width and height in the request\&. .PP Requesting a maximum size to be smaller than the minimum size of a surface is illegal and will result in a protocol error\&. .PP The width and height must be greater than or equal to zero\&. Using strictly negative values for width and height will result in a protocol error\&. .PP Definition at line \fB1294\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void()> & xdg_toplevel_t::on_set_maximized ()" .PP maximize the window Maximize the surface\&. .PP After requesting that the surface should be maximized, the compositor will respond by emitting a configure event\&. Whether this configure actually sets the window maximized is subject to compositor policies\&. The client must then update its content, drawing in the configured state\&. The client must also acknowledge the configure when committing the new content (see ack_configure)\&. .PP It is up to the compositor to decide how and where to maximize the surface, for example which output and what region of the screen should be used\&. .PP If the surface was already maximized, the compositor will still emit a configure event with the 'maximized' state\&. .PP If the surface is in a fullscreen state, this request has no direct effect\&. It may alter the state the surface is returned to when unmaximized unless overridden by the compositor\&. .PP Definition at line \fB1306\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void(int32_t, int32_t)> & xdg_toplevel_t::on_set_min_size ()" .PP set the minimum size .PP \fBParameters\fP .RS 4 \fIwidth\fP .br \fIheight\fP .RE .PP Set a minimum size for the window\&. .PP The client can specify a minimum size so that the compositor does not try to configure the window below this size\&. .PP The width and height arguments are in window geometry coordinates\&. See xdg_surface\&.set_window_geometry\&. .PP Values set in this way are double-buffered\&. They will get applied on the next commit\&. .PP The compositor can use this information to allow or disallow different states like maximize or fullscreen and draw accurate animations\&. .PP Similarly, a tiling window manager may use this information to place and resize client windows in a more effective way\&. .PP The client should not rely on the compositor to obey the minimum size\&. The compositor may decide to ignore the values set by the client and request a smaller size\&. .PP If never set, or a value of zero in the request, means that the client has no expected minimum size in the given dimension\&. As a result, a client wishing to reset the minimum size to an unspecified state can use zero for width and height in the request\&. .PP Requesting a minimum size to be larger than the maximum size of a surface is illegal and will result in a protocol error\&. .PP The width and height must be greater than or equal to zero\&. Using strictly negative values for width and height will result in a protocol error\&. .PP Definition at line \fB1300\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void()> & xdg_toplevel_t::on_set_minimized ()" .PP set the window as minimized Request that the compositor minimize your surface\&. There is no way to know if the surface is currently minimized, nor is there any way to unset minimization on this surface\&. .PP If you are looking to throttle redrawing when minimized, please instead use the wl_surface\&.frame event for this, as this will also work with live previews on windows in Alt-Tab, Expose or similar compositor features\&. .PP Definition at line \fB1330\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void(\fBxdg_toplevel_t\fP)> & xdg_toplevel_t::on_set_parent ()" .PP set the parent of this surface .PP \fBParameters\fP .RS 4 \fIparent\fP .RE .PP Set the 'parent' of this surface\&. This surface should be stacked above the parent surface and all other ancestor surfaces\&. .PP Parent windows should be set on dialogs, toolboxes, or other 'auxiliary' surfaces, so that the parent is raised when the dialog is raised\&. .PP Setting a null parent for a child window removes any parent-child relationship for the child\&. Setting a null parent for a window which currently has no parent is a no-op\&. .PP If the parent is unmapped then its children are managed as though the parent of the now-unmapped parent has become the parent of this surface\&. If no parent exists for the now-unmapped parent then the children are managed as though they have no parent surface\&. .PP Definition at line \fB1258\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void(std::string)> & xdg_toplevel_t::on_set_title ()" .PP set surface title .PP \fBParameters\fP .RS 4 \fItitle\fP .RE .PP Set a short title for the surface\&. .PP This string may be used to identify the surface in a task bar, window list, or other user interface elements provided by the compositor\&. .PP The string must be encoded in UTF-8\&. .PP Definition at line \fB1264\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void(\fBseat_t\fP, uint32_t, int32_t, int32_t)> & xdg_toplevel_t::on_show_window_menu ()" .PP show the window menu .PP \fBParameters\fP .RS 4 \fIseat\fP the wl_seat of the user event .br \fIserial\fP the serial of the user event .br \fIx\fP the x position to pop up the window menu at .br \fIy\fP the y position to pop up the window menu at .RE .PP Clients implementing client-side decorations might want to show a context menu when right-clicking on the decorations, giving the user a menu that they can use to maximize or minimize the window\&. .PP This request asks the compositor to pop up such a window menu at the given position, relative to the local surface coordinates of the parent surface\&. There are no guarantees as to what menu items the window menu contains\&. .PP This request must be used in response to some sort of user action like a button press, key press, or touch down event\&. .PP Definition at line \fB1276\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void()> & xdg_toplevel_t::on_unset_fullscreen ()" .PP unset the window as fullscreen Make the surface no longer fullscreen\&. .PP After requesting that the surface should be unfullscreened, the compositor will respond by emitting a configure event\&. Whether this actually removes the fullscreen state of the client is subject to compositor policies\&. .PP Making a surface unfullscreen sets states for the surface based on the following: the state(s) it may have had before becoming fullscreen any state(s) decided by the compositor any state(s) requested by the client while the surface was fullscreen .PP The compositor may include the previous window geometry dimensions in the configure event, if applicable\&. .PP The client must also acknowledge the configure when committing the new content (see ack_configure)\&. .PP Definition at line \fB1324\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "std::function< void()> & xdg_toplevel_t::on_unset_maximized ()" .PP unmaximize the window Unmaximize the surface\&. .PP After requesting that the surface should be unmaximized, the compositor will respond by emitting a configure event\&. Whether this actually un-maximizes the window is subject to compositor policies\&. If available and applicable, the compositor will include the window geometry dimensions the window had prior to being maximized in the configure event\&. The client must then update its content, drawing it in the configured state\&. The client must also acknowledge the configure when committing the new content (see ack_configure)\&. .PP It is up to the compositor to position the surface after it was unmaximized; usually the position the surface had before maximizing, if applicable\&. .PP If the surface was already not maximized, the compositor will still emit a configure event without the 'maximized' state\&. .PP If the surface is in a fullscreen state, this request has no direct effect\&. It may alter the state the surface is returned to when unmaximized unless overridden by the compositor\&. .PP Definition at line \fB1312\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "void xdg_toplevel_t::post_invalid_resize_edge (std::string const & msg)" .PP Post error: provided value is not a valid variant of the resize_edge enum\&. .PP Definition at line \fB1356\fP of file \fBwayland\-server\-protocol\-extra\&.cpp\fP\&. .SS "void wayland::server::resource_t::post_no_memory () const\fC [inherited]\fP" Post 'not enough memory' error to the client .PP 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\&. .SS "bool wayland::server::resource_t::proxy_has_object () const\fC [inherited]\fP" .PP Check whether this wrapper actually wraps an object\&. .PP \fBReturns\fP .RS 4 true if there is an underlying object, false if this wrapper is empty .RE .PP .SH "Member Data Documentation" .PP .SS "constexpr std::uint32_t wayland::server::xdg_toplevel_t::close_since_version = 1\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBclose\fP function\&. .PP Definition at line \fB1750\fP of file \fBwayland\-server\-protocol\-extra\&.hpp\fP\&. .SS "constexpr std::uint32_t wayland::server::xdg_toplevel_t::configure_bounds_since_version = 4\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBconfigure_bounds\fP function\&. .PP Definition at line \fB1777\fP of file \fBwayland\-server\-protocol\-extra\&.hpp\fP\&. .SS "constexpr std::uint32_t wayland::server::xdg_toplevel_t::configure_since_version = 1\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBconfigure\fP function\&. .PP Definition at line \fB1732\fP of file \fBwayland\-server\-protocol\-extra\&.hpp\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Wayland++ from the source code\&.