xdg-shell-protocol.h 80 KB

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