xdg-shell-client-protocol.h 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392
  1. /* Generated by wayland-scanner 1.26.0 */
  2. #ifndef XDG_SHELL_CLIENT_PROTOCOL_H
  3. #define XDG_SHELL_CLIENT_PROTOCOL_H
  4. #include <stdint.h>
  5. #include <stddef.h>
  6. #include "wayland-client.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. /**
  11. * @page page_xdg_shell The xdg_shell protocol
  12. * @section page_ifaces_xdg_shell Interfaces
  13. * - @subpage page_iface_xdg_wm_base - create desktop-style surfaces
  14. * - @subpage page_iface_xdg_positioner - child surface positioner
  15. * - @subpage page_iface_xdg_surface - desktop user interface surface base interface
  16. * - @subpage page_iface_xdg_toplevel - toplevel surface
  17. * - @subpage page_iface_xdg_popup - short-lived, popup surfaces for menus
  18. * @section page_copyright_xdg_shell Copyright
  19. * <pre>
  20. *
  21. * Copyright © 2008-2013 Kristian Høgsberg
  22. * Copyright © 2013 Rafael Antognolli
  23. * Copyright © 2013 Jasper St. Pierre
  24. * Copyright © 2010-2013 Intel Corporation
  25. * Copyright © 2015-2017 Samsung Electronics Co., Ltd
  26. * Copyright © 2015-2017 Red Hat Inc.
  27. *
  28. * Permission is hereby granted, free of charge, to any person obtaining a
  29. * copy of this software and associated documentation files (the "Software"),
  30. * to deal in the Software without restriction, including without limitation
  31. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  32. * and/or sell copies of the Software, and to permit persons to whom the
  33. * Software is furnished to do so, subject to the following conditions:
  34. *
  35. * The above copyright notice and this permission notice (including the next
  36. * paragraph) shall be included in all copies or substantial portions of the
  37. * Software.
  38. *
  39. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  40. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  42. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  44. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  45. * DEALINGS IN THE SOFTWARE.
  46. * </pre>
  47. */
  48. struct wl_output;
  49. struct wl_seat;
  50. struct wl_surface;
  51. struct xdg_popup;
  52. struct xdg_positioner;
  53. struct xdg_surface;
  54. struct xdg_toplevel;
  55. struct xdg_wm_base;
  56. #ifndef XDG_WM_BASE_INTERFACE
  57. #define XDG_WM_BASE_INTERFACE
  58. /**
  59. * @page page_iface_xdg_wm_base xdg_wm_base
  60. * @section page_iface_xdg_wm_base_desc Description
  61. *
  62. * The xdg_wm_base interface is exposed as a global object enabling clients
  63. * to turn their wl_surfaces into windows in a desktop environment. It
  64. * defines the basic functionality needed for clients and the compositor to
  65. * create windows that can be dragged, resized, maximized, etc, as well as
  66. * creating transient windows such as popup menus.
  67. * @section page_iface_xdg_wm_base_api API
  68. * See @ref iface_xdg_wm_base.
  69. */
  70. /**
  71. * @defgroup iface_xdg_wm_base The xdg_wm_base interface
  72. *
  73. * The xdg_wm_base interface is exposed as a global object enabling clients
  74. * to turn their wl_surfaces into windows in a desktop environment. It
  75. * defines the basic functionality needed for clients and the compositor to
  76. * create windows that can be dragged, resized, maximized, etc, as well as
  77. * creating transient windows such as popup menus.
  78. */
  79. extern const struct wl_interface xdg_wm_base_interface;
  80. #endif
  81. #ifndef XDG_POSITIONER_INTERFACE
  82. #define XDG_POSITIONER_INTERFACE
  83. /**
  84. * @page page_iface_xdg_positioner xdg_positioner
  85. * @section page_iface_xdg_positioner_desc Description
  86. *
  87. * The xdg_positioner provides a collection of rules for the placement of a
  88. * child surface relative to a parent surface. Rules can be defined to ensure
  89. * the child surface remains within the visible area's borders, and to
  90. * specify how the child surface changes its position, such as sliding along
  91. * an axis, or flipping around a rectangle. These positioner-created rules are
  92. * constrained by the requirement that a child surface must intersect with or
  93. * be at least partially adjacent to its parent surface.
  94. *
  95. * See the various requests for details about possible rules.
  96. *
  97. * At the time of the request, the compositor makes a copy of the rules
  98. * specified by the xdg_positioner. Thus, after the request is complete the
  99. * xdg_positioner object can be destroyed or reused; further changes to the
  100. * object will have no effect on previous usages.
  101. *
  102. * For an xdg_positioner object to be considered complete, it must have a
  103. * non-zero size set by set_size, and a non-zero anchor rectangle set by
  104. * set_anchor_rect. Passing an incomplete xdg_positioner object when
  105. * positioning a surface raises an invalid_positioner error.
  106. * @section page_iface_xdg_positioner_api API
  107. * See @ref iface_xdg_positioner.
  108. */
  109. /**
  110. * @defgroup iface_xdg_positioner The xdg_positioner interface
  111. *
  112. * The xdg_positioner provides a collection of rules for the placement of a
  113. * child surface relative to a parent surface. Rules can be defined to ensure
  114. * the child surface remains within the visible area's borders, and to
  115. * specify how the child surface changes its position, such as sliding along
  116. * an axis, or flipping around a rectangle. These positioner-created rules are
  117. * constrained by the requirement that a child surface must intersect with or
  118. * be at least partially adjacent to its parent surface.
  119. *
  120. * See the various requests for details about possible rules.
  121. *
  122. * At the time of the request, the compositor makes a copy of the rules
  123. * specified by the xdg_positioner. Thus, after the request is complete the
  124. * xdg_positioner object can be destroyed or reused; further changes to the
  125. * object will have no effect on previous usages.
  126. *
  127. * For an xdg_positioner object to be considered complete, it must have a
  128. * non-zero size set by set_size, and a non-zero anchor rectangle set by
  129. * set_anchor_rect. Passing an incomplete xdg_positioner object when
  130. * positioning a surface raises an invalid_positioner error.
  131. */
  132. extern const struct wl_interface xdg_positioner_interface;
  133. #endif
  134. #ifndef XDG_SURFACE_INTERFACE
  135. #define XDG_SURFACE_INTERFACE
  136. /**
  137. * @page page_iface_xdg_surface xdg_surface
  138. * @section page_iface_xdg_surface_desc Description
  139. *
  140. * An interface that may be implemented by a wl_surface, for
  141. * implementations that provide a desktop-style user interface.
  142. *
  143. * It provides a base set of functionality required to construct user
  144. * interface elements requiring management by the compositor, such as
  145. * toplevel windows, menus, etc. The types of functionality are split into
  146. * xdg_surface roles.
  147. *
  148. * Creating an xdg_surface does not set the role for a wl_surface. In order
  149. * to map an xdg_surface, the client must create a role-specific object
  150. * using, e.g., get_toplevel, get_popup. The wl_surface for any given
  151. * xdg_surface can have at most one role, and may not be assigned any role
  152. * not based on xdg_surface.
  153. *
  154. * A role must be assigned before any other requests are made to the
  155. * xdg_surface object.
  156. *
  157. * The client must call wl_surface.commit on the corresponding wl_surface
  158. * for the xdg_surface state to take effect.
  159. *
  160. * Creating an xdg_surface from a wl_surface which has a buffer attached or
  161. * committed is a client error, and any attempts by a client to attach or
  162. * manipulate a buffer prior to the first xdg_surface.configure call must
  163. * also be treated as errors.
  164. *
  165. * After creating a role-specific object and setting it up (e.g. by sending
  166. * the title, app ID, size constraints, parent, etc), the client must
  167. * perform an initial commit without any buffer attached. The compositor
  168. * will reply with initial wl_surface state such as
  169. * wl_surface.preferred_buffer_scale followed by an xdg_surface.configure
  170. * event. The client must acknowledge it and is then allowed to attach a
  171. * buffer to map the surface.
  172. *
  173. * Mapping an xdg_surface-based role surface is defined as making it
  174. * possible for the surface to be shown by the compositor. Note that
  175. * a mapped surface is not guaranteed to be visible once it is mapped.
  176. *
  177. * For an xdg_surface to be mapped by the compositor, the following
  178. * conditions must be met:
  179. * (1) the client has assigned an xdg_surface-based role to the surface
  180. * (2) the client has set and committed the xdg_surface state and the
  181. * role-dependent state to the surface
  182. * (3) the client has committed a buffer to the surface
  183. *
  184. * A newly-unmapped surface is considered to have met condition (1) out
  185. * of the 3 required conditions for mapping a surface if its role surface
  186. * has not been destroyed, i.e. the client must perform the initial commit
  187. * again before attaching a buffer.
  188. * @section page_iface_xdg_surface_api API
  189. * See @ref iface_xdg_surface.
  190. */
  191. /**
  192. * @defgroup iface_xdg_surface The xdg_surface interface
  193. *
  194. * An interface that may be implemented by a wl_surface, for
  195. * implementations that provide a desktop-style user interface.
  196. *
  197. * It provides a base set of functionality required to construct user
  198. * interface elements requiring management by the compositor, such as
  199. * toplevel windows, menus, etc. The types of functionality are split into
  200. * xdg_surface roles.
  201. *
  202. * Creating an xdg_surface does not set the role for a wl_surface. In order
  203. * to map an xdg_surface, the client must create a role-specific object
  204. * using, e.g., get_toplevel, get_popup. The wl_surface for any given
  205. * xdg_surface can have at most one role, and may not be assigned any role
  206. * not based on xdg_surface.
  207. *
  208. * A role must be assigned before any other requests are made to the
  209. * xdg_surface object.
  210. *
  211. * The client must call wl_surface.commit on the corresponding wl_surface
  212. * for the xdg_surface state to take effect.
  213. *
  214. * Creating an xdg_surface from a wl_surface which has a buffer attached or
  215. * committed is a client error, and any attempts by a client to attach or
  216. * manipulate a buffer prior to the first xdg_surface.configure call must
  217. * also be treated as errors.
  218. *
  219. * After creating a role-specific object and setting it up (e.g. by sending
  220. * the title, app ID, size constraints, parent, etc), the client must
  221. * perform an initial commit without any buffer attached. The compositor
  222. * will reply with initial wl_surface state such as
  223. * wl_surface.preferred_buffer_scale followed by an xdg_surface.configure
  224. * event. The client must acknowledge it and is then allowed to attach a
  225. * buffer to map the surface.
  226. *
  227. * Mapping an xdg_surface-based role surface is defined as making it
  228. * possible for the surface to be shown by the compositor. Note that
  229. * a mapped surface is not guaranteed to be visible once it is mapped.
  230. *
  231. * For an xdg_surface to be mapped by the compositor, the following
  232. * conditions must be met:
  233. * (1) the client has assigned an xdg_surface-based role to the surface
  234. * (2) the client has set and committed the xdg_surface state and the
  235. * role-dependent state to the surface
  236. * (3) the client has committed a buffer to the surface
  237. *
  238. * A newly-unmapped surface is considered to have met condition (1) out
  239. * of the 3 required conditions for mapping a surface if its role surface
  240. * has not been destroyed, i.e. the client must perform the initial commit
  241. * again before attaching a buffer.
  242. */
  243. extern const struct wl_interface xdg_surface_interface;
  244. #endif
  245. #ifndef XDG_TOPLEVEL_INTERFACE
  246. #define XDG_TOPLEVEL_INTERFACE
  247. /**
  248. * @page page_iface_xdg_toplevel xdg_toplevel
  249. * @section page_iface_xdg_toplevel_desc Description
  250. *
  251. * This interface defines an xdg_surface role which allows a surface to,
  252. * among other things, set window-like properties such as maximize,
  253. * fullscreen, and minimize, set application-specific metadata like title and
  254. * id, and well as trigger user interactive operations such as interactive
  255. * resize and move.
  256. *
  257. * An xdg_toplevel by default is responsible for providing the full intended
  258. * visual representation of the toplevel, which depending on the window
  259. * state, may mean things like a title bar, window controls and drop shadow.
  260. *
  261. * Unmapping an xdg_toplevel means that the surface cannot be shown
  262. * by the compositor until it is explicitly mapped again.
  263. * All active operations (e.g., move, resize) are canceled and all
  264. * attributes (e.g. title, state, stacking, ...) are discarded for
  265. * an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to
  266. * the state it had right after xdg_surface.get_toplevel. The client
  267. * can re-map the toplevel by performing a commit without any buffer
  268. * attached, waiting for a configure event and handling it as usual (see
  269. * xdg_surface description).
  270. *
  271. * Attaching a null buffer to a toplevel unmaps the surface.
  272. * @section page_iface_xdg_toplevel_api API
  273. * See @ref iface_xdg_toplevel.
  274. */
  275. /**
  276. * @defgroup iface_xdg_toplevel The xdg_toplevel interface
  277. *
  278. * This interface defines an xdg_surface role which allows a surface to,
  279. * among other things, set window-like properties such as maximize,
  280. * fullscreen, and minimize, set application-specific metadata like title and
  281. * id, and well as trigger user interactive operations such as interactive
  282. * resize and move.
  283. *
  284. * An xdg_toplevel by default is responsible for providing the full intended
  285. * visual representation of the toplevel, which depending on the window
  286. * state, may mean things like a title bar, window controls and drop shadow.
  287. *
  288. * Unmapping an xdg_toplevel means that the surface cannot be shown
  289. * by the compositor until it is explicitly mapped again.
  290. * All active operations (e.g., move, resize) are canceled and all
  291. * attributes (e.g. title, state, stacking, ...) are discarded for
  292. * an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to
  293. * the state it had right after xdg_surface.get_toplevel. The client
  294. * can re-map the toplevel by performing a commit without any buffer
  295. * attached, waiting for a configure event and handling it as usual (see
  296. * xdg_surface description).
  297. *
  298. * Attaching a null buffer to a toplevel unmaps the surface.
  299. */
  300. extern const struct wl_interface xdg_toplevel_interface;
  301. #endif
  302. #ifndef XDG_POPUP_INTERFACE
  303. #define XDG_POPUP_INTERFACE
  304. /**
  305. * @page page_iface_xdg_popup xdg_popup
  306. * @section page_iface_xdg_popup_desc Description
  307. *
  308. * A popup surface is a short-lived, temporary surface. It can be used to
  309. * implement for example menus, popovers, tooltips and other similar user
  310. * interface concepts.
  311. *
  312. * A popup can be made to take an explicit grab. See xdg_popup.grab for
  313. * details.
  314. *
  315. * When the popup is dismissed, a popup_done event will be sent out, and at
  316. * the same time the surface will be unmapped. See the xdg_popup.popup_done
  317. * event for details.
  318. *
  319. * Explicitly destroying the xdg_popup object will also dismiss the popup and
  320. * unmap the surface. Clients that want to dismiss the popup when another
  321. * surface of their own is clicked should dismiss the popup using the destroy
  322. * request.
  323. *
  324. * A newly created xdg_popup will be stacked on top of all previously created
  325. * xdg_popup surfaces associated with the same xdg_toplevel.
  326. *
  327. * The parent of an xdg_popup must be mapped (see the xdg_surface
  328. * description) before the xdg_popup itself.
  329. *
  330. * The client must call wl_surface.commit on the corresponding wl_surface
  331. * for the xdg_popup state to take effect.
  332. * @section page_iface_xdg_popup_api API
  333. * See @ref iface_xdg_popup.
  334. */
  335. /**
  336. * @defgroup iface_xdg_popup The xdg_popup interface
  337. *
  338. * A popup surface is a short-lived, temporary surface. It can be used to
  339. * implement for example menus, popovers, tooltips and other similar user
  340. * interface concepts.
  341. *
  342. * A popup can be made to take an explicit grab. See xdg_popup.grab for
  343. * details.
  344. *
  345. * When the popup is dismissed, a popup_done event will be sent out, and at
  346. * the same time the surface will be unmapped. See the xdg_popup.popup_done
  347. * event for details.
  348. *
  349. * Explicitly destroying the xdg_popup object will also dismiss the popup and
  350. * unmap the surface. Clients that want to dismiss the popup when another
  351. * surface of their own is clicked should dismiss the popup using the destroy
  352. * request.
  353. *
  354. * A newly created xdg_popup will be stacked on top of all previously created
  355. * xdg_popup surfaces associated with the same xdg_toplevel.
  356. *
  357. * The parent of an xdg_popup must be mapped (see the xdg_surface
  358. * description) before the xdg_popup itself.
  359. *
  360. * The client must call wl_surface.commit on the corresponding wl_surface
  361. * for the xdg_popup state to take effect.
  362. */
  363. extern const struct wl_interface xdg_popup_interface;
  364. #endif
  365. #ifndef XDG_WM_BASE_ERROR_ENUM
  366. #define XDG_WM_BASE_ERROR_ENUM
  367. enum xdg_wm_base_error {
  368. /**
  369. * given wl_surface has another role
  370. */
  371. XDG_WM_BASE_ERROR_ROLE = 0,
  372. /**
  373. * xdg_wm_base was destroyed before children
  374. */
  375. XDG_WM_BASE_ERROR_DEFUNCT_SURFACES = 1,
  376. /**
  377. * the client tried to map or destroy a non-topmost popup
  378. */
  379. XDG_WM_BASE_ERROR_NOT_THE_TOPMOST_POPUP = 2,
  380. /**
  381. * the client specified an invalid popup parent surface
  382. */
  383. XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT = 3,
  384. /**
  385. * the client provided an invalid surface state
  386. */
  387. XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE = 4,
  388. /**
  389. * the client provided an invalid positioner
  390. */
  391. XDG_WM_BASE_ERROR_INVALID_POSITIONER = 5,
  392. /**
  393. * the client didn’t respond to a ping event in time
  394. */
  395. XDG_WM_BASE_ERROR_UNRESPONSIVE = 6,
  396. };
  397. #endif /* XDG_WM_BASE_ERROR_ENUM */
  398. /**
  399. * @ingroup iface_xdg_wm_base
  400. * @struct xdg_wm_base_listener
  401. */
  402. struct xdg_wm_base_listener {
  403. /**
  404. * check if the client is alive
  405. *
  406. * The ping event asks the client if it's still alive. Pass the
  407. * serial specified in the event back to the compositor by sending
  408. * a "pong" request back with the specified serial. See
  409. * xdg_wm_base.pong.
  410. *
  411. * Compositors can use this to determine if the client is still
  412. * alive. It's unspecified what will happen if the client doesn't
  413. * respond to the ping request, or in what timeframe. Clients
  414. * should try to respond in a reasonable amount of time. The
  415. * “unresponsive” error is provided for compositors that wish
  416. * to disconnect unresponsive clients.
  417. *
  418. * A compositor is free to ping in any way it wants, but a client
  419. * must always respond to any xdg_wm_base object it created.
  420. * @param serial pass this to the pong request
  421. */
  422. void (*ping)(void *data,
  423. struct xdg_wm_base *xdg_wm_base,
  424. uint32_t serial);
  425. };
  426. /**
  427. * @ingroup iface_xdg_wm_base
  428. */
  429. static inline int
  430. xdg_wm_base_add_listener(struct xdg_wm_base *xdg_wm_base,
  431. const struct xdg_wm_base_listener *listener, void *data)
  432. {
  433. return wl_proxy_add_listener((struct wl_proxy *) xdg_wm_base,
  434. (void (**)(void)) listener, data);
  435. }
  436. #define XDG_WM_BASE_DESTROY 0
  437. #define XDG_WM_BASE_CREATE_POSITIONER 1
  438. #define XDG_WM_BASE_GET_XDG_SURFACE 2
  439. #define XDG_WM_BASE_PONG 3
  440. /**
  441. * @ingroup iface_xdg_wm_base
  442. */
  443. #define XDG_WM_BASE_PING_SINCE_VERSION 1
  444. /**
  445. * @ingroup iface_xdg_wm_base
  446. */
  447. #define XDG_WM_BASE_DESTROY_SINCE_VERSION 1
  448. /**
  449. * @ingroup iface_xdg_wm_base
  450. */
  451. #define XDG_WM_BASE_CREATE_POSITIONER_SINCE_VERSION 1
  452. /**
  453. * @ingroup iface_xdg_wm_base
  454. */
  455. #define XDG_WM_BASE_GET_XDG_SURFACE_SINCE_VERSION 1
  456. /**
  457. * @ingroup iface_xdg_wm_base
  458. */
  459. #define XDG_WM_BASE_PONG_SINCE_VERSION 1
  460. /** @ingroup iface_xdg_wm_base */
  461. static inline void
  462. xdg_wm_base_set_user_data(struct xdg_wm_base *xdg_wm_base, void *user_data)
  463. {
  464. wl_proxy_set_user_data((struct wl_proxy *) xdg_wm_base, user_data);
  465. }
  466. /** @ingroup iface_xdg_wm_base */
  467. static inline void *
  468. xdg_wm_base_get_user_data(struct xdg_wm_base *xdg_wm_base)
  469. {
  470. return wl_proxy_get_user_data((struct wl_proxy *) xdg_wm_base);
  471. }
  472. static inline uint32_t
  473. xdg_wm_base_get_version(struct xdg_wm_base *xdg_wm_base)
  474. {
  475. return wl_proxy_get_version((struct wl_proxy *) xdg_wm_base);
  476. }
  477. /**
  478. * @ingroup iface_xdg_wm_base
  479. *
  480. * Destroy this xdg_wm_base object.
  481. *
  482. * Destroying a bound xdg_wm_base object while there are surfaces
  483. * still alive created by this xdg_wm_base object instance is illegal
  484. * and will result in a defunct_surfaces error.
  485. */
  486. static inline void
  487. xdg_wm_base_destroy(struct xdg_wm_base *xdg_wm_base)
  488. {
  489. wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
  490. XDG_WM_BASE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), WL_MARSHAL_FLAG_DESTROY);
  491. }
  492. /**
  493. * @ingroup iface_xdg_wm_base
  494. *
  495. * Create a positioner object. A positioner object is used to position
  496. * surfaces relative to some parent surface. See the interface description
  497. * and xdg_surface.get_popup for details.
  498. */
  499. static inline struct xdg_positioner *
  500. xdg_wm_base_create_positioner(struct xdg_wm_base *xdg_wm_base)
  501. {
  502. struct wl_proxy *id;
  503. id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
  504. XDG_WM_BASE_CREATE_POSITIONER, &xdg_positioner_interface, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, NULL);
  505. return (struct xdg_positioner *) id;
  506. }
  507. /**
  508. * @ingroup iface_xdg_wm_base
  509. *
  510. * This creates an xdg_surface for the given surface. An xdg_surface is
  511. * used as basis to define a role to a given surface, such as xdg_toplevel
  512. * or xdg_popup. It also manages functionality shared between xdg_surface
  513. * based surface roles.
  514. *
  515. * While xdg_surface itself is not a role, the corresponding surface may
  516. * only be assigned a role extending xdg_surface, such as xdg_toplevel or
  517. * xdg_popup. It is illegal to create an xdg_surface for a wl_surface which
  518. * already has anassigned role and this will result in a role error.
  519. *
  520. * See the documentation of xdg_surface for more details about what an
  521. * xdg_surface is and how it is used.
  522. */
  523. static inline struct xdg_surface *
  524. xdg_wm_base_get_xdg_surface(struct xdg_wm_base *xdg_wm_base, struct wl_surface *surface)
  525. {
  526. struct wl_proxy *id;
  527. id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
  528. XDG_WM_BASE_GET_XDG_SURFACE, &xdg_surface_interface, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, NULL, surface);
  529. return (struct xdg_surface *) id;
  530. }
  531. /**
  532. * @ingroup iface_xdg_wm_base
  533. *
  534. * A client must respond to a ping event with a pong request or
  535. * the client may be deemed unresponsive. See xdg_wm_base.ping
  536. * and xdg_wm_base.error.unresponsive.
  537. */
  538. static inline void
  539. xdg_wm_base_pong(struct xdg_wm_base *xdg_wm_base, uint32_t serial)
  540. {
  541. wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
  542. XDG_WM_BASE_PONG, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, serial);
  543. }
  544. #ifndef XDG_POSITIONER_ERROR_ENUM
  545. #define XDG_POSITIONER_ERROR_ENUM
  546. enum xdg_positioner_error {
  547. /**
  548. * invalid input provided
  549. */
  550. XDG_POSITIONER_ERROR_INVALID_INPUT = 0,
  551. };
  552. #endif /* XDG_POSITIONER_ERROR_ENUM */
  553. #ifndef XDG_POSITIONER_ANCHOR_ENUM
  554. #define XDG_POSITIONER_ANCHOR_ENUM
  555. enum xdg_positioner_anchor {
  556. XDG_POSITIONER_ANCHOR_NONE = 0,
  557. XDG_POSITIONER_ANCHOR_TOP = 1,
  558. XDG_POSITIONER_ANCHOR_BOTTOM = 2,
  559. XDG_POSITIONER_ANCHOR_LEFT = 3,
  560. XDG_POSITIONER_ANCHOR_RIGHT = 4,
  561. XDG_POSITIONER_ANCHOR_TOP_LEFT = 5,
  562. XDG_POSITIONER_ANCHOR_BOTTOM_LEFT = 6,
  563. XDG_POSITIONER_ANCHOR_TOP_RIGHT = 7,
  564. XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT = 8,
  565. };
  566. #endif /* XDG_POSITIONER_ANCHOR_ENUM */
  567. #ifndef XDG_POSITIONER_GRAVITY_ENUM
  568. #define XDG_POSITIONER_GRAVITY_ENUM
  569. enum xdg_positioner_gravity {
  570. XDG_POSITIONER_GRAVITY_NONE = 0,
  571. XDG_POSITIONER_GRAVITY_TOP = 1,
  572. XDG_POSITIONER_GRAVITY_BOTTOM = 2,
  573. XDG_POSITIONER_GRAVITY_LEFT = 3,
  574. XDG_POSITIONER_GRAVITY_RIGHT = 4,
  575. XDG_POSITIONER_GRAVITY_TOP_LEFT = 5,
  576. XDG_POSITIONER_GRAVITY_BOTTOM_LEFT = 6,
  577. XDG_POSITIONER_GRAVITY_TOP_RIGHT = 7,
  578. XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT = 8,
  579. };
  580. #endif /* XDG_POSITIONER_GRAVITY_ENUM */
  581. #ifndef XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM
  582. #define XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM
  583. /**
  584. * @ingroup iface_xdg_positioner
  585. * constraint adjustments
  586. *
  587. * The constraint adjustment value define ways the compositor will adjust
  588. * the position of the surface, if the unadjusted position would result
  589. * in the surface being partly constrained.
  590. *
  591. * Whether a surface is considered 'constrained' is left to the compositor
  592. * to determine. For example, the surface may be partly outside the
  593. * compositor's defined 'work area', thus necessitating the child surface's
  594. * position be adjusted until it is entirely inside the work area.
  595. *
  596. * The adjustments can be combined, according to a defined precedence: 1)
  597. * Flip, 2) Slide, 3) Resize.
  598. */
  599. enum xdg_positioner_constraint_adjustment {
  600. /**
  601. * don't move the child surface when constrained
  602. *
  603. * Don't alter the surface position even if it is constrained on
  604. * some axis, for example partially outside the edge of an output.
  605. */
  606. XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE = 0,
  607. /**
  608. * move along the x axis until unconstrained
  609. *
  610. * Slide the surface along the x axis until it is no longer
  611. * constrained.
  612. *
  613. * First try to slide towards the direction of the gravity on the x
  614. * axis until either the edge in the opposite direction of the
  615. * gravity is unconstrained or the edge in the direction of the
  616. * gravity is constrained.
  617. *
  618. * Then try to slide towards the opposite direction of the gravity
  619. * on the x axis until either the edge in the direction of the
  620. * gravity is unconstrained or the edge in the opposite direction
  621. * of the gravity is constrained.
  622. */
  623. XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X = 1,
  624. /**
  625. * move along the y axis until unconstrained
  626. *
  627. * Slide the surface along the y axis until it is no longer
  628. * constrained.
  629. *
  630. * First try to slide towards the direction of the gravity on the y
  631. * axis until either the edge in the opposite direction of the
  632. * gravity is unconstrained or the edge in the direction of the
  633. * gravity is constrained.
  634. *
  635. * Then try to slide towards the opposite direction of the gravity
  636. * on the y axis until either the edge in the direction of the
  637. * gravity is unconstrained or the edge in the opposite direction
  638. * of the gravity is constrained.
  639. */
  640. XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y = 2,
  641. /**
  642. * invert the anchor and gravity on the x axis
  643. *
  644. * Invert the anchor and gravity on the x axis if the surface is
  645. * constrained on the x axis. For example, if the left edge of the
  646. * surface is constrained, the gravity is 'left' and the anchor is
  647. * 'left', change the gravity to 'right' and the anchor to 'right'.
  648. *
  649. * If the adjusted position also ends up being constrained, the
  650. * resulting position of the flip_x adjustment will be the one
  651. * before the adjustment.
  652. */
  653. XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X = 4,
  654. /**
  655. * invert the anchor and gravity on the y axis
  656. *
  657. * Invert the anchor and gravity on the y axis if the surface is
  658. * constrained on the y axis. For example, if the bottom edge of
  659. * the surface is constrained, the gravity is 'bottom' and the
  660. * anchor is 'bottom', change the gravity to 'top' and the anchor
  661. * to 'top'.
  662. *
  663. * The adjusted position is calculated given the original anchor
  664. * rectangle and offset, but with the new flipped anchor and
  665. * gravity values.
  666. *
  667. * If the adjusted position also ends up being constrained, the
  668. * resulting position of the flip_y adjustment will be the one
  669. * before the adjustment.
  670. */
  671. XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y = 8,
  672. /**
  673. * horizontally resize the surface
  674. *
  675. * Resize the surface horizontally so that it is completely
  676. * unconstrained.
  677. */
  678. XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X = 16,
  679. /**
  680. * vertically resize the surface
  681. *
  682. * Resize the surface vertically so that it is completely
  683. * unconstrained.
  684. */
  685. XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 32,
  686. };
  687. #endif /* XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM */
  688. #define XDG_POSITIONER_DESTROY 0
  689. #define XDG_POSITIONER_SET_SIZE 1
  690. #define XDG_POSITIONER_SET_ANCHOR_RECT 2
  691. #define XDG_POSITIONER_SET_ANCHOR 3
  692. #define XDG_POSITIONER_SET_GRAVITY 4
  693. #define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT 5
  694. #define XDG_POSITIONER_SET_OFFSET 6
  695. #define XDG_POSITIONER_SET_REACTIVE 7
  696. #define XDG_POSITIONER_SET_PARENT_SIZE 8
  697. #define XDG_POSITIONER_SET_PARENT_CONFIGURE 9
  698. /**
  699. * @ingroup iface_xdg_positioner
  700. */
  701. #define XDG_POSITIONER_DESTROY_SINCE_VERSION 1
  702. /**
  703. * @ingroup iface_xdg_positioner
  704. */
  705. #define XDG_POSITIONER_SET_SIZE_SINCE_VERSION 1
  706. /**
  707. * @ingroup iface_xdg_positioner
  708. */
  709. #define XDG_POSITIONER_SET_ANCHOR_RECT_SINCE_VERSION 1
  710. /**
  711. * @ingroup iface_xdg_positioner
  712. */
  713. #define XDG_POSITIONER_SET_ANCHOR_SINCE_VERSION 1
  714. /**
  715. * @ingroup iface_xdg_positioner
  716. */
  717. #define XDG_POSITIONER_SET_GRAVITY_SINCE_VERSION 1
  718. /**
  719. * @ingroup iface_xdg_positioner
  720. */
  721. #define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT_SINCE_VERSION 1
  722. /**
  723. * @ingroup iface_xdg_positioner
  724. */
  725. #define XDG_POSITIONER_SET_OFFSET_SINCE_VERSION 1
  726. /**
  727. * @ingroup iface_xdg_positioner
  728. */
  729. #define XDG_POSITIONER_SET_REACTIVE_SINCE_VERSION 3
  730. /**
  731. * @ingroup iface_xdg_positioner
  732. */
  733. #define XDG_POSITIONER_SET_PARENT_SIZE_SINCE_VERSION 3
  734. /**
  735. * @ingroup iface_xdg_positioner
  736. */
  737. #define XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION 3
  738. /** @ingroup iface_xdg_positioner */
  739. static inline void
  740. xdg_positioner_set_user_data(struct xdg_positioner *xdg_positioner, void *user_data)
  741. {
  742. wl_proxy_set_user_data((struct wl_proxy *) xdg_positioner, user_data);
  743. }
  744. /** @ingroup iface_xdg_positioner */
  745. static inline void *
  746. xdg_positioner_get_user_data(struct xdg_positioner *xdg_positioner)
  747. {
  748. return wl_proxy_get_user_data((struct wl_proxy *) xdg_positioner);
  749. }
  750. static inline uint32_t
  751. xdg_positioner_get_version(struct xdg_positioner *xdg_positioner)
  752. {
  753. return wl_proxy_get_version((struct wl_proxy *) xdg_positioner);
  754. }
  755. /**
  756. * @ingroup iface_xdg_positioner
  757. *
  758. * Notify the compositor that the xdg_positioner will no longer be used.
  759. */
  760. static inline void
  761. xdg_positioner_destroy(struct xdg_positioner *xdg_positioner)
  762. {
  763. wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
  764. XDG_POSITIONER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), WL_MARSHAL_FLAG_DESTROY);
  765. }
  766. /**
  767. * @ingroup iface_xdg_positioner
  768. *
  769. * Set the size of the surface that is to be positioned with the positioner
  770. * object. The size is in surface-local coordinates and corresponds to the
  771. * window geometry. See xdg_surface.set_window_geometry.
  772. *
  773. * If a zero or negative size is set the invalid_input error is raised.
  774. */
  775. static inline void
  776. xdg_positioner_set_size(struct xdg_positioner *xdg_positioner, int32_t width, int32_t height)
  777. {
  778. wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
  779. XDG_POSITIONER_SET_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, width, height);
  780. }
  781. /**
  782. * @ingroup iface_xdg_positioner
  783. *
  784. * Specify the anchor rectangle within the parent surface that the child
  785. * surface will be placed relative to. The rectangle is relative to the
  786. * window geometry as defined by xdg_surface.set_window_geometry of the
  787. * parent surface.
  788. *
  789. * When the xdg_positioner object is used to position a child surface, the
  790. * anchor rectangle may not extend outside the window geometry of the
  791. * positioned child's parent surface.
  792. *
  793. * If a negative size is set the invalid_input error is raised.
  794. */
  795. static inline void
  796. xdg_positioner_set_anchor_rect(struct xdg_positioner *xdg_positioner, int32_t x, int32_t y, int32_t width, int32_t height)
  797. {
  798. wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
  799. XDG_POSITIONER_SET_ANCHOR_RECT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, x, y, width, height);
  800. }
  801. /**
  802. * @ingroup iface_xdg_positioner
  803. *
  804. * Defines the anchor point for the anchor rectangle. The specified anchor
  805. * is used to derive an anchor point that the child surface will be
  806. * positioned relative to. If a corner anchor is set (e.g. 'top_left' or
  807. * 'bottom_right'), the anchor point will be at the specified corner;
  808. * otherwise, the derived anchor point will be centered on the specified
  809. * edge, or in the center of the anchor rectangle if no edge is specified.
  810. */
  811. static inline void
  812. xdg_positioner_set_anchor(struct xdg_positioner *xdg_positioner, uint32_t anchor)
  813. {
  814. wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
  815. XDG_POSITIONER_SET_ANCHOR, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, anchor);
  816. }
  817. /**
  818. * @ingroup iface_xdg_positioner
  819. *
  820. * Defines in what direction a surface should be positioned, relative to
  821. * the anchor point of the parent surface. If a corner gravity is
  822. * specified (e.g. 'bottom_right' or 'top_left'), then the child surface
  823. * will be placed towards the specified gravity; otherwise, the child
  824. * surface will be centered over the anchor point on any axis that had no
  825. * gravity specified. If the gravity is not in the ‘gravity’ enum, an
  826. * invalid_input error is raised.
  827. */
  828. static inline void
  829. xdg_positioner_set_gravity(struct xdg_positioner *xdg_positioner, uint32_t gravity)
  830. {
  831. wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
  832. XDG_POSITIONER_SET_GRAVITY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, gravity);
  833. }
  834. /**
  835. * @ingroup iface_xdg_positioner
  836. *
  837. * Specify how the window should be positioned if the originally intended
  838. * position caused the surface to be constrained, meaning at least
  839. * partially outside positioning boundaries set by the compositor. The
  840. * adjustment is set by constructing a bitmask describing the adjustment to
  841. * be made when the surface is constrained on that axis.
  842. *
  843. * If no bit for one axis is set, the compositor will assume that the child
  844. * surface should not change its position on that axis when constrained.
  845. *
  846. * If more than one bit for one axis is set, the order of how adjustments
  847. * are applied is specified in the corresponding adjustment descriptions.
  848. *
  849. * The default adjustment is none.
  850. */
  851. static inline void
  852. xdg_positioner_set_constraint_adjustment(struct xdg_positioner *xdg_positioner, uint32_t constraint_adjustment)
  853. {
  854. wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
  855. XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, constraint_adjustment);
  856. }
  857. /**
  858. * @ingroup iface_xdg_positioner
  859. *
  860. * Specify the surface position offset relative to the position of the
  861. * anchor on the anchor rectangle and the anchor on the surface. For
  862. * example if the anchor of the anchor rectangle is at (x, y), the surface
  863. * has the gravity bottom|right, and the offset is (ox, oy), the calculated
  864. * surface position will be (x + ox, y + oy). The offset position of the
  865. * surface is the one used for constraint testing. See
  866. * set_constraint_adjustment.
  867. *
  868. * An example use case is placing a popup menu on top of a user interface
  869. * element, while aligning the user interface element of the parent surface
  870. * with some user interface element placed somewhere in the popup surface.
  871. */
  872. static inline void
  873. xdg_positioner_set_offset(struct xdg_positioner *xdg_positioner, int32_t x, int32_t y)
  874. {
  875. wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
  876. XDG_POSITIONER_SET_OFFSET, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, x, y);
  877. }
  878. /**
  879. * @ingroup iface_xdg_positioner
  880. *
  881. * When set reactive, the surface is reconstrained if the conditions used
  882. * for constraining changed, e.g. the parent window moved.
  883. *
  884. * If the conditions changed and the popup was reconstrained, an
  885. * xdg_popup.configure event is sent with updated geometry, followed by an
  886. * xdg_surface.configure event.
  887. */
  888. static inline void
  889. xdg_positioner_set_reactive(struct xdg_positioner *xdg_positioner)
  890. {
  891. wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
  892. XDG_POSITIONER_SET_REACTIVE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0);
  893. }
  894. /**
  895. * @ingroup iface_xdg_positioner
  896. *
  897. * Set the parent window geometry the compositor should use when
  898. * positioning the popup. The compositor may use this information to
  899. * determine the future state the popup should be constrained using. If
  900. * this doesn't match the dimension of the parent the popup is eventually
  901. * positioned against, the behavior is undefined.
  902. *
  903. * The arguments are given in the surface-local coordinate space.
  904. */
  905. static inline void
  906. xdg_positioner_set_parent_size(struct xdg_positioner *xdg_positioner, int32_t parent_width, int32_t parent_height)
  907. {
  908. wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
  909. XDG_POSITIONER_SET_PARENT_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, parent_width, parent_height);
  910. }
  911. /**
  912. * @ingroup iface_xdg_positioner
  913. *
  914. * Set the serial of an xdg_surface.configure event this positioner will be
  915. * used in response to. The compositor may use this information together
  916. * with set_parent_size to determine what future state the popup should be
  917. * constrained using.
  918. */
  919. static inline void
  920. xdg_positioner_set_parent_configure(struct xdg_positioner *xdg_positioner, uint32_t serial)
  921. {
  922. wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
  923. XDG_POSITIONER_SET_PARENT_CONFIGURE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, serial);
  924. }
  925. #ifndef XDG_SURFACE_ERROR_ENUM
  926. #define XDG_SURFACE_ERROR_ENUM
  927. enum xdg_surface_error {
  928. /**
  929. * Surface was not fully constructed
  930. */
  931. XDG_SURFACE_ERROR_NOT_CONSTRUCTED = 1,
  932. /**
  933. * Surface was already constructed
  934. */
  935. XDG_SURFACE_ERROR_ALREADY_CONSTRUCTED = 2,
  936. /**
  937. * Attaching a buffer to an unconfigured surface
  938. */
  939. XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER = 3,
  940. /**
  941. * Invalid serial number when acking a configure event
  942. */
  943. XDG_SURFACE_ERROR_INVALID_SERIAL = 4,
  944. /**
  945. * Width or height was zero or negative
  946. */
  947. XDG_SURFACE_ERROR_INVALID_SIZE = 5,
  948. /**
  949. * Surface was destroyed before its role object
  950. */
  951. XDG_SURFACE_ERROR_DEFUNCT_ROLE_OBJECT = 6,
  952. };
  953. #endif /* XDG_SURFACE_ERROR_ENUM */
  954. /**
  955. * @ingroup iface_xdg_surface
  956. * @struct xdg_surface_listener
  957. */
  958. struct xdg_surface_listener {
  959. /**
  960. * suggest a surface change
  961. *
  962. * The configure event marks the end of a configure sequence. A
  963. * configure sequence is a set of one or more events configuring
  964. * the state of the xdg_surface, including the final
  965. * xdg_surface.configure event.
  966. *
  967. * Where applicable, xdg_surface surface roles will during a
  968. * configure sequence extend this event as a latched state sent as
  969. * events before the xdg_surface.configure event. Such events
  970. * should be considered to make up a set of atomically applied
  971. * configuration states, where the xdg_surface.configure commits
  972. * the accumulated state.
  973. *
  974. * Clients should arrange their surface for the new states, and
  975. * then send an ack_configure request with the serial sent in this
  976. * configure event at some point before committing the new surface.
  977. *
  978. * If the client receives multiple configure events before it can
  979. * respond to one, it is free to discard all but the last event it
  980. * received.
  981. * @param serial serial of the configure event
  982. */
  983. void (*configure)(void *data,
  984. struct xdg_surface *xdg_surface,
  985. uint32_t serial);
  986. };
  987. /**
  988. * @ingroup iface_xdg_surface
  989. */
  990. static inline int
  991. xdg_surface_add_listener(struct xdg_surface *xdg_surface,
  992. const struct xdg_surface_listener *listener, void *data)
  993. {
  994. return wl_proxy_add_listener((struct wl_proxy *) xdg_surface,
  995. (void (**)(void)) listener, data);
  996. }
  997. #define XDG_SURFACE_DESTROY 0
  998. #define XDG_SURFACE_GET_TOPLEVEL 1
  999. #define XDG_SURFACE_GET_POPUP 2
  1000. #define XDG_SURFACE_SET_WINDOW_GEOMETRY 3
  1001. #define XDG_SURFACE_ACK_CONFIGURE 4
  1002. /**
  1003. * @ingroup iface_xdg_surface
  1004. */
  1005. #define XDG_SURFACE_CONFIGURE_SINCE_VERSION 1
  1006. /**
  1007. * @ingroup iface_xdg_surface
  1008. */
  1009. #define XDG_SURFACE_DESTROY_SINCE_VERSION 1
  1010. /**
  1011. * @ingroup iface_xdg_surface
  1012. */
  1013. #define XDG_SURFACE_GET_TOPLEVEL_SINCE_VERSION 1
  1014. /**
  1015. * @ingroup iface_xdg_surface
  1016. */
  1017. #define XDG_SURFACE_GET_POPUP_SINCE_VERSION 1
  1018. /**
  1019. * @ingroup iface_xdg_surface
  1020. */
  1021. #define XDG_SURFACE_SET_WINDOW_GEOMETRY_SINCE_VERSION 1
  1022. /**
  1023. * @ingroup iface_xdg_surface
  1024. */
  1025. #define XDG_SURFACE_ACK_CONFIGURE_SINCE_VERSION 1
  1026. /** @ingroup iface_xdg_surface */
  1027. static inline void
  1028. xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data)
  1029. {
  1030. wl_proxy_set_user_data((struct wl_proxy *) xdg_surface, user_data);
  1031. }
  1032. /** @ingroup iface_xdg_surface */
  1033. static inline void *
  1034. xdg_surface_get_user_data(struct xdg_surface *xdg_surface)
  1035. {
  1036. return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface);
  1037. }
  1038. static inline uint32_t
  1039. xdg_surface_get_version(struct xdg_surface *xdg_surface)
  1040. {
  1041. return wl_proxy_get_version((struct wl_proxy *) xdg_surface);
  1042. }
  1043. /**
  1044. * @ingroup iface_xdg_surface
  1045. *
  1046. * Destroy the xdg_surface object. An xdg_surface must only be destroyed
  1047. * after its role object has been destroyed, otherwise
  1048. * a defunct_role_object error is raised.
  1049. */
  1050. static inline void
  1051. xdg_surface_destroy(struct xdg_surface *xdg_surface)
  1052. {
  1053. wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
  1054. XDG_SURFACE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), WL_MARSHAL_FLAG_DESTROY);
  1055. }
  1056. /**
  1057. * @ingroup iface_xdg_surface
  1058. *
  1059. * This creates an xdg_toplevel object for the given xdg_surface and gives
  1060. * the associated wl_surface the xdg_toplevel role.
  1061. *
  1062. * See the documentation of xdg_toplevel for more details about what an
  1063. * xdg_toplevel is and how it is used.
  1064. */
  1065. static inline struct xdg_toplevel *
  1066. xdg_surface_get_toplevel(struct xdg_surface *xdg_surface)
  1067. {
  1068. struct wl_proxy *id;
  1069. id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
  1070. XDG_SURFACE_GET_TOPLEVEL, &xdg_toplevel_interface, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, NULL);
  1071. return (struct xdg_toplevel *) id;
  1072. }
  1073. /**
  1074. * @ingroup iface_xdg_surface
  1075. *
  1076. * This creates an xdg_popup object for the given xdg_surface and gives
  1077. * the associated wl_surface the xdg_popup role.
  1078. *
  1079. * If null is passed as a parent, a parent surface must be specified using
  1080. * some other protocol, before committing the initial state.
  1081. *
  1082. * See the documentation of xdg_popup for more details about what an
  1083. * xdg_popup is and how it is used.
  1084. */
  1085. static inline struct xdg_popup *
  1086. xdg_surface_get_popup(struct xdg_surface *xdg_surface, struct xdg_surface *parent, struct xdg_positioner *positioner)
  1087. {
  1088. struct wl_proxy *id;
  1089. id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
  1090. XDG_SURFACE_GET_POPUP, &xdg_popup_interface, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, NULL, parent, positioner);
  1091. return (struct xdg_popup *) id;
  1092. }
  1093. /**
  1094. * @ingroup iface_xdg_surface
  1095. *
  1096. * The window geometry of a surface is its "visible bounds" from the
  1097. * user's perspective. Client-side decorations often have invisible
  1098. * portions like drop-shadows which should be ignored for the
  1099. * purposes of aligning, placing and constraining windows. Note that
  1100. * in some situations, compositors may clip rendering to the window
  1101. * geometry, so the client should avoid putting functional elements
  1102. * outside of it.
  1103. *
  1104. * The window geometry is double-buffered state, see wl_surface.commit.
  1105. *
  1106. * When maintaining a position, the compositor should treat the (x, y)
  1107. * coordinate of the window geometry as the top left corner of the window.
  1108. * A client changing the (x, y) window geometry coordinate should in
  1109. * general not alter the position of the window.
  1110. *
  1111. * Once the window geometry of the surface is set, it is not possible to
  1112. * unset it, and it will remain the same until set_window_geometry is
  1113. * called again, even if a new subsurface or buffer is attached.
  1114. *
  1115. * If never set, the value is the full bounds of the surface,
  1116. * including any subsurfaces. This updates dynamically on every
  1117. * commit. This unset is meant for extremely simple clients.
  1118. *
  1119. * The arguments are given in the surface-local coordinate space of
  1120. * the wl_surface associated with this xdg_surface, and may extend outside
  1121. * of the wl_surface itself to mark parts of the subsurface tree as part of
  1122. * the window geometry.
  1123. *
  1124. * When applied, the effective window geometry will be the set window
  1125. * geometry clamped to the bounding rectangle of the combined
  1126. * geometry of the surface of the xdg_surface and the associated
  1127. * subsurfaces.
  1128. *
  1129. * The effective geometry will not be recalculated unless a new call to
  1130. * set_window_geometry is done and the new pending surface state is
  1131. * subsequently applied.
  1132. *
  1133. * The width and height of the effective window geometry must be
  1134. * greater than zero. Setting an invalid size will raise an
  1135. * invalid_size error.
  1136. */
  1137. static inline void
  1138. xdg_surface_set_window_geometry(struct xdg_surface *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height)
  1139. {
  1140. wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
  1141. XDG_SURFACE_SET_WINDOW_GEOMETRY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, x, y, width, height);
  1142. }
  1143. /**
  1144. * @ingroup iface_xdg_surface
  1145. *
  1146. * When a configure event is received, if a client commits the
  1147. * surface in response to the configure event, then the client
  1148. * must make an ack_configure request sometime before the commit
  1149. * request, passing along the serial of the configure event.
  1150. *
  1151. * For instance, for toplevel surfaces the compositor might use this
  1152. * information to move a surface to the top left only when the client has
  1153. * drawn itself for the maximized or fullscreen state.
  1154. *
  1155. * If the client receives multiple configure events before it
  1156. * can respond to one, it only has to ack the last configure event.
  1157. * Acking a configure event that was never sent raises an invalid_serial
  1158. * error.
  1159. *
  1160. * A client is not required to commit immediately after sending
  1161. * an ack_configure request - it may even ack_configure several times
  1162. * before its next surface commit.
  1163. *
  1164. * A client may send multiple ack_configure requests before committing, but
  1165. * only the last request sent before a commit indicates which configure
  1166. * event the client really is responding to.
  1167. *
  1168. * Sending an ack_configure request consumes the serial number sent with
  1169. * the request, as well as serial numbers sent by all configure events
  1170. * sent on this xdg_surface prior to the configure event referenced by
  1171. * the committed serial.
  1172. *
  1173. * It is an error to issue multiple ack_configure requests referencing a
  1174. * serial from the same configure event, or to issue an ack_configure
  1175. * request referencing a serial from a configure event issued before the
  1176. * event identified by the last ack_configure request for the same
  1177. * xdg_surface. Doing so will raise an invalid_serial error.
  1178. */
  1179. static inline void
  1180. xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial)
  1181. {
  1182. wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
  1183. XDG_SURFACE_ACK_CONFIGURE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, serial);
  1184. }
  1185. #ifndef XDG_TOPLEVEL_ERROR_ENUM
  1186. #define XDG_TOPLEVEL_ERROR_ENUM
  1187. enum xdg_toplevel_error {
  1188. /**
  1189. * provided value is not a valid variant of the resize_edge enum
  1190. */
  1191. XDG_TOPLEVEL_ERROR_INVALID_RESIZE_EDGE = 0,
  1192. /**
  1193. * invalid parent toplevel
  1194. */
  1195. XDG_TOPLEVEL_ERROR_INVALID_PARENT = 1,
  1196. /**
  1197. * client provided an invalid min or max size
  1198. */
  1199. XDG_TOPLEVEL_ERROR_INVALID_SIZE = 2,
  1200. };
  1201. #endif /* XDG_TOPLEVEL_ERROR_ENUM */
  1202. #ifndef XDG_TOPLEVEL_RESIZE_EDGE_ENUM
  1203. #define XDG_TOPLEVEL_RESIZE_EDGE_ENUM
  1204. /**
  1205. * @ingroup iface_xdg_toplevel
  1206. * edge values for resizing
  1207. *
  1208. * These values are used to indicate which edge of a surface
  1209. * is being dragged in a resize operation.
  1210. */
  1211. enum xdg_toplevel_resize_edge {
  1212. XDG_TOPLEVEL_RESIZE_EDGE_NONE = 0,
  1213. XDG_TOPLEVEL_RESIZE_EDGE_TOP = 1,
  1214. XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM = 2,
  1215. XDG_TOPLEVEL_RESIZE_EDGE_LEFT = 4,
  1216. XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT = 5,
  1217. XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT = 6,
  1218. XDG_TOPLEVEL_RESIZE_EDGE_RIGHT = 8,
  1219. XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT = 9,
  1220. XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT = 10,
  1221. };
  1222. #endif /* XDG_TOPLEVEL_RESIZE_EDGE_ENUM */
  1223. #ifndef XDG_TOPLEVEL_STATE_ENUM
  1224. #define XDG_TOPLEVEL_STATE_ENUM
  1225. /**
  1226. * @ingroup iface_xdg_toplevel
  1227. * types of state on the surface
  1228. *
  1229. * The different state values used on the surface. This is designed for
  1230. * state values like maximized, fullscreen. It is paired with the
  1231. * configure event to ensure that both the client and the compositor
  1232. * setting the state can be synchronized.
  1233. *
  1234. * States set in this way are double-buffered, see wl_surface.commit.
  1235. */
  1236. enum xdg_toplevel_state {
  1237. /**
  1238. * the surface is maximized
  1239. * the surface is maximized
  1240. *
  1241. * The surface is maximized. The window geometry specified in the
  1242. * configure event must be obeyed by the client, or the
  1243. * xdg_wm_base.invalid_surface_state error is raised.
  1244. *
  1245. * The client should draw without shadow or other decoration
  1246. * outside of the window geometry.
  1247. */
  1248. XDG_TOPLEVEL_STATE_MAXIMIZED = 1,
  1249. /**
  1250. * the surface is fullscreen
  1251. * the surface is fullscreen
  1252. *
  1253. * The surface is fullscreen. The window geometry specified in
  1254. * the configure event is a maximum; the client cannot resize
  1255. * beyond it. For a surface to cover the whole fullscreened area,
  1256. * the geometry dimensions must be obeyed by the client. For more
  1257. * details, see xdg_toplevel.set_fullscreen.
  1258. */
  1259. XDG_TOPLEVEL_STATE_FULLSCREEN = 2,
  1260. /**
  1261. * the surface is being resized
  1262. * the surface is being resized
  1263. *
  1264. * The surface is being resized. The window geometry specified in
  1265. * the configure event is a maximum; the client cannot resize
  1266. * beyond it. Clients that have aspect ratio or cell sizing
  1267. * configuration can use a smaller size, however.
  1268. */
  1269. XDG_TOPLEVEL_STATE_RESIZING = 3,
  1270. /**
  1271. * the surface is now activated
  1272. * the surface is now activated
  1273. *
  1274. * Client window decorations should be painted as if the window
  1275. * is active. Do not assume this means that the window actually has
  1276. * keyboard or pointer focus.
  1277. */
  1278. XDG_TOPLEVEL_STATE_ACTIVATED = 4,
  1279. /**
  1280. * the surface’s left edge is tiled
  1281. *
  1282. * The window is currently in a tiled layout and the left edge is
  1283. * considered to be adjacent to another part of the tiling grid.
  1284. *
  1285. * The client should draw without shadow or other decoration
  1286. * outside of the window geometry on the left edge.
  1287. * @since 2
  1288. */
  1289. XDG_TOPLEVEL_STATE_TILED_LEFT = 5,
  1290. /**
  1291. * the surface’s right edge is tiled
  1292. *
  1293. * The window is currently in a tiled layout and the right edge
  1294. * is considered to be adjacent to another part of the tiling grid.
  1295. *
  1296. * The client should draw without shadow or other decoration
  1297. * outside of the window geometry on the right edge.
  1298. * @since 2
  1299. */
  1300. XDG_TOPLEVEL_STATE_TILED_RIGHT = 6,
  1301. /**
  1302. * the surface’s top edge is tiled
  1303. *
  1304. * The window is currently in a tiled layout and the top edge is
  1305. * considered to be adjacent to another part of the tiling grid.
  1306. *
  1307. * The client should draw without shadow or other decoration
  1308. * outside of the window geometry on the top edge.
  1309. * @since 2
  1310. */
  1311. XDG_TOPLEVEL_STATE_TILED_TOP = 7,
  1312. /**
  1313. * the surface’s bottom edge is tiled
  1314. *
  1315. * The window is currently in a tiled layout and the bottom edge
  1316. * is considered to be adjacent to another part of the tiling grid.
  1317. *
  1318. * The client should draw without shadow or other decoration
  1319. * outside of the window geometry on the bottom edge.
  1320. * @since 2
  1321. */
  1322. XDG_TOPLEVEL_STATE_TILED_BOTTOM = 8,
  1323. /**
  1324. * surface repaint is suspended
  1325. *
  1326. * The surface is currently not ordinarily being repainted; for
  1327. * example because its content is occluded by another window, or
  1328. * its outputs are switched off due to screen locking.
  1329. * @since 6
  1330. */
  1331. XDG_TOPLEVEL_STATE_SUSPENDED = 9,
  1332. /**
  1333. * the surface’s left edge is constrained
  1334. *
  1335. * The left edge of the window is currently constrained, meaning
  1336. * it shouldn't attempt to resize from that edge. It can for
  1337. * example mean it's tiled next to a monitor edge on the
  1338. * constrained side of the window.
  1339. * @since 7
  1340. */
  1341. XDG_TOPLEVEL_STATE_CONSTRAINED_LEFT = 10,
  1342. /**
  1343. * the surface’s right edge is constrained
  1344. *
  1345. * The right edge of the window is currently constrained, meaning
  1346. * it shouldn't attempt to resize from that edge. It can for
  1347. * example mean it's tiled next to a monitor edge on the
  1348. * constrained side of the window.
  1349. * @since 7
  1350. */
  1351. XDG_TOPLEVEL_STATE_CONSTRAINED_RIGHT = 11,
  1352. /**
  1353. * the surface’s top edge is constrained
  1354. *
  1355. * The top edge of the window is currently constrained, meaning
  1356. * it shouldn't attempt to resize from that edge. It can for
  1357. * example mean it's tiled next to a monitor edge on the
  1358. * constrained side of the window.
  1359. * @since 7
  1360. */
  1361. XDG_TOPLEVEL_STATE_CONSTRAINED_TOP = 12,
  1362. /**
  1363. * the surface’s bottom edge is constrained
  1364. *
  1365. * The bottom edge of the window is currently constrained,
  1366. * meaning it shouldn't attempt to resize from that edge. It can
  1367. * for example mean it's tiled next to a monitor edge on the
  1368. * constrained side of the window.
  1369. * @since 7
  1370. */
  1371. XDG_TOPLEVEL_STATE_CONSTRAINED_BOTTOM = 13,
  1372. };
  1373. /**
  1374. * @ingroup iface_xdg_toplevel
  1375. */
  1376. #define XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION 2
  1377. /**
  1378. * @ingroup iface_xdg_toplevel
  1379. */
  1380. #define XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION 2
  1381. /**
  1382. * @ingroup iface_xdg_toplevel
  1383. */
  1384. #define XDG_TOPLEVEL_STATE_TILED_TOP_SINCE_VERSION 2
  1385. /**
  1386. * @ingroup iface_xdg_toplevel
  1387. */
  1388. #define XDG_TOPLEVEL_STATE_TILED_BOTTOM_SINCE_VERSION 2
  1389. /**
  1390. * @ingroup iface_xdg_toplevel
  1391. */
  1392. #define XDG_TOPLEVEL_STATE_SUSPENDED_SINCE_VERSION 6
  1393. /**
  1394. * @ingroup iface_xdg_toplevel
  1395. */
  1396. #define XDG_TOPLEVEL_STATE_CONSTRAINED_LEFT_SINCE_VERSION 7
  1397. /**
  1398. * @ingroup iface_xdg_toplevel
  1399. */
  1400. #define XDG_TOPLEVEL_STATE_CONSTRAINED_RIGHT_SINCE_VERSION 7
  1401. /**
  1402. * @ingroup iface_xdg_toplevel
  1403. */
  1404. #define XDG_TOPLEVEL_STATE_CONSTRAINED_TOP_SINCE_VERSION 7
  1405. /**
  1406. * @ingroup iface_xdg_toplevel
  1407. */
  1408. #define XDG_TOPLEVEL_STATE_CONSTRAINED_BOTTOM_SINCE_VERSION 7
  1409. #endif /* XDG_TOPLEVEL_STATE_ENUM */
  1410. #ifndef XDG_TOPLEVEL_WM_CAPABILITIES_ENUM
  1411. #define XDG_TOPLEVEL_WM_CAPABILITIES_ENUM
  1412. enum xdg_toplevel_wm_capabilities {
  1413. /**
  1414. * show_window_menu is available
  1415. */
  1416. XDG_TOPLEVEL_WM_CAPABILITIES_WINDOW_MENU = 1,
  1417. /**
  1418. * set_maximized and unset_maximized are available
  1419. */
  1420. XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE = 2,
  1421. /**
  1422. * set_fullscreen and unset_fullscreen are available
  1423. */
  1424. XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN = 3,
  1425. /**
  1426. * set_minimized is available
  1427. */
  1428. XDG_TOPLEVEL_WM_CAPABILITIES_MINIMIZE = 4,
  1429. };
  1430. #endif /* XDG_TOPLEVEL_WM_CAPABILITIES_ENUM */
  1431. /**
  1432. * @ingroup iface_xdg_toplevel
  1433. * @struct xdg_toplevel_listener
  1434. */
  1435. struct xdg_toplevel_listener {
  1436. /**
  1437. * suggest a surface change
  1438. *
  1439. * This configure event asks the client to resize its toplevel
  1440. * surface or to change its state. The configured state should not
  1441. * be applied immediately. See xdg_surface.configure for details.
  1442. *
  1443. * The width and height arguments specify a hint to the window
  1444. * about how its surface should be resized in window geometry
  1445. * coordinates. See set_window_geometry.
  1446. *
  1447. * If the width or height arguments are zero, it means the client
  1448. * should decide its own window dimension. This may happen when the
  1449. * compositor needs to configure the state of the surface but
  1450. * doesn't have any information about any previous or expected
  1451. * dimension.
  1452. *
  1453. * The states listed in the event specify how the width/height
  1454. * arguments should be interpreted, and possibly how it should be
  1455. * drawn.
  1456. *
  1457. * The states are sent as an array of 32-bit unsigned integers in
  1458. * native endianness. State values are defined in the state enum.
  1459. *
  1460. * Clients must send an ack_configure in response to this event.
  1461. * See xdg_surface.configure and xdg_surface.ack_configure for
  1462. * details.
  1463. * @param width suggested width of window
  1464. * @param height suggested height of window
  1465. * @param states suggested states of the window
  1466. */
  1467. void (*configure)(void *data,
  1468. struct xdg_toplevel *xdg_toplevel,
  1469. int32_t width,
  1470. int32_t height,
  1471. struct wl_array *states);
  1472. /**
  1473. * surface wants to be closed
  1474. *
  1475. * The close event is sent by the compositor when the user wants
  1476. * the surface to be closed. This should be equivalent to the user
  1477. * clicking the close button in client-side decorations, if your
  1478. * application has any.
  1479. *
  1480. * This is only a request that the user intends to close the
  1481. * window. The client may choose to ignore this request, or show a
  1482. * dialog to ask the user to save their data, etc.
  1483. */
  1484. void (*close)(void *data,
  1485. struct xdg_toplevel *xdg_toplevel);
  1486. /**
  1487. * recommended window geometry bounds
  1488. *
  1489. * The configure_bounds event may be sent prior to a
  1490. * xdg_toplevel.configure event to communicate the bounds a window
  1491. * geometry size is recommended to constrain to.
  1492. *
  1493. * The passed width and height are in surface coordinate space. If
  1494. * width and height are 0, it means bounds is unknown and
  1495. * equivalent to as if no configure_bounds event was ever sent for
  1496. * this surface.
  1497. *
  1498. * The bounds can for example correspond to the size of a monitor
  1499. * excluding any panels or other shell components, so that a
  1500. * surface isn't created in a way that it cannot fit.
  1501. *
  1502. * The bounds may change at any point, and in such a case, a new
  1503. * xdg_toplevel.configure_bounds will be sent, followed by
  1504. * xdg_toplevel.configure and xdg_surface.configure.
  1505. * @param width suggested maximum width of surface
  1506. * @param height suggested maximum height of surface
  1507. * @since 4
  1508. */
  1509. void (*configure_bounds)(void *data,
  1510. struct xdg_toplevel *xdg_toplevel,
  1511. int32_t width,
  1512. int32_t height);
  1513. /**
  1514. * compositor capabilities
  1515. *
  1516. * This event advertises the capabilities supported by the
  1517. * compositor. If a capability isn't supported, clients should hide
  1518. * or disable the UI elements that expose this functionality. For
  1519. * instance, if the compositor doesn't advertise support for
  1520. * minimized toplevels, a button triggering the set_minimized
  1521. * request should not be displayed.
  1522. *
  1523. * The compositor will ignore requests it doesn't support. For
  1524. * instance, a compositor which doesn't advertise support for
  1525. * minimized will ignore set_minimized requests.
  1526. *
  1527. * Compositors must send this event once before the first
  1528. * xdg_surface.configure event. When the capabilities change,
  1529. * compositors must send this event again and then send an
  1530. * xdg_surface.configure event.
  1531. *
  1532. * The configured state should not be applied immediately. See
  1533. * xdg_surface.configure for details.
  1534. *
  1535. * The capabilities are sent as an array of 32-bit unsigned
  1536. * integers in native endianness. Capability values are defined in
  1537. * the wm_capabilities enum.
  1538. * @param capabilities array of 32-bit capabilities
  1539. * @since 5
  1540. */
  1541. void (*wm_capabilities)(void *data,
  1542. struct xdg_toplevel *xdg_toplevel,
  1543. struct wl_array *capabilities);
  1544. };
  1545. /**
  1546. * @ingroup iface_xdg_toplevel
  1547. */
  1548. static inline int
  1549. xdg_toplevel_add_listener(struct xdg_toplevel *xdg_toplevel,
  1550. const struct xdg_toplevel_listener *listener, void *data)
  1551. {
  1552. return wl_proxy_add_listener((struct wl_proxy *) xdg_toplevel,
  1553. (void (**)(void)) listener, data);
  1554. }
  1555. #define XDG_TOPLEVEL_DESTROY 0
  1556. #define XDG_TOPLEVEL_SET_PARENT 1
  1557. #define XDG_TOPLEVEL_SET_TITLE 2
  1558. #define XDG_TOPLEVEL_SET_APP_ID 3
  1559. #define XDG_TOPLEVEL_SHOW_WINDOW_MENU 4
  1560. #define XDG_TOPLEVEL_MOVE 5
  1561. #define XDG_TOPLEVEL_RESIZE 6
  1562. #define XDG_TOPLEVEL_SET_MAX_SIZE 7
  1563. #define XDG_TOPLEVEL_SET_MIN_SIZE 8
  1564. #define XDG_TOPLEVEL_SET_MAXIMIZED 9
  1565. #define XDG_TOPLEVEL_UNSET_MAXIMIZED 10
  1566. #define XDG_TOPLEVEL_SET_FULLSCREEN 11
  1567. #define XDG_TOPLEVEL_UNSET_FULLSCREEN 12
  1568. #define XDG_TOPLEVEL_SET_MINIMIZED 13
  1569. /**
  1570. * @ingroup iface_xdg_toplevel
  1571. */
  1572. #define XDG_TOPLEVEL_CONFIGURE_SINCE_VERSION 1
  1573. /**
  1574. * @ingroup iface_xdg_toplevel
  1575. */
  1576. #define XDG_TOPLEVEL_CLOSE_SINCE_VERSION 1
  1577. /**
  1578. * @ingroup iface_xdg_toplevel
  1579. */
  1580. #define XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION 4
  1581. /**
  1582. * @ingroup iface_xdg_toplevel
  1583. */
  1584. #define XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION 5
  1585. /**
  1586. * @ingroup iface_xdg_toplevel
  1587. */
  1588. #define XDG_TOPLEVEL_DESTROY_SINCE_VERSION 1
  1589. /**
  1590. * @ingroup iface_xdg_toplevel
  1591. */
  1592. #define XDG_TOPLEVEL_SET_PARENT_SINCE_VERSION 1
  1593. /**
  1594. * @ingroup iface_xdg_toplevel
  1595. */
  1596. #define XDG_TOPLEVEL_SET_TITLE_SINCE_VERSION 1
  1597. /**
  1598. * @ingroup iface_xdg_toplevel
  1599. */
  1600. #define XDG_TOPLEVEL_SET_APP_ID_SINCE_VERSION 1
  1601. /**
  1602. * @ingroup iface_xdg_toplevel
  1603. */
  1604. #define XDG_TOPLEVEL_SHOW_WINDOW_MENU_SINCE_VERSION 1
  1605. /**
  1606. * @ingroup iface_xdg_toplevel
  1607. */
  1608. #define XDG_TOPLEVEL_MOVE_SINCE_VERSION 1
  1609. /**
  1610. * @ingroup iface_xdg_toplevel
  1611. */
  1612. #define XDG_TOPLEVEL_RESIZE_SINCE_VERSION 1
  1613. /**
  1614. * @ingroup iface_xdg_toplevel
  1615. */
  1616. #define XDG_TOPLEVEL_SET_MAX_SIZE_SINCE_VERSION 1
  1617. /**
  1618. * @ingroup iface_xdg_toplevel
  1619. */
  1620. #define XDG_TOPLEVEL_SET_MIN_SIZE_SINCE_VERSION 1
  1621. /**
  1622. * @ingroup iface_xdg_toplevel
  1623. */
  1624. #define XDG_TOPLEVEL_SET_MAXIMIZED_SINCE_VERSION 1
  1625. /**
  1626. * @ingroup iface_xdg_toplevel
  1627. */
  1628. #define XDG_TOPLEVEL_UNSET_MAXIMIZED_SINCE_VERSION 1
  1629. /**
  1630. * @ingroup iface_xdg_toplevel
  1631. */
  1632. #define XDG_TOPLEVEL_SET_FULLSCREEN_SINCE_VERSION 1
  1633. /**
  1634. * @ingroup iface_xdg_toplevel
  1635. */
  1636. #define XDG_TOPLEVEL_UNSET_FULLSCREEN_SINCE_VERSION 1
  1637. /**
  1638. * @ingroup iface_xdg_toplevel
  1639. */
  1640. #define XDG_TOPLEVEL_SET_MINIMIZED_SINCE_VERSION 1
  1641. /** @ingroup iface_xdg_toplevel */
  1642. static inline void
  1643. xdg_toplevel_set_user_data(struct xdg_toplevel *xdg_toplevel, void *user_data)
  1644. {
  1645. wl_proxy_set_user_data((struct wl_proxy *) xdg_toplevel, user_data);
  1646. }
  1647. /** @ingroup iface_xdg_toplevel */
  1648. static inline void *
  1649. xdg_toplevel_get_user_data(struct xdg_toplevel *xdg_toplevel)
  1650. {
  1651. return wl_proxy_get_user_data((struct wl_proxy *) xdg_toplevel);
  1652. }
  1653. static inline uint32_t
  1654. xdg_toplevel_get_version(struct xdg_toplevel *xdg_toplevel)
  1655. {
  1656. return wl_proxy_get_version((struct wl_proxy *) xdg_toplevel);
  1657. }
  1658. /**
  1659. * @ingroup iface_xdg_toplevel
  1660. *
  1661. * This request destroys the role surface and unmaps the surface;
  1662. * see "Unmapping" behavior in interface section for details.
  1663. */
  1664. static inline void
  1665. xdg_toplevel_destroy(struct xdg_toplevel *xdg_toplevel)
  1666. {
  1667. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  1668. XDG_TOPLEVEL_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), WL_MARSHAL_FLAG_DESTROY);
  1669. }
  1670. /**
  1671. * @ingroup iface_xdg_toplevel
  1672. *
  1673. * Set the "parent" of this surface. This surface should be stacked
  1674. * above the parent surface and all other ancestor surfaces.
  1675. *
  1676. * Parent surfaces should be set on dialogs, toolboxes, or other
  1677. * "auxiliary" surfaces, so that the parent is raised when the dialog
  1678. * is raised.
  1679. *
  1680. * Setting a null parent for a child surface unsets its parent. Setting
  1681. * a null parent for a surface which currently has no parent is a no-op.
  1682. *
  1683. * Only mapped surfaces can have child surfaces. Setting a parent which
  1684. * is not mapped is equivalent to setting a null parent. If a surface
  1685. * becomes unmapped, its children's parent is set to the parent of
  1686. * the now-unmapped surface. If the now-unmapped surface has no parent,
  1687. * its children's parent is unset. If the now-unmapped surface becomes
  1688. * mapped again, its parent-child relationship is not restored.
  1689. *
  1690. * The parent toplevel must not be one of the child toplevel's
  1691. * descendants, and the parent must be different from the child toplevel,
  1692. * otherwise the invalid_parent protocol error is raised.
  1693. */
  1694. static inline void
  1695. xdg_toplevel_set_parent(struct xdg_toplevel *xdg_toplevel, struct xdg_toplevel *parent)
  1696. {
  1697. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  1698. XDG_TOPLEVEL_SET_PARENT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, parent);
  1699. }
  1700. /**
  1701. * @ingroup iface_xdg_toplevel
  1702. *
  1703. * Set a short title for the surface.
  1704. *
  1705. * This string may be used to identify the surface in a task bar,
  1706. * window list, or other user interface elements provided by the
  1707. * compositor.
  1708. *
  1709. * The string must be encoded in UTF-8.
  1710. */
  1711. static inline void
  1712. xdg_toplevel_set_title(struct xdg_toplevel *xdg_toplevel, const char *title)
  1713. {
  1714. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  1715. XDG_TOPLEVEL_SET_TITLE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, title);
  1716. }
  1717. /**
  1718. * @ingroup iface_xdg_toplevel
  1719. *
  1720. * Set an application identifier for the surface.
  1721. *
  1722. * The app ID identifies the general class of applications to which
  1723. * the surface belongs. The compositor can use this to group multiple
  1724. * surfaces together, or to determine how to launch a new application.
  1725. *
  1726. * For D-Bus activatable applications, the app ID is used as the D-Bus
  1727. * service name.
  1728. *
  1729. * The compositor shell will try to group application surfaces together
  1730. * by their app ID. As a best practice, it is suggested to select app
  1731. * ID's that match the basename of the application's .desktop file.
  1732. * For example, "org.freedesktop.FooViewer" where the .desktop file is
  1733. * "org.freedesktop.FooViewer.desktop".
  1734. *
  1735. * Like other properties, a set_app_id request can be sent after the
  1736. * xdg_toplevel has been mapped to update the property.
  1737. *
  1738. * See the desktop-entry specification [0] for more details on
  1739. * application identifiers and how they relate to well-known D-Bus
  1740. * names and .desktop files.
  1741. *
  1742. * [0] https://standards.freedesktop.org/desktop-entry-spec/
  1743. */
  1744. static inline void
  1745. xdg_toplevel_set_app_id(struct xdg_toplevel *xdg_toplevel, const char *app_id)
  1746. {
  1747. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  1748. XDG_TOPLEVEL_SET_APP_ID, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, app_id);
  1749. }
  1750. /**
  1751. * @ingroup iface_xdg_toplevel
  1752. *
  1753. * Clients implementing client-side decorations might want to show
  1754. * a context menu when right-clicking on the decorations, giving the
  1755. * user a menu that they can use to maximize or minimize the window.
  1756. *
  1757. * This request asks the compositor to pop up such a window menu at
  1758. * the given position, relative to the local surface coordinates of
  1759. * the parent surface. There are no guarantees as to what menu items
  1760. * the window menu contains, or even if a window menu will be drawn
  1761. * at all.
  1762. *
  1763. * This request must be used in response to some sort of user action
  1764. * like a button press, key press, or touch down event.
  1765. */
  1766. static inline void
  1767. xdg_toplevel_show_window_menu(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
  1768. {
  1769. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  1770. XDG_TOPLEVEL_SHOW_WINDOW_MENU, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial, x, y);
  1771. }
  1772. /**
  1773. * @ingroup iface_xdg_toplevel
  1774. *
  1775. * Start an interactive, user-driven move of the surface.
  1776. *
  1777. * This request must be used in response to some sort of user action
  1778. * like a button press, key press, or touch down event. The passed
  1779. * serial is used to determine the type of interactive move (touch,
  1780. * pointer, etc).
  1781. *
  1782. * The server may ignore move requests depending on the state of
  1783. * the surface (e.g. fullscreen or maximized), or if the passed serial
  1784. * is no longer valid.
  1785. *
  1786. * If triggered, the surface will lose the focus of the device
  1787. * (wl_pointer, wl_touch, etc) used for the move. It is up to the
  1788. * compositor to visually indicate that the move is taking place, such as
  1789. * updating a pointer cursor, during the move. There is no guarantee
  1790. * that the device focus will return when the move is completed.
  1791. */
  1792. static inline void
  1793. xdg_toplevel_move(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial)
  1794. {
  1795. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  1796. XDG_TOPLEVEL_MOVE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial);
  1797. }
  1798. /**
  1799. * @ingroup iface_xdg_toplevel
  1800. *
  1801. * Start a user-driven, interactive resize of the surface.
  1802. *
  1803. * This request must be used in response to some sort of user action
  1804. * like a button press, key press, or touch down event. The passed
  1805. * serial is used to determine the type of interactive resize (touch,
  1806. * pointer, etc).
  1807. *
  1808. * The server may ignore resize requests depending on the state of
  1809. * the surface (e.g. fullscreen or maximized).
  1810. *
  1811. * If triggered, the client will receive configure events with the
  1812. * "resize" state enum value and the expected sizes. See the "resize"
  1813. * enum value for more details about what is required. The client
  1814. * must also acknowledge configure events using "ack_configure". After
  1815. * the resize is completed, the client will receive another "configure"
  1816. * event without the resize state.
  1817. *
  1818. * If triggered, the surface also will lose the focus of the device
  1819. * (wl_pointer, wl_touch, etc) used for the resize. It is up to the
  1820. * compositor to visually indicate that the resize is taking place,
  1821. * such as updating a pointer cursor, during the resize. There is no
  1822. * guarantee that the device focus will return when the resize is
  1823. * completed.
  1824. *
  1825. * The edges parameter specifies how the surface should be resized, and
  1826. * is one of the values of the resize_edge enum. Values not matching
  1827. * a variant of the enum will cause the invalid_resize_edge protocol error.
  1828. * The compositor may use this information to update the surface position
  1829. * for example when dragging the top left corner. The compositor may also
  1830. * use this information to adapt its behavior, e.g. choose an appropriate
  1831. * cursor image.
  1832. */
  1833. static inline void
  1834. xdg_toplevel_resize(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial, uint32_t edges)
  1835. {
  1836. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  1837. XDG_TOPLEVEL_RESIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial, edges);
  1838. }
  1839. /**
  1840. * @ingroup iface_xdg_toplevel
  1841. *
  1842. * Set a maximum size for the window.
  1843. *
  1844. * The client can specify a maximum size so that the compositor does
  1845. * not try to configure the window beyond this size.
  1846. *
  1847. * The width and height arguments are in window geometry coordinates.
  1848. * See xdg_surface.set_window_geometry.
  1849. *
  1850. * Values set in this way are double-buffered, see wl_surface.commit.
  1851. *
  1852. * The compositor can use this information to allow or disallow
  1853. * different states like maximize or fullscreen and draw accurate
  1854. * animations.
  1855. *
  1856. * Similarly, a tiling window manager may use this information to
  1857. * place and resize client windows in a more effective way.
  1858. *
  1859. * The client should not rely on the compositor to obey the maximum
  1860. * size. The compositor may decide to ignore the values set by the
  1861. * client and request a larger size.
  1862. *
  1863. * If never set, or a value of zero in the request, means that the
  1864. * client has no expected maximum size in the given dimension.
  1865. * As a result, a client wishing to reset the maximum size
  1866. * to an unspecified state can use zero for width and height in the
  1867. * request.
  1868. *
  1869. * Requesting a maximum size to be smaller than the minimum size of
  1870. * a surface is illegal and will result in an invalid_size error.
  1871. *
  1872. * The width and height must be greater than or equal to zero. Using
  1873. * strictly negative values for width or height will result in an
  1874. * invalid_size error.
  1875. */
  1876. static inline void
  1877. xdg_toplevel_set_max_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height)
  1878. {
  1879. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  1880. XDG_TOPLEVEL_SET_MAX_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, width, height);
  1881. }
  1882. /**
  1883. * @ingroup iface_xdg_toplevel
  1884. *
  1885. * Set a minimum size for the window.
  1886. *
  1887. * The client can specify a minimum size so that the compositor does
  1888. * not try to configure the window below this size.
  1889. *
  1890. * The width and height arguments are in window geometry coordinates.
  1891. * See xdg_surface.set_window_geometry.
  1892. *
  1893. * Values set in this way are double-buffered, see wl_surface.commit.
  1894. *
  1895. * The compositor can use this information to allow or disallow
  1896. * different states like maximize or fullscreen and draw accurate
  1897. * animations.
  1898. *
  1899. * Similarly, a tiling window manager may use this information to
  1900. * place and resize client windows in a more effective way.
  1901. *
  1902. * The client should not rely on the compositor to obey the minimum
  1903. * size. The compositor may decide to ignore the values set by the
  1904. * client and request a smaller size.
  1905. *
  1906. * If never set, or a value of zero in the request, means that the
  1907. * client has no expected minimum size in the given dimension.
  1908. * As a result, a client wishing to reset the minimum size
  1909. * to an unspecified state can use zero for width and height in the
  1910. * request.
  1911. *
  1912. * Requesting a minimum size to be larger than the maximum size of
  1913. * a surface is illegal and will result in an invalid_size error.
  1914. *
  1915. * The width and height must be greater than or equal to zero. Using
  1916. * strictly negative values for width and height will result in an
  1917. * invalid_size error.
  1918. */
  1919. static inline void
  1920. xdg_toplevel_set_min_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height)
  1921. {
  1922. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  1923. XDG_TOPLEVEL_SET_MIN_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, width, height);
  1924. }
  1925. /**
  1926. * @ingroup iface_xdg_toplevel
  1927. *
  1928. * Maximize the surface.
  1929. *
  1930. * After requesting that the surface should be maximized, the compositor
  1931. * will respond by emitting a configure event. Whether this configure
  1932. * actually sets the window maximized is subject to compositor policies.
  1933. * The client must then update its content, drawing in the configured
  1934. * state. The client must also acknowledge the configure when committing
  1935. * the new content (see ack_configure).
  1936. *
  1937. * It is up to the compositor to decide how and where to maximize the
  1938. * surface, for example which output and what region of the screen should
  1939. * be used.
  1940. *
  1941. * If the surface was already maximized, the compositor will still emit
  1942. * a configure event with the "maximized" state.
  1943. *
  1944. * If the surface is in a fullscreen state, this request has no direct
  1945. * effect. It may alter the state the surface is returned to when
  1946. * unmaximized unless overridden by the compositor.
  1947. */
  1948. static inline void
  1949. xdg_toplevel_set_maximized(struct xdg_toplevel *xdg_toplevel)
  1950. {
  1951. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  1952. XDG_TOPLEVEL_SET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);
  1953. }
  1954. /**
  1955. * @ingroup iface_xdg_toplevel
  1956. *
  1957. * Unmaximize the surface.
  1958. *
  1959. * After requesting that the surface should be unmaximized, the compositor
  1960. * will respond by emitting a configure event. Whether this actually
  1961. * un-maximizes the window is subject to compositor policies.
  1962. * If available and applicable, the compositor will include the window
  1963. * geometry dimensions the window had prior to being maximized in the
  1964. * configure event. The client must then update its content, drawing it in
  1965. * the configured state. The client must also acknowledge the configure
  1966. * when committing the new content (see ack_configure).
  1967. *
  1968. * It is up to the compositor to position the surface after it was
  1969. * unmaximized; usually the position the surface had before maximizing, if
  1970. * applicable.
  1971. *
  1972. * If the surface was already not maximized, the compositor will still
  1973. * emit a configure event without the "maximized" state.
  1974. *
  1975. * If the surface is in a fullscreen state, this request has no direct
  1976. * effect. It may alter the state the surface is returned to when
  1977. * unmaximized unless overridden by the compositor.
  1978. */
  1979. static inline void
  1980. xdg_toplevel_unset_maximized(struct xdg_toplevel *xdg_toplevel)
  1981. {
  1982. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  1983. XDG_TOPLEVEL_UNSET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);
  1984. }
  1985. /**
  1986. * @ingroup iface_xdg_toplevel
  1987. *
  1988. * Make the surface fullscreen.
  1989. *
  1990. * After requesting that the surface should be fullscreened, the
  1991. * compositor will respond by emitting a configure event. Whether the
  1992. * client is actually put into a fullscreen state is subject to compositor
  1993. * policies. The client must also acknowledge the configure when
  1994. * committing the new content (see ack_configure).
  1995. *
  1996. * The output passed by the request indicates the client's preference as
  1997. * to which display it should be set fullscreen on. If this value is NULL,
  1998. * it's up to the compositor to choose which display will be used to map
  1999. * this surface.
  2000. *
  2001. * If the surface doesn't cover the whole output, the compositor will
  2002. * position the surface in the center of the output and compensate with
  2003. * border fill covering the rest of the output. The content of the
  2004. * border fill is undefined, but should be assumed to be in some way that
  2005. * attempts to blend into the surrounding area (e.g. solid black).
  2006. *
  2007. * If the fullscreened surface is not opaque, the compositor must make
  2008. * sure that other screen content not part of the same surface tree (made
  2009. * up of subsurfaces, popups or similarly coupled surfaces) are not
  2010. * visible below the fullscreened surface.
  2011. */
  2012. static inline void
  2013. xdg_toplevel_set_fullscreen(struct xdg_toplevel *xdg_toplevel, struct wl_output *output)
  2014. {
  2015. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  2016. XDG_TOPLEVEL_SET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, output);
  2017. }
  2018. /**
  2019. * @ingroup iface_xdg_toplevel
  2020. *
  2021. * Make the surface no longer fullscreen.
  2022. *
  2023. * After requesting that the surface should be unfullscreened, the
  2024. * compositor will respond by emitting a configure event.
  2025. * Whether this actually removes the fullscreen state of the client is
  2026. * subject to compositor policies.
  2027. *
  2028. * Making a surface unfullscreen sets states for the surface based on the following:
  2029. * * the state(s) it may have had before becoming fullscreen
  2030. * * any state(s) decided by the compositor
  2031. * * any state(s) requested by the client while the surface was fullscreen
  2032. *
  2033. * The compositor may include the previous window geometry dimensions in
  2034. * the configure event, if applicable.
  2035. *
  2036. * The client must also acknowledge the configure when committing the new
  2037. * content (see ack_configure).
  2038. */
  2039. static inline void
  2040. xdg_toplevel_unset_fullscreen(struct xdg_toplevel *xdg_toplevel)
  2041. {
  2042. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  2043. XDG_TOPLEVEL_UNSET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);
  2044. }
  2045. /**
  2046. * @ingroup iface_xdg_toplevel
  2047. *
  2048. * Request that the compositor minimize your surface. There is no
  2049. * way to know if the surface is currently minimized, nor is there
  2050. * any way to unset minimization on this surface.
  2051. *
  2052. * If you are looking to throttle redrawing when minimized, please
  2053. * instead use the wl_surface.frame event for this, as this will
  2054. * also work with live previews on windows in Alt-Tab, Expose or
  2055. * similar compositor features.
  2056. */
  2057. static inline void
  2058. xdg_toplevel_set_minimized(struct xdg_toplevel *xdg_toplevel)
  2059. {
  2060. wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
  2061. XDG_TOPLEVEL_SET_MINIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);
  2062. }
  2063. #ifndef XDG_POPUP_ERROR_ENUM
  2064. #define XDG_POPUP_ERROR_ENUM
  2065. enum xdg_popup_error {
  2066. /**
  2067. * tried to grab after being mapped
  2068. */
  2069. XDG_POPUP_ERROR_INVALID_GRAB = 0,
  2070. };
  2071. #endif /* XDG_POPUP_ERROR_ENUM */
  2072. /**
  2073. * @ingroup iface_xdg_popup
  2074. * @struct xdg_popup_listener
  2075. */
  2076. struct xdg_popup_listener {
  2077. /**
  2078. * configure the popup surface
  2079. *
  2080. * This event asks the popup surface to configure itself given
  2081. * the configuration. The configured state should not be applied
  2082. * immediately. See xdg_surface.configure for details.
  2083. *
  2084. * The x and y arguments represent the position the popup was
  2085. * placed at given the xdg_positioner rule, relative to the upper
  2086. * left corner of the window geometry of the parent surface.
  2087. *
  2088. * For version 2 or older, the configure event for an xdg_popup is
  2089. * only ever sent once for the initial configuration. Starting with
  2090. * version 3, it may be sent again if the popup is setup with an
  2091. * xdg_positioner with set_reactive requested, or in response to
  2092. * xdg_popup.reposition requests.
  2093. * @param x x position relative to parent surface window geometry
  2094. * @param y y position relative to parent surface window geometry
  2095. * @param width window geometry width
  2096. * @param height window geometry height
  2097. */
  2098. void (*configure)(void *data,
  2099. struct xdg_popup *xdg_popup,
  2100. int32_t x,
  2101. int32_t y,
  2102. int32_t width,
  2103. int32_t height);
  2104. /**
  2105. * popup interaction is done
  2106. *
  2107. * The popup_done event is sent out when a popup is dismissed by
  2108. * the compositor. The client should destroy the xdg_popup object
  2109. * at this point.
  2110. */
  2111. void (*popup_done)(void *data,
  2112. struct xdg_popup *xdg_popup);
  2113. /**
  2114. * signal the completion of a repositioned request
  2115. *
  2116. * The repositioned event is sent as part of a popup
  2117. * configuration sequence, together with xdg_popup.configure and
  2118. * lastly xdg_surface.configure to notify the completion of a
  2119. * reposition request.
  2120. *
  2121. * The repositioned event is to notify about the completion of a
  2122. * xdg_popup.reposition request. The token argument is the token
  2123. * passed in the xdg_popup.reposition request.
  2124. *
  2125. * Immediately after this event is emitted, xdg_popup.configure and
  2126. * xdg_surface.configure will be sent with the updated size and
  2127. * position, as well as a new configure serial.
  2128. *
  2129. * The client should optionally update the content of the popup,
  2130. * but must acknowledge the new popup configuration for the new
  2131. * position to take effect. See xdg_surface.ack_configure for
  2132. * details.
  2133. * @param token reposition request token
  2134. * @since 3
  2135. */
  2136. void (*repositioned)(void *data,
  2137. struct xdg_popup *xdg_popup,
  2138. uint32_t token);
  2139. };
  2140. /**
  2141. * @ingroup iface_xdg_popup
  2142. */
  2143. static inline int
  2144. xdg_popup_add_listener(struct xdg_popup *xdg_popup,
  2145. const struct xdg_popup_listener *listener, void *data)
  2146. {
  2147. return wl_proxy_add_listener((struct wl_proxy *) xdg_popup,
  2148. (void (**)(void)) listener, data);
  2149. }
  2150. #define XDG_POPUP_DESTROY 0
  2151. #define XDG_POPUP_GRAB 1
  2152. #define XDG_POPUP_REPOSITION 2
  2153. /**
  2154. * @ingroup iface_xdg_popup
  2155. */
  2156. #define XDG_POPUP_CONFIGURE_SINCE_VERSION 1
  2157. /**
  2158. * @ingroup iface_xdg_popup
  2159. */
  2160. #define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1
  2161. /**
  2162. * @ingroup iface_xdg_popup
  2163. */
  2164. #define XDG_POPUP_REPOSITIONED_SINCE_VERSION 3
  2165. /**
  2166. * @ingroup iface_xdg_popup
  2167. */
  2168. #define XDG_POPUP_DESTROY_SINCE_VERSION 1
  2169. /**
  2170. * @ingroup iface_xdg_popup
  2171. */
  2172. #define XDG_POPUP_GRAB_SINCE_VERSION 1
  2173. /**
  2174. * @ingroup iface_xdg_popup
  2175. */
  2176. #define XDG_POPUP_REPOSITION_SINCE_VERSION 3
  2177. /** @ingroup iface_xdg_popup */
  2178. static inline void
  2179. xdg_popup_set_user_data(struct xdg_popup *xdg_popup, void *user_data)
  2180. {
  2181. wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data);
  2182. }
  2183. /** @ingroup iface_xdg_popup */
  2184. static inline void *
  2185. xdg_popup_get_user_data(struct xdg_popup *xdg_popup)
  2186. {
  2187. return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup);
  2188. }
  2189. static inline uint32_t
  2190. xdg_popup_get_version(struct xdg_popup *xdg_popup)
  2191. {
  2192. return wl_proxy_get_version((struct wl_proxy *) xdg_popup);
  2193. }
  2194. /**
  2195. * @ingroup iface_xdg_popup
  2196. *
  2197. * This destroys the popup. Explicitly destroying the xdg_popup
  2198. * object will also dismiss the popup, and unmap the surface.
  2199. *
  2200. * If this xdg_popup is not the "topmost" popup, the
  2201. * xdg_wm_base.not_the_topmost_popup protocol error will be sent.
  2202. */
  2203. static inline void
  2204. xdg_popup_destroy(struct xdg_popup *xdg_popup)
  2205. {
  2206. wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup,
  2207. XDG_POPUP_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), WL_MARSHAL_FLAG_DESTROY);
  2208. }
  2209. /**
  2210. * @ingroup iface_xdg_popup
  2211. *
  2212. * This request makes the created popup take an explicit grab. An explicit
  2213. * grab will be dismissed when the user dismisses the popup, or when the
  2214. * client destroys the xdg_popup. This can be done by the user clicking
  2215. * outside the surface, using the keyboard, or even locking the screen
  2216. * through closing the lid or a timeout.
  2217. *
  2218. * If the compositor denies the grab, the popup will be immediately
  2219. * dismissed.
  2220. *
  2221. * This request must be used in response to some sort of user action like a
  2222. * button press, key press, or touch down event. The serial number of the
  2223. * event should be passed as 'serial'.
  2224. *
  2225. * The parent of a grabbing popup must either be an xdg_toplevel surface or
  2226. * another xdg_popup with an explicit grab. If the parent is another
  2227. * xdg_popup it means that the popups are nested, with this popup now being
  2228. * the topmost popup.
  2229. *
  2230. * Nested popups must be destroyed in the reverse order they were created
  2231. * in, e.g. the only popup you are allowed to destroy at all times is the
  2232. * topmost one.
  2233. *
  2234. * When compositors choose to dismiss a popup, they may dismiss every
  2235. * nested grabbing popup as well. When a compositor dismisses popups, it
  2236. * will follow the same dismissing order as required from the client.
  2237. *
  2238. * If the topmost grabbing popup is destroyed, the grab will be returned to
  2239. * the parent of the popup, if that parent previously had an explicit grab.
  2240. *
  2241. * If the parent is a grabbing popup which has already been dismissed, this
  2242. * popup will be immediately dismissed. If the parent is a popup that did
  2243. * not take an explicit grab, an error will be raised.
  2244. *
  2245. * During a popup grab, the client owning the grab will receive pointer
  2246. * and touch events for all their surfaces as normal (similar to an
  2247. * "owner-events" grab in X11 parlance), while the top most grabbing popup
  2248. * will always have keyboard focus.
  2249. */
  2250. static inline void
  2251. xdg_popup_grab(struct xdg_popup *xdg_popup, struct wl_seat *seat, uint32_t serial)
  2252. {
  2253. wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup,
  2254. XDG_POPUP_GRAB, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), 0, seat, serial);
  2255. }
  2256. /**
  2257. * @ingroup iface_xdg_popup
  2258. *
  2259. * Reposition an already-mapped popup. The popup will be placed given the
  2260. * details in the passed xdg_positioner object, and a
  2261. * xdg_popup.repositioned followed by xdg_popup.configure and
  2262. * xdg_surface.configure will be emitted in response. Any parameters set
  2263. * by the previous positioner will be discarded.
  2264. *
  2265. * The passed token will be sent in the corresponding
  2266. * xdg_popup.repositioned event. The new popup position will not take
  2267. * effect until the corresponding configure event is acknowledged by the
  2268. * client. See xdg_popup.repositioned for details. The token itself is
  2269. * opaque, and has no other special meaning.
  2270. *
  2271. * If multiple reposition requests are sent, the compositor may skip all
  2272. * but the last one.
  2273. *
  2274. * If the popup is repositioned in response to a configure event for its
  2275. * parent, the client should send an xdg_positioner.set_parent_configure
  2276. * and possibly an xdg_positioner.set_parent_size request to allow the
  2277. * compositor to properly constrain the popup.
  2278. *
  2279. * If the popup is repositioned together with a parent that is being
  2280. * resized, but not in response to a configure event, the client should
  2281. * send an xdg_positioner.set_parent_size request.
  2282. */
  2283. static inline void
  2284. xdg_popup_reposition(struct xdg_popup *xdg_popup, struct xdg_positioner *positioner, uint32_t token)
  2285. {
  2286. wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup,
  2287. XDG_POPUP_REPOSITION, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), 0, positioner, token);
  2288. }
  2289. #ifdef __cplusplus
  2290. }
  2291. #endif
  2292. #endif