Wayland++  1.0.0
C++ Bindings for Wayland
wayland-server-protocol-extra.hpp
1 #pragma once
2 
3 #include <array>
4 #include <cstdint>
5 #include <functional>
6 #include <memory>
7 #include <string>
8 #include <vector>
9 
10 #include <wayland-server.hpp>
11 #include <wayland-server-protocol.hpp>
12 
13 struct wp_presentation;
14 struct wp_presentation_feedback;
15 struct wp_viewporter;
16 struct wp_viewport;
17 struct xdg_wm_base;
18 struct xdg_positioner;
19 struct xdg_surface;
20 struct xdg_toplevel;
21 struct xdg_popup;
22 
23 namespace wayland
24 {
25 namespace server
26 {
27 class presentation_t;
28 enum class presentation_error : uint32_t;
29 class presentation_feedback_t;
30 struct presentation_feedback_kind;
31 class viewporter_t;
32 enum class viewporter_error : uint32_t;
33 class viewport_t;
34 enum class viewport_error : uint32_t;
35 class xdg_wm_base_t;
36 enum class xdg_wm_base_error : uint32_t;
37 class xdg_positioner_t;
38 enum class xdg_positioner_error : uint32_t;
39 enum class xdg_positioner_anchor : uint32_t;
40 enum class xdg_positioner_gravity : uint32_t;
41 struct xdg_positioner_constraint_adjustment;
42 class xdg_surface_t;
43 enum class xdg_surface_error : uint32_t;
44 class xdg_toplevel_t;
45 enum class xdg_toplevel_error : uint32_t;
46 struct xdg_toplevel_resize_edge;
47 enum class xdg_toplevel_state : uint32_t;
48 class xdg_popup_t;
49 enum class xdg_popup_error : uint32_t;
50 
51 namespace detail
52 {
53  extern const wl_interface presentation_interface;
54  extern const wl_interface presentation_feedback_interface;
55  extern const wl_interface viewporter_interface;
56  extern const wl_interface viewport_interface;
57  extern const wl_interface xdg_wm_base_interface;
58  extern const wl_interface xdg_positioner_interface;
59  extern const wl_interface xdg_surface_interface;
60  extern const wl_interface xdg_toplevel_interface;
61  extern const wl_interface xdg_popup_interface;
62 }
63 
80 class presentation_t : public resource_t
81 {
82 private:
83  struct events_t : public resource_t::events_base_t
84  {
85  std::function<void()> destroy;
86  std::function<void(surface_t, presentation_feedback_t)> feedback;
87  };
88 
89  static int dispatcher(int opcode, const std::vector<wayland::detail::any>& args, const std::shared_ptr<resource_t::events_base_t>& e);
90 
91 protected:
92  static constexpr const wl_interface *interface = &wayland::server::detail::presentation_interface;
93  static constexpr const unsigned int max_version = 1;
94 
95  friend class global_t<presentation_t>;
96  friend class global_base_t;
97 
98 public:
99  presentation_t() = default;
100  presentation_t(const client_t& client, uint32_t id, int version = 1);
101  presentation_t(const resource_t &resource);
102 
103  static const std::string interface_name;
104 
105  operator wp_presentation*() const;
106 
114  std::function<void()> &on_destroy();
115 
130  std::function<void(surface_t, presentation_feedback_t)> &on_feedback();
131 
166  void clock_id(uint32_t clk_id, bool post = true);
167 
170  static constexpr std::uint32_t clock_id_since_version = 1;
171 
174  void post_invalid_timestamp(std::string const& msg);
175 
178  void post_invalid_flag(std::string const& msg);
179 
180 };
181 
183 
190 enum class presentation_error : uint32_t
191  {
193  invalid_timestamp = 0,
195  invalid_flag = 1
196 };
197 
198 
214 class presentation_feedback_t : public resource_t
215 {
216 private:
217  struct events_t : public resource_t::events_base_t
218  {
219  };
220 
221  static int dispatcher(int opcode, const std::vector<wayland::detail::any>& args, const std::shared_ptr<resource_t::events_base_t>& e);
222 
223 protected:
224  static constexpr const wl_interface *interface = &wayland::server::detail::presentation_feedback_interface;
225  static constexpr const unsigned int max_version = 1;
226 
227  friend class global_t<presentation_feedback_t>;
228  friend class global_base_t;
229 
230 public:
231  presentation_feedback_t() = default;
232  presentation_feedback_t(const client_t& client, uint32_t id, int version = 1);
233  presentation_feedback_t(const resource_t &resource);
234 
235  static const std::string interface_name;
236 
237  operator wp_presentation_feedback*() const;
238 
252  void sync_output(output_t const& output, bool post = true);
253 
256  static constexpr std::uint32_t sync_output_since_version = 1;
257 
310  void presented(uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec, uint32_t refresh, uint32_t seq_hi, uint32_t seq_lo, presentation_feedback_kind const& flags, bool post = true);
311 
314  static constexpr std::uint32_t presented_since_version = 1;
315 
321  void discarded(bool post = true);
322 
325  static constexpr std::uint32_t discarded_since_version = 1;
326 
327 };
328 
330 
339 struct presentation_feedback_kind : public wayland::detail::bitfield<4, 1>
340 {
341  presentation_feedback_kind(const wayland::detail::bitfield<4, 1> &b)
342  : wayland::detail::bitfield<4, 1>(b) {}
343  presentation_feedback_kind(const uint32_t value)
344  : wayland::detail::bitfield<4, 1>(value) {}
345  static const wayland::detail::bitfield<4, 1> vsync;
346  static const wayland::detail::bitfield<4, 1> hw_clock;
347  static const wayland::detail::bitfield<4, 1> hw_completion;
348  static const wayland::detail::bitfield<4, 1> zero_copy;
349 };
350 
351 
362 class viewporter_t : public resource_t
363 {
364 private:
365  struct events_t : public resource_t::events_base_t
366  {
367  std::function<void()> destroy;
368  std::function<void(viewport_t, surface_t)> get_viewport;
369  };
370 
371  static int dispatcher(int opcode, const std::vector<wayland::detail::any>& args, const std::shared_ptr<resource_t::events_base_t>& e);
372 
373 protected:
374  static constexpr const wl_interface *interface = &wayland::server::detail::viewporter_interface;
375  static constexpr const unsigned int max_version = 1;
376 
377  friend class global_t<viewporter_t>;
378  friend class global_base_t;
379 
380 public:
381  viewporter_t() = default;
382  viewporter_t(const client_t& client, uint32_t id, int version = 1);
383  viewporter_t(const resource_t &resource);
384 
385  static const std::string interface_name;
386 
387  operator wp_viewporter*() const;
388 
396  std::function<void()> &on_destroy();
397 
408  std::function<void(viewport_t, surface_t)> &on_get_viewport();
409 
412  void post_viewport_exists(std::string const& msg);
413 
414 };
415 
417 
421 enum class viewporter_error : uint32_t
422  {
424  viewport_exists = 0
425 };
426 
427 
493 class viewport_t : public resource_t
494 {
495 private:
496  struct events_t : public resource_t::events_base_t
497  {
498  std::function<void()> destroy;
499  std::function<void(double, double, double, double)> set_source;
500  std::function<void(int32_t, int32_t)> set_destination;
501  };
502 
503  static int dispatcher(int opcode, const std::vector<wayland::detail::any>& args, const std::shared_ptr<resource_t::events_base_t>& e);
504 
505 protected:
506  static constexpr const wl_interface *interface = &wayland::server::detail::viewport_interface;
507  static constexpr const unsigned int max_version = 1;
508 
509  friend class global_t<viewport_t>;
510  friend class global_base_t;
511 
512 public:
513  viewport_t() = default;
514  viewport_t(const client_t& client, uint32_t id, int version = 1);
515  viewport_t(const resource_t &resource);
516 
517  static const std::string interface_name;
518 
519  operator wp_viewport*() const;
520 
527  std::function<void()> &on_destroy();
528 
548  std::function<void(double, double, double, double)> &on_set_source();
549 
567  std::function<void(int32_t, int32_t)> &on_set_destination();
568 
571  void post_bad_value(std::string const& msg);
572 
575  void post_bad_size(std::string const& msg);
576 
579  void post_out_of_buffer(std::string const& msg);
580 
583  void post_no_surface(std::string const& msg);
584 
585 };
586 
588 
592 enum class viewport_error : uint32_t
593  {
595  bad_value = 0,
597  bad_size = 1,
599  out_of_buffer = 2,
601  no_surface = 3
602 };
603 
604 
614 class xdg_wm_base_t : public resource_t
615 {
616 private:
617  struct events_t : public resource_t::events_base_t
618  {
619  std::function<void()> destroy;
620  std::function<void(xdg_positioner_t)> create_positioner;
621  std::function<void(xdg_surface_t, surface_t)> get_xdg_surface;
622  std::function<void(uint32_t)> pong;
623  };
624 
625  static int dispatcher(int opcode, const std::vector<wayland::detail::any>& args, const std::shared_ptr<resource_t::events_base_t>& e);
626 
627 protected:
628  static constexpr const wl_interface *interface = &wayland::server::detail::xdg_wm_base_interface;
629  static constexpr const unsigned int max_version = 4;
630 
631  friend class global_t<xdg_wm_base_t>;
632  friend class global_base_t;
633 
634 public:
635  xdg_wm_base_t() = default;
636  xdg_wm_base_t(const client_t& client, uint32_t id, int version = 4);
637  xdg_wm_base_t(const resource_t &resource);
638 
639  static const std::string interface_name;
640 
641  operator xdg_wm_base*() const;
642 
652  std::function<void()> &on_destroy();
653 
662  std::function<void(xdg_positioner_t)> &on_create_positioner();
663 
683  std::function<void(xdg_surface_t, surface_t)> &on_get_xdg_surface();
684 
692  std::function<void(uint32_t)> &on_pong();
693 
710  void ping(uint32_t serial, bool post = true);
711 
714  static constexpr std::uint32_t ping_since_version = 1;
715 
718  void post_role(std::string const& msg);
719 
722  void post_defunct_surfaces(std::string const& msg);
723 
726  void post_not_the_topmost_popup(std::string const& msg);
727 
730  void post_invalid_popup_parent(std::string const& msg);
731 
734  void post_invalid_surface_state(std::string const& msg);
735 
738  void post_invalid_positioner(std::string const& msg);
739 
740 };
741 
743 
747 enum class xdg_wm_base_error : uint32_t
748  {
750  role = 0,
752  defunct_surfaces = 1,
754  not_the_topmost_popup = 2,
756  invalid_popup_parent = 3,
758  invalid_surface_state = 4,
760  invalid_positioner = 5
761 };
762 
763 
787 class xdg_positioner_t : public resource_t
788 {
789 private:
790  struct events_t : public resource_t::events_base_t
791  {
792  std::function<void()> destroy;
793  std::function<void(int32_t, int32_t)> set_size;
794  std::function<void(int32_t, int32_t, int32_t, int32_t)> set_anchor_rect;
795  std::function<void(xdg_positioner_anchor)> set_anchor;
796  std::function<void(xdg_positioner_gravity)> set_gravity;
797  std::function<void(xdg_positioner_constraint_adjustment)> set_constraint_adjustment;
798  std::function<void(int32_t, int32_t)> set_offset;
799  std::function<void()> set_reactive;
800  std::function<void(int32_t, int32_t)> set_parent_size;
801  std::function<void(uint32_t)> set_parent_configure;
802  };
803 
804  static int dispatcher(int opcode, const std::vector<wayland::detail::any>& args, const std::shared_ptr<resource_t::events_base_t>& e);
805 
806 protected:
807  static constexpr const wl_interface *interface = &wayland::server::detail::xdg_positioner_interface;
808  static constexpr const unsigned int max_version = 4;
809 
810  friend class global_t<xdg_positioner_t>;
811  friend class global_base_t;
812 
813 public:
814  xdg_positioner_t() = default;
815  xdg_positioner_t(const client_t& client, uint32_t id, int version = 4);
816  xdg_positioner_t(const resource_t &resource);
817 
818  static const std::string interface_name;
819 
820  operator xdg_positioner*() const;
821 
827  std::function<void()> &on_destroy();
828 
840  std::function<void(int32_t, int32_t)> &on_set_size();
841 
860  std::function<void(int32_t, int32_t, int32_t, int32_t)> &on_set_anchor_rect();
861 
873  std::function<void(xdg_positioner_anchor)> &on_set_anchor();
874 
886  std::function<void(xdg_positioner_gravity)> &on_set_gravity();
887 
907 
925  std::function<void(int32_t, int32_t)> &on_set_offset();
926 
937  std::function<void()> &on_set_reactive();
938 
952  std::function<void(int32_t, int32_t)> &on_set_parent_size();
953 
963  std::function<void(uint32_t)> &on_set_parent_configure();
964 
967  void post_invalid_input(std::string const& msg);
968 
969 };
970 
972 
976 enum class xdg_positioner_error : uint32_t
977  {
979  invalid_input = 0
980 };
981 
985 enum class xdg_positioner_anchor : uint32_t
986  {
987  none = 0,
988  top = 1,
989  bottom = 2,
990  left = 3,
991  right = 4,
992  top_left = 5,
993  bottom_left = 6,
994  top_right = 7,
995  bottom_right = 8
996 };
997 
1001 enum class xdg_positioner_gravity : uint32_t
1002  {
1003  none = 0,
1004  top = 1,
1005  bottom = 2,
1006  left = 3,
1007  right = 4,
1008  top_left = 5,
1009  bottom_left = 6,
1010  top_right = 7,
1011  bottom_right = 8
1012 };
1013 
1029 struct xdg_positioner_constraint_adjustment : public wayland::detail::bitfield<6, 8>
1030 {
1031  xdg_positioner_constraint_adjustment(const wayland::detail::bitfield<6, 8> &b)
1032  : wayland::detail::bitfield<6, 8>(b) {}
1033  xdg_positioner_constraint_adjustment(const uint32_t value)
1034  : wayland::detail::bitfield<6, 8>(value) {}
1035  static const wayland::detail::bitfield<6, 8> none;
1036  static const wayland::detail::bitfield<6, 8> slide_x;
1037  static const wayland::detail::bitfield<6, 8> slide_y;
1038  static const wayland::detail::bitfield<6, 8> flip_x;
1039  static const wayland::detail::bitfield<6, 8> flip_y;
1040  static const wayland::detail::bitfield<6, 8> resize_x;
1041  static const wayland::detail::bitfield<6, 8> resize_y;
1042 };
1043 
1044 
1094 class xdg_surface_t : public resource_t
1095 {
1096 private:
1097  struct events_t : public resource_t::events_base_t
1098  {
1099  std::function<void()> destroy;
1100  std::function<void(xdg_toplevel_t)> get_toplevel;
1101  std::function<void(xdg_popup_t, xdg_surface_t, xdg_positioner_t)> get_popup;
1102  std::function<void(int32_t, int32_t, int32_t, int32_t)> set_window_geometry;
1103  std::function<void(uint32_t)> ack_configure;
1104  };
1105 
1106  static int dispatcher(int opcode, const std::vector<wayland::detail::any>& args, const std::shared_ptr<resource_t::events_base_t>& e);
1107 
1108 protected:
1109  static constexpr const wl_interface *interface = &wayland::server::detail::xdg_surface_interface;
1110  static constexpr const unsigned int max_version = 4;
1111 
1112  friend class global_t<xdg_surface_t>;
1113  friend class global_base_t;
1114 
1115 public:
1116  xdg_surface_t() = default;
1117  xdg_surface_t(const client_t& client, uint32_t id, int version = 4);
1118  xdg_surface_t(const resource_t &resource);
1119 
1120  static const std::string interface_name;
1121 
1122  operator xdg_surface*() const;
1123 
1130  std::function<void()> &on_destroy();
1131 
1142  std::function<void(xdg_toplevel_t)> &on_get_toplevel();
1143 
1159  std::function<void(xdg_popup_t, xdg_surface_t, xdg_positioner_t)> &on_get_popup();
1160 
1198  std::function<void(int32_t, int32_t, int32_t, int32_t)> &on_set_window_geometry();
1199 
1224  std::function<void(uint32_t)> &on_ack_configure();
1225 
1247  void configure(uint32_t serial, bool post = true);
1248 
1251  static constexpr std::uint32_t configure_since_version = 1;
1252 
1255  void post_not_constructed(std::string const& msg);
1256 
1259  void post_already_constructed(std::string const& msg);
1260 
1263  void post_unconfigured_buffer(std::string const& msg);
1264 
1265 };
1266 
1268 
1272 enum class xdg_surface_error : uint32_t
1273  {
1274  not_constructed = 1,
1275  already_constructed = 2,
1276  unconfigured_buffer = 3
1277 };
1278 
1279 
1301 class xdg_toplevel_t : public resource_t
1302 {
1303 private:
1304  struct events_t : public resource_t::events_base_t
1305  {
1306  std::function<void()> destroy;
1307  std::function<void(xdg_toplevel_t)> set_parent;
1308  std::function<void(std::string)> set_title;
1309  std::function<void(std::string)> set_app_id;
1310  std::function<void(seat_t, uint32_t, int32_t, int32_t)> show_window_menu;
1311  std::function<void(seat_t, uint32_t)> move;
1312  std::function<void(seat_t, uint32_t, xdg_toplevel_resize_edge)> resize;
1313  std::function<void(int32_t, int32_t)> set_max_size;
1314  std::function<void(int32_t, int32_t)> set_min_size;
1315  std::function<void()> set_maximized;
1316  std::function<void()> unset_maximized;
1317  std::function<void(output_t)> set_fullscreen;
1318  std::function<void()> unset_fullscreen;
1319  std::function<void()> set_minimized;
1320  };
1321 
1322  static int dispatcher(int opcode, const std::vector<wayland::detail::any>& args, const std::shared_ptr<resource_t::events_base_t>& e);
1323 
1324 protected:
1325  static constexpr const wl_interface *interface = &wayland::server::detail::xdg_toplevel_interface;
1326  static constexpr const unsigned int max_version = 4;
1327 
1328  friend class global_t<xdg_toplevel_t>;
1329  friend class global_base_t;
1330 
1331 public:
1332  xdg_toplevel_t() = default;
1333  xdg_toplevel_t(const client_t& client, uint32_t id, int version = 4);
1334  xdg_toplevel_t(const resource_t &resource);
1335 
1336  static const std::string interface_name;
1337 
1338  operator xdg_toplevel*() const;
1339 
1346  std::function<void()> &on_destroy();
1347 
1369  std::function<void(xdg_toplevel_t)> &on_set_parent();
1370 
1383  std::function<void(std::string)> &on_set_title();
1384 
1413  std::function<void(std::string)> &on_set_app_id();
1414 
1434  std::function<void(seat_t, uint32_t, int32_t, int32_t)> &on_show_window_menu();
1435 
1458  std::function<void(seat_t, uint32_t)> &on_move();
1459 
1498  std::function<void(seat_t, uint32_t, xdg_toplevel_resize_edge)> &on_resize();
1499 
1540  std::function<void(int32_t, int32_t)> &on_set_max_size();
1541 
1582  std::function<void(int32_t, int32_t)> &on_set_min_size();
1583 
1607  std::function<void()> &on_set_maximized();
1608 
1634  std::function<void()> &on_unset_maximized();
1635 
1664  std::function<void(output_t)> &on_set_fullscreen();
1665 
1687  std::function<void()> &on_unset_fullscreen();
1688 
1701  std::function<void()> &on_set_minimized();
1702 
1729  void configure(int32_t width, int32_t height, array_t const& states, bool post = true);
1730 
1733  static constexpr std::uint32_t configure_since_version = 1;
1734 
1747  void close(bool post = true);
1748 
1751  static constexpr std::uint32_t close_since_version = 1;
1752 
1774  void configure_bounds(int32_t width, int32_t height, bool post = true);
1775 
1778  static constexpr std::uint32_t configure_bounds_since_version = 4;
1779 
1783  bool can_configure_bounds() const;
1784 
1787  void post_invalid_resize_edge(std::string const& msg);
1788 
1789 };
1790 
1792 
1796 enum class xdg_toplevel_error : uint32_t
1797  {
1799  invalid_resize_edge = 0
1800 };
1801 
1808 struct xdg_toplevel_resize_edge : public wayland::detail::bitfield<4, 11>
1809 {
1810  xdg_toplevel_resize_edge(const wayland::detail::bitfield<4, 11> &b)
1811  : wayland::detail::bitfield<4, 11>(b) {}
1812  xdg_toplevel_resize_edge(const uint32_t value)
1813  : wayland::detail::bitfield<4, 11>(value) {}
1814  static const wayland::detail::bitfield<4, 11> none;
1815  static const wayland::detail::bitfield<4, 11> top;
1816  static const wayland::detail::bitfield<4, 11> bottom;
1817  static const wayland::detail::bitfield<4, 11> left;
1818  static const wayland::detail::bitfield<4, 11> top_left;
1819  static const wayland::detail::bitfield<4, 11> bottom_left;
1820  static const wayland::detail::bitfield<4, 11> right;
1821  static const wayland::detail::bitfield<4, 11> top_right;
1822  static const wayland::detail::bitfield<4, 11> bottom_right;
1823 };
1824 
1836 enum class xdg_toplevel_state : uint32_t
1837  {
1839  maximized = 1,
1841  fullscreen = 2,
1843  resizing = 3,
1845  activated = 4,
1846  tiled_left = 5,
1847  tiled_right = 6,
1848  tiled_top = 7,
1849  tiled_bottom = 8
1850 };
1851 
1852 
1881 class xdg_popup_t : public resource_t
1882 {
1883 private:
1884  struct events_t : public resource_t::events_base_t
1885  {
1886  std::function<void()> destroy;
1887  std::function<void(seat_t, uint32_t)> grab;
1888  std::function<void(xdg_positioner_t, uint32_t)> reposition;
1889  };
1890 
1891  static int dispatcher(int opcode, const std::vector<wayland::detail::any>& args, const std::shared_ptr<resource_t::events_base_t>& e);
1892 
1893 protected:
1894  static constexpr const wl_interface *interface = &wayland::server::detail::xdg_popup_interface;
1895  static constexpr const unsigned int max_version = 4;
1896 
1897  friend class global_t<xdg_popup_t>;
1898  friend class global_base_t;
1899 
1900 public:
1901  xdg_popup_t() = default;
1902  xdg_popup_t(const client_t& client, uint32_t id, int version = 4);
1903  xdg_popup_t(const resource_t &resource);
1904 
1905  static const std::string interface_name;
1906 
1907  operator xdg_popup*() const;
1908 
1918  std::function<void()> &on_destroy();
1919 
1967  std::function<void(seat_t, uint32_t)> &on_grab();
1968 
1998  std::function<void(xdg_positioner_t, uint32_t)> &on_reposition();
1999 
2020  void configure(int32_t x, int32_t y, int32_t width, int32_t height, bool post = true);
2021 
2024  static constexpr std::uint32_t configure_since_version = 1;
2025 
2033  void popup_done(bool post = true);
2034 
2037  static constexpr std::uint32_t popup_done_since_version = 1;
2038 
2059  void repositioned(uint32_t token, bool post = true);
2060 
2063  static constexpr std::uint32_t repositioned_since_version = 3;
2064 
2068  bool can_repositioned() const;
2069 
2072  void post_invalid_grab(std::string const& msg);
2073 
2074 };
2075 
2077 
2081 enum class xdg_popup_error : uint32_t
2082  {
2084  invalid_grab = 0
2085 };
2086 
2087 
2088 
2089 }
2090 }
static constexpr std::uint32_t discarded_since_version
Minimum protocol version required for the discarded function.
void discarded(bool post=true)
the content update was not displayed
void presented(uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec, uint32_t refresh, uint32_t seq_hi, uint32_t seq_lo, presentation_feedback_kind const &flags, bool post=true)
the content update was displayed
static constexpr std::uint32_t presented_since_version
Minimum protocol version required for the presented function.
static constexpr std::uint32_t sync_output_since_version
Minimum protocol version required for the sync_output function.
void sync_output(output_t const &output, bool post=true)
presentation synchronized to this output
timed presentation related wl_surface requests
void post_invalid_timestamp(std::string const &msg)
Post error: invalid value in tv_nsec.
std::function< void(surface_t, presentation_feedback_t)> & on_feedback()
request presentation feedback information
std::function< void()> & on_destroy()
unbind from the presentation interface
void post_invalid_flag(std::string const &msg)
Post error: invalid flag.
static constexpr std::uint32_t clock_id_since_version
Minimum protocol version required for the clock_id function.
void clock_id(uint32_t clk_id, bool post=true)
clock ID for timestamps
crop and scale interface to a wl_surface
void post_bad_size(std::string const &msg)
Post error: destination size is not integer.
std::function< void(int32_t, int32_t)> & on_set_destination()
set the surface size for scaling
void post_no_surface(std::string const &msg)
Post error: the wl_surface was destroyed.
std::function< void()> & on_destroy()
remove scaling and cropping from the surface
void post_bad_value(std::string const &msg)
Post error: negative or zero values in width or height.
void post_out_of_buffer(std::string const &msg)
Post error: source rectangle extends outside of the content area.
std::function< void(double, double, double, double)> & on_set_source()
set the source rectangle for cropping
std::function< void(viewport_t, surface_t)> & on_get_viewport()
extend surface interface for crop and scale
std::function< void()> & on_destroy()
unbind from the cropping and scaling interface
void post_viewport_exists(std::string const &msg)
Post error: the surface already has a viewport object associated.
short-lived, popup surfaces for menus
std::function< void(seat_t, uint32_t)> & on_grab()
make the popup take an explicit grab
bool can_repositioned() const
Check whether the repositioned function is available with the currently bound version of the protocol...
void configure(int32_t x, int32_t y, int32_t width, int32_t height, bool post=true)
configure the popup surface
std::function< void(xdg_positioner_t, uint32_t)> & on_reposition()
recalculate the popup's location
void popup_done(bool post=true)
popup interaction is done
void post_invalid_grab(std::string const &msg)
Post error: tried to grab after being mapped.
void repositioned(uint32_t token, bool post=true)
signal the completion of a repositioned request
static constexpr std::uint32_t configure_since_version
Minimum protocol version required for the configure function.
static constexpr std::uint32_t repositioned_since_version
Minimum protocol version required for the repositioned function.
std::function< void()> & on_destroy()
remove xdg_popup interface
static constexpr std::uint32_t popup_done_since_version
Minimum protocol version required for the popup_done function.
std::function< void(xdg_positioner_gravity)> & on_set_gravity()
set child surface gravity
void post_invalid_input(std::string const &msg)
Post error: invalid input provided.
std::function< void(int32_t, int32_t)> & on_set_size()
set the size of the to-be positioned rectangle
std::function< void(xdg_positioner_anchor)> & on_set_anchor()
set anchor rectangle anchor
std::function< void()> & on_destroy()
destroy the xdg_positioner object
std::function< void(xdg_positioner_constraint_adjustment)> & on_set_constraint_adjustment()
set the adjustment to be done when constrained
std::function< void(int32_t, int32_t)> & on_set_offset()
set surface position offset
std::function< void(int32_t, int32_t)> & on_set_parent_size()
std::function< void()> & on_set_reactive()
continuously reconstrain the surface
std::function< void(uint32_t)> & on_set_parent_configure()
set parent configure this is a response to
std::function< void(int32_t, int32_t, int32_t, int32_t)> & on_set_anchor_rect()
set the anchor rectangle within the parent surface
desktop user interface surface base interface
std::function< void()> & on_destroy()
destroy the xdg_surface
void post_not_constructed(std::string const &msg)
Post error:
void post_already_constructed(std::string const &msg)
Post error:
std::function< void(xdg_toplevel_t)> & on_get_toplevel()
assign the xdg_toplevel surface role
void post_unconfigured_buffer(std::string const &msg)
Post error:
void configure(uint32_t serial, bool post=true)
suggest a surface change
std::function< void(int32_t, int32_t, int32_t, int32_t)> & on_set_window_geometry()
set the new window geometry
std::function< void(uint32_t)> & on_ack_configure()
ack a configure event
static constexpr std::uint32_t configure_since_version
Minimum protocol version required for the configure function.
std::function< void(xdg_popup_t, xdg_surface_t, xdg_positioner_t)> & on_get_popup()
assign the xdg_popup surface role
std::function< void(int32_t, int32_t)> & on_set_min_size()
set the minimum size
std::function< void(seat_t, uint32_t, int32_t, int32_t)> & on_show_window_menu()
show the window menu
std::function< void()> & on_unset_maximized()
unmaximize the window
static constexpr std::uint32_t configure_bounds_since_version
Minimum protocol version required for the configure_bounds function.
static constexpr std::uint32_t close_since_version
Minimum protocol version required for the close function.
std::function< void()> & on_unset_fullscreen()
unset the window as fullscreen
bool can_configure_bounds() const
Check whether the configure_bounds function is available with the currently bound version of the prot...
std::function< void(xdg_toplevel_t)> & on_set_parent()
set the parent of this surface
std::function< void(std::string)> & on_set_app_id()
set application ID
static constexpr std::uint32_t configure_since_version
Minimum protocol version required for the configure function.
std::function< void(int32_t, int32_t)> & on_set_max_size()
set the maximum size
void close(bool post=true)
surface wants to be closed
void post_invalid_resize_edge(std::string const &msg)
Post error: provided value is not a valid variant of the resize_edge enum.
std::function< void(std::string)> & on_set_title()
set surface title
std::function< void(seat_t, uint32_t)> & on_move()
start an interactive move
std::function< void()> & on_set_maximized()
maximize the window
std::function< void(seat_t, uint32_t, xdg_toplevel_resize_edge)> & on_resize()
start an interactive resize
std::function< void(output_t)> & on_set_fullscreen()
set the window as fullscreen on an output
std::function< void()> & on_set_minimized()
set the window as minimized
void configure_bounds(int32_t width, int32_t height, bool post=true)
recommended window geometry bounds
void configure(int32_t width, int32_t height, array_t const &states, bool post=true)
suggest a surface change
std::function< void()> & on_destroy()
destroy the xdg_toplevel
std::function< void()> & on_destroy()
destroy xdg_wm_base
std::function< void(uint32_t)> & on_pong()
respond to a ping event
void post_invalid_surface_state(std::string const &msg)
Post error: the client provided an invalid surface state.
void post_invalid_popup_parent(std::string const &msg)
Post error: the client specified an invalid popup parent surface.
void post_role(std::string const &msg)
Post error: given wl_surface has another role.
void post_defunct_surfaces(std::string const &msg)
Post error: xdg_wm_base was destroyed before children.
void ping(uint32_t serial, bool post=true)
check if the client is alive
std::function< void(xdg_positioner_t)> & on_create_positioner()
create a positioner object
void post_invalid_positioner(std::string const &msg)
Post error: the client provided an invalid positioner.
std::function< void(xdg_surface_t, surface_t)> & on_get_xdg_surface()
create a shell surface from a surface
void post_not_the_topmost_popup(std::string const &msg)
Post error: the client tried to map or destroy a non-topmost popup.
static constexpr std::uint32_t ping_since_version
Minimum protocol version required for the ping function.