wayland-client-protocol.h 195 KB

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