wayland-server-protocol.h 120 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655
  1. /* Generated by wayland-scanner 1.11.0 */
  2. #ifndef WAYLAND_SERVER_PROTOCOL_H
  3. #define WAYLAND_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_wayland The wayland protocol
  14. * @section page_ifaces_wayland Interfaces
  15. * - @subpage page_iface_wl_display - core global object
  16. * - @subpage page_iface_wl_registry - global registry object
  17. * - @subpage page_iface_wl_callback - callback object
  18. * - @subpage page_iface_wl_compositor - the compositor singleton
  19. * - @subpage page_iface_wl_shm_pool - a shared memory pool
  20. * - @subpage page_iface_wl_shm - shared memory support
  21. * - @subpage page_iface_wl_buffer - content for a wl_surface
  22. * - @subpage page_iface_wl_data_offer - offer to transfer data
  23. * - @subpage page_iface_wl_data_source - offer to transfer data
  24. * - @subpage page_iface_wl_data_device - data transfer device
  25. * - @subpage page_iface_wl_data_device_manager - data transfer interface
  26. * - @subpage page_iface_wl_shell - create desktop-style surfaces
  27. * - @subpage page_iface_wl_shell_surface - desktop-style metadata interface
  28. * - @subpage page_iface_wl_surface - an onscreen surface
  29. * - @subpage page_iface_wl_seat - group of input devices
  30. * - @subpage page_iface_wl_pointer - pointer input device
  31. * - @subpage page_iface_wl_keyboard - keyboard input device
  32. * - @subpage page_iface_wl_touch - touchscreen input device
  33. * - @subpage page_iface_wl_output - compositor output region
  34. * - @subpage page_iface_wl_region - region interface
  35. * - @subpage page_iface_wl_subcompositor - sub-surface compositing
  36. * - @subpage page_iface_wl_subsurface - sub-surface interface to a wl_surface
  37. * @section page_copyright_wayland Copyright
  38. * <pre>
  39. *
  40. * Copyright © 2008-2011 Kristian Høgsberg
  41. * Copyright © 2010-2011 Intel Corporation
  42. * Copyright © 2012-2013 Collabora, Ltd.
  43. *
  44. * Permission is hereby granted, free of charge, to any person
  45. * obtaining a copy of this software and associated documentation files
  46. * (the "Software"), to deal in the Software without restriction,
  47. * including without limitation the rights to use, copy, modify, merge,
  48. * publish, distribute, sublicense, and/or sell copies of the Software,
  49. * and to permit persons to whom the Software is furnished to do so,
  50. * subject to the following conditions:
  51. *
  52. * The above copyright notice and this permission notice (including the
  53. * next paragraph) shall be included in all copies or substantial
  54. * portions of the Software.
  55. *
  56. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  57. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  58. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  59. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  60. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  61. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  62. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  63. * SOFTWARE.
  64. * </pre>
  65. */
  66. struct wl_buffer;
  67. struct wl_callback;
  68. struct wl_compositor;
  69. struct wl_data_device;
  70. struct wl_data_device_manager;
  71. struct wl_data_offer;
  72. struct wl_data_source;
  73. struct wl_display;
  74. struct wl_keyboard;
  75. struct wl_output;
  76. struct wl_pointer;
  77. struct wl_region;
  78. struct wl_registry;
  79. struct wl_seat;
  80. struct wl_shell;
  81. struct wl_shell_surface;
  82. struct wl_shm;
  83. struct wl_shm_pool;
  84. struct wl_subcompositor;
  85. struct wl_subsurface;
  86. struct wl_surface;
  87. struct wl_touch;
  88. /**
  89. * @page page_iface_wl_display wl_display
  90. * @section page_iface_wl_display_desc Description
  91. *
  92. * The core global object. This is a special singleton object. It
  93. * is used for internal Wayland protocol features.
  94. * @section page_iface_wl_display_api API
  95. * See @ref iface_wl_display.
  96. */
  97. /**
  98. * @defgroup iface_wl_display The wl_display interface
  99. *
  100. * The core global object. This is a special singleton object. It
  101. * is used for internal Wayland protocol features.
  102. */
  103. extern const struct wl_interface wl_display_interface;
  104. /**
  105. * @page page_iface_wl_registry wl_registry
  106. * @section page_iface_wl_registry_desc Description
  107. *
  108. * The global registry object. The server has a number of global
  109. * objects that are available to all clients. These objects
  110. * typically represent an actual object in the server (for example,
  111. * an input device) or they are singleton objects that provide
  112. * extension functionality.
  113. *
  114. * When a client creates a registry object, the registry object
  115. * will emit a global event for each global currently in the
  116. * registry. Globals come and go as a result of device or
  117. * monitor hotplugs, reconfiguration or other events, and the
  118. * registry will send out global and global_remove events to
  119. * keep the client up to date with the changes. To mark the end
  120. * of the initial burst of events, the client can use the
  121. * wl_display.sync request immediately after calling
  122. * wl_display.get_registry.
  123. *
  124. * A client can bind to a global object by using the bind
  125. * request. This creates a client-side handle that lets the object
  126. * emit events to the client and lets the client invoke requests on
  127. * the object.
  128. * @section page_iface_wl_registry_api API
  129. * See @ref iface_wl_registry.
  130. */
  131. /**
  132. * @defgroup iface_wl_registry The wl_registry interface
  133. *
  134. * The global registry object. The server has a number of global
  135. * objects that are available to all clients. These objects
  136. * typically represent an actual object in the server (for example,
  137. * an input device) or they are singleton objects that provide
  138. * extension functionality.
  139. *
  140. * When a client creates a registry object, the registry object
  141. * will emit a global event for each global currently in the
  142. * registry. Globals come and go as a result of device or
  143. * monitor hotplugs, reconfiguration or other events, and the
  144. * registry will send out global and global_remove events to
  145. * keep the client up to date with the changes. To mark the end
  146. * of the initial burst of events, the client can use the
  147. * wl_display.sync request immediately after calling
  148. * wl_display.get_registry.
  149. *
  150. * A client can bind to a global object by using the bind
  151. * request. This creates a client-side handle that lets the object
  152. * emit events to the client and lets the client invoke requests on
  153. * the object.
  154. */
  155. extern const struct wl_interface wl_registry_interface;
  156. /**
  157. * @page page_iface_wl_callback wl_callback
  158. * @section page_iface_wl_callback_desc Description
  159. *
  160. * Clients can handle the 'done' event to get notified when
  161. * the related request is done.
  162. * @section page_iface_wl_callback_api API
  163. * See @ref iface_wl_callback.
  164. */
  165. /**
  166. * @defgroup iface_wl_callback The wl_callback interface
  167. *
  168. * Clients can handle the 'done' event to get notified when
  169. * the related request is done.
  170. */
  171. extern const struct wl_interface wl_callback_interface;
  172. /**
  173. * @page page_iface_wl_compositor wl_compositor
  174. * @section page_iface_wl_compositor_desc Description
  175. *
  176. * A compositor. This object is a singleton global. The
  177. * compositor is in charge of combining the contents of multiple
  178. * surfaces into one displayable output.
  179. * @section page_iface_wl_compositor_api API
  180. * See @ref iface_wl_compositor.
  181. */
  182. /**
  183. * @defgroup iface_wl_compositor The wl_compositor interface
  184. *
  185. * A compositor. This object is a singleton global. The
  186. * compositor is in charge of combining the contents of multiple
  187. * surfaces into one displayable output.
  188. */
  189. extern const struct wl_interface wl_compositor_interface;
  190. /**
  191. * @page page_iface_wl_shm_pool wl_shm_pool
  192. * @section page_iface_wl_shm_pool_desc Description
  193. *
  194. * The wl_shm_pool object encapsulates a piece of memory shared
  195. * between the compositor and client. Through the wl_shm_pool
  196. * object, the client can allocate shared memory wl_buffer objects.
  197. * All objects created through the same pool share the same
  198. * underlying mapped memory. Reusing the mapped memory avoids the
  199. * setup/teardown overhead and is useful when interactively resizing
  200. * a surface or for many small buffers.
  201. * @section page_iface_wl_shm_pool_api API
  202. * See @ref iface_wl_shm_pool.
  203. */
  204. /**
  205. * @defgroup iface_wl_shm_pool The wl_shm_pool interface
  206. *
  207. * The wl_shm_pool object encapsulates a piece of memory shared
  208. * between the compositor and client. Through the wl_shm_pool
  209. * object, the client can allocate shared memory wl_buffer objects.
  210. * All objects created through the same pool share the same
  211. * underlying mapped memory. Reusing the mapped memory avoids the
  212. * setup/teardown overhead and is useful when interactively resizing
  213. * a surface or for many small buffers.
  214. */
  215. extern const struct wl_interface wl_shm_pool_interface;
  216. /**
  217. * @page page_iface_wl_shm wl_shm
  218. * @section page_iface_wl_shm_desc Description
  219. *
  220. * A global singleton object that provides support for shared
  221. * memory.
  222. *
  223. * Clients can create wl_shm_pool objects using the create_pool
  224. * request.
  225. *
  226. * At connection setup time, the wl_shm object emits one or more
  227. * format events to inform clients about the valid pixel formats
  228. * that can be used for buffers.
  229. * @section page_iface_wl_shm_api API
  230. * See @ref iface_wl_shm.
  231. */
  232. /**
  233. * @defgroup iface_wl_shm The wl_shm interface
  234. *
  235. * A global singleton object that provides support for shared
  236. * memory.
  237. *
  238. * Clients can create wl_shm_pool objects using the create_pool
  239. * request.
  240. *
  241. * At connection setup time, the wl_shm object emits one or more
  242. * format events to inform clients about the valid pixel formats
  243. * that can be used for buffers.
  244. */
  245. extern const struct wl_interface wl_shm_interface;
  246. /**
  247. * @page page_iface_wl_buffer wl_buffer
  248. * @section page_iface_wl_buffer_desc Description
  249. *
  250. * A buffer provides the content for a wl_surface. Buffers are
  251. * created through factory interfaces such as wl_drm, wl_shm or
  252. * similar. It has a width and a height and can be attached to a
  253. * wl_surface, but the mechanism by which a client provides and
  254. * updates the contents is defined by the buffer factory interface.
  255. * @section page_iface_wl_buffer_api API
  256. * See @ref iface_wl_buffer.
  257. */
  258. /**
  259. * @defgroup iface_wl_buffer The wl_buffer interface
  260. *
  261. * A buffer provides the content for a wl_surface. Buffers are
  262. * created through factory interfaces such as wl_drm, wl_shm or
  263. * similar. It has a width and a height and can be attached to a
  264. * wl_surface, but the mechanism by which a client provides and
  265. * updates the contents is defined by the buffer factory interface.
  266. */
  267. extern const struct wl_interface wl_buffer_interface;
  268. /**
  269. * @page page_iface_wl_data_offer wl_data_offer
  270. * @section page_iface_wl_data_offer_desc Description
  271. *
  272. * A wl_data_offer represents a piece of data offered for transfer
  273. * by another client (the source client). It is used by the
  274. * copy-and-paste and drag-and-drop mechanisms. The offer
  275. * describes the different mime types that the data can be
  276. * converted to and provides the mechanism for transferring the
  277. * data directly from the source client.
  278. * @section page_iface_wl_data_offer_api API
  279. * See @ref iface_wl_data_offer.
  280. */
  281. /**
  282. * @defgroup iface_wl_data_offer The wl_data_offer interface
  283. *
  284. * A wl_data_offer represents a piece of data offered for transfer
  285. * by another client (the source client). It is used by the
  286. * copy-and-paste and drag-and-drop mechanisms. The offer
  287. * describes the different mime types that the data can be
  288. * converted to and provides the mechanism for transferring the
  289. * data directly from the source client.
  290. */
  291. extern const struct wl_interface wl_data_offer_interface;
  292. /**
  293. * @page page_iface_wl_data_source wl_data_source
  294. * @section page_iface_wl_data_source_desc Description
  295. *
  296. * The wl_data_source object is the source side of a wl_data_offer.
  297. * It is created by the source client in a data transfer and
  298. * provides a way to describe the offered data and a way to respond
  299. * to requests to transfer the data.
  300. * @section page_iface_wl_data_source_api API
  301. * See @ref iface_wl_data_source.
  302. */
  303. /**
  304. * @defgroup iface_wl_data_source The wl_data_source interface
  305. *
  306. * The wl_data_source object is the source side of a wl_data_offer.
  307. * It is created by the source client in a data transfer and
  308. * provides a way to describe the offered data and a way to respond
  309. * to requests to transfer the data.
  310. */
  311. extern const struct wl_interface wl_data_source_interface;
  312. /**
  313. * @page page_iface_wl_data_device wl_data_device
  314. * @section page_iface_wl_data_device_desc Description
  315. *
  316. * There is one wl_data_device per seat which can be obtained
  317. * from the global wl_data_device_manager singleton.
  318. *
  319. * A wl_data_device provides access to inter-client data transfer
  320. * mechanisms such as copy-and-paste and drag-and-drop.
  321. * @section page_iface_wl_data_device_api API
  322. * See @ref iface_wl_data_device.
  323. */
  324. /**
  325. * @defgroup iface_wl_data_device The wl_data_device interface
  326. *
  327. * There is one wl_data_device per seat which can be obtained
  328. * from the global wl_data_device_manager singleton.
  329. *
  330. * A wl_data_device provides access to inter-client data transfer
  331. * mechanisms such as copy-and-paste and drag-and-drop.
  332. */
  333. extern const struct wl_interface wl_data_device_interface;
  334. /**
  335. * @page page_iface_wl_data_device_manager wl_data_device_manager
  336. * @section page_iface_wl_data_device_manager_desc Description
  337. *
  338. * The wl_data_device_manager is a singleton global object that
  339. * provides access to inter-client data transfer mechanisms such as
  340. * copy-and-paste and drag-and-drop. These mechanisms are tied to
  341. * a wl_seat and this interface lets a client get a wl_data_device
  342. * corresponding to a wl_seat.
  343. *
  344. * Depending on the version bound, the objects created from the bound
  345. * wl_data_device_manager object will have different requirements for
  346. * functioning properly. See wl_data_source.set_actions,
  347. * wl_data_offer.accept and wl_data_offer.finish for details.
  348. * @section page_iface_wl_data_device_manager_api API
  349. * See @ref iface_wl_data_device_manager.
  350. */
  351. /**
  352. * @defgroup iface_wl_data_device_manager The wl_data_device_manager interface
  353. *
  354. * The wl_data_device_manager is a singleton global object that
  355. * provides access to inter-client data transfer mechanisms such as
  356. * copy-and-paste and drag-and-drop. These mechanisms are tied to
  357. * a wl_seat and this interface lets a client get a wl_data_device
  358. * corresponding to a wl_seat.
  359. *
  360. * Depending on the version bound, the objects created from the bound
  361. * wl_data_device_manager object will have different requirements for
  362. * functioning properly. See wl_data_source.set_actions,
  363. * wl_data_offer.accept and wl_data_offer.finish for details.
  364. */
  365. extern const struct wl_interface wl_data_device_manager_interface;
  366. /**
  367. * @page page_iface_wl_shell wl_shell
  368. * @section page_iface_wl_shell_desc Description
  369. *
  370. * This interface is implemented by servers that provide
  371. * desktop-style user interfaces.
  372. *
  373. * It allows clients to associate a wl_shell_surface with
  374. * a basic surface.
  375. * @section page_iface_wl_shell_api API
  376. * See @ref iface_wl_shell.
  377. */
  378. /**
  379. * @defgroup iface_wl_shell The wl_shell interface
  380. *
  381. * This interface is implemented by servers that provide
  382. * desktop-style user interfaces.
  383. *
  384. * It allows clients to associate a wl_shell_surface with
  385. * a basic surface.
  386. */
  387. extern const struct wl_interface wl_shell_interface;
  388. /**
  389. * @page page_iface_wl_shell_surface wl_shell_surface
  390. * @section page_iface_wl_shell_surface_desc Description
  391. *
  392. * An interface that may be implemented by a wl_surface, for
  393. * implementations that provide a desktop-style user interface.
  394. *
  395. * It provides requests to treat surfaces like toplevel, fullscreen
  396. * or popup windows, move, resize or maximize them, associate
  397. * metadata like title and class, etc.
  398. *
  399. * On the server side the object is automatically destroyed when
  400. * the related wl_surface is destroyed. On the client side,
  401. * wl_shell_surface_destroy() must be called before destroying
  402. * the wl_surface object.
  403. * @section page_iface_wl_shell_surface_api API
  404. * See @ref iface_wl_shell_surface.
  405. */
  406. /**
  407. * @defgroup iface_wl_shell_surface The wl_shell_surface interface
  408. *
  409. * An interface that may be implemented by a wl_surface, for
  410. * implementations that provide a desktop-style user interface.
  411. *
  412. * It provides requests to treat surfaces like toplevel, fullscreen
  413. * or popup windows, move, resize or maximize them, associate
  414. * metadata like title and class, etc.
  415. *
  416. * On the server side the object is automatically destroyed when
  417. * the related wl_surface is destroyed. On the client side,
  418. * wl_shell_surface_destroy() must be called before destroying
  419. * the wl_surface object.
  420. */
  421. extern const struct wl_interface wl_shell_surface_interface;
  422. /**
  423. * @page page_iface_wl_surface wl_surface
  424. * @section page_iface_wl_surface_desc Description
  425. *
  426. * A surface is a rectangular area that is displayed on the screen.
  427. * It has a location, size and pixel contents.
  428. *
  429. * The size of a surface (and relative positions on it) is described
  430. * in surface-local coordinates, which may differ from the buffer
  431. * coordinates of the pixel content, in case a buffer_transform
  432. * or a buffer_scale is used.
  433. *
  434. * A surface without a "role" is fairly useless: a compositor does
  435. * not know where, when or how to present it. The role is the
  436. * purpose of a wl_surface. Examples of roles are a cursor for a
  437. * pointer (as set by wl_pointer.set_cursor), a drag icon
  438. * (wl_data_device.start_drag), a sub-surface
  439. * (wl_subcompositor.get_subsurface), and a window as defined by a
  440. * shell protocol (e.g. wl_shell.get_shell_surface).
  441. *
  442. * A surface can have only one role at a time. Initially a
  443. * wl_surface does not have a role. Once a wl_surface is given a
  444. * role, it is set permanently for the whole lifetime of the
  445. * wl_surface object. Giving the current role again is allowed,
  446. * unless explicitly forbidden by the relevant interface
  447. * specification.
  448. *
  449. * Surface roles are given by requests in other interfaces such as
  450. * wl_pointer.set_cursor. The request should explicitly mention
  451. * that this request gives a role to a wl_surface. Often, this
  452. * request also creates a new protocol object that represents the
  453. * role and adds additional functionality to wl_surface. When a
  454. * client wants to destroy a wl_surface, they must destroy this 'role
  455. * object' before the wl_surface.
  456. *
  457. * Destroying the role object does not remove the role from the
  458. * wl_surface, but it may stop the wl_surface from "playing the role".
  459. * For instance, if a wl_subsurface object is destroyed, the wl_surface
  460. * it was created for will be unmapped and forget its position and
  461. * z-order. It is allowed to create a wl_subsurface for the same
  462. * wl_surface again, but it is not allowed to use the wl_surface as
  463. * a cursor (cursor is a different role than sub-surface, and role
  464. * switching is not allowed).
  465. * @section page_iface_wl_surface_api API
  466. * See @ref iface_wl_surface.
  467. */
  468. /**
  469. * @defgroup iface_wl_surface The wl_surface interface
  470. *
  471. * A surface is a rectangular area that is displayed on the screen.
  472. * It has a location, size and pixel contents.
  473. *
  474. * The size of a surface (and relative positions on it) is described
  475. * in surface-local coordinates, which may differ from the buffer
  476. * coordinates of the pixel content, in case a buffer_transform
  477. * or a buffer_scale is used.
  478. *
  479. * A surface without a "role" is fairly useless: a compositor does
  480. * not know where, when or how to present it. The role is the
  481. * purpose of a wl_surface. Examples of roles are a cursor for a
  482. * pointer (as set by wl_pointer.set_cursor), a drag icon
  483. * (wl_data_device.start_drag), a sub-surface
  484. * (wl_subcompositor.get_subsurface), and a window as defined by a
  485. * shell protocol (e.g. wl_shell.get_shell_surface).
  486. *
  487. * A surface can have only one role at a time. Initially a
  488. * wl_surface does not have a role. Once a wl_surface is given a
  489. * role, it is set permanently for the whole lifetime of the
  490. * wl_surface object. Giving the current role again is allowed,
  491. * unless explicitly forbidden by the relevant interface
  492. * specification.
  493. *
  494. * Surface roles are given by requests in other interfaces such as
  495. * wl_pointer.set_cursor. The request should explicitly mention
  496. * that this request gives a role to a wl_surface. Often, this
  497. * request also creates a new protocol object that represents the
  498. * role and adds additional functionality to wl_surface. When a
  499. * client wants to destroy a wl_surface, they must destroy this 'role
  500. * object' before the wl_surface.
  501. *
  502. * Destroying the role object does not remove the role from the
  503. * wl_surface, but it may stop the wl_surface from "playing the role".
  504. * For instance, if a wl_subsurface object is destroyed, the wl_surface
  505. * it was created for will be unmapped and forget its position and
  506. * z-order. It is allowed to create a wl_subsurface for the same
  507. * wl_surface again, but it is not allowed to use the wl_surface as
  508. * a cursor (cursor is a different role than sub-surface, and role
  509. * switching is not allowed).
  510. */
  511. extern const struct wl_interface wl_surface_interface;
  512. /**
  513. * @page page_iface_wl_seat wl_seat
  514. * @section page_iface_wl_seat_desc Description
  515. *
  516. * A seat is a group of keyboards, pointer and touch devices. This
  517. * object is published as a global during start up, or when such a
  518. * device is hot plugged. A seat typically has a pointer and
  519. * maintains a keyboard focus and a pointer focus.
  520. * @section page_iface_wl_seat_api API
  521. * See @ref iface_wl_seat.
  522. */
  523. /**
  524. * @defgroup iface_wl_seat The wl_seat interface
  525. *
  526. * A seat is a group of keyboards, pointer and touch devices. This
  527. * object is published as a global during start up, or when such a
  528. * device is hot plugged. A seat typically has a pointer and
  529. * maintains a keyboard focus and a pointer focus.
  530. */
  531. extern const struct wl_interface wl_seat_interface;
  532. /**
  533. * @page page_iface_wl_pointer wl_pointer
  534. * @section page_iface_wl_pointer_desc Description
  535. *
  536. * The wl_pointer interface represents one or more input devices,
  537. * such as mice, which control the pointer location and pointer_focus
  538. * of a seat.
  539. *
  540. * The wl_pointer interface generates motion, enter and leave
  541. * events for the surfaces that the pointer is located over,
  542. * and button and axis events for button presses, button releases
  543. * and scrolling.
  544. * @section page_iface_wl_pointer_api API
  545. * See @ref iface_wl_pointer.
  546. */
  547. /**
  548. * @defgroup iface_wl_pointer The wl_pointer interface
  549. *
  550. * The wl_pointer interface represents one or more input devices,
  551. * such as mice, which control the pointer location and pointer_focus
  552. * of a seat.
  553. *
  554. * The wl_pointer interface generates motion, enter and leave
  555. * events for the surfaces that the pointer is located over,
  556. * and button and axis events for button presses, button releases
  557. * and scrolling.
  558. */
  559. extern const struct wl_interface wl_pointer_interface;
  560. /**
  561. * @page page_iface_wl_keyboard wl_keyboard
  562. * @section page_iface_wl_keyboard_desc Description
  563. *
  564. * The wl_keyboard interface represents one or more keyboards
  565. * associated with a seat.
  566. * @section page_iface_wl_keyboard_api API
  567. * See @ref iface_wl_keyboard.
  568. */
  569. /**
  570. * @defgroup iface_wl_keyboard The wl_keyboard interface
  571. *
  572. * The wl_keyboard interface represents one or more keyboards
  573. * associated with a seat.
  574. */
  575. extern const struct wl_interface wl_keyboard_interface;
  576. /**
  577. * @page page_iface_wl_touch wl_touch
  578. * @section page_iface_wl_touch_desc Description
  579. *
  580. * The wl_touch interface represents a touchscreen
  581. * associated with a seat.
  582. *
  583. * Touch interactions can consist of one or more contacts.
  584. * For each contact, a series of events is generated, starting
  585. * with a down event, followed by zero or more motion events,
  586. * and ending with an up event. Events relating to the same
  587. * contact point can be identified by the ID of the sequence.
  588. * @section page_iface_wl_touch_api API
  589. * See @ref iface_wl_touch.
  590. */
  591. /**
  592. * @defgroup iface_wl_touch The wl_touch interface
  593. *
  594. * The wl_touch interface represents a touchscreen
  595. * associated with a seat.
  596. *
  597. * Touch interactions can consist of one or more contacts.
  598. * For each contact, a series of events is generated, starting
  599. * with a down event, followed by zero or more motion events,
  600. * and ending with an up event. Events relating to the same
  601. * contact point can be identified by the ID of the sequence.
  602. */
  603. extern const struct wl_interface wl_touch_interface;
  604. /**
  605. * @page page_iface_wl_output wl_output
  606. * @section page_iface_wl_output_desc Description
  607. *
  608. * An output describes part of the compositor geometry. The
  609. * compositor works in the 'compositor coordinate system' and an
  610. * output corresponds to a rectangular area in that space that is
  611. * actually visible. This typically corresponds to a monitor that
  612. * displays part of the compositor space. This object is published
  613. * as global during start up, or when a monitor is hotplugged.
  614. * @section page_iface_wl_output_api API
  615. * See @ref iface_wl_output.
  616. */
  617. /**
  618. * @defgroup iface_wl_output The wl_output interface
  619. *
  620. * An output describes part of the compositor geometry. The
  621. * compositor works in the 'compositor coordinate system' and an
  622. * output corresponds to a rectangular area in that space that is
  623. * actually visible. This typically corresponds to a monitor that
  624. * displays part of the compositor space. This object is published
  625. * as global during start up, or when a monitor is hotplugged.
  626. */
  627. extern const struct wl_interface wl_output_interface;
  628. /**
  629. * @page page_iface_wl_region wl_region
  630. * @section page_iface_wl_region_desc Description
  631. *
  632. * A region object describes an area.
  633. *
  634. * Region objects are used to describe the opaque and input
  635. * regions of a surface.
  636. * @section page_iface_wl_region_api API
  637. * See @ref iface_wl_region.
  638. */
  639. /**
  640. * @defgroup iface_wl_region The wl_region interface
  641. *
  642. * A region object describes an area.
  643. *
  644. * Region objects are used to describe the opaque and input
  645. * regions of a surface.
  646. */
  647. extern const struct wl_interface wl_region_interface;
  648. /**
  649. * @page page_iface_wl_subcompositor wl_subcompositor
  650. * @section page_iface_wl_subcompositor_desc Description
  651. *
  652. * The global interface exposing sub-surface compositing capabilities.
  653. * A wl_surface, that has sub-surfaces associated, is called the
  654. * parent surface. Sub-surfaces can be arbitrarily nested and create
  655. * a tree of sub-surfaces.
  656. *
  657. * The root surface in a tree of sub-surfaces is the main
  658. * surface. The main surface cannot be a sub-surface, because
  659. * sub-surfaces must always have a parent.
  660. *
  661. * A main surface with its sub-surfaces forms a (compound) window.
  662. * For window management purposes, this set of wl_surface objects is
  663. * to be considered as a single window, and it should also behave as
  664. * such.
  665. *
  666. * The aim of sub-surfaces is to offload some of the compositing work
  667. * within a window from clients to the compositor. A prime example is
  668. * a video player with decorations and video in separate wl_surface
  669. * objects. This should allow the compositor to pass YUV video buffer
  670. * processing to dedicated overlay hardware when possible.
  671. * @section page_iface_wl_subcompositor_api API
  672. * See @ref iface_wl_subcompositor.
  673. */
  674. /**
  675. * @defgroup iface_wl_subcompositor The wl_subcompositor interface
  676. *
  677. * The global interface exposing sub-surface compositing capabilities.
  678. * A wl_surface, that has sub-surfaces associated, is called the
  679. * parent surface. Sub-surfaces can be arbitrarily nested and create
  680. * a tree of sub-surfaces.
  681. *
  682. * The root surface in a tree of sub-surfaces is the main
  683. * surface. The main surface cannot be a sub-surface, because
  684. * sub-surfaces must always have a parent.
  685. *
  686. * A main surface with its sub-surfaces forms a (compound) window.
  687. * For window management purposes, this set of wl_surface objects is
  688. * to be considered as a single window, and it should also behave as
  689. * such.
  690. *
  691. * The aim of sub-surfaces is to offload some of the compositing work
  692. * within a window from clients to the compositor. A prime example is
  693. * a video player with decorations and video in separate wl_surface
  694. * objects. This should allow the compositor to pass YUV video buffer
  695. * processing to dedicated overlay hardware when possible.
  696. */
  697. extern const struct wl_interface wl_subcompositor_interface;
  698. /**
  699. * @page page_iface_wl_subsurface wl_subsurface
  700. * @section page_iface_wl_subsurface_desc Description
  701. *
  702. * An additional interface to a wl_surface object, which has been
  703. * made a sub-surface. A sub-surface has one parent surface. A
  704. * sub-surface's size and position are not limited to that of the parent.
  705. * Particularly, a sub-surface is not automatically clipped to its
  706. * parent's area.
  707. *
  708. * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
  709. * and the parent surface is mapped. The order of which one happens
  710. * first is irrelevant. A sub-surface is hidden if the parent becomes
  711. * hidden, or if a NULL wl_buffer is applied. These rules apply
  712. * recursively through the tree of surfaces.
  713. *
  714. * The behaviour of a wl_surface.commit request on a sub-surface
  715. * depends on the sub-surface's mode. The possible modes are
  716. * synchronized and desynchronized, see methods
  717. * wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
  718. * mode caches the wl_surface state to be applied when the parent's
  719. * state gets applied, and desynchronized mode applies the pending
  720. * wl_surface state directly. A sub-surface is initially in the
  721. * synchronized mode.
  722. *
  723. * Sub-surfaces have also other kind of state, which is managed by
  724. * wl_subsurface requests, as opposed to wl_surface requests. This
  725. * state includes the sub-surface position relative to the parent
  726. * surface (wl_subsurface.set_position), and the stacking order of
  727. * the parent and its sub-surfaces (wl_subsurface.place_above and
  728. * .place_below). This state is applied when the parent surface's
  729. * wl_surface state is applied, regardless of the sub-surface's mode.
  730. * As the exception, set_sync and set_desync are effective immediately.
  731. *
  732. * The main surface can be thought to be always in desynchronized mode,
  733. * since it does not have a parent in the sub-surfaces sense.
  734. *
  735. * Even if a sub-surface is in desynchronized mode, it will behave as
  736. * in synchronized mode, if its parent surface behaves as in
  737. * synchronized mode. This rule is applied recursively throughout the
  738. * tree of surfaces. This means, that one can set a sub-surface into
  739. * synchronized mode, and then assume that all its child and grand-child
  740. * sub-surfaces are synchronized, too, without explicitly setting them.
  741. *
  742. * If the wl_surface associated with the wl_subsurface is destroyed, the
  743. * wl_subsurface object becomes inert. Note, that destroying either object
  744. * takes effect immediately. If you need to synchronize the removal
  745. * of a sub-surface to the parent surface update, unmap the sub-surface
  746. * first by attaching a NULL wl_buffer, update parent, and then destroy
  747. * the sub-surface.
  748. *
  749. * If the parent wl_surface object is destroyed, the sub-surface is
  750. * unmapped.
  751. * @section page_iface_wl_subsurface_api API
  752. * See @ref iface_wl_subsurface.
  753. */
  754. /**
  755. * @defgroup iface_wl_subsurface The wl_subsurface interface
  756. *
  757. * An additional interface to a wl_surface object, which has been
  758. * made a sub-surface. A sub-surface has one parent surface. A
  759. * sub-surface's size and position are not limited to that of the parent.
  760. * Particularly, a sub-surface is not automatically clipped to its
  761. * parent's area.
  762. *
  763. * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
  764. * and the parent surface is mapped. The order of which one happens
  765. * first is irrelevant. A sub-surface is hidden if the parent becomes
  766. * hidden, or if a NULL wl_buffer is applied. These rules apply
  767. * recursively through the tree of surfaces.
  768. *
  769. * The behaviour of a wl_surface.commit request on a sub-surface
  770. * depends on the sub-surface's mode. The possible modes are
  771. * synchronized and desynchronized, see methods
  772. * wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
  773. * mode caches the wl_surface state to be applied when the parent's
  774. * state gets applied, and desynchronized mode applies the pending
  775. * wl_surface state directly. A sub-surface is initially in the
  776. * synchronized mode.
  777. *
  778. * Sub-surfaces have also other kind of state, which is managed by
  779. * wl_subsurface requests, as opposed to wl_surface requests. This
  780. * state includes the sub-surface position relative to the parent
  781. * surface (wl_subsurface.set_position), and the stacking order of
  782. * the parent and its sub-surfaces (wl_subsurface.place_above and
  783. * .place_below). This state is applied when the parent surface's
  784. * wl_surface state is applied, regardless of the sub-surface's mode.
  785. * As the exception, set_sync and set_desync are effective immediately.
  786. *
  787. * The main surface can be thought to be always in desynchronized mode,
  788. * since it does not have a parent in the sub-surfaces sense.
  789. *
  790. * Even if a sub-surface is in desynchronized mode, it will behave as
  791. * in synchronized mode, if its parent surface behaves as in
  792. * synchronized mode. This rule is applied recursively throughout the
  793. * tree of surfaces. This means, that one can set a sub-surface into
  794. * synchronized mode, and then assume that all its child and grand-child
  795. * sub-surfaces are synchronized, too, without explicitly setting them.
  796. *
  797. * If the wl_surface associated with the wl_subsurface is destroyed, the
  798. * wl_subsurface object becomes inert. Note, that destroying either object
  799. * takes effect immediately. If you need to synchronize the removal
  800. * of a sub-surface to the parent surface update, unmap the sub-surface
  801. * first by attaching a NULL wl_buffer, update parent, and then destroy
  802. * the sub-surface.
  803. *
  804. * If the parent wl_surface object is destroyed, the sub-surface is
  805. * unmapped.
  806. */
  807. extern const struct wl_interface wl_subsurface_interface;
  808. #ifndef WL_DISPLAY_ERROR_ENUM
  809. #define WL_DISPLAY_ERROR_ENUM
  810. /**
  811. * @ingroup iface_wl_display
  812. * global error values
  813. *
  814. * These errors are global and can be emitted in response to any
  815. * server request.
  816. */
  817. enum wl_display_error {
  818. /**
  819. * server couldn't find object
  820. */
  821. WL_DISPLAY_ERROR_INVALID_OBJECT = 0,
  822. /**
  823. * method doesn't exist on the specified interface
  824. */
  825. WL_DISPLAY_ERROR_INVALID_METHOD = 1,
  826. /**
  827. * server is out of memory
  828. */
  829. WL_DISPLAY_ERROR_NO_MEMORY = 2,
  830. };
  831. #endif /* WL_DISPLAY_ERROR_ENUM */
  832. /**
  833. * @ingroup iface_wl_display
  834. * @struct wl_display_interface
  835. */
  836. struct wl_display_interface {
  837. /**
  838. * asynchronous roundtrip
  839. *
  840. * The sync request asks the server to emit the 'done' event on
  841. * the returned wl_callback object. Since requests are handled
  842. * in-order and events are delivered in-order, this can be used as
  843. * a barrier to ensure all previous requests and the resulting
  844. * events have been handled.
  845. *
  846. * The object returned by this request will be destroyed by the
  847. * compositor after the callback is fired and as such the client
  848. * must not attempt to use it after that point.
  849. *
  850. * The callback_data passed in the callback is the event serial.
  851. */
  852. void (*sync)(struct wl_client *client,
  853. struct wl_resource *resource,
  854. uint32_t callback);
  855. /**
  856. * get global registry object
  857. *
  858. * This request creates a registry object that allows the client
  859. * to list and bind the global objects available from the
  860. * compositor.
  861. */
  862. void (*get_registry)(struct wl_client *client,
  863. struct wl_resource *resource,
  864. uint32_t registry);
  865. };
  866. #define WL_DISPLAY_ERROR 0
  867. #define WL_DISPLAY_DELETE_ID 1
  868. /**
  869. * @ingroup iface_wl_display
  870. */
  871. #define WL_DISPLAY_ERROR_SINCE_VERSION 1
  872. /**
  873. * @ingroup iface_wl_display
  874. */
  875. #define WL_DISPLAY_DELETE_ID_SINCE_VERSION 1
  876. /**
  877. * @ingroup iface_wl_registry
  878. * @struct wl_registry_interface
  879. */
  880. struct wl_registry_interface {
  881. /**
  882. * bind an object to the display
  883. *
  884. * Binds a new, client-created object to the server using the
  885. * specified name as the identifier.
  886. * @param name unique name for the object
  887. * @param interface name of the objects interface
  888. * @param version version of the objects interface
  889. */
  890. void (*bind)(struct wl_client *client,
  891. struct wl_resource *resource,
  892. uint32_t name,
  893. const char *interface, uint32_t version, uint32_t id);
  894. };
  895. #define WL_REGISTRY_GLOBAL 0
  896. #define WL_REGISTRY_GLOBAL_REMOVE 1
  897. /**
  898. * @ingroup iface_wl_registry
  899. */
  900. #define WL_REGISTRY_GLOBAL_SINCE_VERSION 1
  901. /**
  902. * @ingroup iface_wl_registry
  903. */
  904. #define WL_REGISTRY_GLOBAL_REMOVE_SINCE_VERSION 1
  905. /**
  906. * @ingroup iface_wl_registry
  907. * Sends an global event to the client owning the resource.
  908. * @param resource_ The client's resource
  909. * @param name numeric name of the global object
  910. * @param interface interface implemented by the object
  911. * @param version interface version
  912. */
  913. static inline void
  914. wl_registry_send_global(struct wl_resource *resource_, uint32_t name, const char *interface, uint32_t version)
  915. {
  916. wl_resource_post_event(resource_, WL_REGISTRY_GLOBAL, name, interface, version);
  917. }
  918. /**
  919. * @ingroup iface_wl_registry
  920. * Sends an global_remove event to the client owning the resource.
  921. * @param resource_ The client's resource
  922. * @param name numeric name of the global object
  923. */
  924. static inline void
  925. wl_registry_send_global_remove(struct wl_resource *resource_, uint32_t name)
  926. {
  927. wl_resource_post_event(resource_, WL_REGISTRY_GLOBAL_REMOVE, name);
  928. }
  929. #define WL_CALLBACK_DONE 0
  930. /**
  931. * @ingroup iface_wl_callback
  932. */
  933. #define WL_CALLBACK_DONE_SINCE_VERSION 1
  934. /**
  935. * @ingroup iface_wl_callback
  936. * Sends an done event to the client owning the resource.
  937. * @param resource_ The client's resource
  938. * @param callback_data request-specific data for the wl_callback
  939. */
  940. static inline void
  941. wl_callback_send_done(struct wl_resource *resource_, uint32_t callback_data)
  942. {
  943. wl_resource_post_event(resource_, WL_CALLBACK_DONE, callback_data);
  944. }
  945. /**
  946. * @ingroup iface_wl_compositor
  947. * @struct wl_compositor_interface
  948. */
  949. struct wl_compositor_interface {
  950. /**
  951. * create new surface
  952. *
  953. * Ask the compositor to create a new surface.
  954. */
  955. void (*create_surface)(struct wl_client *client,
  956. struct wl_resource *resource,
  957. uint32_t id);
  958. /**
  959. * create new region
  960. *
  961. * Ask the compositor to create a new region.
  962. */
  963. void (*create_region)(struct wl_client *client,
  964. struct wl_resource *resource,
  965. uint32_t id);
  966. };
  967. /**
  968. * @ingroup iface_wl_shm_pool
  969. * @struct wl_shm_pool_interface
  970. */
  971. struct wl_shm_pool_interface {
  972. /**
  973. * create a buffer from the pool
  974. *
  975. * Create a wl_buffer object from the pool.
  976. *
  977. * The buffer is created offset bytes into the pool and has width
  978. * and height as specified. The stride argument specifies the
  979. * number of bytes from the beginning of one row to the beginning
  980. * of the next. The format is the pixel format of the buffer and
  981. * must be one of those advertised through the wl_shm.format event.
  982. *
  983. * A buffer will keep a reference to the pool it was created from
  984. * so it is valid to destroy the pool immediately after creating a
  985. * buffer from it.
  986. */
  987. void (*create_buffer)(struct wl_client *client,
  988. struct wl_resource *resource,
  989. uint32_t id,
  990. int32_t offset,
  991. int32_t width,
  992. int32_t height,
  993. int32_t stride,
  994. uint32_t format);
  995. /**
  996. * destroy the pool
  997. *
  998. * Destroy the shared memory pool.
  999. *
  1000. * The mmapped memory will be released when all buffers that have
  1001. * been created from this pool are gone.
  1002. */
  1003. void (*destroy)(struct wl_client *client,
  1004. struct wl_resource *resource);
  1005. /**
  1006. * change the size of the pool mapping
  1007. *
  1008. * This request will cause the server to remap the backing memory
  1009. * for the pool from the file descriptor passed when the pool was
  1010. * created, but using the new size. This request can only be used
  1011. * to make the pool bigger.
  1012. */
  1013. void (*resize)(struct wl_client *client,
  1014. struct wl_resource *resource,
  1015. int32_t size);
  1016. };
  1017. #ifndef WL_SHM_ERROR_ENUM
  1018. #define WL_SHM_ERROR_ENUM
  1019. /**
  1020. * @ingroup iface_wl_shm
  1021. * wl_shm error values
  1022. *
  1023. * These errors can be emitted in response to wl_shm requests.
  1024. */
  1025. enum wl_shm_error {
  1026. /**
  1027. * buffer format is not known
  1028. */
  1029. WL_SHM_ERROR_INVALID_FORMAT = 0,
  1030. /**
  1031. * invalid size or stride during pool or buffer creation
  1032. */
  1033. WL_SHM_ERROR_INVALID_STRIDE = 1,
  1034. /**
  1035. * mmapping the file descriptor failed
  1036. */
  1037. WL_SHM_ERROR_INVALID_FD = 2,
  1038. };
  1039. #endif /* WL_SHM_ERROR_ENUM */
  1040. #ifndef WL_SHM_FORMAT_ENUM
  1041. #define WL_SHM_FORMAT_ENUM
  1042. /**
  1043. * @ingroup iface_wl_shm
  1044. * pixel formats
  1045. *
  1046. * This describes the memory layout of an individual pixel.
  1047. *
  1048. * All renderers should support argb8888 and xrgb8888 but any other
  1049. * formats are optional and may not be supported by the particular
  1050. * renderer in use.
  1051. */
  1052. enum wl_shm_format {
  1053. /**
  1054. * 32-bit ARGB format
  1055. */
  1056. WL_SHM_FORMAT_ARGB8888 = 0,
  1057. /**
  1058. * 32-bit RGB format
  1059. */
  1060. WL_SHM_FORMAT_XRGB8888 = 1,
  1061. WL_SHM_FORMAT_C8 = 0x20203843,
  1062. WL_SHM_FORMAT_RGB332 = 0x38424752,
  1063. WL_SHM_FORMAT_BGR233 = 0x38524742,
  1064. WL_SHM_FORMAT_XRGB4444 = 0x32315258,
  1065. WL_SHM_FORMAT_XBGR4444 = 0x32314258,
  1066. WL_SHM_FORMAT_RGBX4444 = 0x32315852,
  1067. WL_SHM_FORMAT_BGRX4444 = 0x32315842,
  1068. WL_SHM_FORMAT_ARGB4444 = 0x32315241,
  1069. WL_SHM_FORMAT_ABGR4444 = 0x32314241,
  1070. WL_SHM_FORMAT_RGBA4444 = 0x32314152,
  1071. WL_SHM_FORMAT_BGRA4444 = 0x32314142,
  1072. WL_SHM_FORMAT_XRGB1555 = 0x35315258,
  1073. WL_SHM_FORMAT_XBGR1555 = 0x35314258,
  1074. WL_SHM_FORMAT_RGBX5551 = 0x35315852,
  1075. WL_SHM_FORMAT_BGRX5551 = 0x35315842,
  1076. WL_SHM_FORMAT_ARGB1555 = 0x35315241,
  1077. WL_SHM_FORMAT_ABGR1555 = 0x35314241,
  1078. WL_SHM_FORMAT_RGBA5551 = 0x35314152,
  1079. WL_SHM_FORMAT_BGRA5551 = 0x35314142,
  1080. WL_SHM_FORMAT_RGB565 = 0x36314752,
  1081. WL_SHM_FORMAT_BGR565 = 0x36314742,
  1082. WL_SHM_FORMAT_RGB888 = 0x34324752,
  1083. WL_SHM_FORMAT_BGR888 = 0x34324742,
  1084. WL_SHM_FORMAT_XBGR8888 = 0x34324258,
  1085. WL_SHM_FORMAT_RGBX8888 = 0x34325852,
  1086. WL_SHM_FORMAT_BGRX8888 = 0x34325842,
  1087. WL_SHM_FORMAT_ABGR8888 = 0x34324241,
  1088. WL_SHM_FORMAT_RGBA8888 = 0x34324152,
  1089. WL_SHM_FORMAT_BGRA8888 = 0x34324142,
  1090. WL_SHM_FORMAT_XRGB2101010 = 0x30335258,
  1091. WL_SHM_FORMAT_XBGR2101010 = 0x30334258,
  1092. WL_SHM_FORMAT_RGBX1010102 = 0x30335852,
  1093. WL_SHM_FORMAT_BGRX1010102 = 0x30335842,
  1094. WL_SHM_FORMAT_ARGB2101010 = 0x30335241,
  1095. WL_SHM_FORMAT_ABGR2101010 = 0x30334241,
  1096. WL_SHM_FORMAT_RGBA1010102 = 0x30334152,
  1097. WL_SHM_FORMAT_BGRA1010102 = 0x30334142,
  1098. WL_SHM_FORMAT_YUYV = 0x56595559,
  1099. WL_SHM_FORMAT_YVYU = 0x55595659,
  1100. WL_SHM_FORMAT_UYVY = 0x59565955,
  1101. WL_SHM_FORMAT_VYUY = 0x59555956,
  1102. WL_SHM_FORMAT_AYUV = 0x56555941,
  1103. WL_SHM_FORMAT_NV12 = 0x3231564e,
  1104. WL_SHM_FORMAT_NV21 = 0x3132564e,
  1105. WL_SHM_FORMAT_NV16 = 0x3631564e,
  1106. WL_SHM_FORMAT_NV61 = 0x3136564e,
  1107. WL_SHM_FORMAT_YUV410 = 0x39565559,
  1108. WL_SHM_FORMAT_YVU410 = 0x39555659,
  1109. WL_SHM_FORMAT_YUV411 = 0x31315559,
  1110. WL_SHM_FORMAT_YVU411 = 0x31315659,
  1111. WL_SHM_FORMAT_YUV420 = 0x32315559,
  1112. WL_SHM_FORMAT_YVU420 = 0x32315659,
  1113. WL_SHM_FORMAT_YUV422 = 0x36315559,
  1114. WL_SHM_FORMAT_YVU422 = 0x36315659,
  1115. WL_SHM_FORMAT_YUV444 = 0x34325559,
  1116. WL_SHM_FORMAT_YVU444 = 0x34325659,
  1117. };
  1118. #endif /* WL_SHM_FORMAT_ENUM */
  1119. /**
  1120. * @ingroup iface_wl_shm
  1121. * @struct wl_shm_interface
  1122. */
  1123. struct wl_shm_interface {
  1124. /**
  1125. * create a shm pool
  1126. *
  1127. * Create a new wl_shm_pool object.
  1128. *
  1129. * The pool can be used to create shared memory based buffer
  1130. * objects. The server will mmap size bytes of the passed file
  1131. * descriptor, to use as backing memory for the pool.
  1132. */
  1133. void (*create_pool)(struct wl_client *client,
  1134. struct wl_resource *resource,
  1135. uint32_t id,
  1136. int32_t fd,
  1137. int32_t size);
  1138. };
  1139. #define WL_SHM_FORMAT 0
  1140. /**
  1141. * @ingroup iface_wl_shm
  1142. */
  1143. #define WL_SHM_FORMAT_SINCE_VERSION 1
  1144. /**
  1145. * @ingroup iface_wl_shm
  1146. * Sends an format event to the client owning the resource.
  1147. * @param resource_ The client's resource
  1148. * @param format buffer pixel format
  1149. */
  1150. static inline void
  1151. wl_shm_send_format(struct wl_resource *resource_, uint32_t format)
  1152. {
  1153. wl_resource_post_event(resource_, WL_SHM_FORMAT, format);
  1154. }
  1155. /**
  1156. * @ingroup iface_wl_buffer
  1157. * @struct wl_buffer_interface
  1158. */
  1159. struct wl_buffer_interface {
  1160. /**
  1161. * destroy a buffer
  1162. *
  1163. * Destroy a buffer. If and how you need to release the backing
  1164. * storage is defined by the buffer factory interface.
  1165. *
  1166. * For possible side-effects to a surface, see wl_surface.attach.
  1167. */
  1168. void (*destroy)(struct wl_client *client,
  1169. struct wl_resource *resource);
  1170. };
  1171. #define WL_BUFFER_RELEASE 0
  1172. /**
  1173. * @ingroup iface_wl_buffer
  1174. */
  1175. #define WL_BUFFER_RELEASE_SINCE_VERSION 1
  1176. /**
  1177. * @ingroup iface_wl_buffer
  1178. * Sends an release event to the client owning the resource.
  1179. * @param resource_ The client's resource
  1180. */
  1181. static inline void
  1182. wl_buffer_send_release(struct wl_resource *resource_)
  1183. {
  1184. wl_resource_post_event(resource_, WL_BUFFER_RELEASE);
  1185. }
  1186. #ifndef WL_DATA_OFFER_ERROR_ENUM
  1187. #define WL_DATA_OFFER_ERROR_ENUM
  1188. enum wl_data_offer_error {
  1189. /**
  1190. * finish request was called untimely
  1191. */
  1192. WL_DATA_OFFER_ERROR_INVALID_FINISH = 0,
  1193. /**
  1194. * action mask contains invalid values
  1195. */
  1196. WL_DATA_OFFER_ERROR_INVALID_ACTION_MASK = 1,
  1197. /**
  1198. * action argument has an invalid value
  1199. */
  1200. WL_DATA_OFFER_ERROR_INVALID_ACTION = 2,
  1201. /**
  1202. * offer doesn't accept this request
  1203. */
  1204. WL_DATA_OFFER_ERROR_INVALID_OFFER = 3,
  1205. };
  1206. #endif /* WL_DATA_OFFER_ERROR_ENUM */
  1207. /**
  1208. * @ingroup iface_wl_data_offer
  1209. * @struct wl_data_offer_interface
  1210. */
  1211. struct wl_data_offer_interface {
  1212. /**
  1213. * accept one of the offered mime types
  1214. *
  1215. * Indicate that the client can accept the given mime type, or
  1216. * NULL for not accepted.
  1217. *
  1218. * For objects of version 2 or older, this request is used by the
  1219. * client to give feedback whether the client can receive the given
  1220. * mime type, or NULL if none is accepted; the feedback does not
  1221. * determine whether the drag-and-drop operation succeeds or not.
  1222. *
  1223. * For objects of version 3 or newer, this request determines the
  1224. * final result of the drag-and-drop operation. If the end result
  1225. * is that no mime types were accepted, the drag-and-drop operation
  1226. * will be cancelled and the corresponding drag source will receive
  1227. * wl_data_source.cancelled. Clients may still use this event in
  1228. * conjunction with wl_data_source.action for feedback.
  1229. */
  1230. void (*accept)(struct wl_client *client,
  1231. struct wl_resource *resource,
  1232. uint32_t serial,
  1233. const char *mime_type);
  1234. /**
  1235. * request that the data is transferred
  1236. *
  1237. * To transfer the offered data, the client issues this request
  1238. * and indicates the mime type it wants to receive. The transfer
  1239. * happens through the passed file descriptor (typically created
  1240. * with the pipe system call). The source client writes the data in
  1241. * the mime type representation requested and then closes the file
  1242. * descriptor.
  1243. *
  1244. * The receiving client reads from the read end of the pipe until
  1245. * EOF and then closes its end, at which point the transfer is
  1246. * complete.
  1247. *
  1248. * This request may happen multiple times for different mime types,
  1249. * both before and after wl_data_device.drop. Drag-and-drop
  1250. * destination clients may preemptively fetch data or examine it
  1251. * more closely to determine acceptance.
  1252. */
  1253. void (*receive)(struct wl_client *client,
  1254. struct wl_resource *resource,
  1255. const char *mime_type,
  1256. int32_t fd);
  1257. /**
  1258. * destroy data offer
  1259. *
  1260. * Destroy the data offer.
  1261. */
  1262. void (*destroy)(struct wl_client *client,
  1263. struct wl_resource *resource);
  1264. /**
  1265. * the offer will no longer be used
  1266. *
  1267. * Notifies the compositor that the drag destination successfully
  1268. * finished the drag-and-drop operation.
  1269. *
  1270. * Upon receiving this request, the compositor will emit
  1271. * wl_data_source.dnd_finished on the drag source client.
  1272. *
  1273. * It is a client error to perform other requests than
  1274. * wl_data_offer.destroy after this one. It is also an error to
  1275. * perform this request after a NULL mime type has been set in
  1276. * wl_data_offer.accept or no action was received through
  1277. * wl_data_offer.action.
  1278. * @since 3
  1279. */
  1280. void (*finish)(struct wl_client *client,
  1281. struct wl_resource *resource);
  1282. /**
  1283. * set the available/preferred drag-and-drop actions
  1284. *
  1285. * Sets the actions that the destination side client supports for
  1286. * this operation. This request may trigger the emission of
  1287. * wl_data_source.action and wl_data_offer.action events if the
  1288. * compositor needs to change the selected action.
  1289. *
  1290. * This request can be called multiple times throughout the
  1291. * drag-and-drop operation, typically in response to
  1292. * wl_data_device.enter or wl_data_device.motion events.
  1293. *
  1294. * This request determines the final result of the drag-and-drop
  1295. * operation. If the end result is that no action is accepted, the
  1296. * drag source will receive wl_drag_source.cancelled.
  1297. *
  1298. * The dnd_actions argument must contain only values expressed in
  1299. * the wl_data_device_manager.dnd_actions enum, and the
  1300. * preferred_action argument must only contain one of those values
  1301. * set, otherwise it will result in a protocol error.
  1302. *
  1303. * While managing an "ask" action, the destination drag-and-drop
  1304. * client may perform further wl_data_offer.receive requests, and
  1305. * is expected to perform one last wl_data_offer.set_actions
  1306. * request with a preferred action other than "ask" (and optionally
  1307. * wl_data_offer.accept) before requesting wl_data_offer.finish, in
  1308. * order to convey the action selected by the user. If the
  1309. * preferred action is not in the wl_data_offer.source_actions
  1310. * mask, an error will be raised.
  1311. *
  1312. * If the "ask" action is dismissed (e.g. user cancellation), the
  1313. * client is expected to perform wl_data_offer.destroy right away.
  1314. *
  1315. * This request can only be made on drag-and-drop offers, a
  1316. * protocol error will be raised otherwise.
  1317. * @since 3
  1318. */
  1319. void (*set_actions)(struct wl_client *client,
  1320. struct wl_resource *resource,
  1321. uint32_t dnd_actions,
  1322. uint32_t preferred_action);
  1323. };
  1324. #define WL_DATA_OFFER_OFFER 0
  1325. #define WL_DATA_OFFER_SOURCE_ACTIONS 1
  1326. #define WL_DATA_OFFER_ACTION 2
  1327. /**
  1328. * @ingroup iface_wl_data_offer
  1329. */
  1330. #define WL_DATA_OFFER_OFFER_SINCE_VERSION 1
  1331. /**
  1332. * @ingroup iface_wl_data_offer
  1333. */
  1334. #define WL_DATA_OFFER_SOURCE_ACTIONS_SINCE_VERSION 3
  1335. /**
  1336. * @ingroup iface_wl_data_offer
  1337. */
  1338. #define WL_DATA_OFFER_ACTION_SINCE_VERSION 3
  1339. /**
  1340. * @ingroup iface_wl_data_offer
  1341. * Sends an offer event to the client owning the resource.
  1342. * @param resource_ The client's resource
  1343. * @param mime_type offered mime type
  1344. */
  1345. static inline void
  1346. wl_data_offer_send_offer(struct wl_resource *resource_, const char *mime_type)
  1347. {
  1348. wl_resource_post_event(resource_, WL_DATA_OFFER_OFFER, mime_type);
  1349. }
  1350. /**
  1351. * @ingroup iface_wl_data_offer
  1352. * Sends an source_actions event to the client owning the resource.
  1353. * @param resource_ The client's resource
  1354. * @param source_actions actions offered by the data source
  1355. */
  1356. static inline void
  1357. wl_data_offer_send_source_actions(struct wl_resource *resource_, uint32_t source_actions)
  1358. {
  1359. wl_resource_post_event(resource_, WL_DATA_OFFER_SOURCE_ACTIONS, source_actions);
  1360. }
  1361. /**
  1362. * @ingroup iface_wl_data_offer
  1363. * Sends an action event to the client owning the resource.
  1364. * @param resource_ The client's resource
  1365. * @param dnd_action action selected by the compositor
  1366. */
  1367. static inline void
  1368. wl_data_offer_send_action(struct wl_resource *resource_, uint32_t dnd_action)
  1369. {
  1370. wl_resource_post_event(resource_, WL_DATA_OFFER_ACTION, dnd_action);
  1371. }
  1372. #ifndef WL_DATA_SOURCE_ERROR_ENUM
  1373. #define WL_DATA_SOURCE_ERROR_ENUM
  1374. enum wl_data_source_error {
  1375. /**
  1376. * action mask contains invalid values
  1377. */
  1378. WL_DATA_SOURCE_ERROR_INVALID_ACTION_MASK = 0,
  1379. /**
  1380. * source doesn't accept this request
  1381. */
  1382. WL_DATA_SOURCE_ERROR_INVALID_SOURCE = 1,
  1383. };
  1384. #endif /* WL_DATA_SOURCE_ERROR_ENUM */
  1385. /**
  1386. * @ingroup iface_wl_data_source
  1387. * @struct wl_data_source_interface
  1388. */
  1389. struct wl_data_source_interface {
  1390. /**
  1391. * add an offered mime type
  1392. *
  1393. * This request adds a mime type to the set of mime types
  1394. * advertised to targets. Can be called several times to offer
  1395. * multiple types.
  1396. */
  1397. void (*offer)(struct wl_client *client,
  1398. struct wl_resource *resource,
  1399. const char *mime_type);
  1400. /**
  1401. * destroy the data source
  1402. *
  1403. * Destroy the data source.
  1404. */
  1405. void (*destroy)(struct wl_client *client,
  1406. struct wl_resource *resource);
  1407. /**
  1408. * set the available drag-and-drop actions
  1409. *
  1410. * Sets the actions that the source side client supports for this
  1411. * operation. This request may trigger wl_data_source.action and
  1412. * wl_data_offer.action events if the compositor needs to change
  1413. * the selected action.
  1414. *
  1415. * The dnd_actions argument must contain only values expressed in
  1416. * the wl_data_device_manager.dnd_actions enum, otherwise it will
  1417. * result in a protocol error.
  1418. *
  1419. * This request must be made once only, and can only be made on
  1420. * sources used in drag-and-drop, so it must be performed before
  1421. * wl_data_device.start_drag. Attempting to use the source other
  1422. * than for drag-and-drop will raise a protocol error.
  1423. * @since 3
  1424. */
  1425. void (*set_actions)(struct wl_client *client,
  1426. struct wl_resource *resource,
  1427. uint32_t dnd_actions);
  1428. };
  1429. #define WL_DATA_SOURCE_TARGET 0
  1430. #define WL_DATA_SOURCE_SEND 1
  1431. #define WL_DATA_SOURCE_CANCELLED 2
  1432. #define WL_DATA_SOURCE_DND_DROP_PERFORMED 3
  1433. #define WL_DATA_SOURCE_DND_FINISHED 4
  1434. #define WL_DATA_SOURCE_ACTION 5
  1435. /**
  1436. * @ingroup iface_wl_data_source
  1437. */
  1438. #define WL_DATA_SOURCE_TARGET_SINCE_VERSION 1
  1439. /**
  1440. * @ingroup iface_wl_data_source
  1441. */
  1442. #define WL_DATA_SOURCE_SEND_SINCE_VERSION 1
  1443. /**
  1444. * @ingroup iface_wl_data_source
  1445. */
  1446. #define WL_DATA_SOURCE_CANCELLED_SINCE_VERSION 1
  1447. /**
  1448. * @ingroup iface_wl_data_source
  1449. */
  1450. #define WL_DATA_SOURCE_DND_DROP_PERFORMED_SINCE_VERSION 3
  1451. /**
  1452. * @ingroup iface_wl_data_source
  1453. */
  1454. #define WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION 3
  1455. /**
  1456. * @ingroup iface_wl_data_source
  1457. */
  1458. #define WL_DATA_SOURCE_ACTION_SINCE_VERSION 3
  1459. /**
  1460. * @ingroup iface_wl_data_source
  1461. * Sends an target event to the client owning the resource.
  1462. * @param resource_ The client's resource
  1463. * @param mime_type mime type accepted by the target
  1464. */
  1465. static inline void
  1466. wl_data_source_send_target(struct wl_resource *resource_, const char *mime_type)
  1467. {
  1468. wl_resource_post_event(resource_, WL_DATA_SOURCE_TARGET, mime_type);
  1469. }
  1470. /**
  1471. * @ingroup iface_wl_data_source
  1472. * Sends an send event to the client owning the resource.
  1473. * @param resource_ The client's resource
  1474. * @param mime_type mime type for the data
  1475. * @param fd file descriptor for the data
  1476. */
  1477. static inline void
  1478. wl_data_source_send_send(struct wl_resource *resource_, const char *mime_type, int32_t fd)
  1479. {
  1480. wl_resource_post_event(resource_, WL_DATA_SOURCE_SEND, mime_type, fd);
  1481. }
  1482. /**
  1483. * @ingroup iface_wl_data_source
  1484. * Sends an cancelled event to the client owning the resource.
  1485. * @param resource_ The client's resource
  1486. */
  1487. static inline void
  1488. wl_data_source_send_cancelled(struct wl_resource *resource_)
  1489. {
  1490. wl_resource_post_event(resource_, WL_DATA_SOURCE_CANCELLED);
  1491. }
  1492. /**
  1493. * @ingroup iface_wl_data_source
  1494. * Sends an dnd_drop_performed event to the client owning the resource.
  1495. * @param resource_ The client's resource
  1496. */
  1497. static inline void
  1498. wl_data_source_send_dnd_drop_performed(struct wl_resource *resource_)
  1499. {
  1500. wl_resource_post_event(resource_, WL_DATA_SOURCE_DND_DROP_PERFORMED);
  1501. }
  1502. /**
  1503. * @ingroup iface_wl_data_source
  1504. * Sends an dnd_finished event to the client owning the resource.
  1505. * @param resource_ The client's resource
  1506. */
  1507. static inline void
  1508. wl_data_source_send_dnd_finished(struct wl_resource *resource_)
  1509. {
  1510. wl_resource_post_event(resource_, WL_DATA_SOURCE_DND_FINISHED);
  1511. }
  1512. /**
  1513. * @ingroup iface_wl_data_source
  1514. * Sends an action event to the client owning the resource.
  1515. * @param resource_ The client's resource
  1516. * @param dnd_action action selected by the compositor
  1517. */
  1518. static inline void
  1519. wl_data_source_send_action(struct wl_resource *resource_, uint32_t dnd_action)
  1520. {
  1521. wl_resource_post_event(resource_, WL_DATA_SOURCE_ACTION, dnd_action);
  1522. }
  1523. #ifndef WL_DATA_DEVICE_ERROR_ENUM
  1524. #define WL_DATA_DEVICE_ERROR_ENUM
  1525. enum wl_data_device_error {
  1526. /**
  1527. * given wl_surface has another role
  1528. */
  1529. WL_DATA_DEVICE_ERROR_ROLE = 0,
  1530. };
  1531. #endif /* WL_DATA_DEVICE_ERROR_ENUM */
  1532. /**
  1533. * @ingroup iface_wl_data_device
  1534. * @struct wl_data_device_interface
  1535. */
  1536. struct wl_data_device_interface {
  1537. /**
  1538. * start drag-and-drop operation
  1539. *
  1540. * This request asks the compositor to start a drag-and-drop
  1541. * operation on behalf of the client.
  1542. *
  1543. * The source argument is the data source that provides the data
  1544. * for the eventual data transfer. If source is NULL, enter, leave
  1545. * and motion events are sent only to the client that initiated the
  1546. * drag and the client is expected to handle the data passing
  1547. * internally.
  1548. *
  1549. * The origin surface is the surface where the drag originates and
  1550. * the client must have an active implicit grab that matches the
  1551. * serial.
  1552. *
  1553. * The icon surface is an optional (can be NULL) surface that
  1554. * provides an icon to be moved around with the cursor. Initially,
  1555. * the top-left corner of the icon surface is placed at the cursor
  1556. * hotspot, but subsequent wl_surface.attach request can move the
  1557. * relative position. Attach requests must be confirmed with
  1558. * wl_surface.commit as usual. The icon surface is given the role
  1559. * of a drag-and-drop icon. If the icon surface already has another
  1560. * role, it raises a protocol error.
  1561. *
  1562. * The current and pending input regions of the icon wl_surface are
  1563. * cleared, and wl_surface.set_input_region is ignored until the
  1564. * wl_surface is no longer used as the icon surface. When the use
  1565. * as an icon ends, the current and pending input regions become
  1566. * undefined, and the wl_surface is unmapped.
  1567. * @param serial serial of the implicit grab on the origin
  1568. */
  1569. void (*start_drag)(struct wl_client *client,
  1570. struct wl_resource *resource,
  1571. struct wl_resource *source,
  1572. struct wl_resource *origin,
  1573. struct wl_resource *icon,
  1574. uint32_t serial);
  1575. /**
  1576. * copy data to the selection
  1577. *
  1578. * This request asks the compositor to set the selection to the
  1579. * data from the source on behalf of the client.
  1580. *
  1581. * To unset the selection, set the source to NULL.
  1582. * @param serial serial of the event that triggered this request
  1583. */
  1584. void (*set_selection)(struct wl_client *client,
  1585. struct wl_resource *resource,
  1586. struct wl_resource *source,
  1587. uint32_t serial);
  1588. /**
  1589. * destroy data device
  1590. *
  1591. * This request destroys the data device.
  1592. * @since 2
  1593. */
  1594. void (*release)(struct wl_client *client,
  1595. struct wl_resource *resource);
  1596. };
  1597. #define WL_DATA_DEVICE_DATA_OFFER 0
  1598. #define WL_DATA_DEVICE_ENTER 1
  1599. #define WL_DATA_DEVICE_LEAVE 2
  1600. #define WL_DATA_DEVICE_MOTION 3
  1601. #define WL_DATA_DEVICE_DROP 4
  1602. #define WL_DATA_DEVICE_SELECTION 5
  1603. /**
  1604. * @ingroup iface_wl_data_device
  1605. */
  1606. #define WL_DATA_DEVICE_DATA_OFFER_SINCE_VERSION 1
  1607. /**
  1608. * @ingroup iface_wl_data_device
  1609. */
  1610. #define WL_DATA_DEVICE_ENTER_SINCE_VERSION 1
  1611. /**
  1612. * @ingroup iface_wl_data_device
  1613. */
  1614. #define WL_DATA_DEVICE_LEAVE_SINCE_VERSION 1
  1615. /**
  1616. * @ingroup iface_wl_data_device
  1617. */
  1618. #define WL_DATA_DEVICE_MOTION_SINCE_VERSION 1
  1619. /**
  1620. * @ingroup iface_wl_data_device
  1621. */
  1622. #define WL_DATA_DEVICE_DROP_SINCE_VERSION 1
  1623. /**
  1624. * @ingroup iface_wl_data_device
  1625. */
  1626. #define WL_DATA_DEVICE_SELECTION_SINCE_VERSION 1
  1627. /**
  1628. * @ingroup iface_wl_data_device
  1629. * Sends an data_offer event to the client owning the resource.
  1630. * @param resource_ The client's resource
  1631. * @param id the new data_offer object
  1632. */
  1633. static inline void
  1634. wl_data_device_send_data_offer(struct wl_resource *resource_, struct wl_resource *id)
  1635. {
  1636. wl_resource_post_event(resource_, WL_DATA_DEVICE_DATA_OFFER, id);
  1637. }
  1638. /**
  1639. * @ingroup iface_wl_data_device
  1640. * Sends an enter event to the client owning the resource.
  1641. * @param resource_ The client's resource
  1642. * @param serial serial number of the enter event
  1643. * @param surface client surface entered
  1644. * @param x surface-local x coordinate
  1645. * @param y surface-local y coordinate
  1646. * @param id source data_offer object
  1647. */
  1648. static inline void
  1649. wl_data_device_send_enter(struct wl_resource *resource_, uint32_t serial, struct wl_resource *surface, wl_fixed_t x, wl_fixed_t y, struct wl_resource *id)
  1650. {
  1651. wl_resource_post_event(resource_, WL_DATA_DEVICE_ENTER, serial, surface, x, y, id);
  1652. }
  1653. /**
  1654. * @ingroup iface_wl_data_device
  1655. * Sends an leave event to the client owning the resource.
  1656. * @param resource_ The client's resource
  1657. */
  1658. static inline void
  1659. wl_data_device_send_leave(struct wl_resource *resource_)
  1660. {
  1661. wl_resource_post_event(resource_, WL_DATA_DEVICE_LEAVE);
  1662. }
  1663. /**
  1664. * @ingroup iface_wl_data_device
  1665. * Sends an motion event to the client owning the resource.
  1666. * @param resource_ The client's resource
  1667. * @param time timestamp with millisecond granularity
  1668. * @param x surface-local x coordinate
  1669. * @param y surface-local y coordinate
  1670. */
  1671. static inline void
  1672. wl_data_device_send_motion(struct wl_resource *resource_, uint32_t time, wl_fixed_t x, wl_fixed_t y)
  1673. {
  1674. wl_resource_post_event(resource_, WL_DATA_DEVICE_MOTION, time, x, y);
  1675. }
  1676. /**
  1677. * @ingroup iface_wl_data_device
  1678. * Sends an drop event to the client owning the resource.
  1679. * @param resource_ The client's resource
  1680. */
  1681. static inline void
  1682. wl_data_device_send_drop(struct wl_resource *resource_)
  1683. {
  1684. wl_resource_post_event(resource_, WL_DATA_DEVICE_DROP);
  1685. }
  1686. /**
  1687. * @ingroup iface_wl_data_device
  1688. * Sends an selection event to the client owning the resource.
  1689. * @param resource_ The client's resource
  1690. * @param id selection data_offer object
  1691. */
  1692. static inline void
  1693. wl_data_device_send_selection(struct wl_resource *resource_, struct wl_resource *id)
  1694. {
  1695. wl_resource_post_event(resource_, WL_DATA_DEVICE_SELECTION, id);
  1696. }
  1697. #ifndef WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
  1698. #define WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
  1699. /**
  1700. * @ingroup iface_wl_data_device_manager
  1701. * drag and drop actions
  1702. *
  1703. * This is a bitmask of the available/preferred actions in a
  1704. * drag-and-drop operation.
  1705. *
  1706. * In the compositor, the selected action is a result of matching the
  1707. * actions offered by the source and destination sides. "action" events
  1708. * with a "none" action will be sent to both source and destination if
  1709. * there is no match. All further checks will effectively happen on
  1710. * (source actions ∩ destination actions).
  1711. *
  1712. * In addition, compositors may also pick different actions in
  1713. * reaction to key modifiers being pressed. One common design that
  1714. * is used in major toolkits (and the behavior recommended for
  1715. * compositors) is:
  1716. *
  1717. * - If no modifiers are pressed, the first match (in bit order)
  1718. * will be used.
  1719. * - Pressing Shift selects "move", if enabled in the mask.
  1720. * - Pressing Control selects "copy", if enabled in the mask.
  1721. *
  1722. * Behavior beyond that is considered implementation-dependent.
  1723. * Compositors may for example bind other modifiers (like Alt/Meta)
  1724. * or drags initiated with other buttons than BTN_LEFT to specific
  1725. * actions (e.g. "ask").
  1726. */
  1727. enum wl_data_device_manager_dnd_action {
  1728. WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE = 0,
  1729. WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY = 1,
  1730. WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE = 2,
  1731. WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK = 4,
  1732. };
  1733. #endif /* WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM */
  1734. /**
  1735. * @ingroup iface_wl_data_device_manager
  1736. * @struct wl_data_device_manager_interface
  1737. */
  1738. struct wl_data_device_manager_interface {
  1739. /**
  1740. * create a new data source
  1741. *
  1742. * Create a new data source.
  1743. */
  1744. void (*create_data_source)(struct wl_client *client,
  1745. struct wl_resource *resource,
  1746. uint32_t id);
  1747. /**
  1748. * create a new data device
  1749. *
  1750. * Create a new data device for a given seat.
  1751. */
  1752. void (*get_data_device)(struct wl_client *client,
  1753. struct wl_resource *resource,
  1754. uint32_t id,
  1755. struct wl_resource *seat);
  1756. };
  1757. #ifndef WL_SHELL_ERROR_ENUM
  1758. #define WL_SHELL_ERROR_ENUM
  1759. enum wl_shell_error {
  1760. /**
  1761. * given wl_surface has another role
  1762. */
  1763. WL_SHELL_ERROR_ROLE = 0,
  1764. };
  1765. #endif /* WL_SHELL_ERROR_ENUM */
  1766. /**
  1767. * @ingroup iface_wl_shell
  1768. * @struct wl_shell_interface
  1769. */
  1770. struct wl_shell_interface {
  1771. /**
  1772. * create a shell surface from a surface
  1773. *
  1774. * Create a shell surface for an existing surface. This gives the
  1775. * wl_surface the role of a shell surface. If the wl_surface
  1776. * already has another role, it raises a protocol error.
  1777. *
  1778. * Only one shell surface can be associated with a given surface.
  1779. */
  1780. void (*get_shell_surface)(struct wl_client *client,
  1781. struct wl_resource *resource,
  1782. uint32_t id,
  1783. struct wl_resource *surface);
  1784. };
  1785. #ifndef WL_SHELL_SURFACE_RESIZE_ENUM
  1786. #define WL_SHELL_SURFACE_RESIZE_ENUM
  1787. /**
  1788. * @ingroup iface_wl_shell_surface
  1789. * edge values for resizing
  1790. *
  1791. * These values are used to indicate which edge of a surface
  1792. * is being dragged in a resize operation. The server may
  1793. * use this information to adapt its behavior, e.g. choose
  1794. * an appropriate cursor image.
  1795. */
  1796. enum wl_shell_surface_resize {
  1797. WL_SHELL_SURFACE_RESIZE_NONE = 0,
  1798. WL_SHELL_SURFACE_RESIZE_TOP = 1,
  1799. WL_SHELL_SURFACE_RESIZE_BOTTOM = 2,
  1800. WL_SHELL_SURFACE_RESIZE_LEFT = 4,
  1801. WL_SHELL_SURFACE_RESIZE_TOP_LEFT = 5,
  1802. WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT = 6,
  1803. WL_SHELL_SURFACE_RESIZE_RIGHT = 8,
  1804. WL_SHELL_SURFACE_RESIZE_TOP_RIGHT = 9,
  1805. WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT = 10,
  1806. };
  1807. #endif /* WL_SHELL_SURFACE_RESIZE_ENUM */
  1808. #ifndef WL_SHELL_SURFACE_TRANSIENT_ENUM
  1809. #define WL_SHELL_SURFACE_TRANSIENT_ENUM
  1810. /**
  1811. * @ingroup iface_wl_shell_surface
  1812. * details of transient behaviour
  1813. *
  1814. * These flags specify details of the expected behaviour
  1815. * of transient surfaces. Used in the set_transient request.
  1816. */
  1817. enum wl_shell_surface_transient {
  1818. /**
  1819. * do not set keyboard focus
  1820. */
  1821. WL_SHELL_SURFACE_TRANSIENT_INACTIVE = 0x1,
  1822. };
  1823. #endif /* WL_SHELL_SURFACE_TRANSIENT_ENUM */
  1824. #ifndef WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
  1825. #define WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
  1826. /**
  1827. * @ingroup iface_wl_shell_surface
  1828. * different method to set the surface fullscreen
  1829. *
  1830. * Hints to indicate to the compositor how to deal with a conflict
  1831. * between the dimensions of the surface and the dimensions of the
  1832. * output. The compositor is free to ignore this parameter.
  1833. */
  1834. enum wl_shell_surface_fullscreen_method {
  1835. /**
  1836. * no preference, apply default policy
  1837. */
  1838. WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT = 0,
  1839. /**
  1840. * scale, preserve the surface's aspect ratio and center on output
  1841. */
  1842. WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE = 1,
  1843. /**
  1844. * switch output mode to the smallest mode that can fit the surface, add black borders to compensate size mismatch
  1845. */
  1846. WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER = 2,
  1847. /**
  1848. * no upscaling, center on output and add black borders to compensate size mismatch
  1849. */
  1850. WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL = 3,
  1851. };
  1852. #endif /* WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM */
  1853. /**
  1854. * @ingroup iface_wl_shell_surface
  1855. * @struct wl_shell_surface_interface
  1856. */
  1857. struct wl_shell_surface_interface {
  1858. /**
  1859. * respond to a ping event
  1860. *
  1861. * A client must respond to a ping event with a pong request or
  1862. * the client may be deemed unresponsive.
  1863. * @param serial serial of the ping event
  1864. */
  1865. void (*pong)(struct wl_client *client,
  1866. struct wl_resource *resource,
  1867. uint32_t serial);
  1868. /**
  1869. * start an interactive move
  1870. *
  1871. * Start a pointer-driven move of the surface.
  1872. *
  1873. * This request must be used in response to a button press event.
  1874. * The server may ignore move requests depending on the state of
  1875. * the surface (e.g. fullscreen or maximized).
  1876. * @param seat the wl_seat whose pointer is used
  1877. * @param serial serial of the implicit grab on the pointer
  1878. */
  1879. void (*move)(struct wl_client *client,
  1880. struct wl_resource *resource,
  1881. struct wl_resource *seat,
  1882. uint32_t serial);
  1883. /**
  1884. * start an interactive resize
  1885. *
  1886. * Start a pointer-driven resizing of the surface.
  1887. *
  1888. * This request must be used in response to a button press event.
  1889. * The server may ignore resize requests depending on the state of
  1890. * the surface (e.g. fullscreen or maximized).
  1891. * @param seat the wl_seat whose pointer is used
  1892. * @param serial serial of the implicit grab on the pointer
  1893. * @param edges which edge or corner is being dragged
  1894. */
  1895. void (*resize)(struct wl_client *client,
  1896. struct wl_resource *resource,
  1897. struct wl_resource *seat,
  1898. uint32_t serial,
  1899. uint32_t edges);
  1900. /**
  1901. * make the surface a toplevel surface
  1902. *
  1903. * Map the surface as a toplevel surface.
  1904. *
  1905. * A toplevel surface is not fullscreen, maximized or transient.
  1906. */
  1907. void (*set_toplevel)(struct wl_client *client,
  1908. struct wl_resource *resource);
  1909. /**
  1910. * make the surface a transient surface
  1911. *
  1912. * Map the surface relative to an existing surface.
  1913. *
  1914. * The x and y arguments specify the location of the upper left
  1915. * corner of the surface relative to the upper left corner of the
  1916. * parent surface, in surface-local coordinates.
  1917. *
  1918. * The flags argument controls details of the transient behaviour.
  1919. */
  1920. void (*set_transient)(struct wl_client *client,
  1921. struct wl_resource *resource,
  1922. struct wl_resource *parent,
  1923. int32_t x,
  1924. int32_t y,
  1925. uint32_t flags);
  1926. /**
  1927. * make the surface a fullscreen surface
  1928. *
  1929. * Map the surface as a fullscreen surface.
  1930. *
  1931. * If an output parameter is given then the surface will be made
  1932. * fullscreen on that output. If the client does not specify the
  1933. * output then the compositor will apply its policy - usually
  1934. * choosing the output on which the surface has the biggest surface
  1935. * area.
  1936. *
  1937. * The client may specify a method to resolve a size conflict
  1938. * between the output size and the surface size - this is provided
  1939. * through the method parameter.
  1940. *
  1941. * The framerate parameter is used only when the method is set to
  1942. * "driver", to indicate the preferred framerate. A value of 0
  1943. * indicates that the client does not care about framerate. The
  1944. * framerate is specified in mHz, that is framerate of 60000 is
  1945. * 60Hz.
  1946. *
  1947. * A method of "scale" or "driver" implies a scaling operation of
  1948. * the surface, either via a direct scaling operation or a change
  1949. * of the output mode. This will override any kind of output
  1950. * scaling, so that mapping a surface with a buffer size equal to
  1951. * the mode can fill the screen independent of buffer_scale.
  1952. *
  1953. * A method of "fill" means we don't scale up the buffer, however
  1954. * any output scale is applied. This means that you may run into an
  1955. * edge case where the application maps a buffer with the same size
  1956. * of the output mode but buffer_scale 1 (thus making a surface
  1957. * larger than the output). In this case it is allowed to downscale
  1958. * the results to fit the screen.
  1959. *
  1960. * The compositor must reply to this request with a configure event
  1961. * with the dimensions for the output on which the surface will be
  1962. * made fullscreen.
  1963. */
  1964. void (*set_fullscreen)(struct wl_client *client,
  1965. struct wl_resource *resource,
  1966. uint32_t method,
  1967. uint32_t framerate,
  1968. struct wl_resource *output);
  1969. /**
  1970. * make the surface a popup surface
  1971. *
  1972. * Map the surface as a popup.
  1973. *
  1974. * A popup surface is a transient surface with an added pointer
  1975. * grab.
  1976. *
  1977. * An existing implicit grab will be changed to owner-events mode,
  1978. * and the popup grab will continue after the implicit grab ends
  1979. * (i.e. releasing the mouse button does not cause the popup to be
  1980. * unmapped).
  1981. *
  1982. * The popup grab continues until the window is destroyed or a
  1983. * mouse button is pressed in any other client's window. A click in
  1984. * any of the client's surfaces is reported as normal, however,
  1985. * clicks in other clients' surfaces will be discarded and trigger
  1986. * the callback.
  1987. *
  1988. * The x and y arguments specify the location of the upper left
  1989. * corner of the surface relative to the upper left corner of the
  1990. * parent surface, in surface-local coordinates.
  1991. * @param seat the wl_seat whose pointer is used
  1992. * @param serial serial of the implicit grab on the pointer
  1993. */
  1994. void (*set_popup)(struct wl_client *client,
  1995. struct wl_resource *resource,
  1996. struct wl_resource *seat,
  1997. uint32_t serial,
  1998. struct wl_resource *parent,
  1999. int32_t x,
  2000. int32_t y,
  2001. uint32_t flags);
  2002. /**
  2003. * make the surface a maximized surface
  2004. *
  2005. * Map the surface as a maximized surface.
  2006. *
  2007. * If an output parameter is given then the surface will be
  2008. * maximized on that output. If the client does not specify the
  2009. * output then the compositor will apply its policy - usually
  2010. * choosing the output on which the surface has the biggest surface
  2011. * area.
  2012. *
  2013. * The compositor will reply with a configure event telling the
  2014. * expected new surface size. The operation is completed on the
  2015. * next buffer attach to this surface.
  2016. *
  2017. * A maximized surface typically fills the entire output it is
  2018. * bound to, except for desktop elements such as panels. This is
  2019. * the main difference between a maximized shell surface and a
  2020. * fullscreen shell surface.
  2021. *
  2022. * The details depend on the compositor implementation.
  2023. */
  2024. void (*set_maximized)(struct wl_client *client,
  2025. struct wl_resource *resource,
  2026. struct wl_resource *output);
  2027. /**
  2028. * set surface title
  2029. *
  2030. * Set a short title for the surface.
  2031. *
  2032. * This string may be used to identify the surface in a task bar,
  2033. * window list, or other user interface elements provided by the
  2034. * compositor.
  2035. *
  2036. * The string must be encoded in UTF-8.
  2037. */
  2038. void (*set_title)(struct wl_client *client,
  2039. struct wl_resource *resource,
  2040. const char *title);
  2041. /**
  2042. * set surface class
  2043. *
  2044. * Set a class for the surface.
  2045. *
  2046. * The surface class identifies the general class of applications
  2047. * to which the surface belongs. A common convention is to use the
  2048. * file name (or the full path if it is a non-standard location) of
  2049. * the application's .desktop file as the class.
  2050. */
  2051. void (*set_class)(struct wl_client *client,
  2052. struct wl_resource *resource,
  2053. const char *class_);
  2054. };
  2055. #define WL_SHELL_SURFACE_PING 0
  2056. #define WL_SHELL_SURFACE_CONFIGURE 1
  2057. #define WL_SHELL_SURFACE_POPUP_DONE 2
  2058. /**
  2059. * @ingroup iface_wl_shell_surface
  2060. */
  2061. #define WL_SHELL_SURFACE_PING_SINCE_VERSION 1
  2062. /**
  2063. * @ingroup iface_wl_shell_surface
  2064. */
  2065. #define WL_SHELL_SURFACE_CONFIGURE_SINCE_VERSION 1
  2066. /**
  2067. * @ingroup iface_wl_shell_surface
  2068. */
  2069. #define WL_SHELL_SURFACE_POPUP_DONE_SINCE_VERSION 1
  2070. /**
  2071. * @ingroup iface_wl_shell_surface
  2072. * Sends an ping event to the client owning the resource.
  2073. * @param resource_ The client's resource
  2074. * @param serial serial number of the ping
  2075. */
  2076. static inline void
  2077. wl_shell_surface_send_ping(struct wl_resource *resource_, uint32_t serial)
  2078. {
  2079. wl_resource_post_event(resource_, WL_SHELL_SURFACE_PING, serial);
  2080. }
  2081. /**
  2082. * @ingroup iface_wl_shell_surface
  2083. * Sends an configure event to the client owning the resource.
  2084. * @param resource_ The client's resource
  2085. * @param edges how the surface was resized
  2086. * @param width new width of the surface
  2087. * @param height new height of the surface
  2088. */
  2089. static inline void
  2090. wl_shell_surface_send_configure(struct wl_resource *resource_, uint32_t edges, int32_t width, int32_t height)
  2091. {
  2092. wl_resource_post_event(resource_, WL_SHELL_SURFACE_CONFIGURE, edges, width, height);
  2093. }
  2094. /**
  2095. * @ingroup iface_wl_shell_surface
  2096. * Sends an popup_done event to the client owning the resource.
  2097. * @param resource_ The client's resource
  2098. */
  2099. static inline void
  2100. wl_shell_surface_send_popup_done(struct wl_resource *resource_)
  2101. {
  2102. wl_resource_post_event(resource_, WL_SHELL_SURFACE_POPUP_DONE);
  2103. }
  2104. #ifndef WL_SURFACE_ERROR_ENUM
  2105. #define WL_SURFACE_ERROR_ENUM
  2106. /**
  2107. * @ingroup iface_wl_surface
  2108. * wl_surface error values
  2109. *
  2110. * These errors can be emitted in response to wl_surface requests.
  2111. */
  2112. enum wl_surface_error {
  2113. /**
  2114. * buffer scale value is invalid
  2115. */
  2116. WL_SURFACE_ERROR_INVALID_SCALE = 0,
  2117. /**
  2118. * buffer transform value is invalid
  2119. */
  2120. WL_SURFACE_ERROR_INVALID_TRANSFORM = 1,
  2121. };
  2122. #endif /* WL_SURFACE_ERROR_ENUM */
  2123. /**
  2124. * @ingroup iface_wl_surface
  2125. * @struct wl_surface_interface
  2126. */
  2127. struct wl_surface_interface {
  2128. /**
  2129. * delete surface
  2130. *
  2131. * Deletes the surface and invalidates its object ID.
  2132. */
  2133. void (*destroy)(struct wl_client *client,
  2134. struct wl_resource *resource);
  2135. /**
  2136. * set the surface contents
  2137. *
  2138. * Set a buffer as the content of this surface.
  2139. *
  2140. * The new size of the surface is calculated based on the buffer
  2141. * size transformed by the inverse buffer_transform and the inverse
  2142. * buffer_scale. This means that the supplied buffer must be an
  2143. * integer multiple of the buffer_scale.
  2144. *
  2145. * The x and y arguments specify the location of the new pending
  2146. * buffer's upper left corner, relative to the current buffer's
  2147. * upper left corner, in surface-local coordinates. In other words,
  2148. * the x and y, combined with the new surface size define in which
  2149. * directions the surface's size changes.
  2150. *
  2151. * Surface contents are double-buffered state, see
  2152. * wl_surface.commit.
  2153. *
  2154. * The initial surface contents are void; there is no content.
  2155. * wl_surface.attach assigns the given wl_buffer as the pending
  2156. * wl_buffer. wl_surface.commit makes the pending wl_buffer the new
  2157. * surface contents, and the size of the surface becomes the size
  2158. * calculated from the wl_buffer, as described above. After commit,
  2159. * there is no pending buffer until the next attach.
  2160. *
  2161. * Committing a pending wl_buffer allows the compositor to read the
  2162. * pixels in the wl_buffer. The compositor may access the pixels at
  2163. * any time after the wl_surface.commit request. When the
  2164. * compositor will not access the pixels anymore, it will send the
  2165. * wl_buffer.release event. Only after receiving wl_buffer.release,
  2166. * the client may reuse the wl_buffer. A wl_buffer that has been
  2167. * attached and then replaced by another attach instead of
  2168. * committed will not receive a release event, and is not used by
  2169. * the compositor.
  2170. *
  2171. * Destroying the wl_buffer after wl_buffer.release does not change
  2172. * the surface contents. However, if the client destroys the
  2173. * wl_buffer before receiving the wl_buffer.release event, the
  2174. * surface contents become undefined immediately.
  2175. *
  2176. * If wl_surface.attach is sent with a NULL wl_buffer, the
  2177. * following wl_surface.commit will remove the surface content.
  2178. */
  2179. void (*attach)(struct wl_client *client,
  2180. struct wl_resource *resource,
  2181. struct wl_resource *buffer,
  2182. int32_t x,
  2183. int32_t y);
  2184. /**
  2185. * mark part of the surface damaged
  2186. *
  2187. * This request is used to describe the regions where the pending
  2188. * buffer is different from the current surface contents, and where
  2189. * the surface therefore needs to be repainted. The compositor
  2190. * ignores the parts of the damage that fall outside of the
  2191. * surface.
  2192. *
  2193. * Damage is double-buffered state, see wl_surface.commit.
  2194. *
  2195. * The damage rectangle is specified in surface-local coordinates.
  2196. *
  2197. * The initial value for pending damage is empty: no damage.
  2198. * wl_surface.damage adds pending damage: the new pending damage is
  2199. * the union of old pending damage and the given rectangle.
  2200. *
  2201. * wl_surface.commit assigns pending damage as the current damage,
  2202. * and clears pending damage. The server will clear the current
  2203. * damage as it repaints the surface.
  2204. *
  2205. * Alternatively, damage can be posted with
  2206. * wl_surface.damage_buffer which uses buffer coordinates instead
  2207. * of surface coordinates, and is probably the preferred and
  2208. * intuitive way of doing this.
  2209. */
  2210. void (*damage)(struct wl_client *client,
  2211. struct wl_resource *resource,
  2212. int32_t x,
  2213. int32_t y,
  2214. int32_t width,
  2215. int32_t height);
  2216. /**
  2217. * request a frame throttling hint
  2218. *
  2219. * Request a notification when it is a good time to start drawing
  2220. * a new frame, by creating a frame callback. This is useful for
  2221. * throttling redrawing operations, and driving animations.
  2222. *
  2223. * When a client is animating on a wl_surface, it can use the
  2224. * 'frame' request to get notified when it is a good time to draw
  2225. * and commit the next frame of animation. If the client commits an
  2226. * update earlier than that, it is likely that some updates will
  2227. * not make it to the display, and the client is wasting resources
  2228. * by drawing too often.
  2229. *
  2230. * The frame request will take effect on the next
  2231. * wl_surface.commit. The notification will only be posted for one
  2232. * frame unless requested again. For a wl_surface, the
  2233. * notifications are posted in the order the frame requests were
  2234. * committed.
  2235. *
  2236. * The server must send the notifications so that a client will not
  2237. * send excessive updates, while still allowing the highest
  2238. * possible update rate for clients that wait for the reply before
  2239. * drawing again. The server should give some time for the client
  2240. * to draw and commit after sending the frame callback events to
  2241. * let it hit the next output refresh.
  2242. *
  2243. * A server should avoid signaling the frame callbacks if the
  2244. * surface is not visible in any way, e.g. the surface is
  2245. * off-screen, or completely obscured by other opaque surfaces.
  2246. *
  2247. * The object returned by this request will be destroyed by the
  2248. * compositor after the callback is fired and as such the client
  2249. * must not attempt to use it after that point.
  2250. *
  2251. * The callback_data passed in the callback is the current time, in
  2252. * milliseconds, with an undefined base.
  2253. */
  2254. void (*frame)(struct wl_client *client,
  2255. struct wl_resource *resource,
  2256. uint32_t callback);
  2257. /**
  2258. * set opaque region
  2259. *
  2260. * This request sets the region of the surface that contains
  2261. * opaque content.
  2262. *
  2263. * The opaque region is an optimization hint for the compositor
  2264. * that lets it optimize the redrawing of content behind opaque
  2265. * regions. Setting an opaque region is not required for correct
  2266. * behaviour, but marking transparent content as opaque will result
  2267. * in repaint artifacts.
  2268. *
  2269. * The opaque region is specified in surface-local coordinates.
  2270. *
  2271. * The compositor ignores the parts of the opaque region that fall
  2272. * outside of the surface.
  2273. *
  2274. * Opaque region is double-buffered state, see wl_surface.commit.
  2275. *
  2276. * wl_surface.set_opaque_region changes the pending opaque region.
  2277. * wl_surface.commit copies the pending region to the current
  2278. * region. Otherwise, the pending and current regions are never
  2279. * changed.
  2280. *
  2281. * The initial value for an opaque region is empty. Setting the
  2282. * pending opaque region has copy semantics, and the wl_region
  2283. * object can be destroyed immediately. A NULL wl_region causes the
  2284. * pending opaque region to be set to empty.
  2285. */
  2286. void (*set_opaque_region)(struct wl_client *client,
  2287. struct wl_resource *resource,
  2288. struct wl_resource *region);
  2289. /**
  2290. * set input region
  2291. *
  2292. * This request sets the region of the surface that can receive
  2293. * pointer and touch events.
  2294. *
  2295. * Input events happening outside of this region will try the next
  2296. * surface in the server surface stack. The compositor ignores the
  2297. * parts of the input region that fall outside of the surface.
  2298. *
  2299. * The input region is specified in surface-local coordinates.
  2300. *
  2301. * Input region is double-buffered state, see wl_surface.commit.
  2302. *
  2303. * wl_surface.set_input_region changes the pending input region.
  2304. * wl_surface.commit copies the pending region to the current
  2305. * region. Otherwise the pending and current regions are never
  2306. * changed, except cursor and icon surfaces are special cases, see
  2307. * wl_pointer.set_cursor and wl_data_device.start_drag.
  2308. *
  2309. * The initial value for an input region is infinite. That means
  2310. * the whole surface will accept input. Setting the pending input
  2311. * region has copy semantics, and the wl_region object can be
  2312. * destroyed immediately. A NULL wl_region causes the input region
  2313. * to be set to infinite.
  2314. */
  2315. void (*set_input_region)(struct wl_client *client,
  2316. struct wl_resource *resource,
  2317. struct wl_resource *region);
  2318. /**
  2319. * commit pending surface state
  2320. *
  2321. * Surface state (input, opaque, and damage regions, attached
  2322. * buffers, etc.) is double-buffered. Protocol requests modify the
  2323. * pending state, as opposed to the current state in use by the
  2324. * compositor. A commit request atomically applies all pending
  2325. * state, replacing the current state. After commit, the new
  2326. * pending state is as documented for each related request.
  2327. *
  2328. * On commit, a pending wl_buffer is applied first, and all other
  2329. * state second. This means that all coordinates in double-buffered
  2330. * state are relative to the new wl_buffer coming into use, except
  2331. * for wl_surface.attach itself. If there is no pending wl_buffer,
  2332. * the coordinates are relative to the current surface contents.
  2333. *
  2334. * All requests that need a commit to become effective are
  2335. * documented to affect double-buffered state.
  2336. *
  2337. * Other interfaces may add further double-buffered surface state.
  2338. */
  2339. void (*commit)(struct wl_client *client,
  2340. struct wl_resource *resource);
  2341. /**
  2342. * sets the buffer transformation
  2343. *
  2344. * This request sets an optional transformation on how the
  2345. * compositor interprets the contents of the buffer attached to the
  2346. * surface. The accepted values for the transform parameter are the
  2347. * values for wl_output.transform.
  2348. *
  2349. * Buffer transform is double-buffered state, see
  2350. * wl_surface.commit.
  2351. *
  2352. * A newly created surface has its buffer transformation set to
  2353. * normal.
  2354. *
  2355. * wl_surface.set_buffer_transform changes the pending buffer
  2356. * transformation. wl_surface.commit copies the pending buffer
  2357. * transformation to the current one. Otherwise, the pending and
  2358. * current values are never changed.
  2359. *
  2360. * The purpose of this request is to allow clients to render
  2361. * content according to the output transform, thus permitting the
  2362. * compositor to use certain optimizations even if the display is
  2363. * rotated. Using hardware overlays and scanning out a client
  2364. * buffer for fullscreen surfaces are examples of such
  2365. * optimizations. Those optimizations are highly dependent on the
  2366. * compositor implementation, so the use of this request should be
  2367. * considered on a case-by-case basis.
  2368. *
  2369. * Note that if the transform value includes 90 or 270 degree
  2370. * rotation, the width of the buffer will become the surface height
  2371. * and the height of the buffer will become the surface width.
  2372. *
  2373. * If transform is not one of the values from the
  2374. * wl_output.transform enum the invalid_transform protocol error is
  2375. * raised.
  2376. * @since 2
  2377. */
  2378. void (*set_buffer_transform)(struct wl_client *client,
  2379. struct wl_resource *resource,
  2380. int32_t transform);
  2381. /**
  2382. * sets the buffer scaling factor
  2383. *
  2384. * This request sets an optional scaling factor on how the
  2385. * compositor interprets the contents of the buffer attached to the
  2386. * window.
  2387. *
  2388. * Buffer scale is double-buffered state, see wl_surface.commit.
  2389. *
  2390. * A newly created surface has its buffer scale set to 1.
  2391. *
  2392. * wl_surface.set_buffer_scale changes the pending buffer scale.
  2393. * wl_surface.commit copies the pending buffer scale to the current
  2394. * one. Otherwise, the pending and current values are never
  2395. * changed.
  2396. *
  2397. * The purpose of this request is to allow clients to supply higher
  2398. * resolution buffer data for use on high resolution outputs. It is
  2399. * intended that you pick the same buffer scale as the scale of the
  2400. * output that the surface is displayed on. This means the
  2401. * compositor can avoid scaling when rendering the surface on that
  2402. * output.
  2403. *
  2404. * Note that if the scale is larger than 1, then you have to attach
  2405. * a buffer that is larger (by a factor of scale in each dimension)
  2406. * than the desired surface size.
  2407. *
  2408. * If scale is not positive the invalid_scale protocol error is
  2409. * raised.
  2410. * @since 3
  2411. */
  2412. void (*set_buffer_scale)(struct wl_client *client,
  2413. struct wl_resource *resource,
  2414. int32_t scale);
  2415. /**
  2416. * mark part of the surface damaged using buffer coordinates
  2417. *
  2418. * This request is used to describe the regions where the pending
  2419. * buffer is different from the current surface contents, and where
  2420. * the surface therefore needs to be repainted. The compositor
  2421. * ignores the parts of the damage that fall outside of the
  2422. * surface.
  2423. *
  2424. * Damage is double-buffered state, see wl_surface.commit.
  2425. *
  2426. * The damage rectangle is specified in buffer coordinates.
  2427. *
  2428. * The initial value for pending damage is empty: no damage.
  2429. * wl_surface.damage_buffer adds pending damage: the new pending
  2430. * damage is the union of old pending damage and the given
  2431. * rectangle.
  2432. *
  2433. * wl_surface.commit assigns pending damage as the current damage,
  2434. * and clears pending damage. The server will clear the current
  2435. * damage as it repaints the surface.
  2436. *
  2437. * This request differs from wl_surface.damage in only one way - it
  2438. * takes damage in buffer coordinates instead of surface-local
  2439. * coordinates. While this generally is more intuitive than surface
  2440. * coordinates, it is especially desirable when using wp_viewport
  2441. * or when a drawing library (like EGL) is unaware of buffer scale
  2442. * and buffer transform.
  2443. *
  2444. * Note: Because buffer transformation changes and damage requests
  2445. * may be interleaved in the protocol stream, it is impossible to
  2446. * determine the actual mapping between surface and buffer damage
  2447. * until wl_surface.commit time. Therefore, compositors wishing to
  2448. * take both kinds of damage into account will have to accumulate
  2449. * damage from the two requests separately and only transform from
  2450. * one to the other after receiving the wl_surface.commit.
  2451. * @since 4
  2452. */
  2453. void (*damage_buffer)(struct wl_client *client,
  2454. struct wl_resource *resource,
  2455. int32_t x,
  2456. int32_t y,
  2457. int32_t width,
  2458. int32_t height);
  2459. };
  2460. #define WL_SURFACE_ENTER 0
  2461. #define WL_SURFACE_LEAVE 1
  2462. /**
  2463. * @ingroup iface_wl_surface
  2464. */
  2465. #define WL_SURFACE_ENTER_SINCE_VERSION 1
  2466. /**
  2467. * @ingroup iface_wl_surface
  2468. */
  2469. #define WL_SURFACE_LEAVE_SINCE_VERSION 1
  2470. /**
  2471. * @ingroup iface_wl_surface
  2472. * Sends an enter event to the client owning the resource.
  2473. * @param resource_ The client's resource
  2474. * @param output output entered by the surface
  2475. */
  2476. static inline void
  2477. wl_surface_send_enter(struct wl_resource *resource_, struct wl_resource *output)
  2478. {
  2479. wl_resource_post_event(resource_, WL_SURFACE_ENTER, output);
  2480. }
  2481. /**
  2482. * @ingroup iface_wl_surface
  2483. * Sends an leave event to the client owning the resource.
  2484. * @param resource_ The client's resource
  2485. * @param output output left by the surface
  2486. */
  2487. static inline void
  2488. wl_surface_send_leave(struct wl_resource *resource_, struct wl_resource *output)
  2489. {
  2490. wl_resource_post_event(resource_, WL_SURFACE_LEAVE, output);
  2491. }
  2492. #ifndef WL_SEAT_CAPABILITY_ENUM
  2493. #define WL_SEAT_CAPABILITY_ENUM
  2494. /**
  2495. * @ingroup iface_wl_seat
  2496. * seat capability bitmask
  2497. *
  2498. * This is a bitmask of capabilities this seat has; if a member is
  2499. * set, then it is present on the seat.
  2500. */
  2501. enum wl_seat_capability {
  2502. /**
  2503. * the seat has pointer devices
  2504. */
  2505. WL_SEAT_CAPABILITY_POINTER = 1,
  2506. /**
  2507. * the seat has one or more keyboards
  2508. */
  2509. WL_SEAT_CAPABILITY_KEYBOARD = 2,
  2510. /**
  2511. * the seat has touch devices
  2512. */
  2513. WL_SEAT_CAPABILITY_TOUCH = 4,
  2514. };
  2515. #endif /* WL_SEAT_CAPABILITY_ENUM */
  2516. /**
  2517. * @ingroup iface_wl_seat
  2518. * @struct wl_seat_interface
  2519. */
  2520. struct wl_seat_interface {
  2521. /**
  2522. * return pointer object
  2523. *
  2524. * The ID provided will be initialized to the wl_pointer
  2525. * interface for this seat.
  2526. *
  2527. * This request only takes effect if the seat has the pointer
  2528. * capability, or has had the pointer capability in the past. It is
  2529. * a protocol violation to issue this request on a seat that has
  2530. * never had the pointer capability.
  2531. */
  2532. void (*get_pointer)(struct wl_client *client,
  2533. struct wl_resource *resource,
  2534. uint32_t id);
  2535. /**
  2536. * return keyboard object
  2537. *
  2538. * The ID provided will be initialized to the wl_keyboard
  2539. * interface for this seat.
  2540. *
  2541. * This request only takes effect if the seat has the keyboard
  2542. * capability, or has had the keyboard capability in the past. It
  2543. * is a protocol violation to issue this request on a seat that has
  2544. * never had the keyboard capability.
  2545. */
  2546. void (*get_keyboard)(struct wl_client *client,
  2547. struct wl_resource *resource,
  2548. uint32_t id);
  2549. /**
  2550. * return touch object
  2551. *
  2552. * The ID provided will be initialized to the wl_touch interface
  2553. * for this seat.
  2554. *
  2555. * This request only takes effect if the seat has the touch
  2556. * capability, or has had the touch capability in the past. It is a
  2557. * protocol violation to issue this request on a seat that has
  2558. * never had the touch capability.
  2559. */
  2560. void (*get_touch)(struct wl_client *client,
  2561. struct wl_resource *resource,
  2562. uint32_t id);
  2563. /**
  2564. * release the seat object
  2565. *
  2566. * Using this request a client can tell the server that it is not
  2567. * going to use the seat object anymore.
  2568. * @since 5
  2569. */
  2570. void (*release)(struct wl_client *client,
  2571. struct wl_resource *resource);
  2572. };
  2573. #define WL_SEAT_CAPABILITIES 0
  2574. #define WL_SEAT_NAME 1
  2575. /**
  2576. * @ingroup iface_wl_seat
  2577. */
  2578. #define WL_SEAT_CAPABILITIES_SINCE_VERSION 1
  2579. /**
  2580. * @ingroup iface_wl_seat
  2581. */
  2582. #define WL_SEAT_NAME_SINCE_VERSION 2
  2583. /**
  2584. * @ingroup iface_wl_seat
  2585. * Sends an capabilities event to the client owning the resource.
  2586. * @param resource_ The client's resource
  2587. * @param capabilities capabilities of the seat
  2588. */
  2589. static inline void
  2590. wl_seat_send_capabilities(struct wl_resource *resource_, uint32_t capabilities)
  2591. {
  2592. wl_resource_post_event(resource_, WL_SEAT_CAPABILITIES, capabilities);
  2593. }
  2594. /**
  2595. * @ingroup iface_wl_seat
  2596. * Sends an name event to the client owning the resource.
  2597. * @param resource_ The client's resource
  2598. * @param name seat identifier
  2599. */
  2600. static inline void
  2601. wl_seat_send_name(struct wl_resource *resource_, const char *name)
  2602. {
  2603. wl_resource_post_event(resource_, WL_SEAT_NAME, name);
  2604. }
  2605. #ifndef WL_POINTER_ERROR_ENUM
  2606. #define WL_POINTER_ERROR_ENUM
  2607. enum wl_pointer_error {
  2608. /**
  2609. * given wl_surface has another role
  2610. */
  2611. WL_POINTER_ERROR_ROLE = 0,
  2612. };
  2613. #endif /* WL_POINTER_ERROR_ENUM */
  2614. #ifndef WL_POINTER_BUTTON_STATE_ENUM
  2615. #define WL_POINTER_BUTTON_STATE_ENUM
  2616. /**
  2617. * @ingroup iface_wl_pointer
  2618. * physical button state
  2619. *
  2620. * Describes the physical state of a button that produced the button
  2621. * event.
  2622. */
  2623. enum wl_pointer_button_state {
  2624. /**
  2625. * the button is not pressed
  2626. */
  2627. WL_POINTER_BUTTON_STATE_RELEASED = 0,
  2628. /**
  2629. * the button is pressed
  2630. */
  2631. WL_POINTER_BUTTON_STATE_PRESSED = 1,
  2632. };
  2633. #endif /* WL_POINTER_BUTTON_STATE_ENUM */
  2634. #ifndef WL_POINTER_AXIS_ENUM
  2635. #define WL_POINTER_AXIS_ENUM
  2636. /**
  2637. * @ingroup iface_wl_pointer
  2638. * axis types
  2639. *
  2640. * Describes the axis types of scroll events.
  2641. */
  2642. enum wl_pointer_axis {
  2643. WL_POINTER_AXIS_VERTICAL_SCROLL = 0,
  2644. WL_POINTER_AXIS_HORIZONTAL_SCROLL = 1,
  2645. };
  2646. #endif /* WL_POINTER_AXIS_ENUM */
  2647. #ifndef WL_POINTER_AXIS_SOURCE_ENUM
  2648. #define WL_POINTER_AXIS_SOURCE_ENUM
  2649. /**
  2650. * @ingroup iface_wl_pointer
  2651. * axis source types
  2652. *
  2653. * Describes the source types for axis events. This indicates to the
  2654. * client how an axis event was physically generated; a client may
  2655. * adjust the user interface accordingly. For example, scroll events
  2656. * from a "finger" source may be in a smooth coordinate space with
  2657. * kinetic scrolling whereas a "wheel" source may be in discrete steps
  2658. * of a number of lines.
  2659. *
  2660. * The "continuous" axis source is a device generating events in a
  2661. * continuous coordinate space, but using something other than a
  2662. * finger. One example for this source is button-based scrolling where
  2663. * the vertical motion of a device is converted to scroll events while
  2664. * a button is held down.
  2665. */
  2666. enum wl_pointer_axis_source {
  2667. /**
  2668. * a physical wheel
  2669. */
  2670. WL_POINTER_AXIS_SOURCE_WHEEL = 0,
  2671. /**
  2672. * finger on a touch surface
  2673. */
  2674. WL_POINTER_AXIS_SOURCE_FINGER = 1,
  2675. /**
  2676. * continuous coordinate space
  2677. */
  2678. WL_POINTER_AXIS_SOURCE_CONTINUOUS = 2,
  2679. };
  2680. #endif /* WL_POINTER_AXIS_SOURCE_ENUM */
  2681. /**
  2682. * @ingroup iface_wl_pointer
  2683. * @struct wl_pointer_interface
  2684. */
  2685. struct wl_pointer_interface {
  2686. /**
  2687. * set the pointer surface
  2688. *
  2689. * Set the pointer surface, i.e., the surface that contains the
  2690. * pointer image (cursor). This request gives the surface the role
  2691. * of a cursor. If the surface already has another role, it raises
  2692. * a protocol error.
  2693. *
  2694. * The cursor actually changes only if the pointer focus for this
  2695. * device is one of the requesting client's surfaces or the surface
  2696. * parameter is the current pointer surface. If there was a
  2697. * previous surface set with this request it is replaced. If
  2698. * surface is NULL, the pointer image is hidden.
  2699. *
  2700. * The parameters hotspot_x and hotspot_y define the position of
  2701. * the pointer surface relative to the pointer location. Its
  2702. * top-left corner is always at (x, y) - (hotspot_x, hotspot_y),
  2703. * where (x, y) are the coordinates of the pointer location, in
  2704. * surface-local coordinates.
  2705. *
  2706. * On surface.attach requests to the pointer surface, hotspot_x and
  2707. * hotspot_y are decremented by the x and y parameters passed to
  2708. * the request. Attach must be confirmed by wl_surface.commit as
  2709. * usual.
  2710. *
  2711. * The hotspot can also be updated by passing the currently set
  2712. * pointer surface to this request with new values for hotspot_x
  2713. * and hotspot_y.
  2714. *
  2715. * The current and pending input regions of the wl_surface are
  2716. * cleared, and wl_surface.set_input_region is ignored until the
  2717. * wl_surface is no longer used as the cursor. When the use as a
  2718. * cursor ends, the current and pending input regions become
  2719. * undefined, and the wl_surface is unmapped.
  2720. * @param serial serial of the enter event
  2721. * @param hotspot_x surface-local x coordinate
  2722. * @param hotspot_y surface-local y coordinate
  2723. */
  2724. void (*set_cursor)(struct wl_client *client,
  2725. struct wl_resource *resource,
  2726. uint32_t serial,
  2727. struct wl_resource *surface,
  2728. int32_t hotspot_x,
  2729. int32_t hotspot_y);
  2730. /**
  2731. * release the pointer object
  2732. *
  2733. * Using this request a client can tell the server that it is not
  2734. * going to use the pointer object anymore.
  2735. *
  2736. * This request destroys the pointer proxy object, so clients must
  2737. * not call wl_pointer_destroy() after using this request.
  2738. * @since 3
  2739. */
  2740. void (*release)(struct wl_client *client,
  2741. struct wl_resource *resource);
  2742. };
  2743. #define WL_POINTER_ENTER 0
  2744. #define WL_POINTER_LEAVE 1
  2745. #define WL_POINTER_MOTION 2
  2746. #define WL_POINTER_BUTTON 3
  2747. #define WL_POINTER_AXIS 4
  2748. #define WL_POINTER_FRAME 5
  2749. #define WL_POINTER_AXIS_SOURCE 6
  2750. #define WL_POINTER_AXIS_STOP 7
  2751. #define WL_POINTER_AXIS_DISCRETE 8
  2752. /**
  2753. * @ingroup iface_wl_pointer
  2754. */
  2755. #define WL_POINTER_ENTER_SINCE_VERSION 1
  2756. /**
  2757. * @ingroup iface_wl_pointer
  2758. */
  2759. #define WL_POINTER_LEAVE_SINCE_VERSION 1
  2760. /**
  2761. * @ingroup iface_wl_pointer
  2762. */
  2763. #define WL_POINTER_MOTION_SINCE_VERSION 1
  2764. /**
  2765. * @ingroup iface_wl_pointer
  2766. */
  2767. #define WL_POINTER_BUTTON_SINCE_VERSION 1
  2768. /**
  2769. * @ingroup iface_wl_pointer
  2770. */
  2771. #define WL_POINTER_AXIS_SINCE_VERSION 1
  2772. /**
  2773. * @ingroup iface_wl_pointer
  2774. */
  2775. #define WL_POINTER_FRAME_SINCE_VERSION 5
  2776. /**
  2777. * @ingroup iface_wl_pointer
  2778. */
  2779. #define WL_POINTER_AXIS_SOURCE_SINCE_VERSION 5
  2780. /**
  2781. * @ingroup iface_wl_pointer
  2782. */
  2783. #define WL_POINTER_AXIS_STOP_SINCE_VERSION 5
  2784. /**
  2785. * @ingroup iface_wl_pointer
  2786. */
  2787. #define WL_POINTER_AXIS_DISCRETE_SINCE_VERSION 5
  2788. /**
  2789. * @ingroup iface_wl_pointer
  2790. * Sends an enter event to the client owning the resource.
  2791. * @param resource_ The client's resource
  2792. * @param serial serial number of the enter event
  2793. * @param surface surface entered by the pointer
  2794. * @param surface_x surface-local x coordinate
  2795. * @param surface_y surface-local y coordinate
  2796. */
  2797. static inline void
  2798. wl_pointer_send_enter(struct wl_resource *resource_, uint32_t serial, struct wl_resource *surface, wl_fixed_t surface_x, wl_fixed_t surface_y)
  2799. {
  2800. wl_resource_post_event(resource_, WL_POINTER_ENTER, serial, surface, surface_x, surface_y);
  2801. }
  2802. /**
  2803. * @ingroup iface_wl_pointer
  2804. * Sends an leave event to the client owning the resource.
  2805. * @param resource_ The client's resource
  2806. * @param serial serial number of the leave event
  2807. * @param surface surface left by the pointer
  2808. */
  2809. static inline void
  2810. wl_pointer_send_leave(struct wl_resource *resource_, uint32_t serial, struct wl_resource *surface)
  2811. {
  2812. wl_resource_post_event(resource_, WL_POINTER_LEAVE, serial, surface);
  2813. }
  2814. /**
  2815. * @ingroup iface_wl_pointer
  2816. * Sends an motion event to the client owning the resource.
  2817. * @param resource_ The client's resource
  2818. * @param time timestamp with millisecond granularity
  2819. * @param surface_x surface-local x coordinate
  2820. * @param surface_y surface-local y coordinate
  2821. */
  2822. static inline void
  2823. wl_pointer_send_motion(struct wl_resource *resource_, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y)
  2824. {
  2825. wl_resource_post_event(resource_, WL_POINTER_MOTION, time, surface_x, surface_y);
  2826. }
  2827. /**
  2828. * @ingroup iface_wl_pointer
  2829. * Sends an button event to the client owning the resource.
  2830. * @param resource_ The client's resource
  2831. * @param serial serial number of the button event
  2832. * @param time timestamp with millisecond granularity
  2833. * @param button button that produced the event
  2834. * @param state physical state of the button
  2835. */
  2836. static inline void
  2837. wl_pointer_send_button(struct wl_resource *resource_, uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
  2838. {
  2839. wl_resource_post_event(resource_, WL_POINTER_BUTTON, serial, time, button, state);
  2840. }
  2841. /**
  2842. * @ingroup iface_wl_pointer
  2843. * Sends an axis event to the client owning the resource.
  2844. * @param resource_ The client's resource
  2845. * @param time timestamp with millisecond granularity
  2846. * @param axis axis type
  2847. * @param value length of vector in surface-local coordinate space
  2848. */
  2849. static inline void
  2850. wl_pointer_send_axis(struct wl_resource *resource_, uint32_t time, uint32_t axis, wl_fixed_t value)
  2851. {
  2852. wl_resource_post_event(resource_, WL_POINTER_AXIS, time, axis, value);
  2853. }
  2854. /**
  2855. * @ingroup iface_wl_pointer
  2856. * Sends an frame event to the client owning the resource.
  2857. * @param resource_ The client's resource
  2858. */
  2859. static inline void
  2860. wl_pointer_send_frame(struct wl_resource *resource_)
  2861. {
  2862. wl_resource_post_event(resource_, WL_POINTER_FRAME);
  2863. }
  2864. /**
  2865. * @ingroup iface_wl_pointer
  2866. * Sends an axis_source event to the client owning the resource.
  2867. * @param resource_ The client's resource
  2868. * @param axis_source source of the axis event
  2869. */
  2870. static inline void
  2871. wl_pointer_send_axis_source(struct wl_resource *resource_, uint32_t axis_source)
  2872. {
  2873. wl_resource_post_event(resource_, WL_POINTER_AXIS_SOURCE, axis_source);
  2874. }
  2875. /**
  2876. * @ingroup iface_wl_pointer
  2877. * Sends an axis_stop event to the client owning the resource.
  2878. * @param resource_ The client's resource
  2879. * @param time timestamp with millisecond granularity
  2880. * @param axis the axis stopped with this event
  2881. */
  2882. static inline void
  2883. wl_pointer_send_axis_stop(struct wl_resource *resource_, uint32_t time, uint32_t axis)
  2884. {
  2885. wl_resource_post_event(resource_, WL_POINTER_AXIS_STOP, time, axis);
  2886. }
  2887. /**
  2888. * @ingroup iface_wl_pointer
  2889. * Sends an axis_discrete event to the client owning the resource.
  2890. * @param resource_ The client's resource
  2891. * @param axis axis type
  2892. * @param discrete number of steps
  2893. */
  2894. static inline void
  2895. wl_pointer_send_axis_discrete(struct wl_resource *resource_, uint32_t axis, int32_t discrete)
  2896. {
  2897. wl_resource_post_event(resource_, WL_POINTER_AXIS_DISCRETE, axis, discrete);
  2898. }
  2899. #ifndef WL_KEYBOARD_KEYMAP_FORMAT_ENUM
  2900. #define WL_KEYBOARD_KEYMAP_FORMAT_ENUM
  2901. /**
  2902. * @ingroup iface_wl_keyboard
  2903. * keyboard mapping format
  2904. *
  2905. * This specifies the format of the keymap provided to the
  2906. * client with the wl_keyboard.keymap event.
  2907. */
  2908. enum wl_keyboard_keymap_format {
  2909. /**
  2910. * no keymap; client must understand how to interpret the raw keycode
  2911. */
  2912. WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP = 0,
  2913. /**
  2914. * libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode
  2915. */
  2916. WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1 = 1,
  2917. };
  2918. #endif /* WL_KEYBOARD_KEYMAP_FORMAT_ENUM */
  2919. #ifndef WL_KEYBOARD_KEY_STATE_ENUM
  2920. #define WL_KEYBOARD_KEY_STATE_ENUM
  2921. /**
  2922. * @ingroup iface_wl_keyboard
  2923. * physical key state
  2924. *
  2925. * Describes the physical state of a key that produced the key event.
  2926. */
  2927. enum wl_keyboard_key_state {
  2928. /**
  2929. * key is not pressed
  2930. */
  2931. WL_KEYBOARD_KEY_STATE_RELEASED = 0,
  2932. /**
  2933. * key is pressed
  2934. */
  2935. WL_KEYBOARD_KEY_STATE_PRESSED = 1,
  2936. };
  2937. #endif /* WL_KEYBOARD_KEY_STATE_ENUM */
  2938. /**
  2939. * @ingroup iface_wl_keyboard
  2940. * @struct wl_keyboard_interface
  2941. */
  2942. struct wl_keyboard_interface {
  2943. /**
  2944. * release the keyboard object
  2945. *
  2946. *
  2947. * @since 3
  2948. */
  2949. void (*release)(struct wl_client *client,
  2950. struct wl_resource *resource);
  2951. };
  2952. #define WL_KEYBOARD_KEYMAP 0
  2953. #define WL_KEYBOARD_ENTER 1
  2954. #define WL_KEYBOARD_LEAVE 2
  2955. #define WL_KEYBOARD_KEY 3
  2956. #define WL_KEYBOARD_MODIFIERS 4
  2957. #define WL_KEYBOARD_REPEAT_INFO 5
  2958. /**
  2959. * @ingroup iface_wl_keyboard
  2960. */
  2961. #define WL_KEYBOARD_KEYMAP_SINCE_VERSION 1
  2962. /**
  2963. * @ingroup iface_wl_keyboard
  2964. */
  2965. #define WL_KEYBOARD_ENTER_SINCE_VERSION 1
  2966. /**
  2967. * @ingroup iface_wl_keyboard
  2968. */
  2969. #define WL_KEYBOARD_LEAVE_SINCE_VERSION 1
  2970. /**
  2971. * @ingroup iface_wl_keyboard
  2972. */
  2973. #define WL_KEYBOARD_KEY_SINCE_VERSION 1
  2974. /**
  2975. * @ingroup iface_wl_keyboard
  2976. */
  2977. #define WL_KEYBOARD_MODIFIERS_SINCE_VERSION 1
  2978. /**
  2979. * @ingroup iface_wl_keyboard
  2980. */
  2981. #define WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION 4
  2982. /**
  2983. * @ingroup iface_wl_keyboard
  2984. * Sends an keymap event to the client owning the resource.
  2985. * @param resource_ The client's resource
  2986. * @param format keymap format
  2987. * @param fd keymap file descriptor
  2988. * @param size keymap size, in bytes
  2989. */
  2990. static inline void
  2991. wl_keyboard_send_keymap(struct wl_resource *resource_, uint32_t format, int32_t fd, uint32_t size)
  2992. {
  2993. wl_resource_post_event(resource_, WL_KEYBOARD_KEYMAP, format, fd, size);
  2994. }
  2995. /**
  2996. * @ingroup iface_wl_keyboard
  2997. * Sends an enter event to the client owning the resource.
  2998. * @param resource_ The client's resource
  2999. * @param serial serial number of the enter event
  3000. * @param surface surface gaining keyboard focus
  3001. * @param keys the currently pressed keys
  3002. */
  3003. static inline void
  3004. wl_keyboard_send_enter(struct wl_resource *resource_, uint32_t serial, struct wl_resource *surface, struct wl_array *keys)
  3005. {
  3006. wl_resource_post_event(resource_, WL_KEYBOARD_ENTER, serial, surface, keys);
  3007. }
  3008. /**
  3009. * @ingroup iface_wl_keyboard
  3010. * Sends an leave event to the client owning the resource.
  3011. * @param resource_ The client's resource
  3012. * @param serial serial number of the leave event
  3013. * @param surface surface that lost keyboard focus
  3014. */
  3015. static inline void
  3016. wl_keyboard_send_leave(struct wl_resource *resource_, uint32_t serial, struct wl_resource *surface)
  3017. {
  3018. wl_resource_post_event(resource_, WL_KEYBOARD_LEAVE, serial, surface);
  3019. }
  3020. /**
  3021. * @ingroup iface_wl_keyboard
  3022. * Sends an key event to the client owning the resource.
  3023. * @param resource_ The client's resource
  3024. * @param serial serial number of the key event
  3025. * @param time timestamp with millisecond granularity
  3026. * @param key key that produced the event
  3027. * @param state physical state of the key
  3028. */
  3029. static inline void
  3030. wl_keyboard_send_key(struct wl_resource *resource_, uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
  3031. {
  3032. wl_resource_post_event(resource_, WL_KEYBOARD_KEY, serial, time, key, state);
  3033. }
  3034. /**
  3035. * @ingroup iface_wl_keyboard
  3036. * Sends an modifiers event to the client owning the resource.
  3037. * @param resource_ The client's resource
  3038. * @param serial serial number of the modifiers event
  3039. * @param mods_depressed depressed modifiers
  3040. * @param mods_latched latched modifiers
  3041. * @param mods_locked locked modifiers
  3042. * @param group keyboard layout
  3043. */
  3044. static inline void
  3045. wl_keyboard_send_modifiers(struct wl_resource *resource_, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
  3046. {
  3047. wl_resource_post_event(resource_, WL_KEYBOARD_MODIFIERS, serial, mods_depressed, mods_latched, mods_locked, group);
  3048. }
  3049. /**
  3050. * @ingroup iface_wl_keyboard
  3051. * Sends an repeat_info event to the client owning the resource.
  3052. * @param resource_ The client's resource
  3053. * @param rate the rate of repeating keys in characters per second
  3054. * @param delay delay in milliseconds since key down until repeating starts
  3055. */
  3056. static inline void
  3057. wl_keyboard_send_repeat_info(struct wl_resource *resource_, int32_t rate, int32_t delay)
  3058. {
  3059. wl_resource_post_event(resource_, WL_KEYBOARD_REPEAT_INFO, rate, delay);
  3060. }
  3061. /**
  3062. * @ingroup iface_wl_touch
  3063. * @struct wl_touch_interface
  3064. */
  3065. struct wl_touch_interface {
  3066. /**
  3067. * release the touch object
  3068. *
  3069. *
  3070. * @since 3
  3071. */
  3072. void (*release)(struct wl_client *client,
  3073. struct wl_resource *resource);
  3074. };
  3075. #define WL_TOUCH_DOWN 0
  3076. #define WL_TOUCH_UP 1
  3077. #define WL_TOUCH_MOTION 2
  3078. #define WL_TOUCH_FRAME 3
  3079. #define WL_TOUCH_CANCEL 4
  3080. /**
  3081. * @ingroup iface_wl_touch
  3082. */
  3083. #define WL_TOUCH_DOWN_SINCE_VERSION 1
  3084. /**
  3085. * @ingroup iface_wl_touch
  3086. */
  3087. #define WL_TOUCH_UP_SINCE_VERSION 1
  3088. /**
  3089. * @ingroup iface_wl_touch
  3090. */
  3091. #define WL_TOUCH_MOTION_SINCE_VERSION 1
  3092. /**
  3093. * @ingroup iface_wl_touch
  3094. */
  3095. #define WL_TOUCH_FRAME_SINCE_VERSION 1
  3096. /**
  3097. * @ingroup iface_wl_touch
  3098. */
  3099. #define WL_TOUCH_CANCEL_SINCE_VERSION 1
  3100. /**
  3101. * @ingroup iface_wl_touch
  3102. * Sends an down event to the client owning the resource.
  3103. * @param resource_ The client's resource
  3104. * @param serial serial number of the touch down event
  3105. * @param time timestamp with millisecond granularity
  3106. * @param surface surface touched
  3107. * @param id the unique ID of this touch point
  3108. * @param x surface-local x coordinate
  3109. * @param y surface-local y coordinate
  3110. */
  3111. static inline void
  3112. wl_touch_send_down(struct wl_resource *resource_, uint32_t serial, uint32_t time, struct wl_resource *surface, int32_t id, wl_fixed_t x, wl_fixed_t y)
  3113. {
  3114. wl_resource_post_event(resource_, WL_TOUCH_DOWN, serial, time, surface, id, x, y);
  3115. }
  3116. /**
  3117. * @ingroup iface_wl_touch
  3118. * Sends an up event to the client owning the resource.
  3119. * @param resource_ The client's resource
  3120. * @param serial serial number of the touch up event
  3121. * @param time timestamp with millisecond granularity
  3122. * @param id the unique ID of this touch point
  3123. */
  3124. static inline void
  3125. wl_touch_send_up(struct wl_resource *resource_, uint32_t serial, uint32_t time, int32_t id)
  3126. {
  3127. wl_resource_post_event(resource_, WL_TOUCH_UP, serial, time, id);
  3128. }
  3129. /**
  3130. * @ingroup iface_wl_touch
  3131. * Sends an motion event to the client owning the resource.
  3132. * @param resource_ The client's resource
  3133. * @param time timestamp with millisecond granularity
  3134. * @param id the unique ID of this touch point
  3135. * @param x surface-local x coordinate
  3136. * @param y surface-local y coordinate
  3137. */
  3138. static inline void
  3139. wl_touch_send_motion(struct wl_resource *resource_, uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y)
  3140. {
  3141. wl_resource_post_event(resource_, WL_TOUCH_MOTION, time, id, x, y);
  3142. }
  3143. /**
  3144. * @ingroup iface_wl_touch
  3145. * Sends an frame event to the client owning the resource.
  3146. * @param resource_ The client's resource
  3147. */
  3148. static inline void
  3149. wl_touch_send_frame(struct wl_resource *resource_)
  3150. {
  3151. wl_resource_post_event(resource_, WL_TOUCH_FRAME);
  3152. }
  3153. /**
  3154. * @ingroup iface_wl_touch
  3155. * Sends an cancel event to the client owning the resource.
  3156. * @param resource_ The client's resource
  3157. */
  3158. static inline void
  3159. wl_touch_send_cancel(struct wl_resource *resource_)
  3160. {
  3161. wl_resource_post_event(resource_, WL_TOUCH_CANCEL);
  3162. }
  3163. #ifndef WL_OUTPUT_SUBPIXEL_ENUM
  3164. #define WL_OUTPUT_SUBPIXEL_ENUM
  3165. /**
  3166. * @ingroup iface_wl_output
  3167. * subpixel geometry information
  3168. *
  3169. * This enumeration describes how the physical
  3170. * pixels on an output are laid out.
  3171. */
  3172. enum wl_output_subpixel {
  3173. WL_OUTPUT_SUBPIXEL_UNKNOWN = 0,
  3174. WL_OUTPUT_SUBPIXEL_NONE = 1,
  3175. WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB = 2,
  3176. WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR = 3,
  3177. WL_OUTPUT_SUBPIXEL_VERTICAL_RGB = 4,
  3178. WL_OUTPUT_SUBPIXEL_VERTICAL_BGR = 5,
  3179. };
  3180. #endif /* WL_OUTPUT_SUBPIXEL_ENUM */
  3181. #ifndef WL_OUTPUT_TRANSFORM_ENUM
  3182. #define WL_OUTPUT_TRANSFORM_ENUM
  3183. /**
  3184. * @ingroup iface_wl_output
  3185. * transform from framebuffer to output
  3186. *
  3187. * This describes the transform that a compositor will apply to a
  3188. * surface to compensate for the rotation or mirroring of an
  3189. * output device.
  3190. *
  3191. * The flipped values correspond to an initial flip around a
  3192. * vertical axis followed by rotation.
  3193. *
  3194. * The purpose is mainly to allow clients to render accordingly and
  3195. * tell the compositor, so that for fullscreen surfaces, the
  3196. * compositor will still be able to scan out directly from client
  3197. * surfaces.
  3198. */
  3199. enum wl_output_transform {
  3200. WL_OUTPUT_TRANSFORM_NORMAL = 0,
  3201. WL_OUTPUT_TRANSFORM_90 = 1,
  3202. WL_OUTPUT_TRANSFORM_180 = 2,
  3203. WL_OUTPUT_TRANSFORM_270 = 3,
  3204. WL_OUTPUT_TRANSFORM_FLIPPED = 4,
  3205. WL_OUTPUT_TRANSFORM_FLIPPED_90 = 5,
  3206. WL_OUTPUT_TRANSFORM_FLIPPED_180 = 6,
  3207. WL_OUTPUT_TRANSFORM_FLIPPED_270 = 7,
  3208. };
  3209. #endif /* WL_OUTPUT_TRANSFORM_ENUM */
  3210. #ifndef WL_OUTPUT_MODE_ENUM
  3211. #define WL_OUTPUT_MODE_ENUM
  3212. /**
  3213. * @ingroup iface_wl_output
  3214. * mode information
  3215. *
  3216. * These flags describe properties of an output mode.
  3217. * They are used in the flags bitfield of the mode event.
  3218. */
  3219. enum wl_output_mode {
  3220. /**
  3221. * indicates this is the current mode
  3222. */
  3223. WL_OUTPUT_MODE_CURRENT = 0x1,
  3224. /**
  3225. * indicates this is the preferred mode
  3226. */
  3227. WL_OUTPUT_MODE_PREFERRED = 0x2,
  3228. };
  3229. #endif /* WL_OUTPUT_MODE_ENUM */
  3230. #define WL_OUTPUT_GEOMETRY 0
  3231. #define WL_OUTPUT_MODE 1
  3232. #define WL_OUTPUT_DONE 2
  3233. #define WL_OUTPUT_SCALE 3
  3234. /**
  3235. * @ingroup iface_wl_output
  3236. */
  3237. #define WL_OUTPUT_GEOMETRY_SINCE_VERSION 1
  3238. /**
  3239. * @ingroup iface_wl_output
  3240. */
  3241. #define WL_OUTPUT_MODE_SINCE_VERSION 1
  3242. /**
  3243. * @ingroup iface_wl_output
  3244. */
  3245. #define WL_OUTPUT_DONE_SINCE_VERSION 2
  3246. /**
  3247. * @ingroup iface_wl_output
  3248. */
  3249. #define WL_OUTPUT_SCALE_SINCE_VERSION 2
  3250. /**
  3251. * @ingroup iface_wl_output
  3252. * Sends an geometry event to the client owning the resource.
  3253. * @param resource_ The client's resource
  3254. * @param x x position within the global compositor space
  3255. * @param y y position within the global compositor space
  3256. * @param physical_width width in millimeters of the output
  3257. * @param physical_height height in millimeters of the output
  3258. * @param subpixel subpixel orientation of the output
  3259. * @param make textual description of the manufacturer
  3260. * @param model textual description of the model
  3261. * @param transform transform that maps framebuffer to output
  3262. */
  3263. static inline void
  3264. wl_output_send_geometry(struct wl_resource *resource_, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const char *make, const char *model, int32_t transform)
  3265. {
  3266. wl_resource_post_event(resource_, WL_OUTPUT_GEOMETRY, x, y, physical_width, physical_height, subpixel, make, model, transform);
  3267. }
  3268. /**
  3269. * @ingroup iface_wl_output
  3270. * Sends an mode event to the client owning the resource.
  3271. * @param resource_ The client's resource
  3272. * @param flags bitfield of mode flags
  3273. * @param width width of the mode in hardware units
  3274. * @param height height of the mode in hardware units
  3275. * @param refresh vertical refresh rate in mHz
  3276. */
  3277. static inline void
  3278. wl_output_send_mode(struct wl_resource *resource_, uint32_t flags, int32_t width, int32_t height, int32_t refresh)
  3279. {
  3280. wl_resource_post_event(resource_, WL_OUTPUT_MODE, flags, width, height, refresh);
  3281. }
  3282. /**
  3283. * @ingroup iface_wl_output
  3284. * Sends an done event to the client owning the resource.
  3285. * @param resource_ The client's resource
  3286. */
  3287. static inline void
  3288. wl_output_send_done(struct wl_resource *resource_)
  3289. {
  3290. wl_resource_post_event(resource_, WL_OUTPUT_DONE);
  3291. }
  3292. /**
  3293. * @ingroup iface_wl_output
  3294. * Sends an scale event to the client owning the resource.
  3295. * @param resource_ The client's resource
  3296. * @param factor scaling factor of output
  3297. */
  3298. static inline void
  3299. wl_output_send_scale(struct wl_resource *resource_, int32_t factor)
  3300. {
  3301. wl_resource_post_event(resource_, WL_OUTPUT_SCALE, factor);
  3302. }
  3303. /**
  3304. * @ingroup iface_wl_region
  3305. * @struct wl_region_interface
  3306. */
  3307. struct wl_region_interface {
  3308. /**
  3309. * destroy region
  3310. *
  3311. * Destroy the region. This will invalidate the object ID.
  3312. */
  3313. void (*destroy)(struct wl_client *client,
  3314. struct wl_resource *resource);
  3315. /**
  3316. * add rectangle to region
  3317. *
  3318. * Add the specified rectangle to the region.
  3319. */
  3320. void (*add)(struct wl_client *client,
  3321. struct wl_resource *resource,
  3322. int32_t x,
  3323. int32_t y,
  3324. int32_t width,
  3325. int32_t height);
  3326. /**
  3327. * subtract rectangle from region
  3328. *
  3329. * Subtract the specified rectangle from the region.
  3330. */
  3331. void (*subtract)(struct wl_client *client,
  3332. struct wl_resource *resource,
  3333. int32_t x,
  3334. int32_t y,
  3335. int32_t width,
  3336. int32_t height);
  3337. };
  3338. #ifndef WL_SUBCOMPOSITOR_ERROR_ENUM
  3339. #define WL_SUBCOMPOSITOR_ERROR_ENUM
  3340. enum wl_subcompositor_error {
  3341. /**
  3342. * the to-be sub-surface is invalid
  3343. */
  3344. WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE = 0,
  3345. };
  3346. #endif /* WL_SUBCOMPOSITOR_ERROR_ENUM */
  3347. /**
  3348. * @ingroup iface_wl_subcompositor
  3349. * @struct wl_subcompositor_interface
  3350. */
  3351. struct wl_subcompositor_interface {
  3352. /**
  3353. * unbind from the subcompositor interface
  3354. *
  3355. * Informs the server that the client will not be using this
  3356. * protocol object anymore. This does not affect any other objects,
  3357. * wl_subsurface objects included.
  3358. */
  3359. void (*destroy)(struct wl_client *client,
  3360. struct wl_resource *resource);
  3361. /**
  3362. * give a surface the role sub-surface
  3363. *
  3364. * Create a sub-surface interface for the given surface, and
  3365. * associate it with the given parent surface. This turns a plain
  3366. * wl_surface into a sub-surface.
  3367. *
  3368. * The to-be sub-surface must not already have another role, and it
  3369. * must not have an existing wl_subsurface object. Otherwise a
  3370. * protocol error is raised.
  3371. * @param id the new subsurface object ID
  3372. * @param surface the surface to be turned into a sub-surface
  3373. * @param parent the parent surface
  3374. */
  3375. void (*get_subsurface)(struct wl_client *client,
  3376. struct wl_resource *resource,
  3377. uint32_t id,
  3378. struct wl_resource *surface,
  3379. struct wl_resource *parent);
  3380. };
  3381. #ifndef WL_SUBSURFACE_ERROR_ENUM
  3382. #define WL_SUBSURFACE_ERROR_ENUM
  3383. enum wl_subsurface_error {
  3384. /**
  3385. * wl_surface is not a sibling or the parent
  3386. */
  3387. WL_SUBSURFACE_ERROR_BAD_SURFACE = 0,
  3388. };
  3389. #endif /* WL_SUBSURFACE_ERROR_ENUM */
  3390. /**
  3391. * @ingroup iface_wl_subsurface
  3392. * @struct wl_subsurface_interface
  3393. */
  3394. struct wl_subsurface_interface {
  3395. /**
  3396. * remove sub-surface interface
  3397. *
  3398. * The sub-surface interface is removed from the wl_surface
  3399. * object that was turned into a sub-surface with a
  3400. * wl_subcompositor.get_subsurface request. The wl_surface's
  3401. * association to the parent is deleted, and the wl_surface loses
  3402. * its role as a sub-surface. The wl_surface is unmapped.
  3403. */
  3404. void (*destroy)(struct wl_client *client,
  3405. struct wl_resource *resource);
  3406. /**
  3407. * reposition the sub-surface
  3408. *
  3409. * This schedules a sub-surface position change. The sub-surface
  3410. * will be moved so that its origin (top left corner pixel) will be
  3411. * at the location x, y of the parent surface coordinate system.
  3412. * The coordinates are not restricted to the parent surface area.
  3413. * Negative values are allowed.
  3414. *
  3415. * The scheduled coordinates will take effect whenever the state of
  3416. * the parent surface is applied. When this happens depends on
  3417. * whether the parent surface is in synchronized mode or not. See
  3418. * wl_subsurface.set_sync and wl_subsurface.set_desync for details.
  3419. *
  3420. * If more than one set_position request is invoked by the client
  3421. * before the commit of the parent surface, the position of a new
  3422. * request always replaces the scheduled position from any previous
  3423. * request.
  3424. *
  3425. * The initial position is 0, 0.
  3426. * @param x x coordinate in the parent surface
  3427. * @param y y coordinate in the parent surface
  3428. */
  3429. void (*set_position)(struct wl_client *client,
  3430. struct wl_resource *resource,
  3431. int32_t x,
  3432. int32_t y);
  3433. /**
  3434. * restack the sub-surface
  3435. *
  3436. * This sub-surface is taken from the stack, and put back just
  3437. * above the reference surface, changing the z-order of the
  3438. * sub-surfaces. The reference surface must be one of the sibling
  3439. * surfaces, or the parent surface. Using any other surface,
  3440. * including this sub-surface, will cause a protocol error.
  3441. *
  3442. * The z-order is double-buffered. Requests are handled in order
  3443. * and applied immediately to a pending state. The final pending
  3444. * state is copied to the active state the next time the state of
  3445. * the parent surface is applied. When this happens depends on
  3446. * whether the parent surface is in synchronized mode or not. See
  3447. * wl_subsurface.set_sync and wl_subsurface.set_desync for details.
  3448. *
  3449. * A new sub-surface is initially added as the top-most in the
  3450. * stack of its siblings and parent.
  3451. * @param sibling the reference surface
  3452. */
  3453. void (*place_above)(struct wl_client *client,
  3454. struct wl_resource *resource,
  3455. struct wl_resource *sibling);
  3456. /**
  3457. * restack the sub-surface
  3458. *
  3459. * The sub-surface is placed just below the reference surface.
  3460. * See wl_subsurface.place_above.
  3461. * @param sibling the reference surface
  3462. */
  3463. void (*place_below)(struct wl_client *client,
  3464. struct wl_resource *resource,
  3465. struct wl_resource *sibling);
  3466. /**
  3467. * set sub-surface to synchronized mode
  3468. *
  3469. * Change the commit behaviour of the sub-surface to synchronized
  3470. * mode, also described as the parent dependent mode.
  3471. *
  3472. * In synchronized mode, wl_surface.commit on a sub-surface will
  3473. * accumulate the committed state in a cache, but the state will
  3474. * not be applied and hence will not change the compositor output.
  3475. * The cached state is applied to the sub-surface immediately after
  3476. * the parent surface's state is applied. This ensures atomic
  3477. * updates of the parent and all its synchronized sub-surfaces.
  3478. * Applying the cached state will invalidate the cache, so further
  3479. * parent surface commits do not (re-)apply old state.
  3480. *
  3481. * See wl_subsurface for the recursive effect of this mode.
  3482. */
  3483. void (*set_sync)(struct wl_client *client,
  3484. struct wl_resource *resource);
  3485. /**
  3486. * set sub-surface to desynchronized mode
  3487. *
  3488. * Change the commit behaviour of the sub-surface to
  3489. * desynchronized mode, also described as independent or freely
  3490. * running mode.
  3491. *
  3492. * In desynchronized mode, wl_surface.commit on a sub-surface will
  3493. * apply the pending state directly, without caching, as happens
  3494. * normally with a wl_surface. Calling wl_surface.commit on the
  3495. * parent surface has no effect on the sub-surface's wl_surface
  3496. * state. This mode allows a sub-surface to be updated on its own.
  3497. *
  3498. * If cached state exists when wl_surface.commit is called in
  3499. * desynchronized mode, the pending state is added to the cached
  3500. * state, and applied as a whole. This invalidates the cache.
  3501. *
  3502. * Note: even if a sub-surface is set to desynchronized, a parent
  3503. * sub-surface may override it to behave as synchronized. For
  3504. * details, see wl_subsurface.
  3505. *
  3506. * If a surface's parent surface behaves as desynchronized, then
  3507. * the cached state is applied on set_desync.
  3508. */
  3509. void (*set_desync)(struct wl_client *client,
  3510. struct wl_resource *resource);
  3511. };
  3512. #ifdef __cplusplus
  3513. }
  3514. #endif
  3515. #endif