example-client.h 178 KB

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