Loading...
Searching...
No Matches
wayland::proxy_t Class Reference

Represents a protocol object on the client side. More...

`#include <wayland-client.hpp>`

Inherited by wayland::buffer_t, wayland::callback_t, wayland::compositor_t, wayland::data_device_manager_t, wayland::data_device_t, wayland::data_offer_t, wayland::data_source_t, wayland::display_t, wayland::keyboard_t, wayland::output_t, wayland::pointer_t, wayland::presentation_feedback_t, wayland::presentation_t, wayland::region_t, wayland::registry_t, wayland::seat_t, wayland::shell_surface_t, wayland::shell_t, wayland::shm_pool_t, wayland::shm_t, wayland::subcompositor_t, wayland::subsurface_t, wayland::surface_t, wayland::touch_t, wayland::viewport_t, wayland::viewporter_t, wayland::xdg_activation_token_v1_t, wayland::xdg_activation_v1_t, wayland::xdg_popup_t, wayland::xdg_positioner_t, wayland::xdg_surface_t, wayland::xdg_toplevel_t, wayland::xdg_wm_base_t, wayland::zwp_confined_pointer_v1_t, wayland::zwp_fullscreen_shell_mode_feedback_v1_t, wayland::zwp_fullscreen_shell_v1_t, wayland::zwp_idle_inhibit_manager_v1_t, wayland::zwp_idle_inhibitor_v1_t, wayland::zwp_input_method_context_v1_t, wayland::zwp_input_method_v1_t, wayland::zwp_input_panel_surface_v1_t, wayland::zwp_input_panel_v1_t, wayland::zwp_input_timestamps_manager_v1_t, wayland::zwp_input_timestamps_v1_t, wayland::zwp_keyboard_shortcuts_inhibit_manager_v1_t, wayland::zwp_keyboard_shortcuts_inhibitor_v1_t, wayland::zwp_linux_buffer_params_v1_t, wayland::zwp_linux_buffer_release_v1_t, wayland::zwp_linux_dmabuf_feedback_v1_t, wayland::zwp_linux_dmabuf_v1_t, wayland::zwp_linux_explicit_synchronization_v1_t, wayland::zwp_linux_surface_synchronization_v1_t, wayland::zwp_locked_pointer_v1_t, wayland::zwp_pointer_constraints_v1_t, wayland::zwp_pointer_gesture_hold_v1_t, wayland::zwp_pointer_gesture_pinch_v1_t, wayland::zwp_pointer_gesture_swipe_v1_t, wayland::zwp_pointer_gestures_v1_t, wayland::zwp_primary_selection_device_manager_v1_t, wayland::zwp_primary_selection_device_v1_t, wayland::zwp_primary_selection_offer_v1_t, wayland::zwp_primary_selection_source_v1_t, wayland::zwp_relative_pointer_manager_v1_t, wayland::zwp_relative_pointer_v1_t, wayland::zwp_tablet_manager_v1_t, wayland::zwp_tablet_manager_v2_t, wayland::zwp_tablet_pad_group_v2_t, wayland::zwp_tablet_pad_ring_v2_t, wayland::zwp_tablet_pad_strip_v2_t, wayland::zwp_tablet_pad_v2_t, wayland::zwp_tablet_seat_v1_t, wayland::zwp_tablet_seat_v2_t, wayland::zwp_tablet_tool_v1_t, wayland::zwp_tablet_tool_v2_t, wayland::zwp_tablet_v1_t, wayland::zwp_tablet_v2_t, wayland::zwp_text_input_manager_v1_t, wayland::zwp_text_input_manager_v3_t, wayland::zwp_text_input_v1_t, wayland::zwp_text_input_v3_t, wayland::zwp_xwayland_keyboard_grab_manager_v1_t, wayland::zwp_xwayland_keyboard_grab_v1_t, wayland::zxdg_decoration_manager_v1_t, wayland::zxdg_exported_v1_t, wayland::zxdg_exported_v2_t, wayland::zxdg_exporter_v1_t, wayland::zxdg_exporter_v2_t, wayland::zxdg_imported_v1_t, wayland::zxdg_imported_v2_t, wayland::zxdg_importer_v1_t, wayland::zxdg_importer_v2_t, wayland::zxdg_output_manager_v1_t, wayland::zxdg_output_v1_t, wayland::zxdg_popup_v6_t, wayland::zxdg_positioner_v6_t, wayland::zxdg_shell_v6_t, wayland::zxdg_surface_v6_t, wayland::zxdg_toplevel_decoration_v1_t, and wayland::zxdg_toplevel_v6_t.

## Public Types

enum class | wrapper_type { standard , display , foreign , proxy_wrapper }

## Public Member Functions

| proxy_t (wl_proxy *p, wrapper_type t=wrapper_type::standard, event_queue_t const &queue=event_queue_t())
| Cronstruct a proxy_t from a wl_proxy pointer.
| proxy_t (const proxy_t &p)
| Copy Constructior.
proxy_t & | operator= (const proxy_t &p)
| Assignment operator.
| proxy_t (proxy_t &&p) noexcept
| Move Constructior.
proxy_t & | operator= (proxy_t &&p) noexcept
| Move Asignment operator.
| ~proxy_t ()
| Destructor.
uint32_t | get_id () const
| Get the id of a proxy object.
std::string | get_class () const
| Get the interface name (class) of a proxy object.
uint32_t | get_version () const
| Get the protocol object version of a proxy object.
wrapper_type | get_wrapper_type () const
| Get the type of a proxy object.
void | set_queue (event_queue_t queue)
| Assign a proxy to an event queue.
wl_proxy * | c_ptr () const
| Get a pointer to the underlying C struct.
bool | proxy_has_object () const
| Check whether this wrapper actually wraps an object.
| operator bool () const
| Check whether this wrapper actually wraps an object.
bool | operator== (const proxy_t &right) const
| Check whether two wrappers refer to the same object.
bool | operator!= (const proxy_t &right) const
| Check whether two wrappers refer to different objects.
void | proxy_release ()
| Release the wrapped object (if any), making this an empty wrapper.

## Detailed Description

Represents a protocol object on the client side.

A proxy_t acts as a client side proxy to an object existing in the compositor. The proxy is responsible for converting requests made by the clients with proxy_t::marshal() or proxy_t::marshal_constructor() into Wayland's wire format. Events coming from the compositor are also handled by the proxy, which will in turn call the handler set with the on_XXX() functions of each interface class.

With the exception of the function proxy_t::set_queue(), functions accessing a proxy_t are not normally used by client code. Clients should normally use the higher level interface classed generated by the scanner to interact with compositor objects.

Definition at line 110 of file wayland-client.hpp.

## Member Enumeration Documentation

## wrapper_type

enum class wayland::proxy_t::wrapper_type

strong

Underlying wl_proxy type and properties of a proxy_t that affect construction, destruction, and event handling

Enumerator
standard | C pointer is a standard type compatible with wl_proxy*. Events are dispatched and it is destructed when the proxy_t is destructed. User data is set.
display | C pointer is a wl_display*. No events are dispatched, wl_display_disconnect is called when the proxy_t is destructed. User data is set.

foreign

C pointer is a standard type compatible with wl_proxy*, but another library owns it and it should not be touched in a way that could affect the operation of the other library. No events are dispatched, wl_proxy_destroy is not called when the proxy_t is destructed, user data is not touched. Consequently, there is no reference counting for the proxy_t. Lifetime of such wrappers should preferably be short to minimize the chance that the owning library decides to destroy the wl_proxy.

proxy_wrapper | C pointer is a wl_proxy* that was constructed with wl_proxy_create_wrapper. No events are dispatched, wl_proxy_wrapper_destroy is called when the proxy_t is destroyed. Reference counting is active. A reference to the proxy_t creating this proxy wrapper is held to extend its lifetime until after the proxy wrapper is destroyed.

Definition at line 117 of file wayland-client.hpp.

## Constructor & Destructor Documentation

## proxy_t() [1/3]

wayland::proxy_t::proxy_t | ( | wl_proxy * | p,
|  | wrapper_type | t = `wrapper_type::standard`,
|  | event_queue_t const & | queue = `event_queue_t()`
| ) |  |

Cronstruct a proxy_t from a wl_proxy pointer.

Parameters

  p | Pointer to a wl_proxy
  t | type and requested behavior of the pointer
  queue | initial event queue reference to retain (set_queue is not called)

## proxy_t() [2/3]

wayland::proxy_t::proxy_t | ( | const proxy_t & | p | ) |

Copy Constructior.

Parameters

  p | A proxy_t object

Creates a copy of the proxy_t object that points to the sme proxy.

## proxy_t() [3/3]

wayland::proxy_t::proxy_t | ( | proxy_t && | p | ) |

noexcept

Move Constructior.

Parameters

  p | A proxy_t object

Transfers the contents of the proxy_t object on the right to the proxy_t object being constructed.

## ~proxy_t()

wayland::proxy_t::~proxy_t | ( |  | ) |

Destructor.

If this is the last copy of a paticular proxy, the proxy itself will be detroyed and an destroy request will be marshaled. If the proxy belongs to a wl_display object, the connection will be closed. Special rules apply to proxy wrappers and foreign proxies. See wrapper_type for more infos.

## Member Function Documentation

## c_ptr()

wl_proxy * wayland::proxy_t::c_ptr | ( |  | ) | const

Get a pointer to the underlying C struct.

Returns
  The underlying wl_proxy wrapped by this proxy_t if it exists, otherwise an exception is thrown

## get_class()

std::string wayland::proxy_t::get_class | ( |  | ) | const

Get the interface name (class) of a proxy object.

Returns
  The interface name of the object associated with the proxy

## get_id()

uint32_t wayland::proxy_t::get_id | ( |  | ) | const

Get the id of a proxy object.

Returns
  The id the object associated with the proxy

## get_version()

uint32_t wayland::proxy_t::get_version | ( |  | ) | const

Get the protocol object version of a proxy object.

Gets the protocol object version of a proxy object, or 0 if the proxy was created with unversioned API.

A returned value of 0 means that no version information is available, so the caller must make safe assumptions about the object's real version.

display_t will always return version 0.

Returns
  The protocol object version of the proxy or 0

## get_wrapper_type()

wrapper_type wayland::proxy_t::get_wrapper_type | ( |  | ) | const

inline

Get the type of a proxy object.

Definition at line 303 of file wayland-client.hpp.

## operator bool()

wayland::proxy_t::operator bool | ( |  | ) | const

Check whether this wrapper actually wraps an object.

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

## operator!=()

bool wayland::proxy_t::operator!= | ( | const proxy_t & | right | ) | const

Check whether two wrappers refer to different objects.

## operator=() [1/2]

proxy_t & wayland::proxy_t::operator= | ( | const proxy_t & | p | ) |

Assignment operator.

Parameters

  p | A proxy_t object

After an assignment, both proxy_t objects will point to the same proxy.

## operator=() [2/2]

proxy_t & wayland::proxy_t::operator= | ( | proxy_t && | p | ) |

noexcept

Move Asignment operator.

Parameters

  p | A proxy_t object

Swaps the contents of both proxy_t objects.

## operator==()

bool wayland::proxy_t::operator== | ( | const proxy_t & | right | ) | const

Check whether two wrappers refer to the same object.

## proxy_has_object()

bool wayland::proxy_t::proxy_has_object | ( |  | ) | const

Check whether this wrapper actually wraps an object.

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

## proxy_release()

void wayland::proxy_t::proxy_release | ( |  | ) |

Release the wrapped object (if any), making this an empty wrapper.

Note that display_t instances cannot be released this way. Attempts to do so are ignored.

Examples
  foreign_display.cpp.

## set_queue()

void wayland::proxy_t::set_queue | ( | event_queue_t | queue | ) |

Assign a proxy to an event queue.

Parameters

  queue | The event queue that will handle this proxy

Assign proxy to event queue. Events coming from proxy will be queued in queue instead of the display's main queue.

See also: display_t::dispatch_queue().

Examples
  proxy_wrapper.cpp.

The documentation for this class was generated from the following file:

- include/wayland-client.hpp