wayland_xdg_shell.h 67 KB

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