example-server.h 154 KB

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