xdg-shell-server-protocol.h 81 KB

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