wayland-client-protocol.h 159 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961
  1. /* Generated by wayland-scanner 1.11.0 */
  2. #ifndef WAYLAND_CLIENT_PROTOCOL_H
  3. #define WAYLAND_CLIENT_PROTOCOL_H
  4. #include <stdint.h>
  5. #include <stddef.h>
  6. #include "wayland-client.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. /**
  11. * @page page_wayland The wayland protocol
  12. * @section page_ifaces_wayland Interfaces
  13. * - @subpage page_iface_wl_display - core global object
  14. * - @subpage page_iface_wl_registry - global registry object
  15. * - @subpage page_iface_wl_callback - callback object
  16. * - @subpage page_iface_wl_compositor - the compositor singleton
  17. * - @subpage page_iface_wl_shm_pool - a shared memory pool
  18. * - @subpage page_iface_wl_shm - shared memory support
  19. * - @subpage page_iface_wl_buffer - content for a wl_surface
  20. * - @subpage page_iface_wl_data_offer - offer to transfer data
  21. * - @subpage page_iface_wl_data_source - offer to transfer data
  22. * - @subpage page_iface_wl_data_device - data transfer device
  23. * - @subpage page_iface_wl_data_device_manager - data transfer interface
  24. * - @subpage page_iface_wl_shell - create desktop-style surfaces
  25. * - @subpage page_iface_wl_shell_surface - desktop-style metadata interface
  26. * - @subpage page_iface_wl_surface - an onscreen surface
  27. * - @subpage page_iface_wl_seat - group of input devices
  28. * - @subpage page_iface_wl_pointer - pointer input device
  29. * - @subpage page_iface_wl_keyboard - keyboard input device
  30. * - @subpage page_iface_wl_touch - touchscreen input device
  31. * - @subpage page_iface_wl_output - compositor output region
  32. * - @subpage page_iface_wl_region - region interface
  33. * - @subpage page_iface_wl_subcompositor - sub-surface compositing
  34. * - @subpage page_iface_wl_subsurface - sub-surface interface to a wl_surface
  35. * @section page_copyright_wayland Copyright
  36. * <pre>
  37. *
  38. * Copyright © 2008-2011 Kristian Høgsberg
  39. * Copyright © 2010-2011 Intel Corporation
  40. * Copyright © 2012-2013 Collabora, Ltd.
  41. *
  42. * Permission is hereby granted, free of charge, to any person
  43. * obtaining a copy of this software and associated documentation files
  44. * (the "Software"), to deal in the Software without restriction,
  45. * including without limitation the rights to use, copy, modify, merge,
  46. * publish, distribute, sublicense, and/or sell copies of the Software,
  47. * and to permit persons to whom the Software is furnished to do so,
  48. * subject to the following conditions:
  49. *
  50. * The above copyright notice and this permission notice (including the
  51. * next paragraph) shall be included in all copies or substantial
  52. * portions of the Software.
  53. *
  54. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  55. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  56. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  57. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  58. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  59. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  60. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  61. * SOFTWARE.
  62. * </pre>
  63. */
  64. struct wl_buffer;
  65. struct wl_callback;
  66. struct wl_compositor;
  67. struct wl_data_device;
  68. struct wl_data_device_manager;
  69. struct wl_data_offer;
  70. struct wl_data_source;
  71. struct wl_display;
  72. struct wl_keyboard;
  73. struct wl_output;
  74. struct wl_pointer;
  75. struct wl_region;
  76. struct wl_registry;
  77. struct wl_seat;
  78. struct wl_shell;
  79. struct wl_shell_surface;
  80. struct wl_shm;
  81. struct wl_shm_pool;
  82. struct wl_subcompositor;
  83. struct wl_subsurface;
  84. struct wl_surface;
  85. struct wl_touch;
  86. /**
  87. * @page page_iface_wl_display wl_display
  88. * @section page_iface_wl_display_desc Description
  89. *
  90. * The core global object. This is a special singleton object. It
  91. * is used for internal Wayland protocol features.
  92. * @section page_iface_wl_display_api API
  93. * See @ref iface_wl_display.
  94. */
  95. /**
  96. * @defgroup iface_wl_display The wl_display interface
  97. *
  98. * The core global object. This is a special singleton object. It
  99. * is used for internal Wayland protocol features.
  100. */
  101. extern const struct wl_interface wl_display_interface;
  102. /**
  103. * @page page_iface_wl_registry wl_registry
  104. * @section page_iface_wl_registry_desc Description
  105. *
  106. * The global registry object. The server has a number of global
  107. * objects that are available to all clients. These objects
  108. * typically represent an actual object in the server (for example,
  109. * an input device) or they are singleton objects that provide
  110. * extension functionality.
  111. *
  112. * When a client creates a registry object, the registry object
  113. * will emit a global event for each global currently in the
  114. * registry. Globals come and go as a result of device or
  115. * monitor hotplugs, reconfiguration or other events, and the
  116. * registry will send out global and global_remove events to
  117. * keep the client up to date with the changes. To mark the end
  118. * of the initial burst of events, the client can use the
  119. * wl_display.sync request immediately after calling
  120. * wl_display.get_registry.
  121. *
  122. * A client can bind to a global object by using the bind
  123. * request. This creates a client-side handle that lets the object
  124. * emit events to the client and lets the client invoke requests on
  125. * the object.
  126. * @section page_iface_wl_registry_api API
  127. * See @ref iface_wl_registry.
  128. */
  129. /**
  130. * @defgroup iface_wl_registry The wl_registry interface
  131. *
  132. * The global registry object. The server has a number of global
  133. * objects that are available to all clients. These objects
  134. * typically represent an actual object in the server (for example,
  135. * an input device) or they are singleton objects that provide
  136. * extension functionality.
  137. *
  138. * When a client creates a registry object, the registry object
  139. * will emit a global event for each global currently in the
  140. * registry. Globals come and go as a result of device or
  141. * monitor hotplugs, reconfiguration or other events, and the
  142. * registry will send out global and global_remove events to
  143. * keep the client up to date with the changes. To mark the end
  144. * of the initial burst of events, the client can use the
  145. * wl_display.sync request immediately after calling
  146. * wl_display.get_registry.
  147. *
  148. * A client can bind to a global object by using the bind
  149. * request. This creates a client-side handle that lets the object
  150. * emit events to the client and lets the client invoke requests on
  151. * the object.
  152. */
  153. extern const struct wl_interface wl_registry_interface;
  154. /**
  155. * @page page_iface_wl_callback wl_callback
  156. * @section page_iface_wl_callback_desc Description
  157. *
  158. * Clients can handle the 'done' event to get notified when
  159. * the related request is done.
  160. * @section page_iface_wl_callback_api API
  161. * See @ref iface_wl_callback.
  162. */
  163. /**
  164. * @defgroup iface_wl_callback The wl_callback interface
  165. *
  166. * Clients can handle the 'done' event to get notified when
  167. * the related request is done.
  168. */
  169. extern const struct wl_interface wl_callback_interface;
  170. /**
  171. * @page page_iface_wl_compositor wl_compositor
  172. * @section page_iface_wl_compositor_desc Description
  173. *
  174. * A compositor. This object is a singleton global. The
  175. * compositor is in charge of combining the contents of multiple
  176. * surfaces into one displayable output.
  177. * @section page_iface_wl_compositor_api API
  178. * See @ref iface_wl_compositor.
  179. */
  180. /**
  181. * @defgroup iface_wl_compositor The wl_compositor interface
  182. *
  183. * A compositor. This object is a singleton global. The
  184. * compositor is in charge of combining the contents of multiple
  185. * surfaces into one displayable output.
  186. */
  187. extern const struct wl_interface wl_compositor_interface;
  188. /**
  189. * @page page_iface_wl_shm_pool wl_shm_pool
  190. * @section page_iface_wl_shm_pool_desc Description
  191. *
  192. * The wl_shm_pool object encapsulates a piece of memory shared
  193. * between the compositor and client. Through the wl_shm_pool
  194. * object, the client can allocate shared memory wl_buffer objects.
  195. * All objects created through the same pool share the same
  196. * underlying mapped memory. Reusing the mapped memory avoids the
  197. * setup/teardown overhead and is useful when interactively resizing
  198. * a surface or for many small buffers.
  199. * @section page_iface_wl_shm_pool_api API
  200. * See @ref iface_wl_shm_pool.
  201. */
  202. /**
  203. * @defgroup iface_wl_shm_pool The wl_shm_pool interface
  204. *
  205. * The wl_shm_pool object encapsulates a piece of memory shared
  206. * between the compositor and client. Through the wl_shm_pool
  207. * object, the client can allocate shared memory wl_buffer objects.
  208. * All objects created through the same pool share the same
  209. * underlying mapped memory. Reusing the mapped memory avoids the
  210. * setup/teardown overhead and is useful when interactively resizing
  211. * a surface or for many small buffers.
  212. */
  213. extern const struct wl_interface wl_shm_pool_interface;
  214. /**
  215. * @page page_iface_wl_shm wl_shm
  216. * @section page_iface_wl_shm_desc Description
  217. *
  218. * A global singleton object that provides support for shared
  219. * memory.
  220. *
  221. * Clients can create wl_shm_pool objects using the create_pool
  222. * request.
  223. *
  224. * At connection setup time, the wl_shm object emits one or more
  225. * format events to inform clients about the valid pixel formats
  226. * that can be used for buffers.
  227. * @section page_iface_wl_shm_api API
  228. * See @ref iface_wl_shm.
  229. */
  230. /**
  231. * @defgroup iface_wl_shm The wl_shm interface
  232. *
  233. * A global singleton object that provides support for shared
  234. * memory.
  235. *
  236. * Clients can create wl_shm_pool objects using the create_pool
  237. * request.
  238. *
  239. * At connection setup time, the wl_shm object emits one or more
  240. * format events to inform clients about the valid pixel formats
  241. * that can be used for buffers.
  242. */
  243. extern const struct wl_interface wl_shm_interface;
  244. /**
  245. * @page page_iface_wl_buffer wl_buffer
  246. * @section page_iface_wl_buffer_desc Description
  247. *
  248. * A buffer provides the content for a wl_surface. Buffers are
  249. * created through factory interfaces such as wl_drm, wl_shm or
  250. * similar. It has a width and a height and can be attached to a
  251. * wl_surface, but the mechanism by which a client provides and
  252. * updates the contents is defined by the buffer factory interface.
  253. * @section page_iface_wl_buffer_api API
  254. * See @ref iface_wl_buffer.
  255. */
  256. /**
  257. * @defgroup iface_wl_buffer The wl_buffer interface
  258. *
  259. * A buffer provides the content for a wl_surface. Buffers are
  260. * created through factory interfaces such as wl_drm, wl_shm or
  261. * similar. It has a width and a height and can be attached to a
  262. * wl_surface, but the mechanism by which a client provides and
  263. * updates the contents is defined by the buffer factory interface.
  264. */
  265. extern const struct wl_interface wl_buffer_interface;
  266. /**
  267. * @page page_iface_wl_data_offer wl_data_offer
  268. * @section page_iface_wl_data_offer_desc Description
  269. *
  270. * A wl_data_offer represents a piece of data offered for transfer
  271. * by another client (the source client). It is used by the
  272. * copy-and-paste and drag-and-drop mechanisms. The offer
  273. * describes the different mime types that the data can be
  274. * converted to and provides the mechanism for transferring the
  275. * data directly from the source client.
  276. * @section page_iface_wl_data_offer_api API
  277. * See @ref iface_wl_data_offer.
  278. */
  279. /**
  280. * @defgroup iface_wl_data_offer The wl_data_offer interface
  281. *
  282. * A wl_data_offer represents a piece of data offered for transfer
  283. * by another client (the source client). It is used by the
  284. * copy-and-paste and drag-and-drop mechanisms. The offer
  285. * describes the different mime types that the data can be
  286. * converted to and provides the mechanism for transferring the
  287. * data directly from the source client.
  288. */
  289. extern const struct wl_interface wl_data_offer_interface;
  290. /**
  291. * @page page_iface_wl_data_source wl_data_source
  292. * @section page_iface_wl_data_source_desc Description
  293. *
  294. * The wl_data_source object is the source side of a wl_data_offer.
  295. * It is created by the source client in a data transfer and
  296. * provides a way to describe the offered data and a way to respond
  297. * to requests to transfer the data.
  298. * @section page_iface_wl_data_source_api API
  299. * See @ref iface_wl_data_source.
  300. */
  301. /**
  302. * @defgroup iface_wl_data_source The wl_data_source interface
  303. *
  304. * The wl_data_source object is the source side of a wl_data_offer.
  305. * It is created by the source client in a data transfer and
  306. * provides a way to describe the offered data and a way to respond
  307. * to requests to transfer the data.
  308. */
  309. extern const struct wl_interface wl_data_source_interface;
  310. /**
  311. * @page page_iface_wl_data_device wl_data_device
  312. * @section page_iface_wl_data_device_desc Description
  313. *
  314. * There is one wl_data_device per seat which can be obtained
  315. * from the global wl_data_device_manager singleton.
  316. *
  317. * A wl_data_device provides access to inter-client data transfer
  318. * mechanisms such as copy-and-paste and drag-and-drop.
  319. * @section page_iface_wl_data_device_api API
  320. * See @ref iface_wl_data_device.
  321. */
  322. /**
  323. * @defgroup iface_wl_data_device The wl_data_device interface
  324. *
  325. * There is one wl_data_device per seat which can be obtained
  326. * from the global wl_data_device_manager singleton.
  327. *
  328. * A wl_data_device provides access to inter-client data transfer
  329. * mechanisms such as copy-and-paste and drag-and-drop.
  330. */
  331. extern const struct wl_interface wl_data_device_interface;
  332. /**
  333. * @page page_iface_wl_data_device_manager wl_data_device_manager
  334. * @section page_iface_wl_data_device_manager_desc Description
  335. *
  336. * The wl_data_device_manager is a singleton global object that
  337. * provides access to inter-client data transfer mechanisms such as
  338. * copy-and-paste and drag-and-drop. These mechanisms are tied to
  339. * a wl_seat and this interface lets a client get a wl_data_device
  340. * corresponding to a wl_seat.
  341. *
  342. * Depending on the version bound, the objects created from the bound
  343. * wl_data_device_manager object will have different requirements for
  344. * functioning properly. See wl_data_source.set_actions,
  345. * wl_data_offer.accept and wl_data_offer.finish for details.
  346. * @section page_iface_wl_data_device_manager_api API
  347. * See @ref iface_wl_data_device_manager.
  348. */
  349. /**
  350. * @defgroup iface_wl_data_device_manager The wl_data_device_manager interface
  351. *
  352. * The wl_data_device_manager is a singleton global object that
  353. * provides access to inter-client data transfer mechanisms such as
  354. * copy-and-paste and drag-and-drop. These mechanisms are tied to
  355. * a wl_seat and this interface lets a client get a wl_data_device
  356. * corresponding to a wl_seat.
  357. *
  358. * Depending on the version bound, the objects created from the bound
  359. * wl_data_device_manager object will have different requirements for
  360. * functioning properly. See wl_data_source.set_actions,
  361. * wl_data_offer.accept and wl_data_offer.finish for details.
  362. */
  363. extern const struct wl_interface wl_data_device_manager_interface;
  364. /**
  365. * @page page_iface_wl_shell wl_shell
  366. * @section page_iface_wl_shell_desc Description
  367. *
  368. * This interface is implemented by servers that provide
  369. * desktop-style user interfaces.
  370. *
  371. * It allows clients to associate a wl_shell_surface with
  372. * a basic surface.
  373. * @section page_iface_wl_shell_api API
  374. * See @ref iface_wl_shell.
  375. */
  376. /**
  377. * @defgroup iface_wl_shell The wl_shell interface
  378. *
  379. * This interface is implemented by servers that provide
  380. * desktop-style user interfaces.
  381. *
  382. * It allows clients to associate a wl_shell_surface with
  383. * a basic surface.
  384. */
  385. extern const struct wl_interface wl_shell_interface;
  386. /**
  387. * @page page_iface_wl_shell_surface wl_shell_surface
  388. * @section page_iface_wl_shell_surface_desc Description
  389. *
  390. * An interface that may be implemented by a wl_surface, for
  391. * implementations that provide a desktop-style user interface.
  392. *
  393. * It provides requests to treat surfaces like toplevel, fullscreen
  394. * or popup windows, move, resize or maximize them, associate
  395. * metadata like title and class, etc.
  396. *
  397. * On the server side the object is automatically destroyed when
  398. * the related wl_surface is destroyed. On the client side,
  399. * wl_shell_surface_destroy() must be called before destroying
  400. * the wl_surface object.
  401. * @section page_iface_wl_shell_surface_api API
  402. * See @ref iface_wl_shell_surface.
  403. */
  404. /**
  405. * @defgroup iface_wl_shell_surface The wl_shell_surface interface
  406. *
  407. * An interface that may be implemented by a wl_surface, for
  408. * implementations that provide a desktop-style user interface.
  409. *
  410. * It provides requests to treat surfaces like toplevel, fullscreen
  411. * or popup windows, move, resize or maximize them, associate
  412. * metadata like title and class, etc.
  413. *
  414. * On the server side the object is automatically destroyed when
  415. * the related wl_surface is destroyed. On the client side,
  416. * wl_shell_surface_destroy() must be called before destroying
  417. * the wl_surface object.
  418. */
  419. extern const struct wl_interface wl_shell_surface_interface;
  420. /**
  421. * @page page_iface_wl_surface wl_surface
  422. * @section page_iface_wl_surface_desc Description
  423. *
  424. * A surface is a rectangular area that is displayed on the screen.
  425. * It has a location, size and pixel contents.
  426. *
  427. * The size of a surface (and relative positions on it) is described
  428. * in surface-local coordinates, which may differ from the buffer
  429. * coordinates of the pixel content, in case a buffer_transform
  430. * or a buffer_scale is used.
  431. *
  432. * A surface without a "role" is fairly useless: a compositor does
  433. * not know where, when or how to present it. The role is the
  434. * purpose of a wl_surface. Examples of roles are a cursor for a
  435. * pointer (as set by wl_pointer.set_cursor), a drag icon
  436. * (wl_data_device.start_drag), a sub-surface
  437. * (wl_subcompositor.get_subsurface), and a window as defined by a
  438. * shell protocol (e.g. wl_shell.get_shell_surface).
  439. *
  440. * A surface can have only one role at a time. Initially a
  441. * wl_surface does not have a role. Once a wl_surface is given a
  442. * role, it is set permanently for the whole lifetime of the
  443. * wl_surface object. Giving the current role again is allowed,
  444. * unless explicitly forbidden by the relevant interface
  445. * specification.
  446. *
  447. * Surface roles are given by requests in other interfaces such as
  448. * wl_pointer.set_cursor. The request should explicitly mention
  449. * that this request gives a role to a wl_surface. Often, this
  450. * request also creates a new protocol object that represents the
  451. * role and adds additional functionality to wl_surface. When a
  452. * client wants to destroy a wl_surface, they must destroy this 'role
  453. * object' before the wl_surface.
  454. *
  455. * Destroying the role object does not remove the role from the
  456. * wl_surface, but it may stop the wl_surface from "playing the role".
  457. * For instance, if a wl_subsurface object is destroyed, the wl_surface
  458. * it was created for will be unmapped and forget its position and
  459. * z-order. It is allowed to create a wl_subsurface for the same
  460. * wl_surface again, but it is not allowed to use the wl_surface as
  461. * a cursor (cursor is a different role than sub-surface, and role
  462. * switching is not allowed).
  463. * @section page_iface_wl_surface_api API
  464. * See @ref iface_wl_surface.
  465. */
  466. /**
  467. * @defgroup iface_wl_surface The wl_surface interface
  468. *
  469. * A surface is a rectangular area that is displayed on the screen.
  470. * It has a location, size and pixel contents.
  471. *
  472. * The size of a surface (and relative positions on it) is described
  473. * in surface-local coordinates, which may differ from the buffer
  474. * coordinates of the pixel content, in case a buffer_transform
  475. * or a buffer_scale is used.
  476. *
  477. * A surface without a "role" is fairly useless: a compositor does
  478. * not know where, when or how to present it. The role is the
  479. * purpose of a wl_surface. Examples of roles are a cursor for a
  480. * pointer (as set by wl_pointer.set_cursor), a drag icon
  481. * (wl_data_device.start_drag), a sub-surface
  482. * (wl_subcompositor.get_subsurface), and a window as defined by a
  483. * shell protocol (e.g. wl_shell.get_shell_surface).
  484. *
  485. * A surface can have only one role at a time. Initially a
  486. * wl_surface does not have a role. Once a wl_surface is given a
  487. * role, it is set permanently for the whole lifetime of the
  488. * wl_surface object. Giving the current role again is allowed,
  489. * unless explicitly forbidden by the relevant interface
  490. * specification.
  491. *
  492. * Surface roles are given by requests in other interfaces such as
  493. * wl_pointer.set_cursor. The request should explicitly mention
  494. * that this request gives a role to a wl_surface. Often, this
  495. * request also creates a new protocol object that represents the
  496. * role and adds additional functionality to wl_surface. When a
  497. * client wants to destroy a wl_surface, they must destroy this 'role
  498. * object' before the wl_surface.
  499. *
  500. * Destroying the role object does not remove the role from the
  501. * wl_surface, but it may stop the wl_surface from "playing the role".
  502. * For instance, if a wl_subsurface object is destroyed, the wl_surface
  503. * it was created for will be unmapped and forget its position and
  504. * z-order. It is allowed to create a wl_subsurface for the same
  505. * wl_surface again, but it is not allowed to use the wl_surface as
  506. * a cursor (cursor is a different role than sub-surface, and role
  507. * switching is not allowed).
  508. */
  509. extern const struct wl_interface wl_surface_interface;
  510. /**
  511. * @page page_iface_wl_seat wl_seat
  512. * @section page_iface_wl_seat_desc Description
  513. *
  514. * A seat is a group of keyboards, pointer and touch devices. This
  515. * object is published as a global during start up, or when such a
  516. * device is hot plugged. A seat typically has a pointer and
  517. * maintains a keyboard focus and a pointer focus.
  518. * @section page_iface_wl_seat_api API
  519. * See @ref iface_wl_seat.
  520. */
  521. /**
  522. * @defgroup iface_wl_seat The wl_seat interface
  523. *
  524. * A seat is a group of keyboards, pointer and touch devices. This
  525. * object is published as a global during start up, or when such a
  526. * device is hot plugged. A seat typically has a pointer and
  527. * maintains a keyboard focus and a pointer focus.
  528. */
  529. extern const struct wl_interface wl_seat_interface;
  530. /**
  531. * @page page_iface_wl_pointer wl_pointer
  532. * @section page_iface_wl_pointer_desc Description
  533. *
  534. * The wl_pointer interface represents one or more input devices,
  535. * such as mice, which control the pointer location and pointer_focus
  536. * of a seat.
  537. *
  538. * The wl_pointer interface generates motion, enter and leave
  539. * events for the surfaces that the pointer is located over,
  540. * and button and axis events for button presses, button releases
  541. * and scrolling.
  542. * @section page_iface_wl_pointer_api API
  543. * See @ref iface_wl_pointer.
  544. */
  545. /**
  546. * @defgroup iface_wl_pointer The wl_pointer interface
  547. *
  548. * The wl_pointer interface represents one or more input devices,
  549. * such as mice, which control the pointer location and pointer_focus
  550. * of a seat.
  551. *
  552. * The wl_pointer interface generates motion, enter and leave
  553. * events for the surfaces that the pointer is located over,
  554. * and button and axis events for button presses, button releases
  555. * and scrolling.
  556. */
  557. extern const struct wl_interface wl_pointer_interface;
  558. /**
  559. * @page page_iface_wl_keyboard wl_keyboard
  560. * @section page_iface_wl_keyboard_desc Description
  561. *
  562. * The wl_keyboard interface represents one or more keyboards
  563. * associated with a seat.
  564. * @section page_iface_wl_keyboard_api API
  565. * See @ref iface_wl_keyboard.
  566. */
  567. /**
  568. * @defgroup iface_wl_keyboard The wl_keyboard interface
  569. *
  570. * The wl_keyboard interface represents one or more keyboards
  571. * associated with a seat.
  572. */
  573. extern const struct wl_interface wl_keyboard_interface;
  574. /**
  575. * @page page_iface_wl_touch wl_touch
  576. * @section page_iface_wl_touch_desc Description
  577. *
  578. * The wl_touch interface represents a touchscreen
  579. * associated with a seat.
  580. *
  581. * Touch interactions can consist of one or more contacts.
  582. * For each contact, a series of events is generated, starting
  583. * with a down event, followed by zero or more motion events,
  584. * and ending with an up event. Events relating to the same
  585. * contact point can be identified by the ID of the sequence.
  586. * @section page_iface_wl_touch_api API
  587. * See @ref iface_wl_touch.
  588. */
  589. /**
  590. * @defgroup iface_wl_touch The wl_touch interface
  591. *
  592. * The wl_touch interface represents a touchscreen
  593. * associated with a seat.
  594. *
  595. * Touch interactions can consist of one or more contacts.
  596. * For each contact, a series of events is generated, starting
  597. * with a down event, followed by zero or more motion events,
  598. * and ending with an up event. Events relating to the same
  599. * contact point can be identified by the ID of the sequence.
  600. */
  601. extern const struct wl_interface wl_touch_interface;
  602. /**
  603. * @page page_iface_wl_output wl_output
  604. * @section page_iface_wl_output_desc Description
  605. *
  606. * An output describes part of the compositor geometry. The
  607. * compositor works in the 'compositor coordinate system' and an
  608. * output corresponds to a rectangular area in that space that is
  609. * actually visible. This typically corresponds to a monitor that
  610. * displays part of the compositor space. This object is published
  611. * as global during start up, or when a monitor is hotplugged.
  612. * @section page_iface_wl_output_api API
  613. * See @ref iface_wl_output.
  614. */
  615. /**
  616. * @defgroup iface_wl_output The wl_output interface
  617. *
  618. * An output describes part of the compositor geometry. The
  619. * compositor works in the 'compositor coordinate system' and an
  620. * output corresponds to a rectangular area in that space that is
  621. * actually visible. This typically corresponds to a monitor that
  622. * displays part of the compositor space. This object is published
  623. * as global during start up, or when a monitor is hotplugged.
  624. */
  625. extern const struct wl_interface wl_output_interface;
  626. /**
  627. * @page page_iface_wl_region wl_region
  628. * @section page_iface_wl_region_desc Description
  629. *
  630. * A region object describes an area.
  631. *
  632. * Region objects are used to describe the opaque and input
  633. * regions of a surface.
  634. * @section page_iface_wl_region_api API
  635. * See @ref iface_wl_region.
  636. */
  637. /**
  638. * @defgroup iface_wl_region The wl_region interface
  639. *
  640. * A region object describes an area.
  641. *
  642. * Region objects are used to describe the opaque and input
  643. * regions of a surface.
  644. */
  645. extern const struct wl_interface wl_region_interface;
  646. /**
  647. * @page page_iface_wl_subcompositor wl_subcompositor
  648. * @section page_iface_wl_subcompositor_desc Description
  649. *
  650. * The global interface exposing sub-surface compositing capabilities.
  651. * A wl_surface, that has sub-surfaces associated, is called the
  652. * parent surface. Sub-surfaces can be arbitrarily nested and create
  653. * a tree of sub-surfaces.
  654. *
  655. * The root surface in a tree of sub-surfaces is the main
  656. * surface. The main surface cannot be a sub-surface, because
  657. * sub-surfaces must always have a parent.
  658. *
  659. * A main surface with its sub-surfaces forms a (compound) window.
  660. * For window management purposes, this set of wl_surface objects is
  661. * to be considered as a single window, and it should also behave as
  662. * such.
  663. *
  664. * The aim of sub-surfaces is to offload some of the compositing work
  665. * within a window from clients to the compositor. A prime example is
  666. * a video player with decorations and video in separate wl_surface
  667. * objects. This should allow the compositor to pass YUV video buffer
  668. * processing to dedicated overlay hardware when possible.
  669. * @section page_iface_wl_subcompositor_api API
  670. * See @ref iface_wl_subcompositor.
  671. */
  672. /**
  673. * @defgroup iface_wl_subcompositor The wl_subcompositor interface
  674. *
  675. * The global interface exposing sub-surface compositing capabilities.
  676. * A wl_surface, that has sub-surfaces associated, is called the
  677. * parent surface. Sub-surfaces can be arbitrarily nested and create
  678. * a tree of sub-surfaces.
  679. *
  680. * The root surface in a tree of sub-surfaces is the main
  681. * surface. The main surface cannot be a sub-surface, because
  682. * sub-surfaces must always have a parent.
  683. *
  684. * A main surface with its sub-surfaces forms a (compound) window.
  685. * For window management purposes, this set of wl_surface objects is
  686. * to be considered as a single window, and it should also behave as
  687. * such.
  688. *
  689. * The aim of sub-surfaces is to offload some of the compositing work
  690. * within a window from clients to the compositor. A prime example is
  691. * a video player with decorations and video in separate wl_surface
  692. * objects. This should allow the compositor to pass YUV video buffer
  693. * processing to dedicated overlay hardware when possible.
  694. */
  695. extern const struct wl_interface wl_subcompositor_interface;
  696. /**
  697. * @page page_iface_wl_subsurface wl_subsurface
  698. * @section page_iface_wl_subsurface_desc Description
  699. *
  700. * An additional interface to a wl_surface object, which has been
  701. * made a sub-surface. A sub-surface has one parent surface. A
  702. * sub-surface's size and position are not limited to that of the parent.
  703. * Particularly, a sub-surface is not automatically clipped to its
  704. * parent's area.
  705. *
  706. * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
  707. * and the parent surface is mapped. The order of which one happens
  708. * first is irrelevant. A sub-surface is hidden if the parent becomes
  709. * hidden, or if a NULL wl_buffer is applied. These rules apply
  710. * recursively through the tree of surfaces.
  711. *
  712. * The behaviour of a wl_surface.commit request on a sub-surface
  713. * depends on the sub-surface's mode. The possible modes are
  714. * synchronized and desynchronized, see methods
  715. * wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
  716. * mode caches the wl_surface state to be applied when the parent's
  717. * state gets applied, and desynchronized mode applies the pending
  718. * wl_surface state directly. A sub-surface is initially in the
  719. * synchronized mode.
  720. *
  721. * Sub-surfaces have also other kind of state, which is managed by
  722. * wl_subsurface requests, as opposed to wl_surface requests. This
  723. * state includes the sub-surface position relative to the parent
  724. * surface (wl_subsurface.set_position), and the stacking order of
  725. * the parent and its sub-surfaces (wl_subsurface.place_above and
  726. * .place_below). This state is applied when the parent surface's
  727. * wl_surface state is applied, regardless of the sub-surface's mode.
  728. * As the exception, set_sync and set_desync are effective immediately.
  729. *
  730. * The main surface can be thought to be always in desynchronized mode,
  731. * since it does not have a parent in the sub-surfaces sense.
  732. *
  733. * Even if a sub-surface is in desynchronized mode, it will behave as
  734. * in synchronized mode, if its parent surface behaves as in
  735. * synchronized mode. This rule is applied recursively throughout the
  736. * tree of surfaces. This means, that one can set a sub-surface into
  737. * synchronized mode, and then assume that all its child and grand-child
  738. * sub-surfaces are synchronized, too, without explicitly setting them.
  739. *
  740. * If the wl_surface associated with the wl_subsurface is destroyed, the
  741. * wl_subsurface object becomes inert. Note, that destroying either object
  742. * takes effect immediately. If you need to synchronize the removal
  743. * of a sub-surface to the parent surface update, unmap the sub-surface
  744. * first by attaching a NULL wl_buffer, update parent, and then destroy
  745. * the sub-surface.
  746. *
  747. * If the parent wl_surface object is destroyed, the sub-surface is
  748. * unmapped.
  749. * @section page_iface_wl_subsurface_api API
  750. * See @ref iface_wl_subsurface.
  751. */
  752. /**
  753. * @defgroup iface_wl_subsurface The wl_subsurface interface
  754. *
  755. * An additional interface to a wl_surface object, which has been
  756. * made a sub-surface. A sub-surface has one parent surface. A
  757. * sub-surface's size and position are not limited to that of the parent.
  758. * Particularly, a sub-surface is not automatically clipped to its
  759. * parent's area.
  760. *
  761. * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
  762. * and the parent surface is mapped. The order of which one happens
  763. * first is irrelevant. A sub-surface is hidden if the parent becomes
  764. * hidden, or if a NULL wl_buffer is applied. These rules apply
  765. * recursively through the tree of surfaces.
  766. *
  767. * The behaviour of a wl_surface.commit request on a sub-surface
  768. * depends on the sub-surface's mode. The possible modes are
  769. * synchronized and desynchronized, see methods
  770. * wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
  771. * mode caches the wl_surface state to be applied when the parent's
  772. * state gets applied, and desynchronized mode applies the pending
  773. * wl_surface state directly. A sub-surface is initially in the
  774. * synchronized mode.
  775. *
  776. * Sub-surfaces have also other kind of state, which is managed by
  777. * wl_subsurface requests, as opposed to wl_surface requests. This
  778. * state includes the sub-surface position relative to the parent
  779. * surface (wl_subsurface.set_position), and the stacking order of
  780. * the parent and its sub-surfaces (wl_subsurface.place_above and
  781. * .place_below). This state is applied when the parent surface's
  782. * wl_surface state is applied, regardless of the sub-surface's mode.
  783. * As the exception, set_sync and set_desync are effective immediately.
  784. *
  785. * The main surface can be thought to be always in desynchronized mode,
  786. * since it does not have a parent in the sub-surfaces sense.
  787. *
  788. * Even if a sub-surface is in desynchronized mode, it will behave as
  789. * in synchronized mode, if its parent surface behaves as in
  790. * synchronized mode. This rule is applied recursively throughout the
  791. * tree of surfaces. This means, that one can set a sub-surface into
  792. * synchronized mode, and then assume that all its child and grand-child
  793. * sub-surfaces are synchronized, too, without explicitly setting them.
  794. *
  795. * If the wl_surface associated with the wl_subsurface is destroyed, the
  796. * wl_subsurface object becomes inert. Note, that destroying either object
  797. * takes effect immediately. If you need to synchronize the removal
  798. * of a sub-surface to the parent surface update, unmap the sub-surface
  799. * first by attaching a NULL wl_buffer, update parent, and then destroy
  800. * the sub-surface.
  801. *
  802. * If the parent wl_surface object is destroyed, the sub-surface is
  803. * unmapped.
  804. */
  805. extern const struct wl_interface wl_subsurface_interface;
  806. #ifndef WL_DISPLAY_ERROR_ENUM
  807. #define WL_DISPLAY_ERROR_ENUM
  808. /**
  809. * @ingroup iface_wl_display
  810. * global error values
  811. *
  812. * These errors are global and can be emitted in response to any
  813. * server request.
  814. */
  815. enum wl_display_error {
  816. /**
  817. * server couldn't find object
  818. */
  819. WL_DISPLAY_ERROR_INVALID_OBJECT = 0,
  820. /**
  821. * method doesn't exist on the specified interface
  822. */
  823. WL_DISPLAY_ERROR_INVALID_METHOD = 1,
  824. /**
  825. * server is out of memory
  826. */
  827. WL_DISPLAY_ERROR_NO_MEMORY = 2,
  828. };
  829. #endif /* WL_DISPLAY_ERROR_ENUM */
  830. /**
  831. * @ingroup iface_wl_display
  832. * @struct wl_display_listener
  833. */
  834. struct wl_display_listener {
  835. /**
  836. * fatal error event
  837. *
  838. * The error event is sent out when a fatal (non-recoverable)
  839. * error has occurred. The object_id argument is the object where
  840. * the error occurred, most often in response to a request to that
  841. * object. The code identifies the error and is defined by the
  842. * object interface. As such, each interface defines its own set of
  843. * error codes. The message is a brief description of the error,
  844. * for (debugging) convenience.
  845. * @param object_id object where the error occurred
  846. * @param code error code
  847. * @param message error description
  848. */
  849. void (*error)(void *data,
  850. struct wl_display *wl_display,
  851. void *object_id,
  852. uint32_t code,
  853. const char *message);
  854. /**
  855. * acknowledge object ID deletion
  856. *
  857. * This event is used internally by the object ID management
  858. * logic. When a client deletes an object, the server will send
  859. * this event to acknowledge that it has seen the delete request.
  860. * When the client receives this event, it will know that it can
  861. * safely reuse the object ID.
  862. * @param id deleted object id
  863. */
  864. void (*delete_id)(void *data,
  865. struct wl_display *wl_display,
  866. uint32_t id);
  867. };
  868. /**
  869. * @ingroup wl_display_iface
  870. */
  871. static inline int
  872. wl_display_add_listener(struct wl_display *wl_display,
  873. const struct wl_display_listener *listener, void *data)
  874. {
  875. return wl_proxy_add_listener((struct wl_proxy *) wl_display,
  876. (void (**)(void)) listener, data);
  877. }
  878. #define WL_DISPLAY_SYNC 0
  879. #define WL_DISPLAY_GET_REGISTRY 1
  880. /**
  881. * @ingroup iface_wl_display
  882. */
  883. #define WL_DISPLAY_SYNC_SINCE_VERSION 1
  884. /**
  885. * @ingroup iface_wl_display
  886. */
  887. #define WL_DISPLAY_GET_REGISTRY_SINCE_VERSION 1
  888. /** @ingroup iface_wl_display */
  889. static inline void
  890. wl_display_set_user_data(struct wl_display *wl_display, void *user_data)
  891. {
  892. wl_proxy_set_user_data((struct wl_proxy *) wl_display, user_data);
  893. }
  894. /** @ingroup iface_wl_display */
  895. static inline void *
  896. wl_display_get_user_data(struct wl_display *wl_display)
  897. {
  898. return wl_proxy_get_user_data((struct wl_proxy *) wl_display);
  899. }
  900. static inline uint32_t
  901. wl_display_get_version(struct wl_display *wl_display)
  902. {
  903. return wl_proxy_get_version((struct wl_proxy *) wl_display);
  904. }
  905. /**
  906. * @ingroup iface_wl_display
  907. *
  908. * The sync request asks the server to emit the 'done' event
  909. * on the returned wl_callback object. Since requests are
  910. * handled in-order and events are delivered in-order, this can
  911. * be used as a barrier to ensure all previous requests and the
  912. * resulting events have been handled.
  913. *
  914. * The object returned by this request will be destroyed by the
  915. * compositor after the callback is fired and as such the client must not
  916. * attempt to use it after that point.
  917. *
  918. * The callback_data passed in the callback is the event serial.
  919. */
  920. static inline struct wl_callback *
  921. wl_display_sync(struct wl_display *wl_display)
  922. {
  923. struct wl_proxy *callback;
  924. callback = wl_proxy_marshal_constructor((struct wl_proxy *) wl_display,
  925. WL_DISPLAY_SYNC, &wl_callback_interface, NULL);
  926. return (struct wl_callback *) callback;
  927. }
  928. /**
  929. * @ingroup iface_wl_display
  930. *
  931. * This request creates a registry object that allows the client
  932. * to list and bind the global objects available from the
  933. * compositor.
  934. */
  935. static inline struct wl_registry *
  936. wl_display_get_registry(struct wl_display *wl_display)
  937. {
  938. struct wl_proxy *registry;
  939. registry = wl_proxy_marshal_constructor((struct wl_proxy *) wl_display,
  940. WL_DISPLAY_GET_REGISTRY, &wl_registry_interface, NULL);
  941. return (struct wl_registry *) registry;
  942. }
  943. /**
  944. * @ingroup iface_wl_registry
  945. * @struct wl_registry_listener
  946. */
  947. struct wl_registry_listener {
  948. /**
  949. * announce global object
  950. *
  951. * Notify the client of global objects.
  952. *
  953. * The event notifies the client that a global object with the
  954. * given name is now available, and it implements the given version
  955. * of the given interface.
  956. * @param name numeric name of the global object
  957. * @param interface interface implemented by the object
  958. * @param version interface version
  959. */
  960. void (*global)(void *data,
  961. struct wl_registry *wl_registry,
  962. uint32_t name,
  963. const char *interface,
  964. uint32_t version);
  965. /**
  966. * announce removal of global object
  967. *
  968. * Notify the client of removed global objects.
  969. *
  970. * This event notifies the client that the global identified by
  971. * name is no longer available. If the client bound to the global
  972. * using the bind request, the client should now destroy that
  973. * object.
  974. *
  975. * The object remains valid and requests to the object will be
  976. * ignored until the client destroys it, to avoid races between the
  977. * global going away and a client sending a request to it.
  978. * @param name numeric name of the global object
  979. */
  980. void (*global_remove)(void *data,
  981. struct wl_registry *wl_registry,
  982. uint32_t name);
  983. };
  984. /**
  985. * @ingroup wl_registry_iface
  986. */
  987. static inline int
  988. wl_registry_add_listener(struct wl_registry *wl_registry,
  989. const struct wl_registry_listener *listener, void *data)
  990. {
  991. return wl_proxy_add_listener((struct wl_proxy *) wl_registry,
  992. (void (**)(void)) listener, data);
  993. }
  994. #define WL_REGISTRY_BIND 0
  995. /**
  996. * @ingroup iface_wl_registry
  997. */
  998. #define WL_REGISTRY_BIND_SINCE_VERSION 1
  999. /** @ingroup iface_wl_registry */
  1000. static inline void
  1001. wl_registry_set_user_data(struct wl_registry *wl_registry, void *user_data)
  1002. {
  1003. wl_proxy_set_user_data((struct wl_proxy *) wl_registry, user_data);
  1004. }
  1005. /** @ingroup iface_wl_registry */
  1006. static inline void *
  1007. wl_registry_get_user_data(struct wl_registry *wl_registry)
  1008. {
  1009. return wl_proxy_get_user_data((struct wl_proxy *) wl_registry);
  1010. }
  1011. static inline uint32_t
  1012. wl_registry_get_version(struct wl_registry *wl_registry)
  1013. {
  1014. return wl_proxy_get_version((struct wl_proxy *) wl_registry);
  1015. }
  1016. /** @ingroup iface_wl_registry */
  1017. static inline void
  1018. wl_registry_destroy(struct wl_registry *wl_registry)
  1019. {
  1020. wl_proxy_destroy((struct wl_proxy *) wl_registry);
  1021. }
  1022. /**
  1023. * @ingroup iface_wl_registry
  1024. *
  1025. * Binds a new, client-created object to the server using the
  1026. * specified name as the identifier.
  1027. */
  1028. static inline void *
  1029. wl_registry_bind(struct wl_registry *wl_registry, uint32_t name, const struct wl_interface *interface, uint32_t version)
  1030. {
  1031. struct wl_proxy *id;
  1032. id = wl_proxy_marshal_constructor_versioned((struct wl_proxy *) wl_registry,
  1033. WL_REGISTRY_BIND, interface, version, name, interface->name, version, NULL);
  1034. return (void *) id;
  1035. }
  1036. /**
  1037. * @ingroup iface_wl_callback
  1038. * @struct wl_callback_listener
  1039. */
  1040. struct wl_callback_listener {
  1041. /**
  1042. * done event
  1043. *
  1044. * Notify the client when the related request is done.
  1045. * @param callback_data request-specific data for the wl_callback
  1046. */
  1047. void (*done)(void *data,
  1048. struct wl_callback *wl_callback,
  1049. uint32_t callback_data);
  1050. };
  1051. /**
  1052. * @ingroup wl_callback_iface
  1053. */
  1054. static inline int
  1055. wl_callback_add_listener(struct wl_callback *wl_callback,
  1056. const struct wl_callback_listener *listener, void *data)
  1057. {
  1058. return wl_proxy_add_listener((struct wl_proxy *) wl_callback,
  1059. (void (**)(void)) listener, data);
  1060. }
  1061. /** @ingroup iface_wl_callback */
  1062. static inline void
  1063. wl_callback_set_user_data(struct wl_callback *wl_callback, void *user_data)
  1064. {
  1065. wl_proxy_set_user_data((struct wl_proxy *) wl_callback, user_data);
  1066. }
  1067. /** @ingroup iface_wl_callback */
  1068. static inline void *
  1069. wl_callback_get_user_data(struct wl_callback *wl_callback)
  1070. {
  1071. return wl_proxy_get_user_data((struct wl_proxy *) wl_callback);
  1072. }
  1073. static inline uint32_t
  1074. wl_callback_get_version(struct wl_callback *wl_callback)
  1075. {
  1076. return wl_proxy_get_version((struct wl_proxy *) wl_callback);
  1077. }
  1078. /** @ingroup iface_wl_callback */
  1079. static inline void
  1080. wl_callback_destroy(struct wl_callback *wl_callback)
  1081. {
  1082. wl_proxy_destroy((struct wl_proxy *) wl_callback);
  1083. }
  1084. #define WL_COMPOSITOR_CREATE_SURFACE 0
  1085. #define WL_COMPOSITOR_CREATE_REGION 1
  1086. /**
  1087. * @ingroup iface_wl_compositor
  1088. */
  1089. #define WL_COMPOSITOR_CREATE_SURFACE_SINCE_VERSION 1
  1090. /**
  1091. * @ingroup iface_wl_compositor
  1092. */
  1093. #define WL_COMPOSITOR_CREATE_REGION_SINCE_VERSION 1
  1094. /** @ingroup iface_wl_compositor */
  1095. static inline void
  1096. wl_compositor_set_user_data(struct wl_compositor *wl_compositor, void *user_data)
  1097. {
  1098. wl_proxy_set_user_data((struct wl_proxy *) wl_compositor, user_data);
  1099. }
  1100. /** @ingroup iface_wl_compositor */
  1101. static inline void *
  1102. wl_compositor_get_user_data(struct wl_compositor *wl_compositor)
  1103. {
  1104. return wl_proxy_get_user_data((struct wl_proxy *) wl_compositor);
  1105. }
  1106. static inline uint32_t
  1107. wl_compositor_get_version(struct wl_compositor *wl_compositor)
  1108. {
  1109. return wl_proxy_get_version((struct wl_proxy *) wl_compositor);
  1110. }
  1111. /** @ingroup iface_wl_compositor */
  1112. static inline void
  1113. wl_compositor_destroy(struct wl_compositor *wl_compositor)
  1114. {
  1115. wl_proxy_destroy((struct wl_proxy *) wl_compositor);
  1116. }
  1117. /**
  1118. * @ingroup iface_wl_compositor
  1119. *
  1120. * Ask the compositor to create a new surface.
  1121. */
  1122. static inline struct wl_surface *
  1123. wl_compositor_create_surface(struct wl_compositor *wl_compositor)
  1124. {
  1125. struct wl_proxy *id;
  1126. id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_compositor,
  1127. WL_COMPOSITOR_CREATE_SURFACE, &wl_surface_interface, NULL);
  1128. return (struct wl_surface *) id;
  1129. }
  1130. /**
  1131. * @ingroup iface_wl_compositor
  1132. *
  1133. * Ask the compositor to create a new region.
  1134. */
  1135. static inline struct wl_region *
  1136. wl_compositor_create_region(struct wl_compositor *wl_compositor)
  1137. {
  1138. struct wl_proxy *id;
  1139. id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_compositor,
  1140. WL_COMPOSITOR_CREATE_REGION, &wl_region_interface, NULL);
  1141. return (struct wl_region *) id;
  1142. }
  1143. #define WL_SHM_POOL_CREATE_BUFFER 0
  1144. #define WL_SHM_POOL_DESTROY 1
  1145. #define WL_SHM_POOL_RESIZE 2
  1146. /**
  1147. * @ingroup iface_wl_shm_pool
  1148. */
  1149. #define WL_SHM_POOL_CREATE_BUFFER_SINCE_VERSION 1
  1150. /**
  1151. * @ingroup iface_wl_shm_pool
  1152. */
  1153. #define WL_SHM_POOL_DESTROY_SINCE_VERSION 1
  1154. /**
  1155. * @ingroup iface_wl_shm_pool
  1156. */
  1157. #define WL_SHM_POOL_RESIZE_SINCE_VERSION 1
  1158. /** @ingroup iface_wl_shm_pool */
  1159. static inline void
  1160. wl_shm_pool_set_user_data(struct wl_shm_pool *wl_shm_pool, void *user_data)
  1161. {
  1162. wl_proxy_set_user_data((struct wl_proxy *) wl_shm_pool, user_data);
  1163. }
  1164. /** @ingroup iface_wl_shm_pool */
  1165. static inline void *
  1166. wl_shm_pool_get_user_data(struct wl_shm_pool *wl_shm_pool)
  1167. {
  1168. return wl_proxy_get_user_data((struct wl_proxy *) wl_shm_pool);
  1169. }
  1170. static inline uint32_t
  1171. wl_shm_pool_get_version(struct wl_shm_pool *wl_shm_pool)
  1172. {
  1173. return wl_proxy_get_version((struct wl_proxy *) wl_shm_pool);
  1174. }
  1175. /**
  1176. * @ingroup iface_wl_shm_pool
  1177. *
  1178. * Create a wl_buffer object from the pool.
  1179. *
  1180. * The buffer is created offset bytes into the pool and has
  1181. * width and height as specified. The stride argument specifies
  1182. * the number of bytes from the beginning of one row to the beginning
  1183. * of the next. The format is the pixel format of the buffer and
  1184. * must be one of those advertised through the wl_shm.format event.
  1185. *
  1186. * A buffer will keep a reference to the pool it was created from
  1187. * so it is valid to destroy the pool immediately after creating
  1188. * a buffer from it.
  1189. */
  1190. static inline struct wl_buffer *
  1191. wl_shm_pool_create_buffer(struct wl_shm_pool *wl_shm_pool, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format)
  1192. {
  1193. struct wl_proxy *id;
  1194. id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_shm_pool,
  1195. WL_SHM_POOL_CREATE_BUFFER, &wl_buffer_interface, NULL, offset, width, height, stride, format);
  1196. return (struct wl_buffer *) id;
  1197. }
  1198. /**
  1199. * @ingroup iface_wl_shm_pool
  1200. *
  1201. * Destroy the shared memory pool.
  1202. *
  1203. * The mmapped memory will be released when all
  1204. * buffers that have been created from this pool
  1205. * are gone.
  1206. */
  1207. static inline void
  1208. wl_shm_pool_destroy(struct wl_shm_pool *wl_shm_pool)
  1209. {
  1210. wl_proxy_marshal((struct wl_proxy *) wl_shm_pool,
  1211. WL_SHM_POOL_DESTROY);
  1212. wl_proxy_destroy((struct wl_proxy *) wl_shm_pool);
  1213. }
  1214. /**
  1215. * @ingroup iface_wl_shm_pool
  1216. *
  1217. * This request will cause the server to remap the backing memory
  1218. * for the pool from the file descriptor passed when the pool was
  1219. * created, but using the new size. This request can only be
  1220. * used to make the pool bigger.
  1221. */
  1222. static inline void
  1223. wl_shm_pool_resize(struct wl_shm_pool *wl_shm_pool, int32_t size)
  1224. {
  1225. wl_proxy_marshal((struct wl_proxy *) wl_shm_pool,
  1226. WL_SHM_POOL_RESIZE, size);
  1227. }
  1228. #ifndef WL_SHM_ERROR_ENUM
  1229. #define WL_SHM_ERROR_ENUM
  1230. /**
  1231. * @ingroup iface_wl_shm
  1232. * wl_shm error values
  1233. *
  1234. * These errors can be emitted in response to wl_shm requests.
  1235. */
  1236. enum wl_shm_error {
  1237. /**
  1238. * buffer format is not known
  1239. */
  1240. WL_SHM_ERROR_INVALID_FORMAT = 0,
  1241. /**
  1242. * invalid size or stride during pool or buffer creation
  1243. */
  1244. WL_SHM_ERROR_INVALID_STRIDE = 1,
  1245. /**
  1246. * mmapping the file descriptor failed
  1247. */
  1248. WL_SHM_ERROR_INVALID_FD = 2,
  1249. };
  1250. #endif /* WL_SHM_ERROR_ENUM */
  1251. #ifndef WL_SHM_FORMAT_ENUM
  1252. #define WL_SHM_FORMAT_ENUM
  1253. /**
  1254. * @ingroup iface_wl_shm
  1255. * pixel formats
  1256. *
  1257. * This describes the memory layout of an individual pixel.
  1258. *
  1259. * All renderers should support argb8888 and xrgb8888 but any other
  1260. * formats are optional and may not be supported by the particular
  1261. * renderer in use.
  1262. */
  1263. enum wl_shm_format {
  1264. /**
  1265. * 32-bit ARGB format
  1266. */
  1267. WL_SHM_FORMAT_ARGB8888 = 0,
  1268. /**
  1269. * 32-bit RGB format
  1270. */
  1271. WL_SHM_FORMAT_XRGB8888 = 1,
  1272. WL_SHM_FORMAT_C8 = 0x20203843,
  1273. WL_SHM_FORMAT_RGB332 = 0x38424752,
  1274. WL_SHM_FORMAT_BGR233 = 0x38524742,
  1275. WL_SHM_FORMAT_XRGB4444 = 0x32315258,
  1276. WL_SHM_FORMAT_XBGR4444 = 0x32314258,
  1277. WL_SHM_FORMAT_RGBX4444 = 0x32315852,
  1278. WL_SHM_FORMAT_BGRX4444 = 0x32315842,
  1279. WL_SHM_FORMAT_ARGB4444 = 0x32315241,
  1280. WL_SHM_FORMAT_ABGR4444 = 0x32314241,
  1281. WL_SHM_FORMAT_RGBA4444 = 0x32314152,
  1282. WL_SHM_FORMAT_BGRA4444 = 0x32314142,
  1283. WL_SHM_FORMAT_XRGB1555 = 0x35315258,
  1284. WL_SHM_FORMAT_XBGR1555 = 0x35314258,
  1285. WL_SHM_FORMAT_RGBX5551 = 0x35315852,
  1286. WL_SHM_FORMAT_BGRX5551 = 0x35315842,
  1287. WL_SHM_FORMAT_ARGB1555 = 0x35315241,
  1288. WL_SHM_FORMAT_ABGR1555 = 0x35314241,
  1289. WL_SHM_FORMAT_RGBA5551 = 0x35314152,
  1290. WL_SHM_FORMAT_BGRA5551 = 0x35314142,
  1291. WL_SHM_FORMAT_RGB565 = 0x36314752,
  1292. WL_SHM_FORMAT_BGR565 = 0x36314742,
  1293. WL_SHM_FORMAT_RGB888 = 0x34324752,
  1294. WL_SHM_FORMAT_BGR888 = 0x34324742,
  1295. WL_SHM_FORMAT_XBGR8888 = 0x34324258,
  1296. WL_SHM_FORMAT_RGBX8888 = 0x34325852,
  1297. WL_SHM_FORMAT_BGRX8888 = 0x34325842,
  1298. WL_SHM_FORMAT_ABGR8888 = 0x34324241,
  1299. WL_SHM_FORMAT_RGBA8888 = 0x34324152,
  1300. WL_SHM_FORMAT_BGRA8888 = 0x34324142,
  1301. WL_SHM_FORMAT_XRGB2101010 = 0x30335258,
  1302. WL_SHM_FORMAT_XBGR2101010 = 0x30334258,
  1303. WL_SHM_FORMAT_RGBX1010102 = 0x30335852,
  1304. WL_SHM_FORMAT_BGRX1010102 = 0x30335842,
  1305. WL_SHM_FORMAT_ARGB2101010 = 0x30335241,
  1306. WL_SHM_FORMAT_ABGR2101010 = 0x30334241,
  1307. WL_SHM_FORMAT_RGBA1010102 = 0x30334152,
  1308. WL_SHM_FORMAT_BGRA1010102 = 0x30334142,
  1309. WL_SHM_FORMAT_YUYV = 0x56595559,
  1310. WL_SHM_FORMAT_YVYU = 0x55595659,
  1311. WL_SHM_FORMAT_UYVY = 0x59565955,
  1312. WL_SHM_FORMAT_VYUY = 0x59555956,
  1313. WL_SHM_FORMAT_AYUV = 0x56555941,
  1314. WL_SHM_FORMAT_NV12 = 0x3231564e,
  1315. WL_SHM_FORMAT_NV21 = 0x3132564e,
  1316. WL_SHM_FORMAT_NV16 = 0x3631564e,
  1317. WL_SHM_FORMAT_NV61 = 0x3136564e,
  1318. WL_SHM_FORMAT_YUV410 = 0x39565559,
  1319. WL_SHM_FORMAT_YVU410 = 0x39555659,
  1320. WL_SHM_FORMAT_YUV411 = 0x31315559,
  1321. WL_SHM_FORMAT_YVU411 = 0x31315659,
  1322. WL_SHM_FORMAT_YUV420 = 0x32315559,
  1323. WL_SHM_FORMAT_YVU420 = 0x32315659,
  1324. WL_SHM_FORMAT_YUV422 = 0x36315559,
  1325. WL_SHM_FORMAT_YVU422 = 0x36315659,
  1326. WL_SHM_FORMAT_YUV444 = 0x34325559,
  1327. WL_SHM_FORMAT_YVU444 = 0x34325659,
  1328. };
  1329. #endif /* WL_SHM_FORMAT_ENUM */
  1330. /**
  1331. * @ingroup iface_wl_shm
  1332. * @struct wl_shm_listener
  1333. */
  1334. struct wl_shm_listener {
  1335. /**
  1336. * pixel format description
  1337. *
  1338. * Informs the client about a valid pixel format that can be used
  1339. * for buffers. Known formats include argb8888 and xrgb8888.
  1340. * @param format buffer pixel format
  1341. */
  1342. void (*format)(void *data,
  1343. struct wl_shm *wl_shm,
  1344. uint32_t format);
  1345. };
  1346. /**
  1347. * @ingroup wl_shm_iface
  1348. */
  1349. static inline int
  1350. wl_shm_add_listener(struct wl_shm *wl_shm,
  1351. const struct wl_shm_listener *listener, void *data)
  1352. {
  1353. return wl_proxy_add_listener((struct wl_proxy *) wl_shm,
  1354. (void (**)(void)) listener, data);
  1355. }
  1356. #define WL_SHM_CREATE_POOL 0
  1357. /**
  1358. * @ingroup iface_wl_shm
  1359. */
  1360. #define WL_SHM_CREATE_POOL_SINCE_VERSION 1
  1361. /** @ingroup iface_wl_shm */
  1362. static inline void
  1363. wl_shm_set_user_data(struct wl_shm *wl_shm, void *user_data)
  1364. {
  1365. wl_proxy_set_user_data((struct wl_proxy *) wl_shm, user_data);
  1366. }
  1367. /** @ingroup iface_wl_shm */
  1368. static inline void *
  1369. wl_shm_get_user_data(struct wl_shm *wl_shm)
  1370. {
  1371. return wl_proxy_get_user_data((struct wl_proxy *) wl_shm);
  1372. }
  1373. static inline uint32_t
  1374. wl_shm_get_version(struct wl_shm *wl_shm)
  1375. {
  1376. return wl_proxy_get_version((struct wl_proxy *) wl_shm);
  1377. }
  1378. /** @ingroup iface_wl_shm */
  1379. static inline void
  1380. wl_shm_destroy(struct wl_shm *wl_shm)
  1381. {
  1382. wl_proxy_destroy((struct wl_proxy *) wl_shm);
  1383. }
  1384. /**
  1385. * @ingroup iface_wl_shm
  1386. *
  1387. * Create a new wl_shm_pool object.
  1388. *
  1389. * The pool can be used to create shared memory based buffer
  1390. * objects. The server will mmap size bytes of the passed file
  1391. * descriptor, to use as backing memory for the pool.
  1392. */
  1393. static inline struct wl_shm_pool *
  1394. wl_shm_create_pool(struct wl_shm *wl_shm, int32_t fd, int32_t size)
  1395. {
  1396. struct wl_proxy *id;
  1397. id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_shm,
  1398. WL_SHM_CREATE_POOL, &wl_shm_pool_interface, NULL, fd, size);
  1399. return (struct wl_shm_pool *) id;
  1400. }
  1401. /**
  1402. * @ingroup iface_wl_buffer
  1403. * @struct wl_buffer_listener
  1404. */
  1405. struct wl_buffer_listener {
  1406. /**
  1407. * compositor releases buffer
  1408. *
  1409. * Sent when this wl_buffer is no longer used by the compositor.
  1410. * The client is now free to reuse or destroy this buffer and its
  1411. * backing storage.
  1412. *
  1413. * If a client receives a release event before the frame callback
  1414. * requested in the same wl_surface.commit that attaches this
  1415. * wl_buffer to a surface, then the client is immediately free to
  1416. * reuse the buffer and its backing storage, and does not need a
  1417. * second buffer for the next surface content update. Typically
  1418. * this is possible, when the compositor maintains a copy of the
  1419. * wl_surface contents, e.g. as a GL texture. This is an important
  1420. * optimization for GL(ES) compositors with wl_shm clients.
  1421. */
  1422. void (*release)(void *data,
  1423. struct wl_buffer *wl_buffer);
  1424. };
  1425. /**
  1426. * @ingroup wl_buffer_iface
  1427. */
  1428. static inline int
  1429. wl_buffer_add_listener(struct wl_buffer *wl_buffer,
  1430. const struct wl_buffer_listener *listener, void *data)
  1431. {
  1432. return wl_proxy_add_listener((struct wl_proxy *) wl_buffer,
  1433. (void (**)(void)) listener, data);
  1434. }
  1435. #define WL_BUFFER_DESTROY 0
  1436. /**
  1437. * @ingroup iface_wl_buffer
  1438. */
  1439. #define WL_BUFFER_DESTROY_SINCE_VERSION 1
  1440. /** @ingroup iface_wl_buffer */
  1441. static inline void
  1442. wl_buffer_set_user_data(struct wl_buffer *wl_buffer, void *user_data)
  1443. {
  1444. wl_proxy_set_user_data((struct wl_proxy *) wl_buffer, user_data);
  1445. }
  1446. /** @ingroup iface_wl_buffer */
  1447. static inline void *
  1448. wl_buffer_get_user_data(struct wl_buffer *wl_buffer)
  1449. {
  1450. return wl_proxy_get_user_data((struct wl_proxy *) wl_buffer);
  1451. }
  1452. static inline uint32_t
  1453. wl_buffer_get_version(struct wl_buffer *wl_buffer)
  1454. {
  1455. return wl_proxy_get_version((struct wl_proxy *) wl_buffer);
  1456. }
  1457. /**
  1458. * @ingroup iface_wl_buffer
  1459. *
  1460. * Destroy a buffer. If and how you need to release the backing
  1461. * storage is defined by the buffer factory interface.
  1462. *
  1463. * For possible side-effects to a surface, see wl_surface.attach.
  1464. */
  1465. static inline void
  1466. wl_buffer_destroy(struct wl_buffer *wl_buffer)
  1467. {
  1468. wl_proxy_marshal((struct wl_proxy *) wl_buffer,
  1469. WL_BUFFER_DESTROY);
  1470. wl_proxy_destroy((struct wl_proxy *) wl_buffer);
  1471. }
  1472. #ifndef WL_DATA_OFFER_ERROR_ENUM
  1473. #define WL_DATA_OFFER_ERROR_ENUM
  1474. enum wl_data_offer_error {
  1475. /**
  1476. * finish request was called untimely
  1477. */
  1478. WL_DATA_OFFER_ERROR_INVALID_FINISH = 0,
  1479. /**
  1480. * action mask contains invalid values
  1481. */
  1482. WL_DATA_OFFER_ERROR_INVALID_ACTION_MASK = 1,
  1483. /**
  1484. * action argument has an invalid value
  1485. */
  1486. WL_DATA_OFFER_ERROR_INVALID_ACTION = 2,
  1487. /**
  1488. * offer doesn't accept this request
  1489. */
  1490. WL_DATA_OFFER_ERROR_INVALID_OFFER = 3,
  1491. };
  1492. #endif /* WL_DATA_OFFER_ERROR_ENUM */
  1493. /**
  1494. * @ingroup iface_wl_data_offer
  1495. * @struct wl_data_offer_listener
  1496. */
  1497. struct wl_data_offer_listener {
  1498. /**
  1499. * advertise offered mime type
  1500. *
  1501. * Sent immediately after creating the wl_data_offer object. One
  1502. * event per offered mime type.
  1503. * @param mime_type offered mime type
  1504. */
  1505. void (*offer)(void *data,
  1506. struct wl_data_offer *wl_data_offer,
  1507. const char *mime_type);
  1508. /**
  1509. * notify the source-side available actions
  1510. *
  1511. * This event indicates the actions offered by the data source.
  1512. * It will be sent right after wl_data_device.enter, or anytime the
  1513. * source side changes its offered actions through
  1514. * wl_data_source.set_actions.
  1515. * @param source_actions actions offered by the data source
  1516. * @since 3
  1517. */
  1518. void (*source_actions)(void *data,
  1519. struct wl_data_offer *wl_data_offer,
  1520. uint32_t source_actions);
  1521. /**
  1522. * notify the selected action
  1523. *
  1524. * This event indicates the action selected by the compositor
  1525. * after matching the source/destination side actions. Only one
  1526. * action (or none) will be offered here.
  1527. *
  1528. * This event can be emitted multiple times during the
  1529. * drag-and-drop operation in response to destination side action
  1530. * changes through wl_data_offer.set_actions.
  1531. *
  1532. * This event will no longer be emitted after wl_data_device.drop
  1533. * happened on the drag-and-drop destination, the client must honor
  1534. * the last action received, or the last preferred one set through
  1535. * wl_data_offer.set_actions when handling an "ask" action.
  1536. *
  1537. * Compositors may also change the selected action on the fly,
  1538. * mainly in response to keyboard modifier changes during the
  1539. * drag-and-drop operation.
  1540. *
  1541. * The most recent action received is always the valid one. Prior
  1542. * to receiving wl_data_device.drop, the chosen action may change
  1543. * (e.g. due to keyboard modifiers being pressed). At the time of
  1544. * receiving wl_data_device.drop the drag-and-drop destination must
  1545. * honor the last action received.
  1546. *
  1547. * Action changes may still happen after wl_data_device.drop,
  1548. * especially on "ask" actions, where the drag-and-drop destination
  1549. * may choose another action afterwards. Action changes happening
  1550. * at this stage are always the result of inter-client negotiation,
  1551. * the compositor shall no longer be able to induce a different
  1552. * action.
  1553. *
  1554. * Upon "ask" actions, it is expected that the drag-and-drop
  1555. * destination may potentially choose a different action and/or
  1556. * mime type, based on wl_data_offer.source_actions and finally
  1557. * chosen by the user (e.g. popping up a menu with the available
  1558. * options). The final wl_data_offer.set_actions and
  1559. * wl_data_offer.accept requests must happen before the call to
  1560. * wl_data_offer.finish.
  1561. * @param dnd_action action selected by the compositor
  1562. * @since 3
  1563. */
  1564. void (*action)(void *data,
  1565. struct wl_data_offer *wl_data_offer,
  1566. uint32_t dnd_action);
  1567. };
  1568. /**
  1569. * @ingroup wl_data_offer_iface
  1570. */
  1571. static inline int
  1572. wl_data_offer_add_listener(struct wl_data_offer *wl_data_offer,
  1573. const struct wl_data_offer_listener *listener, void *data)
  1574. {
  1575. return wl_proxy_add_listener((struct wl_proxy *) wl_data_offer,
  1576. (void (**)(void)) listener, data);
  1577. }
  1578. #define WL_DATA_OFFER_ACCEPT 0
  1579. #define WL_DATA_OFFER_RECEIVE 1
  1580. #define WL_DATA_OFFER_DESTROY 2
  1581. #define WL_DATA_OFFER_FINISH 3
  1582. #define WL_DATA_OFFER_SET_ACTIONS 4
  1583. /**
  1584. * @ingroup iface_wl_data_offer
  1585. */
  1586. #define WL_DATA_OFFER_ACCEPT_SINCE_VERSION 1
  1587. /**
  1588. * @ingroup iface_wl_data_offer
  1589. */
  1590. #define WL_DATA_OFFER_RECEIVE_SINCE_VERSION 1
  1591. /**
  1592. * @ingroup iface_wl_data_offer
  1593. */
  1594. #define WL_DATA_OFFER_DESTROY_SINCE_VERSION 1
  1595. /**
  1596. * @ingroup iface_wl_data_offer
  1597. */
  1598. #define WL_DATA_OFFER_FINISH_SINCE_VERSION 3
  1599. /**
  1600. * @ingroup iface_wl_data_offer
  1601. */
  1602. #define WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION 3
  1603. /** @ingroup iface_wl_data_offer */
  1604. static inline void
  1605. wl_data_offer_set_user_data(struct wl_data_offer *wl_data_offer, void *user_data)
  1606. {
  1607. wl_proxy_set_user_data((struct wl_proxy *) wl_data_offer, user_data);
  1608. }
  1609. /** @ingroup iface_wl_data_offer */
  1610. static inline void *
  1611. wl_data_offer_get_user_data(struct wl_data_offer *wl_data_offer)
  1612. {
  1613. return wl_proxy_get_user_data((struct wl_proxy *) wl_data_offer);
  1614. }
  1615. static inline uint32_t
  1616. wl_data_offer_get_version(struct wl_data_offer *wl_data_offer)
  1617. {
  1618. return wl_proxy_get_version((struct wl_proxy *) wl_data_offer);
  1619. }
  1620. /**
  1621. * @ingroup iface_wl_data_offer
  1622. *
  1623. * Indicate that the client can accept the given mime type, or
  1624. * NULL for not accepted.
  1625. *
  1626. * For objects of version 2 or older, this request is used by the
  1627. * client to give feedback whether the client can receive the given
  1628. * mime type, or NULL if none is accepted; the feedback does not
  1629. * determine whether the drag-and-drop operation succeeds or not.
  1630. *
  1631. * For objects of version 3 or newer, this request determines the
  1632. * final result of the drag-and-drop operation. If the end result
  1633. * is that no mime types were accepted, the drag-and-drop operation
  1634. * will be cancelled and the corresponding drag source will receive
  1635. * wl_data_source.cancelled. Clients may still use this event in
  1636. * conjunction with wl_data_source.action for feedback.
  1637. */
  1638. static inline void
  1639. wl_data_offer_accept(struct wl_data_offer *wl_data_offer, uint32_t serial, const char *mime_type)
  1640. {
  1641. wl_proxy_marshal((struct wl_proxy *) wl_data_offer,
  1642. WL_DATA_OFFER_ACCEPT, serial, mime_type);
  1643. }
  1644. /**
  1645. * @ingroup iface_wl_data_offer
  1646. *
  1647. * To transfer the offered data, the client issues this request
  1648. * and indicates the mime type it wants to receive. The transfer
  1649. * happens through the passed file descriptor (typically created
  1650. * with the pipe system call). The source client writes the data
  1651. * in the mime type representation requested and then closes the
  1652. * file descriptor.
  1653. *
  1654. * The receiving client reads from the read end of the pipe until
  1655. * EOF and then closes its end, at which point the transfer is
  1656. * complete.
  1657. *
  1658. * This request may happen multiple times for different mime types,
  1659. * both before and after wl_data_device.drop. Drag-and-drop destination
  1660. * clients may preemptively fetch data or examine it more closely to
  1661. * determine acceptance.
  1662. */
  1663. static inline void
  1664. wl_data_offer_receive(struct wl_data_offer *wl_data_offer, const char *mime_type, int32_t fd)
  1665. {
  1666. wl_proxy_marshal((struct wl_proxy *) wl_data_offer,
  1667. WL_DATA_OFFER_RECEIVE, mime_type, fd);
  1668. }
  1669. /**
  1670. * @ingroup iface_wl_data_offer
  1671. *
  1672. * Destroy the data offer.
  1673. */
  1674. static inline void
  1675. wl_data_offer_destroy(struct wl_data_offer *wl_data_offer)
  1676. {
  1677. wl_proxy_marshal((struct wl_proxy *) wl_data_offer,
  1678. WL_DATA_OFFER_DESTROY);
  1679. wl_proxy_destroy((struct wl_proxy *) wl_data_offer);
  1680. }
  1681. /**
  1682. * @ingroup iface_wl_data_offer
  1683. *
  1684. * Notifies the compositor that the drag destination successfully
  1685. * finished the drag-and-drop operation.
  1686. *
  1687. * Upon receiving this request, the compositor will emit
  1688. * wl_data_source.dnd_finished on the drag source client.
  1689. *
  1690. * It is a client error to perform other requests than
  1691. * wl_data_offer.destroy after this one. It is also an error to perform
  1692. * this request after a NULL mime type has been set in
  1693. * wl_data_offer.accept or no action was received through
  1694. * wl_data_offer.action.
  1695. */
  1696. static inline void
  1697. wl_data_offer_finish(struct wl_data_offer *wl_data_offer)
  1698. {
  1699. wl_proxy_marshal((struct wl_proxy *) wl_data_offer,
  1700. WL_DATA_OFFER_FINISH);
  1701. }
  1702. /**
  1703. * @ingroup iface_wl_data_offer
  1704. *
  1705. * Sets the actions that the destination side client supports for
  1706. * this operation. This request may trigger the emission of
  1707. * wl_data_source.action and wl_data_offer.action events if the compositor
  1708. * needs to change the selected action.
  1709. *
  1710. * This request can be called multiple times throughout the
  1711. * drag-and-drop operation, typically in response to wl_data_device.enter
  1712. * or wl_data_device.motion events.
  1713. *
  1714. * This request determines the final result of the drag-and-drop
  1715. * operation. If the end result is that no action is accepted,
  1716. * the drag source will receive wl_drag_source.cancelled.
  1717. *
  1718. * The dnd_actions argument must contain only values expressed in the
  1719. * wl_data_device_manager.dnd_actions enum, and the preferred_action
  1720. * argument must only contain one of those values set, otherwise it
  1721. * will result in a protocol error.
  1722. *
  1723. * While managing an "ask" action, the destination drag-and-drop client
  1724. * may perform further wl_data_offer.receive requests, and is expected
  1725. * to perform one last wl_data_offer.set_actions request with a preferred
  1726. * action other than "ask" (and optionally wl_data_offer.accept) before
  1727. * requesting wl_data_offer.finish, in order to convey the action selected
  1728. * by the user. If the preferred action is not in the
  1729. * wl_data_offer.source_actions mask, an error will be raised.
  1730. *
  1731. * If the "ask" action is dismissed (e.g. user cancellation), the client
  1732. * is expected to perform wl_data_offer.destroy right away.
  1733. *
  1734. * This request can only be made on drag-and-drop offers, a protocol error
  1735. * will be raised otherwise.
  1736. */
  1737. static inline void
  1738. wl_data_offer_set_actions(struct wl_data_offer *wl_data_offer, uint32_t dnd_actions, uint32_t preferred_action)
  1739. {
  1740. wl_proxy_marshal((struct wl_proxy *) wl_data_offer,
  1741. WL_DATA_OFFER_SET_ACTIONS, dnd_actions, preferred_action);
  1742. }
  1743. #ifndef WL_DATA_SOURCE_ERROR_ENUM
  1744. #define WL_DATA_SOURCE_ERROR_ENUM
  1745. enum wl_data_source_error {
  1746. /**
  1747. * action mask contains invalid values
  1748. */
  1749. WL_DATA_SOURCE_ERROR_INVALID_ACTION_MASK = 0,
  1750. /**
  1751. * source doesn't accept this request
  1752. */
  1753. WL_DATA_SOURCE_ERROR_INVALID_SOURCE = 1,
  1754. };
  1755. #endif /* WL_DATA_SOURCE_ERROR_ENUM */
  1756. /**
  1757. * @ingroup iface_wl_data_source
  1758. * @struct wl_data_source_listener
  1759. */
  1760. struct wl_data_source_listener {
  1761. /**
  1762. * a target accepts an offered mime type
  1763. *
  1764. * Sent when a target accepts pointer_focus or motion events. If
  1765. * a target does not accept any of the offered types, type is NULL.
  1766. *
  1767. * Used for feedback during drag-and-drop.
  1768. * @param mime_type mime type accepted by the target
  1769. */
  1770. void (*target)(void *data,
  1771. struct wl_data_source *wl_data_source,
  1772. const char *mime_type);
  1773. /**
  1774. * send the data
  1775. *
  1776. * Request for data from the client. Send the data as the
  1777. * specified mime type over the passed file descriptor, then close
  1778. * it.
  1779. * @param mime_type mime type for the data
  1780. * @param fd file descriptor for the data
  1781. */
  1782. void (*send)(void *data,
  1783. struct wl_data_source *wl_data_source,
  1784. const char *mime_type,
  1785. int32_t fd);
  1786. /**
  1787. * selection was cancelled
  1788. *
  1789. * This data source is no longer valid. There are several reasons
  1790. * why this could happen:
  1791. *
  1792. * - The data source has been replaced by another data source. -
  1793. * The drag-and-drop operation was performed, but the drop
  1794. * destination did not accept any of the mime types offered through
  1795. * wl_data_source.target. - The drag-and-drop operation was
  1796. * performed, but the drop destination did not select any of the
  1797. * actions present in the mask offered through
  1798. * wl_data_source.action. - The drag-and-drop operation was
  1799. * performed but didn't happen over a surface. - The compositor
  1800. * cancelled the drag-and-drop operation (e.g. compositor dependent
  1801. * timeouts to avoid stale drag-and-drop transfers).
  1802. *
  1803. * The client should clean up and destroy this data source.
  1804. *
  1805. * For objects of version 2 or older, wl_data_source.cancelled will
  1806. * only be emitted if the data source was replaced by another data
  1807. * source.
  1808. */
  1809. void (*cancelled)(void *data,
  1810. struct wl_data_source *wl_data_source);
  1811. /**
  1812. * the drag-and-drop operation physically finished
  1813. *
  1814. * The user performed the drop action. This event does not
  1815. * indicate acceptance, wl_data_source.cancelled may still be
  1816. * emitted afterwards if the drop destination does not accept any
  1817. * mime type.
  1818. *
  1819. * However, this event might however not be received if the
  1820. * compositor cancelled the drag-and-drop operation before this
  1821. * event could happen.
  1822. *
  1823. * Note that the data_source may still be used in the future and
  1824. * should not be destroyed here.
  1825. * @since 3
  1826. */
  1827. void (*dnd_drop_performed)(void *data,
  1828. struct wl_data_source *wl_data_source);
  1829. /**
  1830. * the drag-and-drop operation concluded
  1831. *
  1832. * The drop destination finished interoperating with this data
  1833. * source, so the client is now free to destroy this data source
  1834. * and free all associated data.
  1835. *
  1836. * If the action used to perform the operation was "move", the
  1837. * source can now delete the transferred data.
  1838. * @since 3
  1839. */
  1840. void (*dnd_finished)(void *data,
  1841. struct wl_data_source *wl_data_source);
  1842. /**
  1843. * notify the selected action
  1844. *
  1845. * This event indicates the action selected by the compositor
  1846. * after matching the source/destination side actions. Only one
  1847. * action (or none) will be offered here.
  1848. *
  1849. * This event can be emitted multiple times during the
  1850. * drag-and-drop operation, mainly in response to destination side
  1851. * changes through wl_data_offer.set_actions, and as the data
  1852. * device enters/leaves surfaces.
  1853. *
  1854. * It is only possible to receive this event after
  1855. * wl_data_source.dnd_drop_performed if the drag-and-drop operation
  1856. * ended in an "ask" action, in which case the final
  1857. * wl_data_source.action event will happen immediately before
  1858. * wl_data_source.dnd_finished.
  1859. *
  1860. * Compositors may also change the selected action on the fly,
  1861. * mainly in response to keyboard modifier changes during the
  1862. * drag-and-drop operation.
  1863. *
  1864. * The most recent action received is always the valid one. The
  1865. * chosen action may change alongside negotiation (e.g. an "ask"
  1866. * action can turn into a "move" operation), so the effects of the
  1867. * final action must always be applied in
  1868. * wl_data_offer.dnd_finished.
  1869. *
  1870. * Clients can trigger cursor surface changes from this point, so
  1871. * they reflect the current action.
  1872. * @param dnd_action action selected by the compositor
  1873. * @since 3
  1874. */
  1875. void (*action)(void *data,
  1876. struct wl_data_source *wl_data_source,
  1877. uint32_t dnd_action);
  1878. };
  1879. /**
  1880. * @ingroup wl_data_source_iface
  1881. */
  1882. static inline int
  1883. wl_data_source_add_listener(struct wl_data_source *wl_data_source,
  1884. const struct wl_data_source_listener *listener, void *data)
  1885. {
  1886. return wl_proxy_add_listener((struct wl_proxy *) wl_data_source,
  1887. (void (**)(void)) listener, data);
  1888. }
  1889. #define WL_DATA_SOURCE_OFFER 0
  1890. #define WL_DATA_SOURCE_DESTROY 1
  1891. #define WL_DATA_SOURCE_SET_ACTIONS 2
  1892. /**
  1893. * @ingroup iface_wl_data_source
  1894. */
  1895. #define WL_DATA_SOURCE_OFFER_SINCE_VERSION 1
  1896. /**
  1897. * @ingroup iface_wl_data_source
  1898. */
  1899. #define WL_DATA_SOURCE_DESTROY_SINCE_VERSION 1
  1900. /**
  1901. * @ingroup iface_wl_data_source
  1902. */
  1903. #define WL_DATA_SOURCE_SET_ACTIONS_SINCE_VERSION 3
  1904. /** @ingroup iface_wl_data_source */
  1905. static inline void
  1906. wl_data_source_set_user_data(struct wl_data_source *wl_data_source, void *user_data)
  1907. {
  1908. wl_proxy_set_user_data((struct wl_proxy *) wl_data_source, user_data);
  1909. }
  1910. /** @ingroup iface_wl_data_source */
  1911. static inline void *
  1912. wl_data_source_get_user_data(struct wl_data_source *wl_data_source)
  1913. {
  1914. return wl_proxy_get_user_data((struct wl_proxy *) wl_data_source);
  1915. }
  1916. static inline uint32_t
  1917. wl_data_source_get_version(struct wl_data_source *wl_data_source)
  1918. {
  1919. return wl_proxy_get_version((struct wl_proxy *) wl_data_source);
  1920. }
  1921. /**
  1922. * @ingroup iface_wl_data_source
  1923. *
  1924. * This request adds a mime type to the set of mime types
  1925. * advertised to targets. Can be called several times to offer
  1926. * multiple types.
  1927. */
  1928. static inline void
  1929. wl_data_source_offer(struct wl_data_source *wl_data_source, const char *mime_type)
  1930. {
  1931. wl_proxy_marshal((struct wl_proxy *) wl_data_source,
  1932. WL_DATA_SOURCE_OFFER, mime_type);
  1933. }
  1934. /**
  1935. * @ingroup iface_wl_data_source
  1936. *
  1937. * Destroy the data source.
  1938. */
  1939. static inline void
  1940. wl_data_source_destroy(struct wl_data_source *wl_data_source)
  1941. {
  1942. wl_proxy_marshal((struct wl_proxy *) wl_data_source,
  1943. WL_DATA_SOURCE_DESTROY);
  1944. wl_proxy_destroy((struct wl_proxy *) wl_data_source);
  1945. }
  1946. /**
  1947. * @ingroup iface_wl_data_source
  1948. *
  1949. * Sets the actions that the source side client supports for this
  1950. * operation. This request may trigger wl_data_source.action and
  1951. * wl_data_offer.action events if the compositor needs to change the
  1952. * selected action.
  1953. *
  1954. * The dnd_actions argument must contain only values expressed in the
  1955. * wl_data_device_manager.dnd_actions enum, otherwise it will result
  1956. * in a protocol error.
  1957. *
  1958. * This request must be made once only, and can only be made on sources
  1959. * used in drag-and-drop, so it must be performed before
  1960. * wl_data_device.start_drag. Attempting to use the source other than
  1961. * for drag-and-drop will raise a protocol error.
  1962. */
  1963. static inline void
  1964. wl_data_source_set_actions(struct wl_data_source *wl_data_source, uint32_t dnd_actions)
  1965. {
  1966. wl_proxy_marshal((struct wl_proxy *) wl_data_source,
  1967. WL_DATA_SOURCE_SET_ACTIONS, dnd_actions);
  1968. }
  1969. #ifndef WL_DATA_DEVICE_ERROR_ENUM
  1970. #define WL_DATA_DEVICE_ERROR_ENUM
  1971. enum wl_data_device_error {
  1972. /**
  1973. * given wl_surface has another role
  1974. */
  1975. WL_DATA_DEVICE_ERROR_ROLE = 0,
  1976. };
  1977. #endif /* WL_DATA_DEVICE_ERROR_ENUM */
  1978. /**
  1979. * @ingroup iface_wl_data_device
  1980. * @struct wl_data_device_listener
  1981. */
  1982. struct wl_data_device_listener {
  1983. /**
  1984. * introduce a new wl_data_offer
  1985. *
  1986. * The data_offer event introduces a new wl_data_offer object,
  1987. * which will subsequently be used in either the data_device.enter
  1988. * event (for drag-and-drop) or the data_device.selection event
  1989. * (for selections). Immediately following the
  1990. * data_device_data_offer event, the new data_offer object will
  1991. * send out data_offer.offer events to describe the mime types it
  1992. * offers.
  1993. * @param id the new data_offer object
  1994. */
  1995. void (*data_offer)(void *data,
  1996. struct wl_data_device *wl_data_device,
  1997. struct wl_data_offer *id);
  1998. /**
  1999. * initiate drag-and-drop session
  2000. *
  2001. * This event is sent when an active drag-and-drop pointer enters
  2002. * a surface owned by the client. The position of the pointer at
  2003. * enter time is provided by the x and y arguments, in
  2004. * surface-local coordinates.
  2005. * @param serial serial number of the enter event
  2006. * @param surface client surface entered
  2007. * @param x surface-local x coordinate
  2008. * @param y surface-local y coordinate
  2009. * @param id source data_offer object
  2010. */
  2011. void (*enter)(void *data,
  2012. struct wl_data_device *wl_data_device,
  2013. uint32_t serial,
  2014. struct wl_surface *surface,
  2015. wl_fixed_t x,
  2016. wl_fixed_t y,
  2017. struct wl_data_offer *id);
  2018. /**
  2019. * end drag-and-drop session
  2020. *
  2021. * This event is sent when the drag-and-drop pointer leaves the
  2022. * surface and the session ends. The client must destroy the
  2023. * wl_data_offer introduced at enter time at this point.
  2024. */
  2025. void (*leave)(void *data,
  2026. struct wl_data_device *wl_data_device);
  2027. /**
  2028. * drag-and-drop session motion
  2029. *
  2030. * This event is sent when the drag-and-drop pointer moves within
  2031. * the currently focused surface. The new position of the pointer
  2032. * is provided by the x and y arguments, in surface-local
  2033. * coordinates.
  2034. * @param time timestamp with millisecond granularity
  2035. * @param x surface-local x coordinate
  2036. * @param y surface-local y coordinate
  2037. */
  2038. void (*motion)(void *data,
  2039. struct wl_data_device *wl_data_device,
  2040. uint32_t time,
  2041. wl_fixed_t x,
  2042. wl_fixed_t y);
  2043. /**
  2044. * end drag-and-drop session successfully
  2045. *
  2046. * The event is sent when a drag-and-drop operation is ended
  2047. * because the implicit grab is removed.
  2048. *
  2049. * The drag-and-drop destination is expected to honor the last
  2050. * action received through wl_data_offer.action, if the resulting
  2051. * action is "copy" or "move", the destination can still perform
  2052. * wl_data_offer.receive requests, and is expected to end all
  2053. * transfers with a wl_data_offer.finish request.
  2054. *
  2055. * If the resulting action is "ask", the action will not be
  2056. * considered final. The drag-and-drop destination is expected to
  2057. * perform one last wl_data_offer.set_actions request, or
  2058. * wl_data_offer.destroy in order to cancel the operation.
  2059. */
  2060. void (*drop)(void *data,
  2061. struct wl_data_device *wl_data_device);
  2062. /**
  2063. * advertise new selection
  2064. *
  2065. * The selection event is sent out to notify the client of a new
  2066. * wl_data_offer for the selection for this device. The
  2067. * data_device.data_offer and the data_offer.offer events are sent
  2068. * out immediately before this event to introduce the data offer
  2069. * object. The selection event is sent to a client immediately
  2070. * before receiving keyboard focus and when a new selection is set
  2071. * while the client has keyboard focus. The data_offer is valid
  2072. * until a new data_offer or NULL is received or until the client
  2073. * loses keyboard focus. The client must destroy the previous
  2074. * selection data_offer, if any, upon receiving this event.
  2075. * @param id selection data_offer object
  2076. */
  2077. void (*selection)(void *data,
  2078. struct wl_data_device *wl_data_device,
  2079. struct wl_data_offer *id);
  2080. };
  2081. /**
  2082. * @ingroup wl_data_device_iface
  2083. */
  2084. static inline int
  2085. wl_data_device_add_listener(struct wl_data_device *wl_data_device,
  2086. const struct wl_data_device_listener *listener, void *data)
  2087. {
  2088. return wl_proxy_add_listener((struct wl_proxy *) wl_data_device,
  2089. (void (**)(void)) listener, data);
  2090. }
  2091. #define WL_DATA_DEVICE_START_DRAG 0
  2092. #define WL_DATA_DEVICE_SET_SELECTION 1
  2093. #define WL_DATA_DEVICE_RELEASE 2
  2094. /**
  2095. * @ingroup iface_wl_data_device
  2096. */
  2097. #define WL_DATA_DEVICE_START_DRAG_SINCE_VERSION 1
  2098. /**
  2099. * @ingroup iface_wl_data_device
  2100. */
  2101. #define WL_DATA_DEVICE_SET_SELECTION_SINCE_VERSION 1
  2102. /**
  2103. * @ingroup iface_wl_data_device
  2104. */
  2105. #define WL_DATA_DEVICE_RELEASE_SINCE_VERSION 2
  2106. /** @ingroup iface_wl_data_device */
  2107. static inline void
  2108. wl_data_device_set_user_data(struct wl_data_device *wl_data_device, void *user_data)
  2109. {
  2110. wl_proxy_set_user_data((struct wl_proxy *) wl_data_device, user_data);
  2111. }
  2112. /** @ingroup iface_wl_data_device */
  2113. static inline void *
  2114. wl_data_device_get_user_data(struct wl_data_device *wl_data_device)
  2115. {
  2116. return wl_proxy_get_user_data((struct wl_proxy *) wl_data_device);
  2117. }
  2118. static inline uint32_t
  2119. wl_data_device_get_version(struct wl_data_device *wl_data_device)
  2120. {
  2121. return wl_proxy_get_version((struct wl_proxy *) wl_data_device);
  2122. }
  2123. /** @ingroup iface_wl_data_device */
  2124. static inline void
  2125. wl_data_device_destroy(struct wl_data_device *wl_data_device)
  2126. {
  2127. wl_proxy_destroy((struct wl_proxy *) wl_data_device);
  2128. }
  2129. /**
  2130. * @ingroup iface_wl_data_device
  2131. *
  2132. * This request asks the compositor to start a drag-and-drop
  2133. * operation on behalf of the client.
  2134. *
  2135. * The source argument is the data source that provides the data
  2136. * for the eventual data transfer. If source is NULL, enter, leave
  2137. * and motion events are sent only to the client that initiated the
  2138. * drag and the client is expected to handle the data passing
  2139. * internally.
  2140. *
  2141. * The origin surface is the surface where the drag originates and
  2142. * the client must have an active implicit grab that matches the
  2143. * serial.
  2144. *
  2145. * The icon surface is an optional (can be NULL) surface that
  2146. * provides an icon to be moved around with the cursor. Initially,
  2147. * the top-left corner of the icon surface is placed at the cursor
  2148. * hotspot, but subsequent wl_surface.attach request can move the
  2149. * relative position. Attach requests must be confirmed with
  2150. * wl_surface.commit as usual. The icon surface is given the role of
  2151. * a drag-and-drop icon. If the icon surface already has another role,
  2152. * it raises a protocol error.
  2153. *
  2154. * The current and pending input regions of the icon wl_surface are
  2155. * cleared, and wl_surface.set_input_region is ignored until the
  2156. * wl_surface is no longer used as the icon surface. When the use
  2157. * as an icon ends, the current and pending input regions become
  2158. * undefined, and the wl_surface is unmapped.
  2159. */
  2160. static inline void
  2161. wl_data_device_start_drag(struct wl_data_device *wl_data_device, struct wl_data_source *source, struct wl_surface *origin, struct wl_surface *icon, uint32_t serial)
  2162. {
  2163. wl_proxy_marshal((struct wl_proxy *) wl_data_device,
  2164. WL_DATA_DEVICE_START_DRAG, source, origin, icon, serial);
  2165. }
  2166. /**
  2167. * @ingroup iface_wl_data_device
  2168. *
  2169. * This request asks the compositor to set the selection
  2170. * to the data from the source on behalf of the client.
  2171. *
  2172. * To unset the selection, set the source to NULL.
  2173. */
  2174. static inline void
  2175. wl_data_device_set_selection(struct wl_data_device *wl_data_device, struct wl_data_source *source, uint32_t serial)
  2176. {
  2177. wl_proxy_marshal((struct wl_proxy *) wl_data_device,
  2178. WL_DATA_DEVICE_SET_SELECTION, source, serial);
  2179. }
  2180. /**
  2181. * @ingroup iface_wl_data_device
  2182. *
  2183. * This request destroys the data device.
  2184. */
  2185. static inline void
  2186. wl_data_device_release(struct wl_data_device *wl_data_device)
  2187. {
  2188. wl_proxy_marshal((struct wl_proxy *) wl_data_device,
  2189. WL_DATA_DEVICE_RELEASE);
  2190. wl_proxy_destroy((struct wl_proxy *) wl_data_device);
  2191. }
  2192. #ifndef WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
  2193. #define WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
  2194. /**
  2195. * @ingroup iface_wl_data_device_manager
  2196. * drag and drop actions
  2197. *
  2198. * This is a bitmask of the available/preferred actions in a
  2199. * drag-and-drop operation.
  2200. *
  2201. * In the compositor, the selected action is a result of matching the
  2202. * actions offered by the source and destination sides. "action" events
  2203. * with a "none" action will be sent to both source and destination if
  2204. * there is no match. All further checks will effectively happen on
  2205. * (source actions ∩ destination actions).
  2206. *
  2207. * In addition, compositors may also pick different actions in
  2208. * reaction to key modifiers being pressed. One common design that
  2209. * is used in major toolkits (and the behavior recommended for
  2210. * compositors) is:
  2211. *
  2212. * - If no modifiers are pressed, the first match (in bit order)
  2213. * will be used.
  2214. * - Pressing Shift selects "move", if enabled in the mask.
  2215. * - Pressing Control selects "copy", if enabled in the mask.
  2216. *
  2217. * Behavior beyond that is considered implementation-dependent.
  2218. * Compositors may for example bind other modifiers (like Alt/Meta)
  2219. * or drags initiated with other buttons than BTN_LEFT to specific
  2220. * actions (e.g. "ask").
  2221. */
  2222. enum wl_data_device_manager_dnd_action {
  2223. WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE = 0,
  2224. WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY = 1,
  2225. WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE = 2,
  2226. WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK = 4,
  2227. };
  2228. #endif /* WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM */
  2229. #define WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE 0
  2230. #define WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE 1
  2231. /**
  2232. * @ingroup iface_wl_data_device_manager
  2233. */
  2234. #define WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE_SINCE_VERSION 1
  2235. /**
  2236. * @ingroup iface_wl_data_device_manager
  2237. */
  2238. #define WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE_SINCE_VERSION 1
  2239. /** @ingroup iface_wl_data_device_manager */
  2240. static inline void
  2241. wl_data_device_manager_set_user_data(struct wl_data_device_manager *wl_data_device_manager, void *user_data)
  2242. {
  2243. wl_proxy_set_user_data((struct wl_proxy *) wl_data_device_manager, user_data);
  2244. }
  2245. /** @ingroup iface_wl_data_device_manager */
  2246. static inline void *
  2247. wl_data_device_manager_get_user_data(struct wl_data_device_manager *wl_data_device_manager)
  2248. {
  2249. return wl_proxy_get_user_data((struct wl_proxy *) wl_data_device_manager);
  2250. }
  2251. static inline uint32_t
  2252. wl_data_device_manager_get_version(struct wl_data_device_manager *wl_data_device_manager)
  2253. {
  2254. return wl_proxy_get_version((struct wl_proxy *) wl_data_device_manager);
  2255. }
  2256. /** @ingroup iface_wl_data_device_manager */
  2257. static inline void
  2258. wl_data_device_manager_destroy(struct wl_data_device_manager *wl_data_device_manager)
  2259. {
  2260. wl_proxy_destroy((struct wl_proxy *) wl_data_device_manager);
  2261. }
  2262. /**
  2263. * @ingroup iface_wl_data_device_manager
  2264. *
  2265. * Create a new data source.
  2266. */
  2267. static inline struct wl_data_source *
  2268. wl_data_device_manager_create_data_source(struct wl_data_device_manager *wl_data_device_manager)
  2269. {
  2270. struct wl_proxy *id;
  2271. id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_data_device_manager,
  2272. WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE, &wl_data_source_interface, NULL);
  2273. return (struct wl_data_source *) id;
  2274. }
  2275. /**
  2276. * @ingroup iface_wl_data_device_manager
  2277. *
  2278. * Create a new data device for a given seat.
  2279. */
  2280. static inline struct wl_data_device *
  2281. wl_data_device_manager_get_data_device(struct wl_data_device_manager *wl_data_device_manager, struct wl_seat *seat)
  2282. {
  2283. struct wl_proxy *id;
  2284. id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_data_device_manager,
  2285. WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE, &wl_data_device_interface, NULL, seat);
  2286. return (struct wl_data_device *) id;
  2287. }
  2288. #ifndef WL_SHELL_ERROR_ENUM
  2289. #define WL_SHELL_ERROR_ENUM
  2290. enum wl_shell_error {
  2291. /**
  2292. * given wl_surface has another role
  2293. */
  2294. WL_SHELL_ERROR_ROLE = 0,
  2295. };
  2296. #endif /* WL_SHELL_ERROR_ENUM */
  2297. #define WL_SHELL_GET_SHELL_SURFACE 0
  2298. /**
  2299. * @ingroup iface_wl_shell
  2300. */
  2301. #define WL_SHELL_GET_SHELL_SURFACE_SINCE_VERSION 1
  2302. /** @ingroup iface_wl_shell */
  2303. static inline void
  2304. wl_shell_set_user_data(struct wl_shell *wl_shell, void *user_data)
  2305. {
  2306. wl_proxy_set_user_data((struct wl_proxy *) wl_shell, user_data);
  2307. }
  2308. /** @ingroup iface_wl_shell */
  2309. static inline void *
  2310. wl_shell_get_user_data(struct wl_shell *wl_shell)
  2311. {
  2312. return wl_proxy_get_user_data((struct wl_proxy *) wl_shell);
  2313. }
  2314. static inline uint32_t
  2315. wl_shell_get_version(struct wl_shell *wl_shell)
  2316. {
  2317. return wl_proxy_get_version((struct wl_proxy *) wl_shell);
  2318. }
  2319. /** @ingroup iface_wl_shell */
  2320. static inline void
  2321. wl_shell_destroy(struct wl_shell *wl_shell)
  2322. {
  2323. wl_proxy_destroy((struct wl_proxy *) wl_shell);
  2324. }
  2325. /**
  2326. * @ingroup iface_wl_shell
  2327. *
  2328. * Create a shell surface for an existing surface. This gives
  2329. * the wl_surface the role of a shell surface. If the wl_surface
  2330. * already has another role, it raises a protocol error.
  2331. *
  2332. * Only one shell surface can be associated with a given surface.
  2333. */
  2334. static inline struct wl_shell_surface *
  2335. wl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface)
  2336. {
  2337. struct wl_proxy *id;
  2338. id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_shell,
  2339. WL_SHELL_GET_SHELL_SURFACE, &wl_shell_surface_interface, NULL, surface);
  2340. return (struct wl_shell_surface *) id;
  2341. }
  2342. #ifndef WL_SHELL_SURFACE_RESIZE_ENUM
  2343. #define WL_SHELL_SURFACE_RESIZE_ENUM
  2344. /**
  2345. * @ingroup iface_wl_shell_surface
  2346. * edge values for resizing
  2347. *
  2348. * These values are used to indicate which edge of a surface
  2349. * is being dragged in a resize operation. The server may
  2350. * use this information to adapt its behavior, e.g. choose
  2351. * an appropriate cursor image.
  2352. */
  2353. enum wl_shell_surface_resize {
  2354. WL_SHELL_SURFACE_RESIZE_NONE = 0,
  2355. WL_SHELL_SURFACE_RESIZE_TOP = 1,
  2356. WL_SHELL_SURFACE_RESIZE_BOTTOM = 2,
  2357. WL_SHELL_SURFACE_RESIZE_LEFT = 4,
  2358. WL_SHELL_SURFACE_RESIZE_TOP_LEFT = 5,
  2359. WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT = 6,
  2360. WL_SHELL_SURFACE_RESIZE_RIGHT = 8,
  2361. WL_SHELL_SURFACE_RESIZE_TOP_RIGHT = 9,
  2362. WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT = 10,
  2363. };
  2364. #endif /* WL_SHELL_SURFACE_RESIZE_ENUM */
  2365. #ifndef WL_SHELL_SURFACE_TRANSIENT_ENUM
  2366. #define WL_SHELL_SURFACE_TRANSIENT_ENUM
  2367. /**
  2368. * @ingroup iface_wl_shell_surface
  2369. * details of transient behaviour
  2370. *
  2371. * These flags specify details of the expected behaviour
  2372. * of transient surfaces. Used in the set_transient request.
  2373. */
  2374. enum wl_shell_surface_transient {
  2375. /**
  2376. * do not set keyboard focus
  2377. */
  2378. WL_SHELL_SURFACE_TRANSIENT_INACTIVE = 0x1,
  2379. };
  2380. #endif /* WL_SHELL_SURFACE_TRANSIENT_ENUM */
  2381. #ifndef WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
  2382. #define WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
  2383. /**
  2384. * @ingroup iface_wl_shell_surface
  2385. * different method to set the surface fullscreen
  2386. *
  2387. * Hints to indicate to the compositor how to deal with a conflict
  2388. * between the dimensions of the surface and the dimensions of the
  2389. * output. The compositor is free to ignore this parameter.
  2390. */
  2391. enum wl_shell_surface_fullscreen_method {
  2392. /**
  2393. * no preference, apply default policy
  2394. */
  2395. WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT = 0,
  2396. /**
  2397. * scale, preserve the surface's aspect ratio and center on output
  2398. */
  2399. WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE = 1,
  2400. /**
  2401. * switch output mode to the smallest mode that can fit the surface, add black borders to compensate size mismatch
  2402. */
  2403. WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER = 2,
  2404. /**
  2405. * no upscaling, center on output and add black borders to compensate size mismatch
  2406. */
  2407. WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL = 3,
  2408. };
  2409. #endif /* WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM */
  2410. /**
  2411. * @ingroup iface_wl_shell_surface
  2412. * @struct wl_shell_surface_listener
  2413. */
  2414. struct wl_shell_surface_listener {
  2415. /**
  2416. * ping client
  2417. *
  2418. * Ping a client to check if it is receiving events and sending
  2419. * requests. A client is expected to reply with a pong request.
  2420. * @param serial serial number of the ping
  2421. */
  2422. void (*ping)(void *data,
  2423. struct wl_shell_surface *wl_shell_surface,
  2424. uint32_t serial);
  2425. /**
  2426. * suggest resize
  2427. *
  2428. * The configure event asks the client to resize its surface.
  2429. *
  2430. * The size is a hint, in the sense that the client is free to
  2431. * ignore it if it doesn't resize, pick a smaller size (to satisfy
  2432. * aspect ratio or resize in steps of NxM pixels).
  2433. *
  2434. * The edges parameter provides a hint about how the surface was
  2435. * resized. The client may use this information to decide how to
  2436. * adjust its content to the new size (e.g. a scrolling area might
  2437. * adjust its content position to leave the viewable content
  2438. * unmoved).
  2439. *
  2440. * The client is free to dismiss all but the last configure event
  2441. * it received.
  2442. *
  2443. * The width and height arguments specify the size of the window in
  2444. * surface-local coordinates.
  2445. * @param edges how the surface was resized
  2446. * @param width new width of the surface
  2447. * @param height new height of the surface
  2448. */
  2449. void (*configure)(void *data,
  2450. struct wl_shell_surface *wl_shell_surface,
  2451. uint32_t edges,
  2452. int32_t width,
  2453. int32_t height);
  2454. /**
  2455. * popup interaction is done
  2456. *
  2457. * The popup_done event is sent out when a popup grab is broken,
  2458. * that is, when the user clicks a surface that doesn't belong to
  2459. * the client owning the popup surface.
  2460. */
  2461. void (*popup_done)(void *data,
  2462. struct wl_shell_surface *wl_shell_surface);
  2463. };
  2464. /**
  2465. * @ingroup wl_shell_surface_iface
  2466. */
  2467. static inline int
  2468. wl_shell_surface_add_listener(struct wl_shell_surface *wl_shell_surface,
  2469. const struct wl_shell_surface_listener *listener, void *data)
  2470. {
  2471. return wl_proxy_add_listener((struct wl_proxy *) wl_shell_surface,
  2472. (void (**)(void)) listener, data);
  2473. }
  2474. #define WL_SHELL_SURFACE_PONG 0
  2475. #define WL_SHELL_SURFACE_MOVE 1
  2476. #define WL_SHELL_SURFACE_RESIZE 2
  2477. #define WL_SHELL_SURFACE_SET_TOPLEVEL 3
  2478. #define WL_SHELL_SURFACE_SET_TRANSIENT 4
  2479. #define WL_SHELL_SURFACE_SET_FULLSCREEN 5
  2480. #define WL_SHELL_SURFACE_SET_POPUP 6
  2481. #define WL_SHELL_SURFACE_SET_MAXIMIZED 7
  2482. #define WL_SHELL_SURFACE_SET_TITLE 8
  2483. #define WL_SHELL_SURFACE_SET_CLASS 9
  2484. /**
  2485. * @ingroup iface_wl_shell_surface
  2486. */
  2487. #define WL_SHELL_SURFACE_PONG_SINCE_VERSION 1
  2488. /**
  2489. * @ingroup iface_wl_shell_surface
  2490. */
  2491. #define WL_SHELL_SURFACE_MOVE_SINCE_VERSION 1
  2492. /**
  2493. * @ingroup iface_wl_shell_surface
  2494. */
  2495. #define WL_SHELL_SURFACE_RESIZE_SINCE_VERSION 1
  2496. /**
  2497. * @ingroup iface_wl_shell_surface
  2498. */
  2499. #define WL_SHELL_SURFACE_SET_TOPLEVEL_SINCE_VERSION 1
  2500. /**
  2501. * @ingroup iface_wl_shell_surface
  2502. */
  2503. #define WL_SHELL_SURFACE_SET_TRANSIENT_SINCE_VERSION 1
  2504. /**
  2505. * @ingroup iface_wl_shell_surface
  2506. */
  2507. #define WL_SHELL_SURFACE_SET_FULLSCREEN_SINCE_VERSION 1
  2508. /**
  2509. * @ingroup iface_wl_shell_surface
  2510. */
  2511. #define WL_SHELL_SURFACE_SET_POPUP_SINCE_VERSION 1
  2512. /**
  2513. * @ingroup iface_wl_shell_surface
  2514. */
  2515. #define WL_SHELL_SURFACE_SET_MAXIMIZED_SINCE_VERSION 1
  2516. /**
  2517. * @ingroup iface_wl_shell_surface
  2518. */
  2519. #define WL_SHELL_SURFACE_SET_TITLE_SINCE_VERSION 1
  2520. /**
  2521. * @ingroup iface_wl_shell_surface
  2522. */
  2523. #define WL_SHELL_SURFACE_SET_CLASS_SINCE_VERSION 1
  2524. /** @ingroup iface_wl_shell_surface */
  2525. static inline void
  2526. wl_shell_surface_set_user_data(struct wl_shell_surface *wl_shell_surface, void *user_data)
  2527. {
  2528. wl_proxy_set_user_data((struct wl_proxy *) wl_shell_surface, user_data);
  2529. }
  2530. /** @ingroup iface_wl_shell_surface */
  2531. static inline void *
  2532. wl_shell_surface_get_user_data(struct wl_shell_surface *wl_shell_surface)
  2533. {
  2534. return wl_proxy_get_user_data((struct wl_proxy *) wl_shell_surface);
  2535. }
  2536. static inline uint32_t
  2537. wl_shell_surface_get_version(struct wl_shell_surface *wl_shell_surface)
  2538. {
  2539. return wl_proxy_get_version((struct wl_proxy *) wl_shell_surface);
  2540. }
  2541. /** @ingroup iface_wl_shell_surface */
  2542. static inline void
  2543. wl_shell_surface_destroy(struct wl_shell_surface *wl_shell_surface)
  2544. {
  2545. wl_proxy_destroy((struct wl_proxy *) wl_shell_surface);
  2546. }
  2547. /**
  2548. * @ingroup iface_wl_shell_surface
  2549. *
  2550. * A client must respond to a ping event with a pong request or
  2551. * the client may be deemed unresponsive.
  2552. */
  2553. static inline void
  2554. wl_shell_surface_pong(struct wl_shell_surface *wl_shell_surface, uint32_t serial)
  2555. {
  2556. wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
  2557. WL_SHELL_SURFACE_PONG, serial);
  2558. }
  2559. /**
  2560. * @ingroup iface_wl_shell_surface
  2561. *
  2562. * Start a pointer-driven move of the surface.
  2563. *
  2564. * This request must be used in response to a button press event.
  2565. * The server may ignore move requests depending on the state of
  2566. * the surface (e.g. fullscreen or maximized).
  2567. */
  2568. static inline void
  2569. wl_shell_surface_move(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial)
  2570. {
  2571. wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
  2572. WL_SHELL_SURFACE_MOVE, seat, serial);
  2573. }
  2574. /**
  2575. * @ingroup iface_wl_shell_surface
  2576. *
  2577. * Start a pointer-driven resizing of the surface.
  2578. *
  2579. * This request must be used in response to a button press event.
  2580. * The server may ignore resize requests depending on the state of
  2581. * the surface (e.g. fullscreen or maximized).
  2582. */
  2583. static inline void
  2584. wl_shell_surface_resize(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges)
  2585. {
  2586. wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
  2587. WL_SHELL_SURFACE_RESIZE, seat, serial, edges);
  2588. }
  2589. /**
  2590. * @ingroup iface_wl_shell_surface
  2591. *
  2592. * Map the surface as a toplevel surface.
  2593. *
  2594. * A toplevel surface is not fullscreen, maximized or transient.
  2595. */
  2596. static inline void
  2597. wl_shell_surface_set_toplevel(struct wl_shell_surface *wl_shell_surface)
  2598. {
  2599. wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
  2600. WL_SHELL_SURFACE_SET_TOPLEVEL);
  2601. }
  2602. /**
  2603. * @ingroup iface_wl_shell_surface
  2604. *
  2605. * Map the surface relative to an existing surface.
  2606. *
  2607. * The x and y arguments specify the location of the upper left
  2608. * corner of the surface relative to the upper left corner of the
  2609. * parent surface, in surface-local coordinates.
  2610. *
  2611. * The flags argument controls details of the transient behaviour.
  2612. */
  2613. static inline void
  2614. wl_shell_surface_set_transient(struct wl_shell_surface *wl_shell_surface, struct wl_surface *parent, int32_t x, int32_t y, uint32_t flags)
  2615. {
  2616. wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
  2617. WL_SHELL_SURFACE_SET_TRANSIENT, parent, x, y, flags);
  2618. }
  2619. /**
  2620. * @ingroup iface_wl_shell_surface
  2621. *
  2622. * Map the surface as a fullscreen surface.
  2623. *
  2624. * If an output parameter is given then the surface will be made
  2625. * fullscreen on that output. If the client does not specify the
  2626. * output then the compositor will apply its policy - usually
  2627. * choosing the output on which the surface has the biggest surface
  2628. * area.
  2629. *
  2630. * The client may specify a method to resolve a size conflict
  2631. * between the output size and the surface size - this is provided
  2632. * through the method parameter.
  2633. *
  2634. * The framerate parameter is used only when the method is set
  2635. * to "driver", to indicate the preferred framerate. A value of 0
  2636. * indicates that the client does not care about framerate. The
  2637. * framerate is specified in mHz, that is framerate of 60000 is 60Hz.
  2638. *
  2639. * A method of "scale" or "driver" implies a scaling operation of
  2640. * the surface, either via a direct scaling operation or a change of
  2641. * the output mode. This will override any kind of output scaling, so
  2642. * that mapping a surface with a buffer size equal to the mode can
  2643. * fill the screen independent of buffer_scale.
  2644. *
  2645. * A method of "fill" means we don't scale up the buffer, however
  2646. * any output scale is applied. This means that you may run into
  2647. * an edge case where the application maps a buffer with the same
  2648. * size of the output mode but buffer_scale 1 (thus making a
  2649. * surface larger than the output). In this case it is allowed to
  2650. * downscale the results to fit the screen.
  2651. *
  2652. * The compositor must reply to this request with a configure event
  2653. * with the dimensions for the output on which the surface will
  2654. * be made fullscreen.
  2655. */
  2656. static inline void
  2657. wl_shell_surface_set_fullscreen(struct wl_shell_surface *wl_shell_surface, uint32_t method, uint32_t framerate, struct wl_output *output)
  2658. {
  2659. wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
  2660. WL_SHELL_SURFACE_SET_FULLSCREEN, method, framerate, output);
  2661. }
  2662. /**
  2663. * @ingroup iface_wl_shell_surface
  2664. *
  2665. * Map the surface as a popup.
  2666. *
  2667. * A popup surface is a transient surface with an added pointer
  2668. * grab.
  2669. *
  2670. * An existing implicit grab will be changed to owner-events mode,
  2671. * and the popup grab will continue after the implicit grab ends
  2672. * (i.e. releasing the mouse button does not cause the popup to
  2673. * be unmapped).
  2674. *
  2675. * The popup grab continues until the window is destroyed or a
  2676. * mouse button is pressed in any other client's window. A click
  2677. * in any of the client's surfaces is reported as normal, however,
  2678. * clicks in other clients' surfaces will be discarded and trigger
  2679. * the callback.
  2680. *
  2681. * The x and y arguments specify the location of the upper left
  2682. * corner of the surface relative to the upper left corner of the
  2683. * parent surface, in surface-local coordinates.
  2684. */
  2685. static inline void
  2686. wl_shell_surface_set_popup(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial, struct wl_surface *parent, int32_t x, int32_t y, uint32_t flags)
  2687. {
  2688. wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
  2689. WL_SHELL_SURFACE_SET_POPUP, seat, serial, parent, x, y, flags);
  2690. }
  2691. /**
  2692. * @ingroup iface_wl_shell_surface
  2693. *
  2694. * Map the surface as a maximized surface.
  2695. *
  2696. * If an output parameter is given then the surface will be
  2697. * maximized on that output. If the client does not specify the
  2698. * output then the compositor will apply its policy - usually
  2699. * choosing the output on which the surface has the biggest surface
  2700. * area.
  2701. *
  2702. * The compositor will reply with a configure event telling
  2703. * the expected new surface size. The operation is completed
  2704. * on the next buffer attach to this surface.
  2705. *
  2706. * A maximized surface typically fills the entire output it is
  2707. * bound to, except for desktop elements such as panels. This is
  2708. * the main difference between a maximized shell surface and a
  2709. * fullscreen shell surface.
  2710. *
  2711. * The details depend on the compositor implementation.
  2712. */
  2713. static inline void
  2714. wl_shell_surface_set_maximized(struct wl_shell_surface *wl_shell_surface, struct wl_output *output)
  2715. {
  2716. wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
  2717. WL_SHELL_SURFACE_SET_MAXIMIZED, output);
  2718. }
  2719. /**
  2720. * @ingroup iface_wl_shell_surface
  2721. *
  2722. * Set a short title for the surface.
  2723. *
  2724. * This string may be used to identify the surface in a task bar,
  2725. * window list, or other user interface elements provided by the
  2726. * compositor.
  2727. *
  2728. * The string must be encoded in UTF-8.
  2729. */
  2730. static inline void
  2731. wl_shell_surface_set_title(struct wl_shell_surface *wl_shell_surface, const char *title)
  2732. {
  2733. wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
  2734. WL_SHELL_SURFACE_SET_TITLE, title);
  2735. }
  2736. /**
  2737. * @ingroup iface_wl_shell_surface
  2738. *
  2739. * Set a class for the surface.
  2740. *
  2741. * The surface class identifies the general class of applications
  2742. * to which the surface belongs. A common convention is to use the
  2743. * file name (or the full path if it is a non-standard location) of
  2744. * the application's .desktop file as the class.
  2745. */
  2746. static inline void
  2747. wl_shell_surface_set_class(struct wl_shell_surface *wl_shell_surface, const char *class_)
  2748. {
  2749. wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
  2750. WL_SHELL_SURFACE_SET_CLASS, class_);
  2751. }
  2752. #ifndef WL_SURFACE_ERROR_ENUM
  2753. #define WL_SURFACE_ERROR_ENUM
  2754. /**
  2755. * @ingroup iface_wl_surface
  2756. * wl_surface error values
  2757. *
  2758. * These errors can be emitted in response to wl_surface requests.
  2759. */
  2760. enum wl_surface_error {
  2761. /**
  2762. * buffer scale value is invalid
  2763. */
  2764. WL_SURFACE_ERROR_INVALID_SCALE = 0,
  2765. /**
  2766. * buffer transform value is invalid
  2767. */
  2768. WL_SURFACE_ERROR_INVALID_TRANSFORM = 1,
  2769. };
  2770. #endif /* WL_SURFACE_ERROR_ENUM */
  2771. /**
  2772. * @ingroup iface_wl_surface
  2773. * @struct wl_surface_listener
  2774. */
  2775. struct wl_surface_listener {
  2776. /**
  2777. * surface enters an output
  2778. *
  2779. * This is emitted whenever a surface's creation, movement, or
  2780. * resizing results in some part of it being within the scanout
  2781. * region of an output.
  2782. *
  2783. * Note that a surface may be overlapping with zero or more
  2784. * outputs.
  2785. * @param output output entered by the surface
  2786. */
  2787. void (*enter)(void *data,
  2788. struct wl_surface *wl_surface,
  2789. struct wl_output *output);
  2790. /**
  2791. * surface leaves an output
  2792. *
  2793. * This is emitted whenever a surface's creation, movement, or
  2794. * resizing results in it no longer having any part of it within
  2795. * the scanout region of an output.
  2796. * @param output output left by the surface
  2797. */
  2798. void (*leave)(void *data,
  2799. struct wl_surface *wl_surface,
  2800. struct wl_output *output);
  2801. };
  2802. /**
  2803. * @ingroup wl_surface_iface
  2804. */
  2805. static inline int
  2806. wl_surface_add_listener(struct wl_surface *wl_surface,
  2807. const struct wl_surface_listener *listener, void *data)
  2808. {
  2809. return wl_proxy_add_listener((struct wl_proxy *) wl_surface,
  2810. (void (**)(void)) listener, data);
  2811. }
  2812. #define WL_SURFACE_DESTROY 0
  2813. #define WL_SURFACE_ATTACH 1
  2814. #define WL_SURFACE_DAMAGE 2
  2815. #define WL_SURFACE_FRAME 3
  2816. #define WL_SURFACE_SET_OPAQUE_REGION 4
  2817. #define WL_SURFACE_SET_INPUT_REGION 5
  2818. #define WL_SURFACE_COMMIT 6
  2819. #define WL_SURFACE_SET_BUFFER_TRANSFORM 7
  2820. #define WL_SURFACE_SET_BUFFER_SCALE 8
  2821. #define WL_SURFACE_DAMAGE_BUFFER 9
  2822. /**
  2823. * @ingroup iface_wl_surface
  2824. */
  2825. #define WL_SURFACE_DESTROY_SINCE_VERSION 1
  2826. /**
  2827. * @ingroup iface_wl_surface
  2828. */
  2829. #define WL_SURFACE_ATTACH_SINCE_VERSION 1
  2830. /**
  2831. * @ingroup iface_wl_surface
  2832. */
  2833. #define WL_SURFACE_DAMAGE_SINCE_VERSION 1
  2834. /**
  2835. * @ingroup iface_wl_surface
  2836. */
  2837. #define WL_SURFACE_FRAME_SINCE_VERSION 1
  2838. /**
  2839. * @ingroup iface_wl_surface
  2840. */
  2841. #define WL_SURFACE_SET_OPAQUE_REGION_SINCE_VERSION 1
  2842. /**
  2843. * @ingroup iface_wl_surface
  2844. */
  2845. #define WL_SURFACE_SET_INPUT_REGION_SINCE_VERSION 1
  2846. /**
  2847. * @ingroup iface_wl_surface
  2848. */
  2849. #define WL_SURFACE_COMMIT_SINCE_VERSION 1
  2850. /**
  2851. * @ingroup iface_wl_surface
  2852. */
  2853. #define WL_SURFACE_SET_BUFFER_TRANSFORM_SINCE_VERSION 2
  2854. /**
  2855. * @ingroup iface_wl_surface
  2856. */
  2857. #define WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION 3
  2858. /**
  2859. * @ingroup iface_wl_surface
  2860. */
  2861. #define WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION 4
  2862. /** @ingroup iface_wl_surface */
  2863. static inline void
  2864. wl_surface_set_user_data(struct wl_surface *wl_surface, void *user_data)
  2865. {
  2866. wl_proxy_set_user_data((struct wl_proxy *) wl_surface, user_data);
  2867. }
  2868. /** @ingroup iface_wl_surface */
  2869. static inline void *
  2870. wl_surface_get_user_data(struct wl_surface *wl_surface)
  2871. {
  2872. return wl_proxy_get_user_data((struct wl_proxy *) wl_surface);
  2873. }
  2874. static inline uint32_t
  2875. wl_surface_get_version(struct wl_surface *wl_surface)
  2876. {
  2877. return wl_proxy_get_version((struct wl_proxy *) wl_surface);
  2878. }
  2879. /**
  2880. * @ingroup iface_wl_surface
  2881. *
  2882. * Deletes the surface and invalidates its object ID.
  2883. */
  2884. static inline void
  2885. wl_surface_destroy(struct wl_surface *wl_surface)
  2886. {
  2887. wl_proxy_marshal((struct wl_proxy *) wl_surface,
  2888. WL_SURFACE_DESTROY);
  2889. wl_proxy_destroy((struct wl_proxy *) wl_surface);
  2890. }
  2891. /**
  2892. * @ingroup iface_wl_surface
  2893. *
  2894. * Set a buffer as the content of this surface.
  2895. *
  2896. * The new size of the surface is calculated based on the buffer
  2897. * size transformed by the inverse buffer_transform and the
  2898. * inverse buffer_scale. This means that the supplied buffer
  2899. * must be an integer multiple of the buffer_scale.
  2900. *
  2901. * The x and y arguments specify the location of the new pending
  2902. * buffer's upper left corner, relative to the current buffer's upper
  2903. * left corner, in surface-local coordinates. In other words, the
  2904. * x and y, combined with the new surface size define in which
  2905. * directions the surface's size changes.
  2906. *
  2907. * Surface contents are double-buffered state, see wl_surface.commit.
  2908. *
  2909. * The initial surface contents are void; there is no content.
  2910. * wl_surface.attach assigns the given wl_buffer as the pending
  2911. * wl_buffer. wl_surface.commit makes the pending wl_buffer the new
  2912. * surface contents, and the size of the surface becomes the size
  2913. * calculated from the wl_buffer, as described above. After commit,
  2914. * there is no pending buffer until the next attach.
  2915. *
  2916. * Committing a pending wl_buffer allows the compositor to read the
  2917. * pixels in the wl_buffer. The compositor may access the pixels at
  2918. * any time after the wl_surface.commit request. When the compositor
  2919. * will not access the pixels anymore, it will send the
  2920. * wl_buffer.release event. Only after receiving wl_buffer.release,
  2921. * the client may reuse the wl_buffer. A wl_buffer that has been
  2922. * attached and then replaced by another attach instead of committed
  2923. * will not receive a release event, and is not used by the
  2924. * compositor.
  2925. *
  2926. * Destroying the wl_buffer after wl_buffer.release does not change
  2927. * the surface contents. However, if the client destroys the
  2928. * wl_buffer before receiving the wl_buffer.release event, the surface
  2929. * contents become undefined immediately.
  2930. *
  2931. * If wl_surface.attach is sent with a NULL wl_buffer, the
  2932. * following wl_surface.commit will remove the surface content.
  2933. */
  2934. static inline void
  2935. wl_surface_attach(struct wl_surface *wl_surface, struct wl_buffer *buffer, int32_t x, int32_t y)
  2936. {
  2937. wl_proxy_marshal((struct wl_proxy *) wl_surface,
  2938. WL_SURFACE_ATTACH, buffer, x, y);
  2939. }
  2940. /**
  2941. * @ingroup iface_wl_surface
  2942. *
  2943. * This request is used to describe the regions where the pending
  2944. * buffer is different from the current surface contents, and where
  2945. * the surface therefore needs to be repainted. The compositor
  2946. * ignores the parts of the damage that fall outside of the surface.
  2947. *
  2948. * Damage is double-buffered state, see wl_surface.commit.
  2949. *
  2950. * The damage rectangle is specified in surface-local coordinates.
  2951. *
  2952. * The initial value for pending damage is empty: no damage.
  2953. * wl_surface.damage adds pending damage: the new pending damage
  2954. * is the union of old pending damage and the given rectangle.
  2955. *
  2956. * wl_surface.commit assigns pending damage as the current damage,
  2957. * and clears pending damage. The server will clear the current
  2958. * damage as it repaints the surface.
  2959. *
  2960. * Alternatively, damage can be posted with wl_surface.damage_buffer
  2961. * which uses buffer coordinates instead of surface coordinates,
  2962. * and is probably the preferred and intuitive way of doing this.
  2963. */
  2964. static inline void
  2965. wl_surface_damage(struct wl_surface *wl_surface, int32_t x, int32_t y, int32_t width, int32_t height)
  2966. {
  2967. wl_proxy_marshal((struct wl_proxy *) wl_surface,
  2968. WL_SURFACE_DAMAGE, x, y, width, height);
  2969. }
  2970. /**
  2971. * @ingroup iface_wl_surface
  2972. *
  2973. * Request a notification when it is a good time to start drawing a new
  2974. * frame, by creating a frame callback. This is useful for throttling
  2975. * redrawing operations, and driving animations.
  2976. *
  2977. * When a client is animating on a wl_surface, it can use the 'frame'
  2978. * request to get notified when it is a good time to draw and commit the
  2979. * next frame of animation. If the client commits an update earlier than
  2980. * that, it is likely that some updates will not make it to the display,
  2981. * and the client is wasting resources by drawing too often.
  2982. *
  2983. * The frame request will take effect on the next wl_surface.commit.
  2984. * The notification will only be posted for one frame unless
  2985. * requested again. For a wl_surface, the notifications are posted in
  2986. * the order the frame requests were committed.
  2987. *
  2988. * The server must send the notifications so that a client
  2989. * will not send excessive updates, while still allowing
  2990. * the highest possible update rate for clients that wait for the reply
  2991. * before drawing again. The server should give some time for the client
  2992. * to draw and commit after sending the frame callback events to let it
  2993. * hit the next output refresh.
  2994. *
  2995. * A server should avoid signaling the frame callbacks if the
  2996. * surface is not visible in any way, e.g. the surface is off-screen,
  2997. * or completely obscured by other opaque surfaces.
  2998. *
  2999. * The object returned by this request will be destroyed by the
  3000. * compositor after the callback is fired and as such the client must not
  3001. * attempt to use it after that point.
  3002. *
  3003. * The callback_data passed in the callback is the current time, in
  3004. * milliseconds, with an undefined base.
  3005. */
  3006. static inline struct wl_callback *
  3007. wl_surface_frame(struct wl_surface *wl_surface)
  3008. {
  3009. struct wl_proxy *callback;
  3010. callback = wl_proxy_marshal_constructor((struct wl_proxy *) wl_surface,
  3011. WL_SURFACE_FRAME, &wl_callback_interface, NULL);
  3012. return (struct wl_callback *) callback;
  3013. }
  3014. /**
  3015. * @ingroup iface_wl_surface
  3016. *
  3017. * This request sets the region of the surface that contains
  3018. * opaque content.
  3019. *
  3020. * The opaque region is an optimization hint for the compositor
  3021. * that lets it optimize the redrawing of content behind opaque
  3022. * regions. Setting an opaque region is not required for correct
  3023. * behaviour, but marking transparent content as opaque will result
  3024. * in repaint artifacts.
  3025. *
  3026. * The opaque region is specified in surface-local coordinates.
  3027. *
  3028. * The compositor ignores the parts of the opaque region that fall
  3029. * outside of the surface.
  3030. *
  3031. * Opaque region is double-buffered state, see wl_surface.commit.
  3032. *
  3033. * wl_surface.set_opaque_region changes the pending opaque region.
  3034. * wl_surface.commit copies the pending region to the current region.
  3035. * Otherwise, the pending and current regions are never changed.
  3036. *
  3037. * The initial value for an opaque region is empty. Setting the pending
  3038. * opaque region has copy semantics, and the wl_region object can be
  3039. * destroyed immediately. A NULL wl_region causes the pending opaque
  3040. * region to be set to empty.
  3041. */
  3042. static inline void
  3043. wl_surface_set_opaque_region(struct wl_surface *wl_surface, struct wl_region *region)
  3044. {
  3045. wl_proxy_marshal((struct wl_proxy *) wl_surface,
  3046. WL_SURFACE_SET_OPAQUE_REGION, region);
  3047. }
  3048. /**
  3049. * @ingroup iface_wl_surface
  3050. *
  3051. * This request sets the region of the surface that can receive
  3052. * pointer and touch events.
  3053. *
  3054. * Input events happening outside of this region will try the next
  3055. * surface in the server surface stack. The compositor ignores the
  3056. * parts of the input region that fall outside of the surface.
  3057. *
  3058. * The input region is specified in surface-local coordinates.
  3059. *
  3060. * Input region is double-buffered state, see wl_surface.commit.
  3061. *
  3062. * wl_surface.set_input_region changes the pending input region.
  3063. * wl_surface.commit copies the pending region to the current region.
  3064. * Otherwise the pending and current regions are never changed,
  3065. * except cursor and icon surfaces are special cases, see
  3066. * wl_pointer.set_cursor and wl_data_device.start_drag.
  3067. *
  3068. * The initial value for an input region is infinite. That means the
  3069. * whole surface will accept input. Setting the pending input region
  3070. * has copy semantics, and the wl_region object can be destroyed
  3071. * immediately. A NULL wl_region causes the input region to be set
  3072. * to infinite.
  3073. */
  3074. static inline void
  3075. wl_surface_set_input_region(struct wl_surface *wl_surface, struct wl_region *region)
  3076. {
  3077. wl_proxy_marshal((struct wl_proxy *) wl_surface,
  3078. WL_SURFACE_SET_INPUT_REGION, region);
  3079. }
  3080. /**
  3081. * @ingroup iface_wl_surface
  3082. *
  3083. * Surface state (input, opaque, and damage regions, attached buffers,
  3084. * etc.) is double-buffered. Protocol requests modify the pending state,
  3085. * as opposed to the current state in use by the compositor. A commit
  3086. * request atomically applies all pending state, replacing the current
  3087. * state. After commit, the new pending state is as documented for each
  3088. * related request.
  3089. *
  3090. * On commit, a pending wl_buffer is applied first, and all other state
  3091. * second. This means that all coordinates in double-buffered state are
  3092. * relative to the new wl_buffer coming into use, except for
  3093. * wl_surface.attach itself. If there is no pending wl_buffer, the
  3094. * coordinates are relative to the current surface contents.
  3095. *
  3096. * All requests that need a commit to become effective are documented
  3097. * to affect double-buffered state.
  3098. *
  3099. * Other interfaces may add further double-buffered surface state.
  3100. */
  3101. static inline void
  3102. wl_surface_commit(struct wl_surface *wl_surface)
  3103. {
  3104. wl_proxy_marshal((struct wl_proxy *) wl_surface,
  3105. WL_SURFACE_COMMIT);
  3106. }
  3107. /**
  3108. * @ingroup iface_wl_surface
  3109. *
  3110. * This request sets an optional transformation on how the compositor
  3111. * interprets the contents of the buffer attached to the surface. The
  3112. * accepted values for the transform parameter are the values for
  3113. * wl_output.transform.
  3114. *
  3115. * Buffer transform is double-buffered state, see wl_surface.commit.
  3116. *
  3117. * A newly created surface has its buffer transformation set to normal.
  3118. *
  3119. * wl_surface.set_buffer_transform changes the pending buffer
  3120. * transformation. wl_surface.commit copies the pending buffer
  3121. * transformation to the current one. Otherwise, the pending and current
  3122. * values are never changed.
  3123. *
  3124. * The purpose of this request is to allow clients to render content
  3125. * according to the output transform, thus permitting the compositor to
  3126. * use certain optimizations even if the display is rotated. Using
  3127. * hardware overlays and scanning out a client buffer for fullscreen
  3128. * surfaces are examples of such optimizations. Those optimizations are
  3129. * highly dependent on the compositor implementation, so the use of this
  3130. * request should be considered on a case-by-case basis.
  3131. *
  3132. * Note that if the transform value includes 90 or 270 degree rotation,
  3133. * the width of the buffer will become the surface height and the height
  3134. * of the buffer will become the surface width.
  3135. *
  3136. * If transform is not one of the values from the
  3137. * wl_output.transform enum the invalid_transform protocol error
  3138. * is raised.
  3139. */
  3140. static inline void
  3141. wl_surface_set_buffer_transform(struct wl_surface *wl_surface, int32_t transform)
  3142. {
  3143. wl_proxy_marshal((struct wl_proxy *) wl_surface,
  3144. WL_SURFACE_SET_BUFFER_TRANSFORM, transform);
  3145. }
  3146. /**
  3147. * @ingroup iface_wl_surface
  3148. *
  3149. * This request sets an optional scaling factor on how the compositor
  3150. * interprets the contents of the buffer attached to the window.
  3151. *
  3152. * Buffer scale is double-buffered state, see wl_surface.commit.
  3153. *
  3154. * A newly created surface has its buffer scale set to 1.
  3155. *
  3156. * wl_surface.set_buffer_scale changes the pending buffer scale.
  3157. * wl_surface.commit copies the pending buffer scale to the current one.
  3158. * Otherwise, the pending and current values are never changed.
  3159. *
  3160. * The purpose of this request is to allow clients to supply higher
  3161. * resolution buffer data for use on high resolution outputs. It is
  3162. * intended that you pick the same buffer scale as the scale of the
  3163. * output that the surface is displayed on. This means the compositor
  3164. * can avoid scaling when rendering the surface on that output.
  3165. *
  3166. * Note that if the scale is larger than 1, then you have to attach
  3167. * a buffer that is larger (by a factor of scale in each dimension)
  3168. * than the desired surface size.
  3169. *
  3170. * If scale is not positive the invalid_scale protocol error is
  3171. * raised.
  3172. */
  3173. static inline void
  3174. wl_surface_set_buffer_scale(struct wl_surface *wl_surface, int32_t scale)
  3175. {
  3176. wl_proxy_marshal((struct wl_proxy *) wl_surface,
  3177. WL_SURFACE_SET_BUFFER_SCALE, scale);
  3178. }
  3179. /**
  3180. * @ingroup iface_wl_surface
  3181. *
  3182. * This request is used to describe the regions where the pending
  3183. * buffer is different from the current surface contents, and where
  3184. * the surface therefore needs to be repainted. The compositor
  3185. * ignores the parts of the damage that fall outside of the surface.
  3186. *
  3187. * Damage is double-buffered state, see wl_surface.commit.
  3188. *
  3189. * The damage rectangle is specified in buffer coordinates.
  3190. *
  3191. * The initial value for pending damage is empty: no damage.
  3192. * wl_surface.damage_buffer adds pending damage: the new pending
  3193. * damage is the union of old pending damage and the given rectangle.
  3194. *
  3195. * wl_surface.commit assigns pending damage as the current damage,
  3196. * and clears pending damage. The server will clear the current
  3197. * damage as it repaints the surface.
  3198. *
  3199. * This request differs from wl_surface.damage in only one way - it
  3200. * takes damage in buffer coordinates instead of surface-local
  3201. * coordinates. While this generally is more intuitive than surface
  3202. * coordinates, it is especially desirable when using wp_viewport
  3203. * or when a drawing library (like EGL) is unaware of buffer scale
  3204. * and buffer transform.
  3205. *
  3206. * Note: Because buffer transformation changes and damage requests may
  3207. * be interleaved in the protocol stream, it is impossible to determine
  3208. * the actual mapping between surface and buffer damage until
  3209. * wl_surface.commit time. Therefore, compositors wishing to take both
  3210. * kinds of damage into account will have to accumulate damage from the
  3211. * two requests separately and only transform from one to the other
  3212. * after receiving the wl_surface.commit.
  3213. */
  3214. static inline void
  3215. wl_surface_damage_buffer(struct wl_surface *wl_surface, int32_t x, int32_t y, int32_t width, int32_t height)
  3216. {
  3217. wl_proxy_marshal((struct wl_proxy *) wl_surface,
  3218. WL_SURFACE_DAMAGE_BUFFER, x, y, width, height);
  3219. }
  3220. #ifndef WL_SEAT_CAPABILITY_ENUM
  3221. #define WL_SEAT_CAPABILITY_ENUM
  3222. /**
  3223. * @ingroup iface_wl_seat
  3224. * seat capability bitmask
  3225. *
  3226. * This is a bitmask of capabilities this seat has; if a member is
  3227. * set, then it is present on the seat.
  3228. */
  3229. enum wl_seat_capability {
  3230. /**
  3231. * the seat has pointer devices
  3232. */
  3233. WL_SEAT_CAPABILITY_POINTER = 1,
  3234. /**
  3235. * the seat has one or more keyboards
  3236. */
  3237. WL_SEAT_CAPABILITY_KEYBOARD = 2,
  3238. /**
  3239. * the seat has touch devices
  3240. */
  3241. WL_SEAT_CAPABILITY_TOUCH = 4,
  3242. };
  3243. #endif /* WL_SEAT_CAPABILITY_ENUM */
  3244. /**
  3245. * @ingroup iface_wl_seat
  3246. * @struct wl_seat_listener
  3247. */
  3248. struct wl_seat_listener {
  3249. /**
  3250. * seat capabilities changed
  3251. *
  3252. * This is emitted whenever a seat gains or loses the pointer,
  3253. * keyboard or touch capabilities. The argument is a capability
  3254. * enum containing the complete set of capabilities this seat has.
  3255. *
  3256. * When the pointer capability is added, a client may create a
  3257. * wl_pointer object using the wl_seat.get_pointer request. This
  3258. * object will receive pointer events until the capability is
  3259. * removed in the future.
  3260. *
  3261. * When the pointer capability is removed, a client should destroy
  3262. * the wl_pointer objects associated with the seat where the
  3263. * capability was removed, using the wl_pointer.release request. No
  3264. * further pointer events will be received on these objects.
  3265. *
  3266. * In some compositors, if a seat regains the pointer capability
  3267. * and a client has a previously obtained wl_pointer object of
  3268. * version 4 or less, that object may start sending pointer events
  3269. * again. This behavior is considered a misinterpretation of the
  3270. * intended behavior and must not be relied upon by the client.
  3271. * wl_pointer objects of version 5 or later must not send events if
  3272. * created before the most recent event notifying the client of an
  3273. * added pointer capability.
  3274. *
  3275. * The above behavior also applies to wl_keyboard and wl_touch with
  3276. * the keyboard and touch capabilities, respectively.
  3277. * @param capabilities capabilities of the seat
  3278. */
  3279. void (*capabilities)(void *data,
  3280. struct wl_seat *wl_seat,
  3281. uint32_t capabilities);
  3282. /**
  3283. * unique identifier for this seat
  3284. *
  3285. * In a multiseat configuration this can be used by the client to
  3286. * help identify which physical devices the seat represents. Based
  3287. * on the seat configuration used by the compositor.
  3288. * @param name seat identifier
  3289. * @since 2
  3290. */
  3291. void (*name)(void *data,
  3292. struct wl_seat *wl_seat,
  3293. const char *name);
  3294. };
  3295. /**
  3296. * @ingroup wl_seat_iface
  3297. */
  3298. static inline int
  3299. wl_seat_add_listener(struct wl_seat *wl_seat,
  3300. const struct wl_seat_listener *listener, void *data)
  3301. {
  3302. return wl_proxy_add_listener((struct wl_proxy *) wl_seat,
  3303. (void (**)(void)) listener, data);
  3304. }
  3305. #define WL_SEAT_GET_POINTER 0
  3306. #define WL_SEAT_GET_KEYBOARD 1
  3307. #define WL_SEAT_GET_TOUCH 2
  3308. #define WL_SEAT_RELEASE 3
  3309. /**
  3310. * @ingroup iface_wl_seat
  3311. */
  3312. #define WL_SEAT_GET_POINTER_SINCE_VERSION 1
  3313. /**
  3314. * @ingroup iface_wl_seat
  3315. */
  3316. #define WL_SEAT_GET_KEYBOARD_SINCE_VERSION 1
  3317. /**
  3318. * @ingroup iface_wl_seat
  3319. */
  3320. #define WL_SEAT_GET_TOUCH_SINCE_VERSION 1
  3321. /**
  3322. * @ingroup iface_wl_seat
  3323. */
  3324. #define WL_SEAT_RELEASE_SINCE_VERSION 5
  3325. /** @ingroup iface_wl_seat */
  3326. static inline void
  3327. wl_seat_set_user_data(struct wl_seat *wl_seat, void *user_data)
  3328. {
  3329. wl_proxy_set_user_data((struct wl_proxy *) wl_seat, user_data);
  3330. }
  3331. /** @ingroup iface_wl_seat */
  3332. static inline void *
  3333. wl_seat_get_user_data(struct wl_seat *wl_seat)
  3334. {
  3335. return wl_proxy_get_user_data((struct wl_proxy *) wl_seat);
  3336. }
  3337. static inline uint32_t
  3338. wl_seat_get_version(struct wl_seat *wl_seat)
  3339. {
  3340. return wl_proxy_get_version((struct wl_proxy *) wl_seat);
  3341. }
  3342. /** @ingroup iface_wl_seat */
  3343. static inline void
  3344. wl_seat_destroy(struct wl_seat *wl_seat)
  3345. {
  3346. wl_proxy_destroy((struct wl_proxy *) wl_seat);
  3347. }
  3348. /**
  3349. * @ingroup iface_wl_seat
  3350. *
  3351. * The ID provided will be initialized to the wl_pointer interface
  3352. * for this seat.
  3353. *
  3354. * This request only takes effect if the seat has the pointer
  3355. * capability, or has had the pointer capability in the past.
  3356. * It is a protocol violation to issue this request on a seat that has
  3357. * never had the pointer capability.
  3358. */
  3359. static inline struct wl_pointer *
  3360. wl_seat_get_pointer(struct wl_seat *wl_seat)
  3361. {
  3362. struct wl_proxy *id;
  3363. id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_seat,
  3364. WL_SEAT_GET_POINTER, &wl_pointer_interface, NULL);
  3365. return (struct wl_pointer *) id;
  3366. }
  3367. /**
  3368. * @ingroup iface_wl_seat
  3369. *
  3370. * The ID provided will be initialized to the wl_keyboard interface
  3371. * for this seat.
  3372. *
  3373. * This request only takes effect if the seat has the keyboard
  3374. * capability, or has had the keyboard capability in the past.
  3375. * It is a protocol violation to issue this request on a seat that has
  3376. * never had the keyboard capability.
  3377. */
  3378. static inline struct wl_keyboard *
  3379. wl_seat_get_keyboard(struct wl_seat *wl_seat)
  3380. {
  3381. struct wl_proxy *id;
  3382. id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_seat,
  3383. WL_SEAT_GET_KEYBOARD, &wl_keyboard_interface, NULL);
  3384. return (struct wl_keyboard *) id;
  3385. }
  3386. /**
  3387. * @ingroup iface_wl_seat
  3388. *
  3389. * The ID provided will be initialized to the wl_touch interface
  3390. * for this seat.
  3391. *
  3392. * This request only takes effect if the seat has the touch
  3393. * capability, or has had the touch capability in the past.
  3394. * It is a protocol violation to issue this request on a seat that has
  3395. * never had the touch capability.
  3396. */
  3397. static inline struct wl_touch *
  3398. wl_seat_get_touch(struct wl_seat *wl_seat)
  3399. {
  3400. struct wl_proxy *id;
  3401. id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_seat,
  3402. WL_SEAT_GET_TOUCH, &wl_touch_interface, NULL);
  3403. return (struct wl_touch *) id;
  3404. }
  3405. /**
  3406. * @ingroup iface_wl_seat
  3407. *
  3408. * Using this request a client can tell the server that it is not going to
  3409. * use the seat object anymore.
  3410. */
  3411. static inline void
  3412. wl_seat_release(struct wl_seat *wl_seat)
  3413. {
  3414. wl_proxy_marshal((struct wl_proxy *) wl_seat,
  3415. WL_SEAT_RELEASE);
  3416. wl_proxy_destroy((struct wl_proxy *) wl_seat);
  3417. }
  3418. #ifndef WL_POINTER_ERROR_ENUM
  3419. #define WL_POINTER_ERROR_ENUM
  3420. enum wl_pointer_error {
  3421. /**
  3422. * given wl_surface has another role
  3423. */
  3424. WL_POINTER_ERROR_ROLE = 0,
  3425. };
  3426. #endif /* WL_POINTER_ERROR_ENUM */
  3427. #ifndef WL_POINTER_BUTTON_STATE_ENUM
  3428. #define WL_POINTER_BUTTON_STATE_ENUM
  3429. /**
  3430. * @ingroup iface_wl_pointer
  3431. * physical button state
  3432. *
  3433. * Describes the physical state of a button that produced the button
  3434. * event.
  3435. */
  3436. enum wl_pointer_button_state {
  3437. /**
  3438. * the button is not pressed
  3439. */
  3440. WL_POINTER_BUTTON_STATE_RELEASED = 0,
  3441. /**
  3442. * the button is pressed
  3443. */
  3444. WL_POINTER_BUTTON_STATE_PRESSED = 1,
  3445. };
  3446. #endif /* WL_POINTER_BUTTON_STATE_ENUM */
  3447. #ifndef WL_POINTER_AXIS_ENUM
  3448. #define WL_POINTER_AXIS_ENUM
  3449. /**
  3450. * @ingroup iface_wl_pointer
  3451. * axis types
  3452. *
  3453. * Describes the axis types of scroll events.
  3454. */
  3455. enum wl_pointer_axis {
  3456. WL_POINTER_AXIS_VERTICAL_SCROLL = 0,
  3457. WL_POINTER_AXIS_HORIZONTAL_SCROLL = 1,
  3458. };
  3459. #endif /* WL_POINTER_AXIS_ENUM */
  3460. #ifndef WL_POINTER_AXIS_SOURCE_ENUM
  3461. #define WL_POINTER_AXIS_SOURCE_ENUM
  3462. /**
  3463. * @ingroup iface_wl_pointer
  3464. * axis source types
  3465. *
  3466. * Describes the source types for axis events. This indicates to the
  3467. * client how an axis event was physically generated; a client may
  3468. * adjust the user interface accordingly. For example, scroll events
  3469. * from a "finger" source may be in a smooth coordinate space with
  3470. * kinetic scrolling whereas a "wheel" source may be in discrete steps
  3471. * of a number of lines.
  3472. *
  3473. * The "continuous" axis source is a device generating events in a
  3474. * continuous coordinate space, but using something other than a
  3475. * finger. One example for this source is button-based scrolling where
  3476. * the vertical motion of a device is converted to scroll events while
  3477. * a button is held down.
  3478. */
  3479. enum wl_pointer_axis_source {
  3480. /**
  3481. * a physical wheel
  3482. */
  3483. WL_POINTER_AXIS_SOURCE_WHEEL = 0,
  3484. /**
  3485. * finger on a touch surface
  3486. */
  3487. WL_POINTER_AXIS_SOURCE_FINGER = 1,
  3488. /**
  3489. * continuous coordinate space
  3490. */
  3491. WL_POINTER_AXIS_SOURCE_CONTINUOUS = 2,
  3492. };
  3493. #endif /* WL_POINTER_AXIS_SOURCE_ENUM */
  3494. /**
  3495. * @ingroup iface_wl_pointer
  3496. * @struct wl_pointer_listener
  3497. */
  3498. struct wl_pointer_listener {
  3499. /**
  3500. * enter event
  3501. *
  3502. * Notification that this seat's pointer is focused on a certain
  3503. * surface.
  3504. *
  3505. * When a seat's focus enters a surface, the pointer image is
  3506. * undefined and a client should respond to this event by setting
  3507. * an appropriate pointer image with the set_cursor request.
  3508. * @param serial serial number of the enter event
  3509. * @param surface surface entered by the pointer
  3510. * @param surface_x surface-local x coordinate
  3511. * @param surface_y surface-local y coordinate
  3512. */
  3513. void (*enter)(void *data,
  3514. struct wl_pointer *wl_pointer,
  3515. uint32_t serial,
  3516. struct wl_surface *surface,
  3517. wl_fixed_t surface_x,
  3518. wl_fixed_t surface_y);
  3519. /**
  3520. * leave event
  3521. *
  3522. * Notification that this seat's pointer is no longer focused on
  3523. * a certain surface.
  3524. *
  3525. * The leave notification is sent before the enter notification for
  3526. * the new focus.
  3527. * @param serial serial number of the leave event
  3528. * @param surface surface left by the pointer
  3529. */
  3530. void (*leave)(void *data,
  3531. struct wl_pointer *wl_pointer,
  3532. uint32_t serial,
  3533. struct wl_surface *surface);
  3534. /**
  3535. * pointer motion event
  3536. *
  3537. * Notification of pointer location change. The arguments
  3538. * surface_x and surface_y are the location relative to the focused
  3539. * surface.
  3540. * @param time timestamp with millisecond granularity
  3541. * @param surface_x surface-local x coordinate
  3542. * @param surface_y surface-local y coordinate
  3543. */
  3544. void (*motion)(void *data,
  3545. struct wl_pointer *wl_pointer,
  3546. uint32_t time,
  3547. wl_fixed_t surface_x,
  3548. wl_fixed_t surface_y);
  3549. /**
  3550. * pointer button event
  3551. *
  3552. * Mouse button click and release notifications.
  3553. *
  3554. * The location of the click is given by the last motion or enter
  3555. * event. The time argument is a timestamp with millisecond
  3556. * granularity, with an undefined base.
  3557. * @param serial serial number of the button event
  3558. * @param time timestamp with millisecond granularity
  3559. * @param button button that produced the event
  3560. * @param state physical state of the button
  3561. */
  3562. void (*button)(void *data,
  3563. struct wl_pointer *wl_pointer,
  3564. uint32_t serial,
  3565. uint32_t time,
  3566. uint32_t button,
  3567. uint32_t state);
  3568. /**
  3569. * axis event
  3570. *
  3571. * Scroll and other axis notifications.
  3572. *
  3573. * For scroll events (vertical and horizontal scroll axes), the
  3574. * value parameter is the length of a vector along the specified
  3575. * axis in a coordinate space identical to those of motion events,
  3576. * representing a relative movement along the specified axis.
  3577. *
  3578. * For devices that support movements non-parallel to axes multiple
  3579. * axis events will be emitted.
  3580. *
  3581. * When applicable, for example for touch pads, the server can
  3582. * choose to emit scroll events where the motion vector is
  3583. * equivalent to a motion event vector.
  3584. *
  3585. * When applicable, a client can transform its content relative to
  3586. * the scroll distance.
  3587. * @param time timestamp with millisecond granularity
  3588. * @param axis axis type
  3589. * @param value length of vector in surface-local coordinate space
  3590. */
  3591. void (*axis)(void *data,
  3592. struct wl_pointer *wl_pointer,
  3593. uint32_t time,
  3594. uint32_t axis,
  3595. wl_fixed_t value);
  3596. /**
  3597. * end of a pointer event sequence
  3598. *
  3599. * Indicates the end of a set of events that logically belong
  3600. * together. A client is expected to accumulate the data in all
  3601. * events within the frame before proceeding.
  3602. *
  3603. * All wl_pointer events before a wl_pointer.frame event belong
  3604. * logically together. For example, in a diagonal scroll motion the
  3605. * compositor will send an optional wl_pointer.axis_source event,
  3606. * two wl_pointer.axis events (horizontal and vertical) and finally
  3607. * a wl_pointer.frame event. The client may use this information to
  3608. * calculate a diagonal vector for scrolling.
  3609. *
  3610. * When multiple wl_pointer.axis events occur within the same
  3611. * frame, the motion vector is the combined motion of all events.
  3612. * When a wl_pointer.axis and a wl_pointer.axis_stop event occur
  3613. * within the same frame, this indicates that axis movement in one
  3614. * axis has stopped but continues in the other axis. When multiple
  3615. * wl_pointer.axis_stop events occur within the same frame, this
  3616. * indicates that these axes stopped in the same instance.
  3617. *
  3618. * A wl_pointer.frame event is sent for every logical event group,
  3619. * even if the group only contains a single wl_pointer event.
  3620. * Specifically, a client may get a sequence: motion, frame,
  3621. * button, frame, axis, frame, axis_stop, frame.
  3622. *
  3623. * The wl_pointer.enter and wl_pointer.leave events are logical
  3624. * events generated by the compositor and not the hardware. These
  3625. * events are also grouped by a wl_pointer.frame. When a pointer
  3626. * moves from one surface to another, a compositor should group the
  3627. * wl_pointer.leave event within the same wl_pointer.frame.
  3628. * However, a client must not rely on wl_pointer.leave and
  3629. * wl_pointer.enter being in the same wl_pointer.frame.
  3630. * Compositor-specific policies may require the wl_pointer.leave
  3631. * and wl_pointer.enter event being split across multiple
  3632. * wl_pointer.frame groups.
  3633. * @since 5
  3634. */
  3635. void (*frame)(void *data,
  3636. struct wl_pointer *wl_pointer);
  3637. /**
  3638. * axis source event
  3639. *
  3640. * Source information for scroll and other axes.
  3641. *
  3642. * This event does not occur on its own. It is sent before a
  3643. * wl_pointer.frame event and carries the source information for
  3644. * all events within that frame.
  3645. *
  3646. * The source specifies how this event was generated. If the source
  3647. * is wl_pointer.axis_source.finger, a wl_pointer.axis_stop event
  3648. * will be sent when the user lifts the finger off the device.
  3649. *
  3650. * If the source is wl_pointer axis_source.wheel or
  3651. * wl_pointer.axis_source.continuous, a wl_pointer.axis_stop event
  3652. * may or may not be sent. Whether a compositor sends an axis_stop
  3653. * event for these sources is hardware-specific and
  3654. * implementation-dependent; clients must not rely on receiving an
  3655. * axis_stop event for these scroll sources and should treat scroll
  3656. * sequences from these scroll sources as unterminated by default.
  3657. *
  3658. * This event is optional. If the source is unknown for a
  3659. * particular axis event sequence, no event is sent. Only one
  3660. * wl_pointer.axis_source event is permitted per frame.
  3661. *
  3662. * The order of wl_pointer.axis_discrete and wl_pointer.axis_source
  3663. * is not guaranteed.
  3664. * @param axis_source source of the axis event
  3665. * @since 5
  3666. */
  3667. void (*axis_source)(void *data,
  3668. struct wl_pointer *wl_pointer,
  3669. uint32_t axis_source);
  3670. /**
  3671. * axis stop event
  3672. *
  3673. * Stop notification for scroll and other axes.
  3674. *
  3675. * For some wl_pointer.axis_source types, a wl_pointer.axis_stop
  3676. * event is sent to notify a client that the axis sequence has
  3677. * terminated. This enables the client to implement kinetic
  3678. * scrolling. See the wl_pointer.axis_source documentation for
  3679. * information on when this event may be generated.
  3680. *
  3681. * Any wl_pointer.axis events with the same axis_source after this
  3682. * event should be considered as the start of a new axis motion.
  3683. *
  3684. * The timestamp is to be interpreted identical to the timestamp in
  3685. * the wl_pointer.axis event. The timestamp value may be the same
  3686. * as a preceding wl_pointer.axis event.
  3687. * @param time timestamp with millisecond granularity
  3688. * @param axis the axis stopped with this event
  3689. * @since 5
  3690. */
  3691. void (*axis_stop)(void *data,
  3692. struct wl_pointer *wl_pointer,
  3693. uint32_t time,
  3694. uint32_t axis);
  3695. /**
  3696. * axis click event
  3697. *
  3698. * Discrete step information for scroll and other axes.
  3699. *
  3700. * This event carries the axis value of the wl_pointer.axis event
  3701. * in discrete steps (e.g. mouse wheel clicks).
  3702. *
  3703. * This event does not occur on its own, it is coupled with a
  3704. * wl_pointer.axis event that represents this axis value on a
  3705. * continuous scale. The protocol guarantees that each
  3706. * axis_discrete event is always followed by exactly one axis event
  3707. * with the same axis number within the same wl_pointer.frame. Note
  3708. * that the protocol allows for other events to occur between the
  3709. * axis_discrete and its coupled axis event, including other
  3710. * axis_discrete or axis events.
  3711. *
  3712. * This event is optional; continuous scrolling devices like
  3713. * two-finger scrolling on touchpads do not have discrete steps and
  3714. * do not generate this event.
  3715. *
  3716. * The discrete value carries the directional information. e.g. a
  3717. * value of -2 is two steps towards the negative direction of this
  3718. * axis.
  3719. *
  3720. * The axis number is identical to the axis number in the
  3721. * associated axis event.
  3722. *
  3723. * The order of wl_pointer.axis_discrete and wl_pointer.axis_source
  3724. * is not guaranteed.
  3725. * @param axis axis type
  3726. * @param discrete number of steps
  3727. * @since 5
  3728. */
  3729. void (*axis_discrete)(void *data,
  3730. struct wl_pointer *wl_pointer,
  3731. uint32_t axis,
  3732. int32_t discrete);
  3733. };
  3734. /**
  3735. * @ingroup wl_pointer_iface
  3736. */
  3737. static inline int
  3738. wl_pointer_add_listener(struct wl_pointer *wl_pointer,
  3739. const struct wl_pointer_listener *listener, void *data)
  3740. {
  3741. return wl_proxy_add_listener((struct wl_proxy *) wl_pointer,
  3742. (void (**)(void)) listener, data);
  3743. }
  3744. #define WL_POINTER_SET_CURSOR 0
  3745. #define WL_POINTER_RELEASE 1
  3746. /**
  3747. * @ingroup iface_wl_pointer
  3748. */
  3749. #define WL_POINTER_SET_CURSOR_SINCE_VERSION 1
  3750. /**
  3751. * @ingroup iface_wl_pointer
  3752. */
  3753. #define WL_POINTER_RELEASE_SINCE_VERSION 3
  3754. /** @ingroup iface_wl_pointer */
  3755. static inline void
  3756. wl_pointer_set_user_data(struct wl_pointer *wl_pointer, void *user_data)
  3757. {
  3758. wl_proxy_set_user_data((struct wl_proxy *) wl_pointer, user_data);
  3759. }
  3760. /** @ingroup iface_wl_pointer */
  3761. static inline void *
  3762. wl_pointer_get_user_data(struct wl_pointer *wl_pointer)
  3763. {
  3764. return wl_proxy_get_user_data((struct wl_proxy *) wl_pointer);
  3765. }
  3766. static inline uint32_t
  3767. wl_pointer_get_version(struct wl_pointer *wl_pointer)
  3768. {
  3769. return wl_proxy_get_version((struct wl_proxy *) wl_pointer);
  3770. }
  3771. /** @ingroup iface_wl_pointer */
  3772. static inline void
  3773. wl_pointer_destroy(struct wl_pointer *wl_pointer)
  3774. {
  3775. wl_proxy_destroy((struct wl_proxy *) wl_pointer);
  3776. }
  3777. /**
  3778. * @ingroup iface_wl_pointer
  3779. *
  3780. * Set the pointer surface, i.e., the surface that contains the
  3781. * pointer image (cursor). This request gives the surface the role
  3782. * of a cursor. If the surface already has another role, it raises
  3783. * a protocol error.
  3784. *
  3785. * The cursor actually changes only if the pointer
  3786. * focus for this device is one of the requesting client's surfaces
  3787. * or the surface parameter is the current pointer surface. If
  3788. * there was a previous surface set with this request it is
  3789. * replaced. If surface is NULL, the pointer image is hidden.
  3790. *
  3791. * The parameters hotspot_x and hotspot_y define the position of
  3792. * the pointer surface relative to the pointer location. Its
  3793. * top-left corner is always at (x, y) - (hotspot_x, hotspot_y),
  3794. * where (x, y) are the coordinates of the pointer location, in
  3795. * surface-local coordinates.
  3796. *
  3797. * On surface.attach requests to the pointer surface, hotspot_x
  3798. * and hotspot_y are decremented by the x and y parameters
  3799. * passed to the request. Attach must be confirmed by
  3800. * wl_surface.commit as usual.
  3801. *
  3802. * The hotspot can also be updated by passing the currently set
  3803. * pointer surface to this request with new values for hotspot_x
  3804. * and hotspot_y.
  3805. *
  3806. * The current and pending input regions of the wl_surface are
  3807. * cleared, and wl_surface.set_input_region is ignored until the
  3808. * wl_surface is no longer used as the cursor. When the use as a
  3809. * cursor ends, the current and pending input regions become
  3810. * undefined, and the wl_surface is unmapped.
  3811. */
  3812. static inline void
  3813. wl_pointer_set_cursor(struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, int32_t hotspot_x, int32_t hotspot_y)
  3814. {
  3815. wl_proxy_marshal((struct wl_proxy *) wl_pointer,
  3816. WL_POINTER_SET_CURSOR, serial, surface, hotspot_x, hotspot_y);
  3817. }
  3818. /**
  3819. * @ingroup iface_wl_pointer
  3820. *
  3821. * Using this request a client can tell the server that it is not going to
  3822. * use the pointer object anymore.
  3823. *
  3824. * This request destroys the pointer proxy object, so clients must not call
  3825. * wl_pointer_destroy() after using this request.
  3826. */
  3827. static inline void
  3828. wl_pointer_release(struct wl_pointer *wl_pointer)
  3829. {
  3830. wl_proxy_marshal((struct wl_proxy *) wl_pointer,
  3831. WL_POINTER_RELEASE);
  3832. wl_proxy_destroy((struct wl_proxy *) wl_pointer);
  3833. }
  3834. #ifndef WL_KEYBOARD_KEYMAP_FORMAT_ENUM
  3835. #define WL_KEYBOARD_KEYMAP_FORMAT_ENUM
  3836. /**
  3837. * @ingroup iface_wl_keyboard
  3838. * keyboard mapping format
  3839. *
  3840. * This specifies the format of the keymap provided to the
  3841. * client with the wl_keyboard.keymap event.
  3842. */
  3843. enum wl_keyboard_keymap_format {
  3844. /**
  3845. * no keymap; client must understand how to interpret the raw keycode
  3846. */
  3847. WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP = 0,
  3848. /**
  3849. * libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode
  3850. */
  3851. WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1 = 1,
  3852. };
  3853. #endif /* WL_KEYBOARD_KEYMAP_FORMAT_ENUM */
  3854. #ifndef WL_KEYBOARD_KEY_STATE_ENUM
  3855. #define WL_KEYBOARD_KEY_STATE_ENUM
  3856. /**
  3857. * @ingroup iface_wl_keyboard
  3858. * physical key state
  3859. *
  3860. * Describes the physical state of a key that produced the key event.
  3861. */
  3862. enum wl_keyboard_key_state {
  3863. /**
  3864. * key is not pressed
  3865. */
  3866. WL_KEYBOARD_KEY_STATE_RELEASED = 0,
  3867. /**
  3868. * key is pressed
  3869. */
  3870. WL_KEYBOARD_KEY_STATE_PRESSED = 1,
  3871. };
  3872. #endif /* WL_KEYBOARD_KEY_STATE_ENUM */
  3873. /**
  3874. * @ingroup iface_wl_keyboard
  3875. * @struct wl_keyboard_listener
  3876. */
  3877. struct wl_keyboard_listener {
  3878. /**
  3879. * keyboard mapping
  3880. *
  3881. * This event provides a file descriptor to the client which can
  3882. * be memory-mapped to provide a keyboard mapping description.
  3883. * @param format keymap format
  3884. * @param fd keymap file descriptor
  3885. * @param size keymap size, in bytes
  3886. */
  3887. void (*keymap)(void *data,
  3888. struct wl_keyboard *wl_keyboard,
  3889. uint32_t format,
  3890. int32_t fd,
  3891. uint32_t size);
  3892. /**
  3893. * enter event
  3894. *
  3895. * Notification that this seat's keyboard focus is on a certain
  3896. * surface.
  3897. * @param serial serial number of the enter event
  3898. * @param surface surface gaining keyboard focus
  3899. * @param keys the currently pressed keys
  3900. */
  3901. void (*enter)(void *data,
  3902. struct wl_keyboard *wl_keyboard,
  3903. uint32_t serial,
  3904. struct wl_surface *surface,
  3905. struct wl_array *keys);
  3906. /**
  3907. * leave event
  3908. *
  3909. * Notification that this seat's keyboard focus is no longer on a
  3910. * certain surface.
  3911. *
  3912. * The leave notification is sent before the enter notification for
  3913. * the new focus.
  3914. * @param serial serial number of the leave event
  3915. * @param surface surface that lost keyboard focus
  3916. */
  3917. void (*leave)(void *data,
  3918. struct wl_keyboard *wl_keyboard,
  3919. uint32_t serial,
  3920. struct wl_surface *surface);
  3921. /**
  3922. * key event
  3923. *
  3924. * A key was pressed or released. The time argument is a
  3925. * timestamp with millisecond granularity, with an undefined base.
  3926. * @param serial serial number of the key event
  3927. * @param time timestamp with millisecond granularity
  3928. * @param key key that produced the event
  3929. * @param state physical state of the key
  3930. */
  3931. void (*key)(void *data,
  3932. struct wl_keyboard *wl_keyboard,
  3933. uint32_t serial,
  3934. uint32_t time,
  3935. uint32_t key,
  3936. uint32_t state);
  3937. /**
  3938. * modifier and group state
  3939. *
  3940. * Notifies clients that the modifier and/or group state has
  3941. * changed, and it should update its local state.
  3942. * @param serial serial number of the modifiers event
  3943. * @param mods_depressed depressed modifiers
  3944. * @param mods_latched latched modifiers
  3945. * @param mods_locked locked modifiers
  3946. * @param group keyboard layout
  3947. */
  3948. void (*modifiers)(void *data,
  3949. struct wl_keyboard *wl_keyboard,
  3950. uint32_t serial,
  3951. uint32_t mods_depressed,
  3952. uint32_t mods_latched,
  3953. uint32_t mods_locked,
  3954. uint32_t group);
  3955. /**
  3956. * repeat rate and delay
  3957. *
  3958. * Informs the client about the keyboard's repeat rate and delay.
  3959. *
  3960. * This event is sent as soon as the wl_keyboard object has been
  3961. * created, and is guaranteed to be received by the client before
  3962. * any key press event.
  3963. *
  3964. * Negative values for either rate or delay are illegal. A rate of
  3965. * zero will disable any repeating (regardless of the value of
  3966. * delay).
  3967. *
  3968. * This event can be sent later on as well with a new value if
  3969. * necessary, so clients should continue listening for the event
  3970. * past the creation of wl_keyboard.
  3971. * @param rate the rate of repeating keys in characters per second
  3972. * @param delay delay in milliseconds since key down until repeating starts
  3973. * @since 4
  3974. */
  3975. void (*repeat_info)(void *data,
  3976. struct wl_keyboard *wl_keyboard,
  3977. int32_t rate,
  3978. int32_t delay);
  3979. };
  3980. /**
  3981. * @ingroup wl_keyboard_iface
  3982. */
  3983. static inline int
  3984. wl_keyboard_add_listener(struct wl_keyboard *wl_keyboard,
  3985. const struct wl_keyboard_listener *listener, void *data)
  3986. {
  3987. return wl_proxy_add_listener((struct wl_proxy *) wl_keyboard,
  3988. (void (**)(void)) listener, data);
  3989. }
  3990. #define WL_KEYBOARD_RELEASE 0
  3991. /**
  3992. * @ingroup iface_wl_keyboard
  3993. */
  3994. #define WL_KEYBOARD_RELEASE_SINCE_VERSION 3
  3995. /** @ingroup iface_wl_keyboard */
  3996. static inline void
  3997. wl_keyboard_set_user_data(struct wl_keyboard *wl_keyboard, void *user_data)
  3998. {
  3999. wl_proxy_set_user_data((struct wl_proxy *) wl_keyboard, user_data);
  4000. }
  4001. /** @ingroup iface_wl_keyboard */
  4002. static inline void *
  4003. wl_keyboard_get_user_data(struct wl_keyboard *wl_keyboard)
  4004. {
  4005. return wl_proxy_get_user_data((struct wl_proxy *) wl_keyboard);
  4006. }
  4007. static inline uint32_t
  4008. wl_keyboard_get_version(struct wl_keyboard *wl_keyboard)
  4009. {
  4010. return wl_proxy_get_version((struct wl_proxy *) wl_keyboard);
  4011. }
  4012. /** @ingroup iface_wl_keyboard */
  4013. static inline void
  4014. wl_keyboard_destroy(struct wl_keyboard *wl_keyboard)
  4015. {
  4016. wl_proxy_destroy((struct wl_proxy *) wl_keyboard);
  4017. }
  4018. /**
  4019. * @ingroup iface_wl_keyboard
  4020. */
  4021. static inline void
  4022. wl_keyboard_release(struct wl_keyboard *wl_keyboard)
  4023. {
  4024. wl_proxy_marshal((struct wl_proxy *) wl_keyboard,
  4025. WL_KEYBOARD_RELEASE);
  4026. wl_proxy_destroy((struct wl_proxy *) wl_keyboard);
  4027. }
  4028. /**
  4029. * @ingroup iface_wl_touch
  4030. * @struct wl_touch_listener
  4031. */
  4032. struct wl_touch_listener {
  4033. /**
  4034. * touch down event and beginning of a touch sequence
  4035. *
  4036. * A new touch point has appeared on the surface. This touch
  4037. * point is assigned a unique ID. Future events from this touch
  4038. * point reference this ID. The ID ceases to be valid after a touch
  4039. * up event and may be reused in the future.
  4040. * @param serial serial number of the touch down event
  4041. * @param time timestamp with millisecond granularity
  4042. * @param surface surface touched
  4043. * @param id the unique ID of this touch point
  4044. * @param x surface-local x coordinate
  4045. * @param y surface-local y coordinate
  4046. */
  4047. void (*down)(void *data,
  4048. struct wl_touch *wl_touch,
  4049. uint32_t serial,
  4050. uint32_t time,
  4051. struct wl_surface *surface,
  4052. int32_t id,
  4053. wl_fixed_t x,
  4054. wl_fixed_t y);
  4055. /**
  4056. * end of a touch event sequence
  4057. *
  4058. * The touch point has disappeared. No further events will be
  4059. * sent for this touch point and the touch point's ID is released
  4060. * and may be reused in a future touch down event.
  4061. * @param serial serial number of the touch up event
  4062. * @param time timestamp with millisecond granularity
  4063. * @param id the unique ID of this touch point
  4064. */
  4065. void (*up)(void *data,
  4066. struct wl_touch *wl_touch,
  4067. uint32_t serial,
  4068. uint32_t time,
  4069. int32_t id);
  4070. /**
  4071. * update of touch point coordinates
  4072. *
  4073. * A touch point has changed coordinates.
  4074. * @param time timestamp with millisecond granularity
  4075. * @param id the unique ID of this touch point
  4076. * @param x surface-local x coordinate
  4077. * @param y surface-local y coordinate
  4078. */
  4079. void (*motion)(void *data,
  4080. struct wl_touch *wl_touch,
  4081. uint32_t time,
  4082. int32_t id,
  4083. wl_fixed_t x,
  4084. wl_fixed_t y);
  4085. /**
  4086. * end of touch frame event
  4087. *
  4088. * Indicates the end of a contact point list.
  4089. */
  4090. void (*frame)(void *data,
  4091. struct wl_touch *wl_touch);
  4092. /**
  4093. * touch session cancelled
  4094. *
  4095. * Sent if the compositor decides the touch stream is a global
  4096. * gesture. No further events are sent to the clients from that
  4097. * particular gesture. Touch cancellation applies to all touch
  4098. * points currently active on this client's surface. The client is
  4099. * responsible for finalizing the touch points, future touch points
  4100. * on this surface may reuse the touch point ID.
  4101. */
  4102. void (*cancel)(void *data,
  4103. struct wl_touch *wl_touch);
  4104. };
  4105. /**
  4106. * @ingroup wl_touch_iface
  4107. */
  4108. static inline int
  4109. wl_touch_add_listener(struct wl_touch *wl_touch,
  4110. const struct wl_touch_listener *listener, void *data)
  4111. {
  4112. return wl_proxy_add_listener((struct wl_proxy *) wl_touch,
  4113. (void (**)(void)) listener, data);
  4114. }
  4115. #define WL_TOUCH_RELEASE 0
  4116. /**
  4117. * @ingroup iface_wl_touch
  4118. */
  4119. #define WL_TOUCH_RELEASE_SINCE_VERSION 3
  4120. /** @ingroup iface_wl_touch */
  4121. static inline void
  4122. wl_touch_set_user_data(struct wl_touch *wl_touch, void *user_data)
  4123. {
  4124. wl_proxy_set_user_data((struct wl_proxy *) wl_touch, user_data);
  4125. }
  4126. /** @ingroup iface_wl_touch */
  4127. static inline void *
  4128. wl_touch_get_user_data(struct wl_touch *wl_touch)
  4129. {
  4130. return wl_proxy_get_user_data((struct wl_proxy *) wl_touch);
  4131. }
  4132. static inline uint32_t
  4133. wl_touch_get_version(struct wl_touch *wl_touch)
  4134. {
  4135. return wl_proxy_get_version((struct wl_proxy *) wl_touch);
  4136. }
  4137. /** @ingroup iface_wl_touch */
  4138. static inline void
  4139. wl_touch_destroy(struct wl_touch *wl_touch)
  4140. {
  4141. wl_proxy_destroy((struct wl_proxy *) wl_touch);
  4142. }
  4143. /**
  4144. * @ingroup iface_wl_touch
  4145. */
  4146. static inline void
  4147. wl_touch_release(struct wl_touch *wl_touch)
  4148. {
  4149. wl_proxy_marshal((struct wl_proxy *) wl_touch,
  4150. WL_TOUCH_RELEASE);
  4151. wl_proxy_destroy((struct wl_proxy *) wl_touch);
  4152. }
  4153. #ifndef WL_OUTPUT_SUBPIXEL_ENUM
  4154. #define WL_OUTPUT_SUBPIXEL_ENUM
  4155. /**
  4156. * @ingroup iface_wl_output
  4157. * subpixel geometry information
  4158. *
  4159. * This enumeration describes how the physical
  4160. * pixels on an output are laid out.
  4161. */
  4162. enum wl_output_subpixel {
  4163. WL_OUTPUT_SUBPIXEL_UNKNOWN = 0,
  4164. WL_OUTPUT_SUBPIXEL_NONE = 1,
  4165. WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB = 2,
  4166. WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR = 3,
  4167. WL_OUTPUT_SUBPIXEL_VERTICAL_RGB = 4,
  4168. WL_OUTPUT_SUBPIXEL_VERTICAL_BGR = 5,
  4169. };
  4170. #endif /* WL_OUTPUT_SUBPIXEL_ENUM */
  4171. #ifndef WL_OUTPUT_TRANSFORM_ENUM
  4172. #define WL_OUTPUT_TRANSFORM_ENUM
  4173. /**
  4174. * @ingroup iface_wl_output
  4175. * transform from framebuffer to output
  4176. *
  4177. * This describes the transform that a compositor will apply to a
  4178. * surface to compensate for the rotation or mirroring of an
  4179. * output device.
  4180. *
  4181. * The flipped values correspond to an initial flip around a
  4182. * vertical axis followed by rotation.
  4183. *
  4184. * The purpose is mainly to allow clients to render accordingly and
  4185. * tell the compositor, so that for fullscreen surfaces, the
  4186. * compositor will still be able to scan out directly from client
  4187. * surfaces.
  4188. */
  4189. enum wl_output_transform {
  4190. WL_OUTPUT_TRANSFORM_NORMAL = 0,
  4191. WL_OUTPUT_TRANSFORM_90 = 1,
  4192. WL_OUTPUT_TRANSFORM_180 = 2,
  4193. WL_OUTPUT_TRANSFORM_270 = 3,
  4194. WL_OUTPUT_TRANSFORM_FLIPPED = 4,
  4195. WL_OUTPUT_TRANSFORM_FLIPPED_90 = 5,
  4196. WL_OUTPUT_TRANSFORM_FLIPPED_180 = 6,
  4197. WL_OUTPUT_TRANSFORM_FLIPPED_270 = 7,
  4198. };
  4199. #endif /* WL_OUTPUT_TRANSFORM_ENUM */
  4200. #ifndef WL_OUTPUT_MODE_ENUM
  4201. #define WL_OUTPUT_MODE_ENUM
  4202. /**
  4203. * @ingroup iface_wl_output
  4204. * mode information
  4205. *
  4206. * These flags describe properties of an output mode.
  4207. * They are used in the flags bitfield of the mode event.
  4208. */
  4209. enum wl_output_mode {
  4210. /**
  4211. * indicates this is the current mode
  4212. */
  4213. WL_OUTPUT_MODE_CURRENT = 0x1,
  4214. /**
  4215. * indicates this is the preferred mode
  4216. */
  4217. WL_OUTPUT_MODE_PREFERRED = 0x2,
  4218. };
  4219. #endif /* WL_OUTPUT_MODE_ENUM */
  4220. /**
  4221. * @ingroup iface_wl_output
  4222. * @struct wl_output_listener
  4223. */
  4224. struct wl_output_listener {
  4225. /**
  4226. * properties of the output
  4227. *
  4228. * The geometry event describes geometric properties of the
  4229. * output. The event is sent when binding to the output object and
  4230. * whenever any of the properties change.
  4231. * @param x x position within the global compositor space
  4232. * @param y y position within the global compositor space
  4233. * @param physical_width width in millimeters of the output
  4234. * @param physical_height height in millimeters of the output
  4235. * @param subpixel subpixel orientation of the output
  4236. * @param make textual description of the manufacturer
  4237. * @param model textual description of the model
  4238. * @param transform transform that maps framebuffer to output
  4239. */
  4240. void (*geometry)(void *data,
  4241. struct wl_output *wl_output,
  4242. int32_t x,
  4243. int32_t y,
  4244. int32_t physical_width,
  4245. int32_t physical_height,
  4246. int32_t subpixel,
  4247. const char *make,
  4248. const char *model,
  4249. int32_t transform);
  4250. /**
  4251. * advertise available modes for the output
  4252. *
  4253. * The mode event describes an available mode for the output.
  4254. *
  4255. * The event is sent when binding to the output object and there
  4256. * will always be one mode, the current mode. The event is sent
  4257. * again if an output changes mode, for the mode that is now
  4258. * current. In other words, the current mode is always the last
  4259. * mode that was received with the current flag set.
  4260. *
  4261. * The size of a mode is given in physical hardware units of the
  4262. * output device. This is not necessarily the same as the output
  4263. * size in the global compositor space. For instance, the output
  4264. * may be scaled, as described in wl_output.scale, or transformed,
  4265. * as described in wl_output.transform.
  4266. * @param flags bitfield of mode flags
  4267. * @param width width of the mode in hardware units
  4268. * @param height height of the mode in hardware units
  4269. * @param refresh vertical refresh rate in mHz
  4270. */
  4271. void (*mode)(void *data,
  4272. struct wl_output *wl_output,
  4273. uint32_t flags,
  4274. int32_t width,
  4275. int32_t height,
  4276. int32_t refresh);
  4277. /**
  4278. * sent all information about output
  4279. *
  4280. * This event is sent after all other properties have been sent
  4281. * after binding to the output object and after any other property
  4282. * changes done after that. This allows changes to the output
  4283. * properties to be seen as atomic, even if they happen via
  4284. * multiple events.
  4285. * @since 2
  4286. */
  4287. void (*done)(void *data,
  4288. struct wl_output *wl_output);
  4289. /**
  4290. * output scaling properties
  4291. *
  4292. * This event contains scaling geometry information that is not
  4293. * in the geometry event. It may be sent after binding the output
  4294. * object or if the output scale changes later. If it is not sent,
  4295. * the client should assume a scale of 1.
  4296. *
  4297. * A scale larger than 1 means that the compositor will
  4298. * automatically scale surface buffers by this amount when
  4299. * rendering. This is used for very high resolution displays where
  4300. * applications rendering at the native resolution would be too
  4301. * small to be legible.
  4302. *
  4303. * It is intended that scaling aware clients track the current
  4304. * output of a surface, and if it is on a scaled output it should
  4305. * use wl_surface.set_buffer_scale with the scale of the output.
  4306. * That way the compositor can avoid scaling the surface, and the
  4307. * client can supply a higher detail image.
  4308. * @param factor scaling factor of output
  4309. * @since 2
  4310. */
  4311. void (*scale)(void *data,
  4312. struct wl_output *wl_output,
  4313. int32_t factor);
  4314. };
  4315. /**
  4316. * @ingroup wl_output_iface
  4317. */
  4318. static inline int
  4319. wl_output_add_listener(struct wl_output *wl_output,
  4320. const struct wl_output_listener *listener, void *data)
  4321. {
  4322. return wl_proxy_add_listener((struct wl_proxy *) wl_output,
  4323. (void (**)(void)) listener, data);
  4324. }
  4325. /** @ingroup iface_wl_output */
  4326. static inline void
  4327. wl_output_set_user_data(struct wl_output *wl_output, void *user_data)
  4328. {
  4329. wl_proxy_set_user_data((struct wl_proxy *) wl_output, user_data);
  4330. }
  4331. /** @ingroup iface_wl_output */
  4332. static inline void *
  4333. wl_output_get_user_data(struct wl_output *wl_output)
  4334. {
  4335. return wl_proxy_get_user_data((struct wl_proxy *) wl_output);
  4336. }
  4337. static inline uint32_t
  4338. wl_output_get_version(struct wl_output *wl_output)
  4339. {
  4340. return wl_proxy_get_version((struct wl_proxy *) wl_output);
  4341. }
  4342. /** @ingroup iface_wl_output */
  4343. static inline void
  4344. wl_output_destroy(struct wl_output *wl_output)
  4345. {
  4346. wl_proxy_destroy((struct wl_proxy *) wl_output);
  4347. }
  4348. #define WL_REGION_DESTROY 0
  4349. #define WL_REGION_ADD 1
  4350. #define WL_REGION_SUBTRACT 2
  4351. /**
  4352. * @ingroup iface_wl_region
  4353. */
  4354. #define WL_REGION_DESTROY_SINCE_VERSION 1
  4355. /**
  4356. * @ingroup iface_wl_region
  4357. */
  4358. #define WL_REGION_ADD_SINCE_VERSION 1
  4359. /**
  4360. * @ingroup iface_wl_region
  4361. */
  4362. #define WL_REGION_SUBTRACT_SINCE_VERSION 1
  4363. /** @ingroup iface_wl_region */
  4364. static inline void
  4365. wl_region_set_user_data(struct wl_region *wl_region, void *user_data)
  4366. {
  4367. wl_proxy_set_user_data((struct wl_proxy *) wl_region, user_data);
  4368. }
  4369. /** @ingroup iface_wl_region */
  4370. static inline void *
  4371. wl_region_get_user_data(struct wl_region *wl_region)
  4372. {
  4373. return wl_proxy_get_user_data((struct wl_proxy *) wl_region);
  4374. }
  4375. static inline uint32_t
  4376. wl_region_get_version(struct wl_region *wl_region)
  4377. {
  4378. return wl_proxy_get_version((struct wl_proxy *) wl_region);
  4379. }
  4380. /**
  4381. * @ingroup iface_wl_region
  4382. *
  4383. * Destroy the region. This will invalidate the object ID.
  4384. */
  4385. static inline void
  4386. wl_region_destroy(struct wl_region *wl_region)
  4387. {
  4388. wl_proxy_marshal((struct wl_proxy *) wl_region,
  4389. WL_REGION_DESTROY);
  4390. wl_proxy_destroy((struct wl_proxy *) wl_region);
  4391. }
  4392. /**
  4393. * @ingroup iface_wl_region
  4394. *
  4395. * Add the specified rectangle to the region.
  4396. */
  4397. static inline void
  4398. wl_region_add(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
  4399. {
  4400. wl_proxy_marshal((struct wl_proxy *) wl_region,
  4401. WL_REGION_ADD, x, y, width, height);
  4402. }
  4403. /**
  4404. * @ingroup iface_wl_region
  4405. *
  4406. * Subtract the specified rectangle from the region.
  4407. */
  4408. static inline void
  4409. wl_region_subtract(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
  4410. {
  4411. wl_proxy_marshal((struct wl_proxy *) wl_region,
  4412. WL_REGION_SUBTRACT, x, y, width, height);
  4413. }
  4414. #ifndef WL_SUBCOMPOSITOR_ERROR_ENUM
  4415. #define WL_SUBCOMPOSITOR_ERROR_ENUM
  4416. enum wl_subcompositor_error {
  4417. /**
  4418. * the to-be sub-surface is invalid
  4419. */
  4420. WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE = 0,
  4421. };
  4422. #endif /* WL_SUBCOMPOSITOR_ERROR_ENUM */
  4423. #define WL_SUBCOMPOSITOR_DESTROY 0
  4424. #define WL_SUBCOMPOSITOR_GET_SUBSURFACE 1
  4425. /**
  4426. * @ingroup iface_wl_subcompositor
  4427. */
  4428. #define WL_SUBCOMPOSITOR_DESTROY_SINCE_VERSION 1
  4429. /**
  4430. * @ingroup iface_wl_subcompositor
  4431. */
  4432. #define WL_SUBCOMPOSITOR_GET_SUBSURFACE_SINCE_VERSION 1
  4433. /** @ingroup iface_wl_subcompositor */
  4434. static inline void
  4435. wl_subcompositor_set_user_data(struct wl_subcompositor *wl_subcompositor, void *user_data)
  4436. {
  4437. wl_proxy_set_user_data((struct wl_proxy *) wl_subcompositor, user_data);
  4438. }
  4439. /** @ingroup iface_wl_subcompositor */
  4440. static inline void *
  4441. wl_subcompositor_get_user_data(struct wl_subcompositor *wl_subcompositor)
  4442. {
  4443. return wl_proxy_get_user_data((struct wl_proxy *) wl_subcompositor);
  4444. }
  4445. static inline uint32_t
  4446. wl_subcompositor_get_version(struct wl_subcompositor *wl_subcompositor)
  4447. {
  4448. return wl_proxy_get_version((struct wl_proxy *) wl_subcompositor);
  4449. }
  4450. /**
  4451. * @ingroup iface_wl_subcompositor
  4452. *
  4453. * Informs the server that the client will not be using this
  4454. * protocol object anymore. This does not affect any other
  4455. * objects, wl_subsurface objects included.
  4456. */
  4457. static inline void
  4458. wl_subcompositor_destroy(struct wl_subcompositor *wl_subcompositor)
  4459. {
  4460. wl_proxy_marshal((struct wl_proxy *) wl_subcompositor,
  4461. WL_SUBCOMPOSITOR_DESTROY);
  4462. wl_proxy_destroy((struct wl_proxy *) wl_subcompositor);
  4463. }
  4464. /**
  4465. * @ingroup iface_wl_subcompositor
  4466. *
  4467. * Create a sub-surface interface for the given surface, and
  4468. * associate it with the given parent surface. This turns a
  4469. * plain wl_surface into a sub-surface.
  4470. *
  4471. * The to-be sub-surface must not already have another role, and it
  4472. * must not have an existing wl_subsurface object. Otherwise a protocol
  4473. * error is raised.
  4474. */
  4475. static inline struct wl_subsurface *
  4476. wl_subcompositor_get_subsurface(struct wl_subcompositor *wl_subcompositor, struct wl_surface *surface, struct wl_surface *parent)
  4477. {
  4478. struct wl_proxy *id;
  4479. id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_subcompositor,
  4480. WL_SUBCOMPOSITOR_GET_SUBSURFACE, &wl_subsurface_interface, NULL, surface, parent);
  4481. return (struct wl_subsurface *) id;
  4482. }
  4483. #ifndef WL_SUBSURFACE_ERROR_ENUM
  4484. #define WL_SUBSURFACE_ERROR_ENUM
  4485. enum wl_subsurface_error {
  4486. /**
  4487. * wl_surface is not a sibling or the parent
  4488. */
  4489. WL_SUBSURFACE_ERROR_BAD_SURFACE = 0,
  4490. };
  4491. #endif /* WL_SUBSURFACE_ERROR_ENUM */
  4492. #define WL_SUBSURFACE_DESTROY 0
  4493. #define WL_SUBSURFACE_SET_POSITION 1
  4494. #define WL_SUBSURFACE_PLACE_ABOVE 2
  4495. #define WL_SUBSURFACE_PLACE_BELOW 3
  4496. #define WL_SUBSURFACE_SET_SYNC 4
  4497. #define WL_SUBSURFACE_SET_DESYNC 5
  4498. /**
  4499. * @ingroup iface_wl_subsurface
  4500. */
  4501. #define WL_SUBSURFACE_DESTROY_SINCE_VERSION 1
  4502. /**
  4503. * @ingroup iface_wl_subsurface
  4504. */
  4505. #define WL_SUBSURFACE_SET_POSITION_SINCE_VERSION 1
  4506. /**
  4507. * @ingroup iface_wl_subsurface
  4508. */
  4509. #define WL_SUBSURFACE_PLACE_ABOVE_SINCE_VERSION 1
  4510. /**
  4511. * @ingroup iface_wl_subsurface
  4512. */
  4513. #define WL_SUBSURFACE_PLACE_BELOW_SINCE_VERSION 1
  4514. /**
  4515. * @ingroup iface_wl_subsurface
  4516. */
  4517. #define WL_SUBSURFACE_SET_SYNC_SINCE_VERSION 1
  4518. /**
  4519. * @ingroup iface_wl_subsurface
  4520. */
  4521. #define WL_SUBSURFACE_SET_DESYNC_SINCE_VERSION 1
  4522. /** @ingroup iface_wl_subsurface */
  4523. static inline void
  4524. wl_subsurface_set_user_data(struct wl_subsurface *wl_subsurface, void *user_data)
  4525. {
  4526. wl_proxy_set_user_data((struct wl_proxy *) wl_subsurface, user_data);
  4527. }
  4528. /** @ingroup iface_wl_subsurface */
  4529. static inline void *
  4530. wl_subsurface_get_user_data(struct wl_subsurface *wl_subsurface)
  4531. {
  4532. return wl_proxy_get_user_data((struct wl_proxy *) wl_subsurface);
  4533. }
  4534. static inline uint32_t
  4535. wl_subsurface_get_version(struct wl_subsurface *wl_subsurface)
  4536. {
  4537. return wl_proxy_get_version((struct wl_proxy *) wl_subsurface);
  4538. }
  4539. /**
  4540. * @ingroup iface_wl_subsurface
  4541. *
  4542. * The sub-surface interface is removed from the wl_surface object
  4543. * that was turned into a sub-surface with a
  4544. * wl_subcompositor.get_subsurface request. The wl_surface's association
  4545. * to the parent is deleted, and the wl_surface loses its role as
  4546. * a sub-surface. The wl_surface is unmapped.
  4547. */
  4548. static inline void
  4549. wl_subsurface_destroy(struct wl_subsurface *wl_subsurface)
  4550. {
  4551. wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
  4552. WL_SUBSURFACE_DESTROY);
  4553. wl_proxy_destroy((struct wl_proxy *) wl_subsurface);
  4554. }
  4555. /**
  4556. * @ingroup iface_wl_subsurface
  4557. *
  4558. * This schedules a sub-surface position change.
  4559. * The sub-surface will be moved so that its origin (top left
  4560. * corner pixel) will be at the location x, y of the parent surface
  4561. * coordinate system. The coordinates are not restricted to the parent
  4562. * surface area. Negative values are allowed.
  4563. *
  4564. * The scheduled coordinates will take effect whenever the state of the
  4565. * parent surface is applied. When this happens depends on whether the
  4566. * parent surface is in synchronized mode or not. See
  4567. * wl_subsurface.set_sync and wl_subsurface.set_desync for details.
  4568. *
  4569. * If more than one set_position request is invoked by the client before
  4570. * the commit of the parent surface, the position of a new request always
  4571. * replaces the scheduled position from any previous request.
  4572. *
  4573. * The initial position is 0, 0.
  4574. */
  4575. static inline void
  4576. wl_subsurface_set_position(struct wl_subsurface *wl_subsurface, int32_t x, int32_t y)
  4577. {
  4578. wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
  4579. WL_SUBSURFACE_SET_POSITION, x, y);
  4580. }
  4581. /**
  4582. * @ingroup iface_wl_subsurface
  4583. *
  4584. * This sub-surface is taken from the stack, and put back just
  4585. * above the reference surface, changing the z-order of the sub-surfaces.
  4586. * The reference surface must be one of the sibling surfaces, or the
  4587. * parent surface. Using any other surface, including this sub-surface,
  4588. * will cause a protocol error.
  4589. *
  4590. * The z-order is double-buffered. Requests are handled in order and
  4591. * applied immediately to a pending state. The final pending state is
  4592. * copied to the active state the next time the state of the parent
  4593. * surface is applied. When this happens depends on whether the parent
  4594. * surface is in synchronized mode or not. See wl_subsurface.set_sync and
  4595. * wl_subsurface.set_desync for details.
  4596. *
  4597. * A new sub-surface is initially added as the top-most in the stack
  4598. * of its siblings and parent.
  4599. */
  4600. static inline void
  4601. wl_subsurface_place_above(struct wl_subsurface *wl_subsurface, struct wl_surface *sibling)
  4602. {
  4603. wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
  4604. WL_SUBSURFACE_PLACE_ABOVE, sibling);
  4605. }
  4606. /**
  4607. * @ingroup iface_wl_subsurface
  4608. *
  4609. * The sub-surface is placed just below the reference surface.
  4610. * See wl_subsurface.place_above.
  4611. */
  4612. static inline void
  4613. wl_subsurface_place_below(struct wl_subsurface *wl_subsurface, struct wl_surface *sibling)
  4614. {
  4615. wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
  4616. WL_SUBSURFACE_PLACE_BELOW, sibling);
  4617. }
  4618. /**
  4619. * @ingroup iface_wl_subsurface
  4620. *
  4621. * Change the commit behaviour of the sub-surface to synchronized
  4622. * mode, also described as the parent dependent mode.
  4623. *
  4624. * In synchronized mode, wl_surface.commit on a sub-surface will
  4625. * accumulate the committed state in a cache, but the state will
  4626. * not be applied and hence will not change the compositor output.
  4627. * The cached state is applied to the sub-surface immediately after
  4628. * the parent surface's state is applied. This ensures atomic
  4629. * updates of the parent and all its synchronized sub-surfaces.
  4630. * Applying the cached state will invalidate the cache, so further
  4631. * parent surface commits do not (re-)apply old state.
  4632. *
  4633. * See wl_subsurface for the recursive effect of this mode.
  4634. */
  4635. static inline void
  4636. wl_subsurface_set_sync(struct wl_subsurface *wl_subsurface)
  4637. {
  4638. wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
  4639. WL_SUBSURFACE_SET_SYNC);
  4640. }
  4641. /**
  4642. * @ingroup iface_wl_subsurface
  4643. *
  4644. * Change the commit behaviour of the sub-surface to desynchronized
  4645. * mode, also described as independent or freely running mode.
  4646. *
  4647. * In desynchronized mode, wl_surface.commit on a sub-surface will
  4648. * apply the pending state directly, without caching, as happens
  4649. * normally with a wl_surface. Calling wl_surface.commit on the
  4650. * parent surface has no effect on the sub-surface's wl_surface
  4651. * state. This mode allows a sub-surface to be updated on its own.
  4652. *
  4653. * If cached state exists when wl_surface.commit is called in
  4654. * desynchronized mode, the pending state is added to the cached
  4655. * state, and applied as a whole. This invalidates the cache.
  4656. *
  4657. * Note: even if a sub-surface is set to desynchronized, a parent
  4658. * sub-surface may override it to behave as synchronized. For details,
  4659. * see wl_subsurface.
  4660. *
  4661. * If a surface's parent surface behaves as desynchronized, then
  4662. * the cached state is applied on set_desync.
  4663. */
  4664. static inline void
  4665. wl_subsurface_set_desync(struct wl_subsurface *wl_subsurface)
  4666. {
  4667. wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
  4668. WL_SUBSURFACE_SET_DESYNC);
  4669. }
  4670. #ifdef __cplusplus
  4671. }
  4672. #endif
  4673. #endif