glfw3.h 207 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816
  1. /*************************************************************************
  2. * GLFW 3.4 - www.glfw.org
  3. * A library for OpenGL, window and input
  4. *------------------------------------------------------------------------
  5. * Copyright (c) 2002-2006 Marcus Geelnard
  6. * Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
  7. *
  8. * This software is provided 'as-is', without any express or implied
  9. * warranty. In no event will the authors be held liable for any damages
  10. * arising from the use of this software.
  11. *
  12. * Permission is granted to anyone to use this software for any purpose,
  13. * including commercial applications, and to alter it and redistribute it
  14. * freely, subject to the following restrictions:
  15. *
  16. * 1. The origin of this software must not be misrepresented; you must not
  17. * claim that you wrote the original software. If you use this software
  18. * in a product, an acknowledgment in the product documentation would
  19. * be appreciated but is not required.
  20. *
  21. * 2. Altered source versions must be plainly marked as such, and must not
  22. * be misrepresented as being the original software.
  23. *
  24. * 3. This notice may not be removed or altered from any source
  25. * distribution.
  26. *
  27. *************************************************************************/
  28. #ifndef _glfw3_h_
  29. #define _glfw3_h_
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /*************************************************************************
  34. * Doxygen documentation
  35. *************************************************************************/
  36. /*! @file glfw3.h
  37. * @brief The header of the GLFW 3 API.
  38. *
  39. * This is the header file of the GLFW 3 API. It defines all its types and
  40. * declares all its functions.
  41. *
  42. * For more information about how to use this file, see @ref build_include.
  43. */
  44. /*! @defgroup context Context reference
  45. * @brief Functions and types related to OpenGL and OpenGL ES contexts.
  46. *
  47. * This is the reference documentation for OpenGL and OpenGL ES context related
  48. * functions. For more task-oriented information, see the @ref context_guide.
  49. */
  50. /*! @defgroup vulkan Vulkan reference
  51. * @brief Functions and types related to Vulkan.
  52. *
  53. * This is the reference documentation for Vulkan related functions and types.
  54. * For more task-oriented information, see the @ref vulkan_guide.
  55. */
  56. /*! @defgroup init Initialization, version and error reference
  57. * @brief Functions and types related to initialization and error handling.
  58. *
  59. * This is the reference documentation for initialization and termination of
  60. * the library, version management and error handling. For more task-oriented
  61. * information, see the @ref intro_guide.
  62. */
  63. /*! @defgroup input Input reference
  64. * @brief Functions and types related to input handling.
  65. *
  66. * This is the reference documentation for input related functions and types.
  67. * For more task-oriented information, see the @ref input_guide.
  68. */
  69. /*! @defgroup monitor Monitor reference
  70. * @brief Functions and types related to monitors.
  71. *
  72. * This is the reference documentation for monitor related functions and types.
  73. * For more task-oriented information, see the @ref monitor_guide.
  74. */
  75. /*! @defgroup window Window reference
  76. * @brief Functions and types related to windows.
  77. *
  78. * This is the reference documentation for window related functions and types,
  79. * including creation, deletion and event polling. For more task-oriented
  80. * information, see the @ref window_guide.
  81. */
  82. /*************************************************************************
  83. * Compiler- and platform-specific preprocessor work
  84. *************************************************************************/
  85. /* If we are we on Windows, we want a single define for it.
  86. */
  87. #if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
  88. #define _WIN32
  89. #endif /* _WIN32 */
  90. /* Include because most Windows GLU headers need wchar_t and
  91. * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h.
  92. * Include it unconditionally to avoid surprising side-effects.
  93. */
  94. #include <stddef.h>
  95. /* Include because it is needed by Vulkan and related functions.
  96. * Include it unconditionally to avoid surprising side-effects.
  97. */
  98. #include <stdint.h>
  99. #include <stdbool.h>
  100. #if defined(GLFW_INCLUDE_VULKAN)
  101. #include <vulkan/vulkan.h>
  102. #endif /* Vulkan header */
  103. /* The Vulkan header may have indirectly included windows.h (because of
  104. * VK_USE_PLATFORM_WIN32_KHR) so we offer our replacement symbols after it.
  105. */
  106. /* It is customary to use APIENTRY for OpenGL function pointer declarations on
  107. * all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
  108. */
  109. #if !defined(APIENTRY)
  110. #if defined(_WIN32)
  111. #define APIENTRY __stdcall
  112. #else
  113. #define APIENTRY
  114. #endif
  115. #define GLFW_APIENTRY_DEFINED
  116. #endif /* APIENTRY */
  117. /* Some Windows OpenGL headers need this.
  118. */
  119. #if !defined(WINGDIAPI) && defined(_WIN32)
  120. #define WINGDIAPI __declspec(dllimport)
  121. #define GLFW_WINGDIAPI_DEFINED
  122. #endif /* WINGDIAPI */
  123. /* Some Windows GLU headers need this.
  124. */
  125. #if !defined(CALLBACK) && defined(_WIN32)
  126. #define CALLBACK __stdcall
  127. #define GLFW_CALLBACK_DEFINED
  128. #endif /* CALLBACK */
  129. /* Include the chosen OpenGL or OpenGL ES headers.
  130. */
  131. #if defined(GLFW_INCLUDE_ES1)
  132. #include <GLES/gl.h>
  133. #if defined(GLFW_INCLUDE_GLEXT)
  134. #include <GLES/glext.h>
  135. #endif
  136. #elif defined(GLFW_INCLUDE_ES2)
  137. #include <GLES2/gl2.h>
  138. #if defined(GLFW_INCLUDE_GLEXT)
  139. #include <GLES2/gl2ext.h>
  140. #endif
  141. #elif defined(GLFW_INCLUDE_ES3)
  142. #include <GLES3/gl3.h>
  143. #if defined(GLFW_INCLUDE_GLEXT)
  144. #include <GLES2/gl2ext.h>
  145. #endif
  146. #elif defined(GLFW_INCLUDE_ES31)
  147. #include <GLES3/gl31.h>
  148. #if defined(GLFW_INCLUDE_GLEXT)
  149. #include <GLES2/gl2ext.h>
  150. #endif
  151. #elif defined(GLFW_INCLUDE_ES32)
  152. #include <GLES3/gl32.h>
  153. #if defined(GLFW_INCLUDE_GLEXT)
  154. #include <GLES2/gl2ext.h>
  155. #endif
  156. #elif defined(GLFW_INCLUDE_GLCOREARB)
  157. #if defined(__APPLE__)
  158. #include <OpenGL/gl3.h>
  159. #if defined(GLFW_INCLUDE_GLEXT)
  160. #include <OpenGL/gl3ext.h>
  161. #endif /*GLFW_INCLUDE_GLEXT*/
  162. #else /*__APPLE__*/
  163. #include <GL/glcorearb.h>
  164. #endif /*__APPLE__*/
  165. #elif defined(GLFW_INCLUDE_GLU)
  166. #if defined(__APPLE__)
  167. #if defined(GLFW_INCLUDE_GLU)
  168. #include <OpenGL/glu.h>
  169. #endif
  170. #else /*__APPLE__*/
  171. #if defined(GLFW_INCLUDE_GLU)
  172. #include <GL/glu.h>
  173. #endif
  174. #endif /*__APPLE__*/
  175. #elif !defined(GLFW_INCLUDE_NONE) && \
  176. !defined(__gl_h_) && \
  177. !defined(__gles1_gl_h_) && \
  178. !defined(__gles2_gl2_h_) && \
  179. !defined(__gles2_gl3_h_) && \
  180. !defined(__gles2_gl31_h_) && \
  181. !defined(__gles2_gl32_h_) && \
  182. !defined(__gl_glcorearb_h_) && \
  183. !defined(__gl2_h_) /*legacy*/ && \
  184. !defined(__gl3_h_) /*legacy*/ && \
  185. !defined(__gl31_h_) /*legacy*/ && \
  186. !defined(__gl32_h_) /*legacy*/ && \
  187. !defined(__glcorearb_h_) /*legacy*/ && \
  188. !defined(__GL_H__) /*non-standard*/ && \
  189. !defined(__gltypes_h_) /*non-standard*/ && \
  190. !defined(__glee_h_) /*non-standard*/
  191. #if defined(__APPLE__)
  192. #if !defined(GLFW_INCLUDE_GLEXT)
  193. #define GL_GLEXT_LEGACY
  194. #endif
  195. #include <OpenGL/gl.h>
  196. #else /*__APPLE__*/
  197. #include <GL/gl.h>
  198. #if defined(GLFW_INCLUDE_GLEXT)
  199. #include <GL/glext.h>
  200. #endif
  201. #endif /*__APPLE__*/
  202. #endif /* OpenGL and OpenGL ES headers */
  203. #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
  204. /* GLFW_DLL must be defined by applications that are linking against the DLL
  205. * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
  206. * configuration header when compiling the DLL version of the library.
  207. */
  208. #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
  209. #endif
  210. /* GLFWAPI is used to declare public API functions for export
  211. * from the DLL / shared library / dynamic library.
  212. */
  213. #if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
  214. /* We are building GLFW as a Win32 DLL */
  215. #define GLFWAPI __declspec(dllexport)
  216. #elif defined(_WIN32) && defined(GLFW_DLL)
  217. /* We are calling GLFW as a Win32 DLL */
  218. #define GLFWAPI __declspec(dllimport)
  219. #elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
  220. /* We are building GLFW as a shared / dynamic library */
  221. #define GLFWAPI __attribute__((visibility("default")))
  222. #else
  223. /* We are building or calling GLFW as a static library */
  224. #define GLFWAPI
  225. #endif
  226. /*************************************************************************
  227. * GLFW API tokens
  228. *************************************************************************/
  229. /*! @name GLFW version macros
  230. * @{ */
  231. /*! @brief The major version number of the GLFW library.
  232. *
  233. * This is incremented when the API is changed in non-compatible ways.
  234. * @ingroup init
  235. */
  236. #define GLFW_VERSION_MAJOR 3
  237. /*! @brief The minor version number of the GLFW library.
  238. *
  239. * This is incremented when features are added to the API but it remains
  240. * backward-compatible.
  241. * @ingroup init
  242. */
  243. #define GLFW_VERSION_MINOR 4
  244. /*! @brief The revision number of the GLFW library.
  245. *
  246. * This is incremented when a bug fix release is made that does not contain any
  247. * API changes.
  248. * @ingroup init
  249. */
  250. #define GLFW_VERSION_REVISION 0
  251. /*! @} */
  252. /*! @defgroup hat_state Joystick hat states
  253. * @brief Joystick hat states.
  254. *
  255. * See [joystick hat input](@ref joystick_hat) for how these are used.
  256. *
  257. * @ingroup input
  258. * @{ */
  259. #define GLFW_HAT_CENTERED 0
  260. #define GLFW_HAT_UP 1
  261. #define GLFW_HAT_RIGHT 2
  262. #define GLFW_HAT_DOWN 4
  263. #define GLFW_HAT_LEFT 8
  264. #define GLFW_HAT_RIGHT_UP (GLFW_HAT_RIGHT | GLFW_HAT_UP)
  265. #define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
  266. #define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP)
  267. #define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
  268. /*! @} */
  269. /*! @defgroup keys Keyboard keys
  270. * @brief Keyboard key IDs.
  271. *
  272. * See [key input](@ref input_key) for how these are used.
  273. *
  274. * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
  275. * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
  276. * put in the 256+ range).
  277. *
  278. * The naming of the key codes follow these rules:
  279. * - The US keyboard layout is used
  280. * - Names of printable alphanumeric characters are used (e.g. "A", "R",
  281. * "3", etc.)
  282. * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
  283. * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
  284. * correspond to the Unicode standard (usually for brevity)
  285. * - Keys that lack a clear US mapping are named "WORLD_x"
  286. * - For non-printable keys, custom names are used (e.g. "F4",
  287. * "BACKSPACE", etc.)
  288. *
  289. * @ingroup input
  290. * @{
  291. */
  292. /* start functional key names (auto generated by gen-key-constants.py do not edit) */
  293. typedef enum {
  294. GLFW_FKEY_FIRST = 0xe000u,
  295. GLFW_FKEY_ESCAPE = 0xe000u,
  296. GLFW_FKEY_ENTER = 0xe001u,
  297. GLFW_FKEY_TAB = 0xe002u,
  298. GLFW_FKEY_BACKSPACE = 0xe003u,
  299. GLFW_FKEY_INSERT = 0xe004u,
  300. GLFW_FKEY_DELETE = 0xe005u,
  301. GLFW_FKEY_LEFT = 0xe006u,
  302. GLFW_FKEY_RIGHT = 0xe007u,
  303. GLFW_FKEY_UP = 0xe008u,
  304. GLFW_FKEY_DOWN = 0xe009u,
  305. GLFW_FKEY_PAGE_UP = 0xe00au,
  306. GLFW_FKEY_PAGE_DOWN = 0xe00bu,
  307. GLFW_FKEY_HOME = 0xe00cu,
  308. GLFW_FKEY_END = 0xe00du,
  309. GLFW_FKEY_CAPS_LOCK = 0xe00eu,
  310. GLFW_FKEY_SCROLL_LOCK = 0xe00fu,
  311. GLFW_FKEY_NUM_LOCK = 0xe010u,
  312. GLFW_FKEY_PRINT_SCREEN = 0xe011u,
  313. GLFW_FKEY_PAUSE = 0xe012u,
  314. GLFW_FKEY_MENU = 0xe013u,
  315. GLFW_FKEY_F1 = 0xe014u,
  316. GLFW_FKEY_F2 = 0xe015u,
  317. GLFW_FKEY_F3 = 0xe016u,
  318. GLFW_FKEY_F4 = 0xe017u,
  319. GLFW_FKEY_F5 = 0xe018u,
  320. GLFW_FKEY_F6 = 0xe019u,
  321. GLFW_FKEY_F7 = 0xe01au,
  322. GLFW_FKEY_F8 = 0xe01bu,
  323. GLFW_FKEY_F9 = 0xe01cu,
  324. GLFW_FKEY_F10 = 0xe01du,
  325. GLFW_FKEY_F11 = 0xe01eu,
  326. GLFW_FKEY_F12 = 0xe01fu,
  327. GLFW_FKEY_F13 = 0xe020u,
  328. GLFW_FKEY_F14 = 0xe021u,
  329. GLFW_FKEY_F15 = 0xe022u,
  330. GLFW_FKEY_F16 = 0xe023u,
  331. GLFW_FKEY_F17 = 0xe024u,
  332. GLFW_FKEY_F18 = 0xe025u,
  333. GLFW_FKEY_F19 = 0xe026u,
  334. GLFW_FKEY_F20 = 0xe027u,
  335. GLFW_FKEY_F21 = 0xe028u,
  336. GLFW_FKEY_F22 = 0xe029u,
  337. GLFW_FKEY_F23 = 0xe02au,
  338. GLFW_FKEY_F24 = 0xe02bu,
  339. GLFW_FKEY_F25 = 0xe02cu,
  340. GLFW_FKEY_F26 = 0xe02du,
  341. GLFW_FKEY_F27 = 0xe02eu,
  342. GLFW_FKEY_F28 = 0xe02fu,
  343. GLFW_FKEY_F29 = 0xe030u,
  344. GLFW_FKEY_F30 = 0xe031u,
  345. GLFW_FKEY_F31 = 0xe032u,
  346. GLFW_FKEY_F32 = 0xe033u,
  347. GLFW_FKEY_F33 = 0xe034u,
  348. GLFW_FKEY_F34 = 0xe035u,
  349. GLFW_FKEY_F35 = 0xe036u,
  350. GLFW_FKEY_KP_0 = 0xe037u,
  351. GLFW_FKEY_KP_1 = 0xe038u,
  352. GLFW_FKEY_KP_2 = 0xe039u,
  353. GLFW_FKEY_KP_3 = 0xe03au,
  354. GLFW_FKEY_KP_4 = 0xe03bu,
  355. GLFW_FKEY_KP_5 = 0xe03cu,
  356. GLFW_FKEY_KP_6 = 0xe03du,
  357. GLFW_FKEY_KP_7 = 0xe03eu,
  358. GLFW_FKEY_KP_8 = 0xe03fu,
  359. GLFW_FKEY_KP_9 = 0xe040u,
  360. GLFW_FKEY_KP_DECIMAL = 0xe041u,
  361. GLFW_FKEY_KP_DIVIDE = 0xe042u,
  362. GLFW_FKEY_KP_MULTIPLY = 0xe043u,
  363. GLFW_FKEY_KP_SUBTRACT = 0xe044u,
  364. GLFW_FKEY_KP_ADD = 0xe045u,
  365. GLFW_FKEY_KP_ENTER = 0xe046u,
  366. GLFW_FKEY_KP_EQUAL = 0xe047u,
  367. GLFW_FKEY_KP_SEPARATOR = 0xe048u,
  368. GLFW_FKEY_KP_LEFT = 0xe049u,
  369. GLFW_FKEY_KP_RIGHT = 0xe04au,
  370. GLFW_FKEY_KP_UP = 0xe04bu,
  371. GLFW_FKEY_KP_DOWN = 0xe04cu,
  372. GLFW_FKEY_KP_PAGE_UP = 0xe04du,
  373. GLFW_FKEY_KP_PAGE_DOWN = 0xe04eu,
  374. GLFW_FKEY_KP_HOME = 0xe04fu,
  375. GLFW_FKEY_KP_END = 0xe050u,
  376. GLFW_FKEY_KP_INSERT = 0xe051u,
  377. GLFW_FKEY_KP_DELETE = 0xe052u,
  378. GLFW_FKEY_KP_BEGIN = 0xe053u,
  379. GLFW_FKEY_MEDIA_PLAY = 0xe054u,
  380. GLFW_FKEY_MEDIA_PAUSE = 0xe055u,
  381. GLFW_FKEY_MEDIA_PLAY_PAUSE = 0xe056u,
  382. GLFW_FKEY_MEDIA_REVERSE = 0xe057u,
  383. GLFW_FKEY_MEDIA_STOP = 0xe058u,
  384. GLFW_FKEY_MEDIA_FAST_FORWARD = 0xe059u,
  385. GLFW_FKEY_MEDIA_REWIND = 0xe05au,
  386. GLFW_FKEY_MEDIA_TRACK_NEXT = 0xe05bu,
  387. GLFW_FKEY_MEDIA_TRACK_PREVIOUS = 0xe05cu,
  388. GLFW_FKEY_MEDIA_RECORD = 0xe05du,
  389. GLFW_FKEY_LOWER_VOLUME = 0xe05eu,
  390. GLFW_FKEY_RAISE_VOLUME = 0xe05fu,
  391. GLFW_FKEY_MUTE_VOLUME = 0xe060u,
  392. GLFW_FKEY_LEFT_SHIFT = 0xe061u,
  393. GLFW_FKEY_LEFT_CONTROL = 0xe062u,
  394. GLFW_FKEY_LEFT_ALT = 0xe063u,
  395. GLFW_FKEY_LEFT_SUPER = 0xe064u,
  396. GLFW_FKEY_LEFT_HYPER = 0xe065u,
  397. GLFW_FKEY_LEFT_META = 0xe066u,
  398. GLFW_FKEY_RIGHT_SHIFT = 0xe067u,
  399. GLFW_FKEY_RIGHT_CONTROL = 0xe068u,
  400. GLFW_FKEY_RIGHT_ALT = 0xe069u,
  401. GLFW_FKEY_RIGHT_SUPER = 0xe06au,
  402. GLFW_FKEY_RIGHT_HYPER = 0xe06bu,
  403. GLFW_FKEY_RIGHT_META = 0xe06cu,
  404. GLFW_FKEY_ISO_LEVEL3_SHIFT = 0xe06du,
  405. GLFW_FKEY_ISO_LEVEL5_SHIFT = 0xe06eu,
  406. GLFW_FKEY_LAST = 0xe06eu
  407. } GLFWFunctionKey;
  408. /* end functional key names */
  409. /*! @} */
  410. /*! @defgroup mods Modifier key flags
  411. * @brief Modifier key flags.
  412. *
  413. * See [key input](@ref input_key) for how these are used.
  414. *
  415. * @ingroup input
  416. * @{ */
  417. /*! @brief If this bit is set one or more Shift keys were held down.
  418. *
  419. * If this bit is set one or more Shift keys were held down.
  420. */
  421. #define GLFW_MOD_SHIFT 0x0001
  422. /*! @brief If this bit is set one or more Alt keys were held down.
  423. *
  424. * If this bit is set one or more Alt keys were held down.
  425. */
  426. #define GLFW_MOD_ALT 0x0002
  427. /*! @brief If this bit is set one or more Alt keys were held down.
  428. *
  429. * If this bit is set one or more Alt keys were held down.
  430. */
  431. #define GLFW_MOD_CONTROL 0x0004
  432. /*! @brief If this bit is set one or more Super keys were held down.
  433. *
  434. * If this bit is set one or more Super keys were held down.
  435. */
  436. #define GLFW_MOD_SUPER 0x0008
  437. /*! @brief If this bit is set one or more Hyper keys were held down.
  438. *
  439. * If this bit is set one or more Hyper keys were held down.
  440. */
  441. #define GLFW_MOD_HYPER 0x0010
  442. /*! @brief If this bit is set one or more Meta keys were held down.
  443. *
  444. * If this bit is set one or more Meta keys were held down.
  445. */
  446. #define GLFW_MOD_META 0x0020
  447. /*! @brief If this bit is set the Caps Lock key is enabled.
  448. *
  449. * If this bit is set the Caps Lock key is enabled and the @ref
  450. * GLFW_LOCK_KEY_MODS input mode is set.
  451. */
  452. #define GLFW_MOD_CAPS_LOCK 0x0040
  453. /*! @brief If this bit is set the Num Lock key is enabled.
  454. *
  455. * If this bit is set the Num Lock key is enabled and the @ref
  456. * GLFW_LOCK_KEY_MODS input mode is set.
  457. */
  458. #define GLFW_MOD_NUM_LOCK 0x0080
  459. #define GLFW_MOD_LAST GLFW_MOD_NUM_LOCK
  460. #define GLFW_LOCK_MASK (GLFW_MOD_NUM_LOCK | GLFW_MOD_CAPS_LOCK)
  461. /*! @} */
  462. /*! @defgroup buttons Mouse buttons
  463. * @brief Mouse button IDs.
  464. *
  465. * See [mouse button input](@ref input_mouse_button) for how these are used.
  466. *
  467. * @ingroup input
  468. * @{ */
  469. typedef enum GLFWMouseButton {
  470. GLFW_MOUSE_BUTTON_1 = 0,
  471. GLFW_MOUSE_BUTTON_LEFT = 0,
  472. GLFW_MOUSE_BUTTON_2 = 1,
  473. GLFW_MOUSE_BUTTON_RIGHT = 1,
  474. GLFW_MOUSE_BUTTON_3 = 2,
  475. GLFW_MOUSE_BUTTON_MIDDLE = 2,
  476. GLFW_MOUSE_BUTTON_4 = 3,
  477. GLFW_MOUSE_BUTTON_5 = 4,
  478. GLFW_MOUSE_BUTTON_6 = 5,
  479. GLFW_MOUSE_BUTTON_7 = 6,
  480. GLFW_MOUSE_BUTTON_8 = 7,
  481. GLFW_MOUSE_BUTTON_LAST = 7
  482. } GLFWMouseButton;
  483. /*! @} */
  484. typedef enum GLFWColorScheme {
  485. GLFW_COLOR_SCHEME_NO_PREFERENCE = 0,
  486. GLFW_COLOR_SCHEME_DARK = 1,
  487. GLFW_COLOR_SCHEME_LIGHT = 2
  488. } GLFWColorScheme;
  489. /*! @defgroup joysticks Joysticks
  490. * @brief Joystick IDs.
  491. *
  492. * See [joystick input](@ref joystick) for how these are used.
  493. *
  494. * @ingroup input
  495. * @{ */
  496. #define GLFW_JOYSTICK_1 0
  497. #define GLFW_JOYSTICK_2 1
  498. #define GLFW_JOYSTICK_3 2
  499. #define GLFW_JOYSTICK_4 3
  500. #define GLFW_JOYSTICK_5 4
  501. #define GLFW_JOYSTICK_6 5
  502. #define GLFW_JOYSTICK_7 6
  503. #define GLFW_JOYSTICK_8 7
  504. #define GLFW_JOYSTICK_9 8
  505. #define GLFW_JOYSTICK_10 9
  506. #define GLFW_JOYSTICK_11 10
  507. #define GLFW_JOYSTICK_12 11
  508. #define GLFW_JOYSTICK_13 12
  509. #define GLFW_JOYSTICK_14 13
  510. #define GLFW_JOYSTICK_15 14
  511. #define GLFW_JOYSTICK_16 15
  512. #define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
  513. /*! @} */
  514. /*! @defgroup gamepad_buttons Gamepad buttons
  515. * @brief Gamepad buttons.
  516. *
  517. * See @ref gamepad for how these are used.
  518. *
  519. * @ingroup input
  520. * @{ */
  521. #define GLFW_GAMEPAD_BUTTON_A 0
  522. #define GLFW_GAMEPAD_BUTTON_B 1
  523. #define GLFW_GAMEPAD_BUTTON_X 2
  524. #define GLFW_GAMEPAD_BUTTON_Y 3
  525. #define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER 4
  526. #define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER 5
  527. #define GLFW_GAMEPAD_BUTTON_BACK 6
  528. #define GLFW_GAMEPAD_BUTTON_START 7
  529. #define GLFW_GAMEPAD_BUTTON_GUIDE 8
  530. #define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9
  531. #define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10
  532. #define GLFW_GAMEPAD_BUTTON_DPAD_UP 11
  533. #define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 12
  534. #define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 13
  535. #define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 14
  536. #define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT
  537. #define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A
  538. #define GLFW_GAMEPAD_BUTTON_CIRCLE GLFW_GAMEPAD_BUTTON_B
  539. #define GLFW_GAMEPAD_BUTTON_SQUARE GLFW_GAMEPAD_BUTTON_X
  540. #define GLFW_GAMEPAD_BUTTON_TRIANGLE GLFW_GAMEPAD_BUTTON_Y
  541. /*! @} */
  542. /*! @defgroup gamepad_axes Gamepad axes
  543. * @brief Gamepad axes.
  544. *
  545. * See @ref gamepad for how these are used.
  546. *
  547. * @ingroup input
  548. * @{ */
  549. #define GLFW_GAMEPAD_AXIS_LEFT_X 0
  550. #define GLFW_GAMEPAD_AXIS_LEFT_Y 1
  551. #define GLFW_GAMEPAD_AXIS_RIGHT_X 2
  552. #define GLFW_GAMEPAD_AXIS_RIGHT_Y 3
  553. #define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER 4
  554. #define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5
  555. #define GLFW_GAMEPAD_AXIS_LAST GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
  556. /*! @} */
  557. /*! @defgroup errors Error codes
  558. * @brief Error codes.
  559. *
  560. * See [error handling](@ref error_handling) for how these are used.
  561. *
  562. * @ingroup init
  563. * @{ */
  564. /*! @brief No error has occurred.
  565. *
  566. * No error has occurred.
  567. *
  568. * @analysis Yay.
  569. */
  570. #define GLFW_NO_ERROR 0
  571. /*! @brief GLFW has not been initialized.
  572. *
  573. * This occurs if a GLFW function was called that must not be called unless the
  574. * library is [initialized](@ref intro_init).
  575. *
  576. * @analysis Application programmer error. Initialize GLFW before calling any
  577. * function that requires initialization.
  578. */
  579. #define GLFW_NOT_INITIALIZED 0x00010001
  580. /*! @brief No context is current for this thread.
  581. *
  582. * This occurs if a GLFW function was called that needs and operates on the
  583. * current OpenGL or OpenGL ES context but no context is current on the calling
  584. * thread. One such function is @ref glfwSwapInterval.
  585. *
  586. * @analysis Application programmer error. Ensure a context is current before
  587. * calling functions that require a current context.
  588. */
  589. #define GLFW_NO_CURRENT_CONTEXT 0x00010002
  590. /*! @brief One of the arguments to the function was an invalid enum value.
  591. *
  592. * One of the arguments to the function was an invalid enum value, for example
  593. * requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib.
  594. *
  595. * @analysis Application programmer error. Fix the offending call.
  596. */
  597. #define GLFW_INVALID_ENUM 0x00010003
  598. /*! @brief One of the arguments to the function was an invalid value.
  599. *
  600. * One of the arguments to the function was an invalid value, for example
  601. * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
  602. *
  603. * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
  604. * result in a @ref GLFW_VERSION_UNAVAILABLE error.
  605. *
  606. * @analysis Application programmer error. Fix the offending call.
  607. */
  608. #define GLFW_INVALID_VALUE 0x00010004
  609. /*! @brief A memory allocation failed.
  610. *
  611. * A memory allocation failed.
  612. *
  613. * @analysis A bug in GLFW or the underlying operating system. Report the bug
  614. * to our [issue tracker](https://github.com/glfw/glfw/issues).
  615. */
  616. #define GLFW_OUT_OF_MEMORY 0x00010005
  617. /*! @brief GLFW could not find support for the requested API on the system.
  618. *
  619. * GLFW could not find support for the requested API on the system.
  620. *
  621. * @analysis The installed graphics driver does not support the requested
  622. * API, or does not support it via the chosen context creation backend.
  623. * Below are a few examples.
  624. *
  625. * @par
  626. * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
  627. * supports OpenGL ES via EGL, while Nvidia and Intel only support it via
  628. * a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa
  629. * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
  630. * driver. Older graphics drivers do not support Vulkan.
  631. */
  632. #define GLFW_API_UNAVAILABLE 0x00010006
  633. /*! @brief The requested OpenGL or OpenGL ES version is not available.
  634. *
  635. * The requested OpenGL or OpenGL ES version (including any requested context
  636. * or framebuffer hints) is not available on this machine.
  637. *
  638. * @analysis The machine does not support your requirements. If your
  639. * application is sufficiently flexible, downgrade your requirements and try
  640. * again. Otherwise, inform the user that their machine does not match your
  641. * requirements.
  642. *
  643. * @par
  644. * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
  645. * comes out before the 4.x series gets that far, also fail with this error and
  646. * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
  647. * will exist.
  648. */
  649. #define GLFW_VERSION_UNAVAILABLE 0x00010007
  650. /*! @brief A platform-specific error occurred that does not match any of the
  651. * more specific categories.
  652. *
  653. * A platform-specific error occurred that does not match any of the more
  654. * specific categories.
  655. *
  656. * @analysis A bug or configuration error in GLFW, the underlying operating
  657. * system or its drivers, or a lack of required resources. Report the issue to
  658. * our [issue tracker](https://github.com/glfw/glfw/issues).
  659. */
  660. #define GLFW_PLATFORM_ERROR 0x00010008
  661. /*! @brief The requested format is not supported or available.
  662. *
  663. * If emitted during window creation, the requested pixel format is not
  664. * supported.
  665. *
  666. * If emitted when querying the clipboard, the contents of the clipboard could
  667. * not be converted to the requested format.
  668. *
  669. * @analysis If emitted during window creation, one or more
  670. * [hard constraints](@ref window_hints_hard) did not match any of the
  671. * available pixel formats. If your application is sufficiently flexible,
  672. * downgrade your requirements and try again. Otherwise, inform the user that
  673. * their machine does not match your requirements.
  674. *
  675. * @par
  676. * If emitted when querying the clipboard, ignore the error or report it to
  677. * the user, as appropriate.
  678. */
  679. #define GLFW_FORMAT_UNAVAILABLE 0x00010009
  680. /*! @brief The specified window does not have an OpenGL or OpenGL ES context.
  681. *
  682. * A window that does not have an OpenGL or OpenGL ES context was passed to
  683. * a function that requires it to have one.
  684. *
  685. * @analysis Application programmer error. Fix the offending call.
  686. */
  687. #define GLFW_NO_WINDOW_CONTEXT 0x0001000A
  688. /*! @brief The requested feature is not provided by the platform.
  689. *
  690. * The requested feature is not provided by the platform, so GLFW is unable to
  691. * implement it. The documentation for each function notes if it could emit
  692. * this error.
  693. *
  694. * @analysis Platform or platform version limitation. The error can be ignored
  695. * unless the feature is critical to the application.
  696. *
  697. * @par
  698. * A function call that emits this error has no effect other than the error and
  699. * updating any existing out parameters.
  700. */
  701. #define GLFW_FEATURE_UNAVAILABLE 0x0001000C
  702. /*! @brief The requested feature is not implemented for the platform.
  703. *
  704. * The requested feature has not yet been implemented in GLFW for this platform.
  705. *
  706. * @analysis An incomplete implementation of GLFW for this platform, hopefully
  707. * fixed in a future release. The error can be ignored unless the feature is
  708. * critical to the application.
  709. *
  710. * @par
  711. * A function call that emits this error has no effect other than the error and
  712. * updating any existing out parameters.
  713. */
  714. #define GLFW_FEATURE_UNIMPLEMENTED 0x0001000D
  715. /*! @} */
  716. /*! @addtogroup window
  717. * @{ */
  718. /*! @brief Input focus window hint and attribute
  719. *
  720. * Input focus [window hint](@ref GLFW_FOCUSED_hint) or
  721. * [window attribute](@ref GLFW_FOCUSED_attrib).
  722. */
  723. #define GLFW_FOCUSED 0x00020001
  724. /*! @brief Window iconification window attribute
  725. *
  726. * Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib).
  727. */
  728. #define GLFW_ICONIFIED 0x00020002
  729. /*! @brief Window resize-ability window hint and attribute
  730. *
  731. * Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and
  732. * [window attribute](@ref GLFW_RESIZABLE_attrib).
  733. */
  734. #define GLFW_RESIZABLE 0x00020003
  735. /*! @brief Window visibility window hint and attribute
  736. *
  737. * Window visibility [window hint](@ref GLFW_VISIBLE_hint) and
  738. * [window attribute](@ref GLFW_VISIBLE_attrib).
  739. */
  740. #define GLFW_VISIBLE 0x00020004
  741. /*! @brief Window decoration window hint and attribute
  742. *
  743. * Window decoration [window hint](@ref GLFW_DECORATED_hint) and
  744. * [window attribute](@ref GLFW_DECORATED_attrib).
  745. */
  746. #define GLFW_DECORATED 0x00020005
  747. /*! @brief Window auto-iconification window hint and attribute
  748. *
  749. * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and
  750. * [window attribute](@ref GLFW_AUTO_ICONIFY_attrib).
  751. */
  752. #define GLFW_AUTO_ICONIFY 0x00020006
  753. /*! @brief Window decoration window hint and attribute
  754. *
  755. * Window decoration [window hint](@ref GLFW_FLOATING_hint) and
  756. * [window attribute](@ref GLFW_FLOATING_attrib).
  757. */
  758. #define GLFW_FLOATING 0x00020007
  759. /*! @brief Window maximization window hint and attribute
  760. *
  761. * Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and
  762. * [window attribute](@ref GLFW_MAXIMIZED_attrib).
  763. */
  764. #define GLFW_MAXIMIZED 0x00020008
  765. /*! @brief Cursor centering window hint
  766. *
  767. * Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint).
  768. */
  769. #define GLFW_CENTER_CURSOR 0x00020009
  770. /*! @brief Window framebuffer transparency hint and attribute
  771. *
  772. * Window framebuffer transparency
  773. * [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and
  774. * [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib).
  775. */
  776. #define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A
  777. /*! @brief Mouse cursor hover window attribute.
  778. *
  779. * Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib).
  780. */
  781. #define GLFW_HOVERED 0x0002000B
  782. /*! @brief Input focus on calling show window hint and attribute
  783. *
  784. * Input focus [window hint](@ref GLFW_FOCUS_ON_SHOW_hint) or
  785. * [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib).
  786. */
  787. #define GLFW_FOCUS_ON_SHOW 0x0002000C
  788. /*! @brief Mouse input transparency window hint and attribute
  789. *
  790. * Mouse input transparency [window hint](@ref GLFW_MOUSE_PASSTHROUGH_hint) or
  791. * [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib).
  792. */
  793. #define GLFW_MOUSE_PASSTHROUGH 0x0002000D
  794. /*! @brief Occlusion window attribute
  795. *
  796. * Occlusion [window attribute](@ref GLFW_OCCLUDED_attrib).
  797. */
  798. #define GLFW_OCCLUDED 0x0002000E
  799. /*! @brief Framebuffer bit depth hint.
  800. *
  801. * Framebuffer bit depth [hint](@ref GLFW_RED_BITS).
  802. */
  803. #define GLFW_RED_BITS 0x00021001
  804. /*! @brief Framebuffer bit depth hint.
  805. *
  806. * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS).
  807. */
  808. #define GLFW_GREEN_BITS 0x00021002
  809. /*! @brief Framebuffer bit depth hint.
  810. *
  811. * Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS).
  812. */
  813. #define GLFW_BLUE_BITS 0x00021003
  814. /*! @brief Framebuffer bit depth hint.
  815. *
  816. * Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS).
  817. */
  818. #define GLFW_ALPHA_BITS 0x00021004
  819. /*! @brief Framebuffer bit depth hint.
  820. *
  821. * Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS).
  822. */
  823. #define GLFW_DEPTH_BITS 0x00021005
  824. /*! @brief Framebuffer bit depth hint.
  825. *
  826. * Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS).
  827. */
  828. #define GLFW_STENCIL_BITS 0x00021006
  829. /*! @brief Framebuffer bit depth hint.
  830. *
  831. * Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS).
  832. */
  833. #define GLFW_ACCUM_RED_BITS 0x00021007
  834. /*! @brief Framebuffer bit depth hint.
  835. *
  836. * Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS).
  837. */
  838. #define GLFW_ACCUM_GREEN_BITS 0x00021008
  839. /*! @brief Framebuffer bit depth hint.
  840. *
  841. * Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS).
  842. */
  843. #define GLFW_ACCUM_BLUE_BITS 0x00021009
  844. /*! @brief Framebuffer bit depth hint.
  845. *
  846. * Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS).
  847. */
  848. #define GLFW_ACCUM_ALPHA_BITS 0x0002100A
  849. /*! @brief Framebuffer auxiliary buffer hint.
  850. *
  851. * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS).
  852. */
  853. #define GLFW_AUX_BUFFERS 0x0002100B
  854. /*! @brief OpenGL stereoscopic rendering hint.
  855. *
  856. * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO).
  857. */
  858. #define GLFW_STEREO 0x0002100C
  859. /*! @brief Framebuffer MSAA samples hint.
  860. *
  861. * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES).
  862. */
  863. #define GLFW_SAMPLES 0x0002100D
  864. /*! @brief Framebuffer sRGB hint.
  865. *
  866. * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE).
  867. */
  868. #define GLFW_SRGB_CAPABLE 0x0002100E
  869. /*! @brief Monitor refresh rate hint.
  870. *
  871. * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE).
  872. */
  873. #define GLFW_REFRESH_RATE 0x0002100F
  874. /*! @brief Framebuffer double buffering hint.
  875. *
  876. * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER).
  877. */
  878. #define GLFW_DOUBLEBUFFER 0x00021010
  879. /*! @brief Context client API hint and attribute.
  880. *
  881. * Context client API [hint](@ref GLFW_CLIENT_API_hint) and
  882. * [attribute](@ref GLFW_CLIENT_API_attrib).
  883. */
  884. #define GLFW_CLIENT_API 0x00022001
  885. /*! @brief Context client API major version hint and attribute.
  886. *
  887. * Context client API major version [hint](@ref GLFW_CONTEXT_VERSION_MAJOR_hint)
  888. * and [attribute](@ref GLFW_CONTEXT_VERSION_MAJOR_attrib).
  889. */
  890. #define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
  891. /*! @brief Context client API minor version hint and attribute.
  892. *
  893. * Context client API minor version [hint](@ref GLFW_CONTEXT_VERSION_MINOR_hint)
  894. * and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
  895. */
  896. #define GLFW_CONTEXT_VERSION_MINOR 0x00022003
  897. /*! @brief Context client API revision number hint and attribute.
  898. *
  899. * Context client API revision number
  900. * [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
  901. */
  902. #define GLFW_CONTEXT_REVISION 0x00022004
  903. /*! @brief Context robustness hint and attribute.
  904. *
  905. * Context client API revision number [hint](@ref GLFW_CONTEXT_ROBUSTNESS_hint)
  906. * and [attribute](@ref GLFW_CONTEXT_ROBUSTNESS_attrib).
  907. */
  908. #define GLFW_CONTEXT_ROBUSTNESS 0x00022005
  909. /*! @brief OpenGL forward-compatibility hint and attribute.
  910. *
  911. * OpenGL forward-compatibility [hint](@ref GLFW_OPENGL_FORWARD_COMPAT_hint)
  912. * and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib).
  913. */
  914. #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
  915. /*! @brief Debug mode context hint and attribute.
  916. *
  917. * Debug mode context [hint](@ref GLFW_CONTEXT_DEBUG_hint) and
  918. * [attribute](@ref GLFW_CONTEXT_DEBUG_attrib).
  919. */
  920. #define GLFW_CONTEXT_DEBUG 0x00022007
  921. /*! @brief Legacy name for compatibility.
  922. *
  923. * This is an alias for compatibility with earlier versions.
  924. */
  925. #define GLFW_OPENGL_DEBUG_CONTEXT GLFW_CONTEXT_DEBUG
  926. /*! @brief OpenGL profile hint and attribute.
  927. *
  928. * OpenGL profile [hint](@ref GLFW_OPENGL_PROFILE_hint) and
  929. * [attribute](@ref GLFW_OPENGL_PROFILE_attrib).
  930. */
  931. #define GLFW_OPENGL_PROFILE 0x00022008
  932. /*! @brief Context flush-on-release hint and attribute.
  933. *
  934. * Context flush-on-release [hint](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) and
  935. * [attribute](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib).
  936. */
  937. #define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
  938. /*! @brief Context error suppression hint and attribute.
  939. *
  940. * Context error suppression [hint](@ref GLFW_CONTEXT_NO_ERROR_hint) and
  941. * [attribute](@ref GLFW_CONTEXT_NO_ERROR_attrib).
  942. */
  943. #define GLFW_CONTEXT_NO_ERROR 0x0002200A
  944. /*! @brief Context creation API hint and attribute.
  945. *
  946. * Context creation API [hint](@ref GLFW_CONTEXT_CREATION_API_hint) and
  947. * [attribute](@ref GLFW_CONTEXT_CREATION_API_attrib).
  948. */
  949. #define GLFW_CONTEXT_CREATION_API 0x0002200B
  950. /*! @brief Window content area scaling window
  951. * [window hint](@ref GLFW_SCALE_TO_MONITOR).
  952. */
  953. #define GLFW_SCALE_TO_MONITOR 0x0002200C
  954. /*! @brief macOS specific
  955. * [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint).
  956. */
  957. #define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
  958. /*! @brief macOS specific
  959. * [window hint](@ref GLFW_COCOA_FRAME_NAME_hint).
  960. */
  961. #define GLFW_COCOA_FRAME_NAME 0x00023002
  962. /*! @brief macOS specific
  963. * [window hint](@ref GLFW_COCOA_GRAPHICS_SWITCHING_hint).
  964. */
  965. #define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003
  966. /*! @brief macOS specific
  967. * [window hint](@ref GLFW_COCOA_COLOR_SPACE_hint).
  968. */
  969. #define GLFW_COCOA_COLOR_SPACE 0x00023004
  970. typedef enum {
  971. DEFAULT_COLORSPACE = 0,
  972. SRGB_COLORSPACE = 1,
  973. DISPLAY_P3_COLORSPACE = 2,
  974. } GlfwCocoaColorSpaces;
  975. /*! @brief Blur Radius. On macOS the actual radius is used. On Linux it is treated as a bool.
  976. * [window hint](@ref GLFW_BLUR_RADIUS).
  977. */
  978. #define GLFW_BLUR_RADIUS 0x0002305
  979. /*! @brief X11 specific
  980. * [window hint](@ref GLFW_X11_CLASS_NAME_hint).
  981. */
  982. #define GLFW_X11_CLASS_NAME 0x00024001
  983. /*! @brief X11 specific
  984. * [window hint](@ref GLFW_X11_CLASS_NAME_hint).
  985. */
  986. #define GLFW_X11_INSTANCE_NAME 0x00024002
  987. #define GLFW_WAYLAND_APP_ID 0x00025001
  988. #define GLFW_WAYLAND_BGCOLOR 0x00025002
  989. /*! @} */
  990. #define GLFW_NO_API 0
  991. #define GLFW_OPENGL_API 0x00030001
  992. #define GLFW_OPENGL_ES_API 0x00030002
  993. #define GLFW_NO_ROBUSTNESS 0
  994. #define GLFW_NO_RESET_NOTIFICATION 0x00031001
  995. #define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
  996. #define GLFW_OPENGL_ANY_PROFILE 0
  997. #define GLFW_OPENGL_CORE_PROFILE 0x00032001
  998. #define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
  999. #define GLFW_CURSOR 0x00033001
  1000. #define GLFW_STICKY_KEYS 0x00033002
  1001. #define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
  1002. #define GLFW_LOCK_KEY_MODS 0x00033004
  1003. #define GLFW_RAW_MOUSE_MOTION 0x00033005
  1004. #define GLFW_CURSOR_NORMAL 0x00034001
  1005. #define GLFW_CURSOR_HIDDEN 0x00034002
  1006. #define GLFW_CURSOR_DISABLED 0x00034003
  1007. #define GLFW_ANY_RELEASE_BEHAVIOR 0
  1008. #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
  1009. #define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
  1010. #define GLFW_NATIVE_CONTEXT_API 0x00036001
  1011. #define GLFW_EGL_CONTEXT_API 0x00036002
  1012. #define GLFW_OSMESA_CONTEXT_API 0x00036003
  1013. #define GLFW_ANGLE_PLATFORM_TYPE_NONE 0x00037001
  1014. #define GLFW_ANGLE_PLATFORM_TYPE_OPENGL 0x00037002
  1015. #define GLFW_ANGLE_PLATFORM_TYPE_OPENGLES 0x00037003
  1016. #define GLFW_ANGLE_PLATFORM_TYPE_D3D9 0x00037004
  1017. #define GLFW_ANGLE_PLATFORM_TYPE_D3D11 0x00037005
  1018. #define GLFW_ANGLE_PLATFORM_TYPE_VULKAN 0x00037007
  1019. #define GLFW_ANGLE_PLATFORM_TYPE_METAL 0x00037008
  1020. /*! @defgroup shapes Standard cursor shapes
  1021. * @brief Standard system cursor shapes.
  1022. *
  1023. * See [standard cursor creation](@ref cursor_standard) for how these are used.
  1024. *
  1025. * @ingroup input
  1026. * @{ */
  1027. typedef enum {
  1028. /* start mouse cursor shapes (auto generated by gen-key-constants.py do not edit) */
  1029. GLFW_DEFAULT_CURSOR,
  1030. GLFW_TEXT_CURSOR,
  1031. GLFW_POINTER_CURSOR,
  1032. GLFW_HELP_CURSOR,
  1033. GLFW_WAIT_CURSOR,
  1034. GLFW_PROGRESS_CURSOR,
  1035. GLFW_CROSSHAIR_CURSOR,
  1036. GLFW_CELL_CURSOR,
  1037. GLFW_VERTICAL_TEXT_CURSOR,
  1038. GLFW_MOVE_CURSOR,
  1039. GLFW_E_RESIZE_CURSOR,
  1040. GLFW_NE_RESIZE_CURSOR,
  1041. GLFW_NW_RESIZE_CURSOR,
  1042. GLFW_N_RESIZE_CURSOR,
  1043. GLFW_SE_RESIZE_CURSOR,
  1044. GLFW_SW_RESIZE_CURSOR,
  1045. GLFW_S_RESIZE_CURSOR,
  1046. GLFW_W_RESIZE_CURSOR,
  1047. GLFW_EW_RESIZE_CURSOR,
  1048. GLFW_NS_RESIZE_CURSOR,
  1049. GLFW_NESW_RESIZE_CURSOR,
  1050. GLFW_NWSE_RESIZE_CURSOR,
  1051. GLFW_ZOOM_IN_CURSOR,
  1052. GLFW_ZOOM_OUT_CURSOR,
  1053. GLFW_ALIAS_CURSOR,
  1054. GLFW_COPY_CURSOR,
  1055. GLFW_NOT_ALLOWED_CURSOR,
  1056. GLFW_NO_DROP_CURSOR,
  1057. GLFW_GRAB_CURSOR,
  1058. GLFW_GRABBING_CURSOR,
  1059. GLFW_INVALID_CURSOR,
  1060. /* end mouse cursor shapes */
  1061. } GLFWCursorShape;
  1062. /*! @} */
  1063. #define GLFW_CONNECTED 0x00040001
  1064. #define GLFW_DISCONNECTED 0x00040002
  1065. /*! @addtogroup init
  1066. * @{ */
  1067. /*! @brief Joystick hat buttons init hint.
  1068. *
  1069. * Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS).
  1070. */
  1071. #define GLFW_JOYSTICK_HAT_BUTTONS 0x00050001
  1072. /*! @brief ANGLE rendering backend init hint.
  1073. *
  1074. * ANGLE rendering backend [init hint](@ref GLFW_ANGLE_PLATFORM_TYPE_hint).
  1075. */
  1076. #define GLFW_ANGLE_PLATFORM_TYPE 0x00050002
  1077. #define GLFW_DEBUG_KEYBOARD 0x00050003
  1078. #define GLFW_DEBUG_RENDERING 0x00050004
  1079. /*! @brief macOS specific init hint.
  1080. *
  1081. * macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).
  1082. */
  1083. #define GLFW_COCOA_CHDIR_RESOURCES 0x00051001
  1084. /*! @brief macOS specific init hint.
  1085. *
  1086. * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint).
  1087. */
  1088. #define GLFW_COCOA_MENUBAR 0x00051002
  1089. #define GLFW_WAYLAND_IME 0x00051003
  1090. /*! @} */
  1091. #define GLFW_DONT_CARE -1
  1092. /*************************************************************************
  1093. * GLFW API types
  1094. *************************************************************************/
  1095. /*! @brief Client API function pointer type.
  1096. *
  1097. * Generic function pointer used for returning client API function pointers
  1098. * without forcing a cast from a regular pointer.
  1099. *
  1100. * @sa @ref context_glext
  1101. * @sa @ref glfwGetProcAddress
  1102. *
  1103. * @since Added in version 3.0.
  1104. *
  1105. * @ingroup context
  1106. */
  1107. typedef void (*GLFWglproc)(void);
  1108. /*! @brief Vulkan API function pointer type.
  1109. *
  1110. * Generic function pointer used for returning Vulkan API function pointers
  1111. * without forcing a cast from a regular pointer.
  1112. *
  1113. * @sa @ref vulkan_proc
  1114. * @sa @ref glfwGetInstanceProcAddress
  1115. *
  1116. * @since Added in version 3.2.
  1117. *
  1118. * @ingroup vulkan
  1119. */
  1120. typedef void (*GLFWvkproc)(void);
  1121. /*! @brief Opaque monitor object.
  1122. *
  1123. * Opaque monitor object.
  1124. *
  1125. * @see @ref monitor_object
  1126. *
  1127. * @since Added in version 3.0.
  1128. *
  1129. * @ingroup monitor
  1130. */
  1131. typedef struct GLFWmonitor GLFWmonitor;
  1132. /*! @brief Opaque window object.
  1133. *
  1134. * Opaque window object.
  1135. *
  1136. * @see @ref window_object
  1137. *
  1138. * @since Added in version 3.0.
  1139. *
  1140. * @ingroup window
  1141. */
  1142. typedef struct GLFWwindow GLFWwindow;
  1143. /*! @brief Opaque cursor object.
  1144. *
  1145. * Opaque cursor object.
  1146. *
  1147. * @see @ref cursor_object
  1148. *
  1149. * @since Added in version 3.1.
  1150. *
  1151. * @ingroup input
  1152. */
  1153. typedef struct GLFWcursor GLFWcursor;
  1154. typedef enum {
  1155. GLFW_RELEASE = 0,
  1156. GLFW_PRESS = 1,
  1157. GLFW_REPEAT = 2
  1158. } GLFWKeyAction;
  1159. typedef enum {
  1160. GLFW_IME_NONE,
  1161. GLFW_IME_PREEDIT_CHANGED,
  1162. GLFW_IME_COMMIT_TEXT,
  1163. GLFW_IME_WAYLAND_DONE_EVENT,
  1164. } GLFWIMEState;
  1165. typedef enum {
  1166. GLFW_IME_UPDATE_FOCUS = 1,
  1167. GLFW_IME_UPDATE_CURSOR_POSITION = 2
  1168. } GLFWIMEUpdateType;
  1169. typedef struct GLFWIMEUpdateEvent {
  1170. GLFWIMEUpdateType type;
  1171. const char *before_text, *at_text, *after_text;
  1172. bool focused;
  1173. struct {
  1174. int left, top, width, height;
  1175. } cursor;
  1176. } GLFWIMEUpdateEvent;
  1177. typedef struct GLFWkeyevent
  1178. {
  1179. // The [keyboard key](@ref keys) that was pressed or released.
  1180. uint32_t key, shifted_key, alternate_key;
  1181. // The platform-specific identifier of the key.
  1182. int native_key;
  1183. // The event action. Either `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
  1184. GLFWKeyAction action;
  1185. // Bit field describing which [modifier keys](@ref mods) were held down.
  1186. int mods;
  1187. // UTF-8 encoded text generated by this key event or empty string or NULL
  1188. const char *text;
  1189. // Used for Input Method events. Zero for normal key events.
  1190. // A value of GLFW_IME_PREEDIT_CHANGED means the pre-edit text for the input event has been changed.
  1191. // A value of GLFW_IME_COMMIT_TEXT means the text should be committed.
  1192. GLFWIMEState ime_state;
  1193. // For internal use only. On Linux it is the actual keycode reported by the windowing system, in contrast
  1194. // to native_key which can be the result of a compose operation. On macOS it is the same as native_key.
  1195. uint32_t native_key_id;
  1196. // True if this is a synthesized event on focus change
  1197. bool fake_event_on_focus_change;
  1198. } GLFWkeyevent;
  1199. typedef enum { GLFW_LAYER_SHELL_NONE, GLFW_LAYER_SHELL_BACKGROUND, GLFW_LAYER_SHELL_PANEL } GLFWLayerShellType;
  1200. typedef enum { GLFW_EDGE_TOP, GLFW_EDGE_BOTTOM, GLFW_EDGE_LEFT, GLFW_EDGE_RIGHT } GLFWEdge;
  1201. typedef enum { GLFW_FOCUS_NOT_ALLOWED, GLFW_FOCUS_EXCLUSIVE, GLFW_FOCUS_ON_DEMAND} GLFWFocusPolicy;
  1202. typedef struct GLFWLayerShellConfig {
  1203. GLFWLayerShellType type;
  1204. GLFWEdge edge;
  1205. char output_name[64];
  1206. GLFWFocusPolicy focus_policy;
  1207. unsigned size_in_cells;
  1208. void (*size_callback)(GLFWwindow *window, const struct GLFWLayerShellConfig *config, unsigned monitor_width, unsigned monitor_height, uint32_t *width, uint32_t *height);
  1209. } GLFWLayerShellConfig;
  1210. typedef struct GLFWDBUSNotificationData {
  1211. const char *app_name, *icon, *summary, *body, *action_name;
  1212. int32_t timeout; uint8_t urgency; uint32_t replaces;
  1213. } GLFWDBUSNotificationData;
  1214. /*! @brief The function pointer type for error callbacks.
  1215. *
  1216. * This is the function pointer type for error callbacks. An error callback
  1217. * function has the following signature:
  1218. * @code
  1219. * void callback_name(int error_code, const char* description)
  1220. * @endcode
  1221. *
  1222. * @param[in] error_code An [error code](@ref errors). Future releases may add
  1223. * more error codes.
  1224. * @param[in] description A UTF-8 encoded string describing the error.
  1225. *
  1226. * @pointer_lifetime The error description string is valid until the callback
  1227. * function returns.
  1228. *
  1229. * @sa @ref error_handling
  1230. * @sa @ref glfwSetErrorCallback
  1231. *
  1232. * @since Added in version 3.0.
  1233. *
  1234. * @ingroup init
  1235. */
  1236. typedef void (* GLFWerrorfun)(int,const char*);
  1237. /*! @brief The function pointer type for window position callbacks.
  1238. *
  1239. * This is the function pointer type for window position callbacks. A window
  1240. * position callback function has the following signature:
  1241. * @code
  1242. * void callback_name(GLFWwindow* window, int xpos, int ypos)
  1243. * @endcode
  1244. *
  1245. * @param[in] window The window that was moved.
  1246. * @param[in] xpos The new x-coordinate, in screen coordinates, of the
  1247. * upper-left corner of the content area of the window.
  1248. * @param[in] ypos The new y-coordinate, in screen coordinates, of the
  1249. * upper-left corner of the content area of the window.
  1250. *
  1251. * @sa @ref window_pos
  1252. * @sa @ref glfwSetWindowPosCallback
  1253. *
  1254. * @since Added in version 3.0.
  1255. *
  1256. * @ingroup window
  1257. */
  1258. typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
  1259. /*! @brief The function pointer type for window size callbacks.
  1260. *
  1261. * This is the function pointer type for window size callbacks. A window size
  1262. * callback function has the following signature:
  1263. * @code
  1264. * void callback_name(GLFWwindow* window, int width, int height)
  1265. * @endcode
  1266. *
  1267. * @param[in] window The window that was resized.
  1268. * @param[in] width The new width, in screen coordinates, of the window.
  1269. * @param[in] height The new height, in screen coordinates, of the window.
  1270. *
  1271. * @sa @ref window_size
  1272. * @sa @ref glfwSetWindowSizeCallback
  1273. *
  1274. * @since Added in version 1.0.
  1275. * @glfw3 Added window handle parameter.
  1276. *
  1277. * @ingroup window
  1278. */
  1279. typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
  1280. /*! @brief The function pointer type for window close callbacks.
  1281. *
  1282. * This is the function pointer type for window close callbacks. A window
  1283. * close callback function has the following signature:
  1284. * @code
  1285. * void function_name(GLFWwindow* window)
  1286. * @endcode
  1287. *
  1288. * @param[in] window The window that the user attempted to close.
  1289. *
  1290. * @sa @ref window_close
  1291. * @sa @ref glfwSetWindowCloseCallback
  1292. *
  1293. * @since Added in version 2.5.
  1294. * @glfw3 Added window handle parameter.
  1295. *
  1296. * @ingroup window
  1297. */
  1298. typedef void (* GLFWwindowclosefun)(GLFWwindow*);
  1299. /*! @brief The function pointer type for application close callbacks.
  1300. *
  1301. * This is the function pointer type for application close callbacks. A application
  1302. * close callback function has the following signature:
  1303. * @code
  1304. * void function_name(int flags)
  1305. * @endcode
  1306. *
  1307. * @param[in] flags 0 for a user requested application quit, 1 if a fatal error occurred and application should quit ASAP
  1308. *
  1309. * @sa @ref glfwSetApplicationCloseCallback
  1310. *
  1311. * @ingroup window
  1312. */
  1313. typedef void (* GLFWapplicationclosefun)(int);
  1314. /*! @brief The function pointer type for system color theme change callbacks.
  1315. *
  1316. * This is the function pointer type for system color theme changes.
  1317. * @code
  1318. * void function_name(int theme_type)
  1319. * @endcode
  1320. *
  1321. * @param[in] theme_type 0 for unknown, 1 for dark and 2 for light
  1322. *
  1323. * @sa @ref glfwSetSystemColorThemeChangeCallback
  1324. *
  1325. * @ingroup window
  1326. */
  1327. typedef void (* GLFWsystemcolorthemechangefun)(GLFWColorScheme);
  1328. /*! @brief The function pointer type for window content refresh callbacks.
  1329. *
  1330. * This is the function pointer type for window content refresh callbacks.
  1331. * A window content refresh callback function has the following signature:
  1332. * @code
  1333. * void function_name(GLFWwindow* window);
  1334. * @endcode
  1335. *
  1336. * @param[in] window The window whose content needs to be refreshed.
  1337. *
  1338. * @sa @ref window_refresh
  1339. * @sa @ref glfwSetWindowRefreshCallback
  1340. *
  1341. * @since Added in version 2.5.
  1342. * @glfw3 Added window handle parameter.
  1343. *
  1344. * @ingroup window
  1345. */
  1346. typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
  1347. /*! @brief The function pointer type for window focus callbacks.
  1348. *
  1349. * This is the function pointer type for window focus callbacks. A window
  1350. * focus callback function has the following signature:
  1351. * @code
  1352. * void function_name(GLFWwindow* window, int focused)
  1353. * @endcode
  1354. *
  1355. * @param[in] window The window that gained or lost input focus.
  1356. * @param[in] focused `true` if the window was given input focus, or
  1357. * `false` if it lost it.
  1358. *
  1359. * @sa @ref window_focus
  1360. * @sa @ref glfwSetWindowFocusCallback
  1361. *
  1362. * @since Added in version 3.0.
  1363. *
  1364. * @ingroup window
  1365. */
  1366. typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
  1367. /*! @brief The function signature for window occlusion callbacks.
  1368. *
  1369. * This is the function signature for window occlusion callback functions.
  1370. *
  1371. * @param[in] window The window whose occlusion state changed.
  1372. * @param[in] occluded `true` if the window was occluded, or `false`
  1373. * if the window is no longer occluded.
  1374. *
  1375. * @sa @ref window_occlusion
  1376. * @sa @ref glfwSetWindowOcclusionCallback
  1377. *
  1378. * @since Added in version 3.3.
  1379. *
  1380. * @ingroup window
  1381. */
  1382. typedef void (* GLFWwindowocclusionfun)(GLFWwindow*, bool);
  1383. /*! @brief The function pointer type for window iconify callbacks.
  1384. *
  1385. * This is the function pointer type for window iconify callbacks. A window
  1386. * iconify callback function has the following signature:
  1387. * @code
  1388. * void function_name(GLFWwindow* window, int iconified)
  1389. * @endcode
  1390. *
  1391. * @param[in] window The window that was iconified or restored.
  1392. * @param[in] iconified `true` if the window was iconified, or
  1393. * `false` if it was restored.
  1394. *
  1395. * @sa @ref window_iconify
  1396. * @sa @ref glfwSetWindowIconifyCallback
  1397. *
  1398. * @since Added in version 3.0.
  1399. *
  1400. * @ingroup window
  1401. */
  1402. typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
  1403. /*! @brief The function pointer type for window maximize callbacks.
  1404. *
  1405. * This is the function pointer type for window maximize callbacks. A window
  1406. * maximize callback function has the following signature:
  1407. * @code
  1408. * void function_name(GLFWwindow* window, int maximized)
  1409. * @endcode
  1410. *
  1411. * @param[in] window The window that was maximized or restored.
  1412. * @param[in] maximized `true` if the window was maximized, or
  1413. * `false` if it was restored.
  1414. *
  1415. * @sa @ref window_maximize
  1416. * @sa glfwSetWindowMaximizeCallback
  1417. *
  1418. * @since Added in version 3.3.
  1419. *
  1420. * @ingroup window
  1421. */
  1422. typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
  1423. /*! @brief The function pointer type for framebuffer size callbacks.
  1424. *
  1425. * This is the function pointer type for framebuffer size callbacks.
  1426. * A framebuffer size callback function has the following signature:
  1427. * @code
  1428. * void function_name(GLFWwindow* window, int width, int height)
  1429. * @endcode
  1430. *
  1431. * @param[in] window The window whose framebuffer was resized.
  1432. * @param[in] width The new width, in pixels, of the framebuffer.
  1433. * @param[in] height The new height, in pixels, of the framebuffer.
  1434. *
  1435. * @sa @ref window_fbsize
  1436. * @sa @ref glfwSetFramebufferSizeCallback
  1437. *
  1438. * @since Added in version 3.0.
  1439. *
  1440. * @ingroup window
  1441. */
  1442. typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
  1443. /*! @brief The function pointer type for window content scale callbacks.
  1444. *
  1445. * This is the function pointer type for window content scale callbacks.
  1446. * A window content scale callback function has the following signature:
  1447. * @code
  1448. * void function_name(GLFWwindow* window, float xscale, float yscale)
  1449. * @endcode
  1450. *
  1451. * @param[in] window The window whose content scale changed.
  1452. * @param[in] xscale The new x-axis content scale of the window.
  1453. * @param[in] yscale The new y-axis content scale of the window.
  1454. *
  1455. * @sa @ref window_scale
  1456. * @sa @ref glfwSetWindowContentScaleCallback
  1457. *
  1458. * @since Added in version 3.3.
  1459. *
  1460. * @ingroup window
  1461. */
  1462. typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float);
  1463. /*! @brief The function pointer type for mouse button callbacks.
  1464. *
  1465. * This is the function pointer type for mouse button callback functions.
  1466. * A mouse button callback function has the following signature:
  1467. * @code
  1468. * void function_name(GLFWwindow* window, int button, int action, int mods)
  1469. * @endcode
  1470. *
  1471. * @param[in] window The window that received the event.
  1472. * @param[in] button The [mouse button](@ref buttons) that was pressed or
  1473. * released.
  1474. * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. Future releases
  1475. * may add more actions.
  1476. * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
  1477. * held down.
  1478. *
  1479. * @sa @ref input_mouse_button
  1480. * @sa @ref glfwSetMouseButtonCallback
  1481. *
  1482. * @since Added in version 1.0.
  1483. * @glfw3 Added window handle and modifier mask parameters.
  1484. *
  1485. * @ingroup input
  1486. */
  1487. typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
  1488. /*! @brief The function pointer type for cursor position callbacks.
  1489. *
  1490. * This is the function pointer type for cursor position callbacks. A cursor
  1491. * position callback function has the following signature:
  1492. * @code
  1493. * void function_name(GLFWwindow* window, double xpos, double ypos);
  1494. * @endcode
  1495. *
  1496. * @param[in] window The window that received the event.
  1497. * @param[in] xpos The new cursor x-coordinate, relative to the left edge of
  1498. * the content area.
  1499. * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
  1500. * content area.
  1501. *
  1502. * @sa @ref cursor_pos
  1503. * @sa @ref glfwSetCursorPosCallback
  1504. *
  1505. * @since Added in version 3.0. Replaces `GLFWmouseposfun`.
  1506. *
  1507. * @ingroup input
  1508. */
  1509. typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
  1510. /*! @brief The function pointer type for cursor enter/leave callbacks.
  1511. *
  1512. * This is the function pointer type for cursor enter/leave callbacks.
  1513. * A cursor enter/leave callback function has the following signature:
  1514. * @code
  1515. * void function_name(GLFWwindow* window, int entered)
  1516. * @endcode
  1517. *
  1518. * @param[in] window The window that received the event.
  1519. * @param[in] entered `true` if the cursor entered the window's content
  1520. * area, or `false` if it left it.
  1521. *
  1522. * @sa @ref cursor_enter
  1523. * @sa @ref glfwSetCursorEnterCallback
  1524. *
  1525. * @since Added in version 3.0.
  1526. *
  1527. * @ingroup input
  1528. */
  1529. typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
  1530. /*! @brief The function pointer type for scroll callbacks.
  1531. *
  1532. * This is the function pointer type for scroll callbacks. A scroll callback
  1533. * function has the following signature:
  1534. * @code
  1535. * void function_name(GLFWwindow* window, double xoffset, double yoffset)
  1536. * @endcode
  1537. *
  1538. * @param[in] window The window that received the event.
  1539. * @param[in] xoffset The scroll offset along the x-axis.
  1540. * @param[in] yoffset The scroll offset along the y-axis.
  1541. * @param[in] flags A bit-mask providing extra data about the event.
  1542. * flags & 1 will be true if and only if the offset values are "high-precision",
  1543. * typically pixel values. Otherwise the offset values are number of lines.
  1544. * (flags >> 1) & 7 will have value 1 for the start of momentum scrolling,
  1545. * value 2 for stationary momentum scrolling, value 3 for momentum scrolling
  1546. * in progress, value 4 for momentum scrolling ended, value 5 for momentum
  1547. * scrolling cancelled and value 6 if scrolling may begin soon.
  1548. * @param[int] mods The keyboard modifiers
  1549. *
  1550. * @sa @ref scrolling
  1551. * @sa @ref glfwSetScrollCallback
  1552. *
  1553. * @since Added in version 3.0. Replaces `GLFWmousewheelfun`.
  1554. * @since Changed in version 4.0. Added `flags` parameter.
  1555. *
  1556. * @ingroup input
  1557. */
  1558. typedef void (* GLFWscrollfun)(GLFWwindow*,double,double,int,int);
  1559. /*! @brief The function pointer type for key callbacks.
  1560. *
  1561. * This is the function pointer type for key callbacks. A keyboard
  1562. * key callback function has the following signature:
  1563. * @code
  1564. * void function_name(GLFWwindow* window, uint32_t key, int native_key, int action, int mods)
  1565. * @endcode
  1566. * The semantics of this function are that the key that is interacted with on the
  1567. * keyboard is reported, and the text, if any generated by the key is reported.
  1568. * So, for example, if on a US-ASCII keyboard the user presses Shift+= GLFW
  1569. * will report the text "+" and the key as GLFW_KEY_EQUAL. The reported key takes into
  1570. * account any current keyboard maps defined in the OS. So with a dvorak mapping, pressing
  1571. * the "s" key will generate text "o" and GLFW_KEY_O.
  1572. *
  1573. * @param[in] window The window that received the event.
  1574. * @param[in] ev The key event, see GLFWkeyevent. The data in this event is only valid for
  1575. * the lifetime of the callback.
  1576. *
  1577. * @note On X11/Wayland if a modifier other than the modifiers GLFW reports
  1578. * (ctrl/shift/alt/super) is used, GLFW will report the shifted key rather
  1579. * than the unshifted key. So for example, if ISO_Shift_Level_5 is used to
  1580. * convert the key A into UP GLFW will report the key as UP with no modifiers.
  1581. *
  1582. * @sa @ref input_key
  1583. * @sa @ref glfwSetKeyboardCallback
  1584. *
  1585. * @since Added in version 4.0.
  1586. *
  1587. * @ingroup input
  1588. */
  1589. typedef void (* GLFWkeyboardfun)(GLFWwindow*, GLFWkeyevent*);
  1590. /*! @brief The function pointer type for drag and drop callbacks.
  1591. *
  1592. * This is the function pointer type for drop callbacks. A drop
  1593. * callback function has the following signature:
  1594. * @code
  1595. * int function_name(GLFWwindow* window, const char* mime, const char* text)
  1596. * @endcode
  1597. *
  1598. * @param[in] window The window that received the event.
  1599. * @param[in] mime The UTF-8 encoded drop mime-type
  1600. * @param[in] data The dropped data or NULL for drag enter events
  1601. * @param[in] sz The size of the dropped data
  1602. * @return For drag events should return the priority for the specified mime type. A priority of zero
  1603. * or lower means the mime type is not accepted. Highest priority will be the finally accepted mime-type.
  1604. *
  1605. * @pointer_lifetime The text is valid until the
  1606. * callback function returns.
  1607. *
  1608. * @sa @ref path_drop
  1609. * @sa @ref glfwSetDropCallback
  1610. *
  1611. * @since Added in version 3.1.
  1612. *
  1613. * @ingroup input
  1614. */
  1615. typedef int (* GLFWdropfun)(GLFWwindow*, const char *, const char*, size_t);
  1616. typedef void (* GLFWliveresizefun)(GLFWwindow*, bool);
  1617. /*! @brief The function pointer type for monitor configuration callbacks.
  1618. *
  1619. * This is the function pointer type for monitor configuration callbacks.
  1620. * A monitor callback function has the following signature:
  1621. * @code
  1622. * void function_name(GLFWmonitor* monitor, int event)
  1623. * @endcode
  1624. *
  1625. * @param[in] monitor The monitor that was connected or disconnected.
  1626. * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future
  1627. * releases may add more events.
  1628. *
  1629. * @sa @ref monitor_event
  1630. * @sa @ref glfwSetMonitorCallback
  1631. *
  1632. * @since Added in version 3.0.
  1633. *
  1634. * @ingroup monitor
  1635. */
  1636. typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
  1637. /*! @brief The function pointer type for joystick configuration callbacks.
  1638. *
  1639. * This is the function pointer type for joystick configuration callbacks.
  1640. * A joystick configuration callback function has the following signature:
  1641. * @code
  1642. * void function_name(int jid, int event)
  1643. * @endcode
  1644. *
  1645. * @param[in] jid The joystick that was connected or disconnected.
  1646. * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future
  1647. * releases may add more events.
  1648. *
  1649. * @sa @ref joystick_event
  1650. * @sa @ref glfwSetJoystickCallback
  1651. *
  1652. * @since Added in version 3.2.
  1653. *
  1654. * @ingroup input
  1655. */
  1656. typedef void (* GLFWjoystickfun)(int,int);
  1657. typedef void (* GLFWuserdatafun)(unsigned long long, void*);
  1658. typedef void (* GLFWtickcallback)(void*);
  1659. typedef void (* GLFWactivationcallback)(GLFWwindow *window, const char *token, void *data);
  1660. typedef bool (* GLFWdrawtextfun)(GLFWwindow *window, const char *text, uint32_t fg, uint32_t bg, uint8_t *output_buf, size_t width, size_t height, float x_offset, float y_offset, size_t right_margin, bool is_single_glyph);
  1661. typedef char* (* GLFWcurrentselectionfun)(void);
  1662. typedef bool (* GLFWhascurrentselectionfun)(void);
  1663. typedef void (* GLFWclipboarddatafreefun)(void* data);
  1664. typedef struct GLFWDataChunk {
  1665. const char *data;
  1666. size_t sz;
  1667. GLFWclipboarddatafreefun free;
  1668. void *iter, *free_data;
  1669. } GLFWDataChunk;
  1670. typedef enum {
  1671. GLFW_CLIPBOARD, GLFW_PRIMARY_SELECTION
  1672. } GLFWClipboardType;
  1673. typedef GLFWDataChunk (* GLFWclipboarditerfun)(const char *mime_type, void *iter, GLFWClipboardType ctype);
  1674. typedef bool (* GLFWclipboardwritedatafun)(void *object, const char *data, size_t sz);
  1675. typedef bool (* GLFWimecursorpositionfun)(GLFWwindow *window, GLFWIMEUpdateEvent *ev);
  1676. /*! @brief Video mode type.
  1677. *
  1678. * This describes a single video mode.
  1679. *
  1680. * @sa @ref monitor_modes
  1681. * @sa @ref glfwGetVideoMode
  1682. * @sa @ref glfwGetVideoModes
  1683. *
  1684. * @since Added in version 1.0.
  1685. * @glfw3 Added refresh rate member.
  1686. *
  1687. * @ingroup monitor
  1688. */
  1689. typedef struct GLFWvidmode
  1690. {
  1691. /*! The width, in screen coordinates, of the video mode.
  1692. */
  1693. int width;
  1694. /*! The height, in screen coordinates, of the video mode.
  1695. */
  1696. int height;
  1697. /*! The bit depth of the red channel of the video mode.
  1698. */
  1699. int redBits;
  1700. /*! The bit depth of the green channel of the video mode.
  1701. */
  1702. int greenBits;
  1703. /*! The bit depth of the blue channel of the video mode.
  1704. */
  1705. int blueBits;
  1706. /*! The refresh rate, in Hz, of the video mode.
  1707. */
  1708. int refreshRate;
  1709. } GLFWvidmode;
  1710. /*! @brief Gamma ramp.
  1711. *
  1712. * This describes the gamma ramp for a monitor.
  1713. *
  1714. * @sa @ref monitor_gamma
  1715. * @sa @ref glfwGetGammaRamp
  1716. * @sa @ref glfwSetGammaRamp
  1717. *
  1718. * @since Added in version 3.0.
  1719. *
  1720. * @ingroup monitor
  1721. */
  1722. typedef struct GLFWgammaramp
  1723. {
  1724. /*! An array of value describing the response of the red channel.
  1725. */
  1726. unsigned short* red;
  1727. /*! An array of value describing the response of the green channel.
  1728. */
  1729. unsigned short* green;
  1730. /*! An array of value describing the response of the blue channel.
  1731. */
  1732. unsigned short* blue;
  1733. /*! The number of elements in each array.
  1734. */
  1735. unsigned int size;
  1736. } GLFWgammaramp;
  1737. /*! @brief Image data.
  1738. *
  1739. * This describes a single 2D image. See the documentation for each related
  1740. * function what the expected pixel format is.
  1741. *
  1742. * @sa @ref cursor_custom
  1743. * @sa @ref window_icon
  1744. *
  1745. * @since Added in version 2.1.
  1746. * @glfw3 Removed format and bytes-per-pixel members.
  1747. *
  1748. * @ingroup window
  1749. */
  1750. typedef struct GLFWimage
  1751. {
  1752. /*! The width, in pixels, of this image.
  1753. */
  1754. int width;
  1755. /*! The height, in pixels, of this image.
  1756. */
  1757. int height;
  1758. /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
  1759. */
  1760. unsigned char* pixels;
  1761. } GLFWimage;
  1762. /*! @brief Gamepad input state
  1763. *
  1764. * This describes the input state of a gamepad.
  1765. *
  1766. * @sa @ref gamepad
  1767. * @sa @ref glfwGetGamepadState
  1768. *
  1769. * @since Added in version 3.3.
  1770. *
  1771. * @ingroup input
  1772. */
  1773. typedef struct GLFWgamepadstate
  1774. {
  1775. /*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
  1776. * or `GLFW_RELEASE`.
  1777. */
  1778. unsigned char buttons[15];
  1779. /*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
  1780. * to 1.0 inclusive.
  1781. */
  1782. float axes[6];
  1783. } GLFWgamepadstate;
  1784. /*************************************************************************
  1785. * GLFW API functions
  1786. *************************************************************************/
  1787. /*! @brief Initializes the GLFW library.
  1788. *
  1789. * This function initializes the GLFW library. Before most GLFW functions can
  1790. * be used, GLFW must be initialized, and before an application terminates GLFW
  1791. * should be terminated in order to free any resources allocated during or
  1792. * after initialization.
  1793. *
  1794. * If this function fails, it calls @ref glfwTerminate before returning. If it
  1795. * succeeds, you should call @ref glfwTerminate before the application exits.
  1796. *
  1797. * Additional calls to this function after successful initialization but before
  1798. * termination will return `true` immediately.
  1799. *
  1800. * @return `true` if successful, or `false` if an
  1801. * [error](@ref error_handling) occurred.
  1802. *
  1803. * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
  1804. *
  1805. * @remark @macos This function will change the current directory of the
  1806. * application to the `Contents/Resources` subdirectory of the application's
  1807. * bundle, if present. This can be disabled with the @ref
  1808. * GLFW_COCOA_CHDIR_RESOURCES init hint.
  1809. *
  1810. * @thread_safety This function must only be called from the main thread.
  1811. *
  1812. * @sa @ref intro_init
  1813. * @sa @ref glfwTerminate
  1814. *
  1815. * @since Added in version 1.0.
  1816. *
  1817. * @ingroup init
  1818. */
  1819. GLFWAPI int glfwInit(monotonic_t start_time);
  1820. GLFWAPI void glfwRunMainLoop(GLFWtickcallback callback, void *callback_data);
  1821. GLFWAPI void glfwStopMainLoop(void);
  1822. GLFWAPI unsigned long long glfwAddTimer(monotonic_t interval, bool repeats, GLFWuserdatafun callback, void * callback_data, GLFWuserdatafun free_callback);
  1823. GLFWAPI void glfwUpdateTimer(unsigned long long timer_id, monotonic_t interval, bool enabled);
  1824. GLFWAPI void glfwRemoveTimer(unsigned long long);
  1825. GLFWAPI GLFWdrawtextfun glfwSetDrawTextFunction(GLFWdrawtextfun function);
  1826. GLFWAPI GLFWcurrentselectionfun glfwSetCurrentSelectionCallback(GLFWcurrentselectionfun callback);
  1827. GLFWAPI GLFWhascurrentselectionfun glfwSetHasCurrentSelectionCallback(GLFWhascurrentselectionfun callback);
  1828. GLFWAPI GLFWimecursorpositionfun glfwSetIMECursorPositionCallback(GLFWimecursorpositionfun callback);
  1829. /*! @brief Terminates the GLFW library.
  1830. *
  1831. * This function destroys all remaining windows and cursors, restores any
  1832. * modified gamma ramps and frees any other allocated resources. Once this
  1833. * function is called, you must again call @ref glfwInit successfully before
  1834. * you will be able to use most GLFW functions.
  1835. *
  1836. * If GLFW has been successfully initialized, this function should be called
  1837. * before the application exits. If initialization fails, there is no need to
  1838. * call this function, as it is called by @ref glfwInit before it returns
  1839. * failure.
  1840. *
  1841. * This function has no effect if GLFW is not initialized.
  1842. *
  1843. * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
  1844. *
  1845. * @remark This function may be called before @ref glfwInit.
  1846. *
  1847. * @warning The contexts of any remaining windows must not be current on any
  1848. * other thread when this function is called.
  1849. *
  1850. * @reentrancy This function must not be called from a callback.
  1851. *
  1852. * @thread_safety This function must only be called from the main thread.
  1853. *
  1854. * @sa @ref intro_init
  1855. * @sa @ref glfwInit
  1856. *
  1857. * @since Added in version 1.0.
  1858. *
  1859. * @ingroup init
  1860. */
  1861. GLFWAPI void glfwTerminate(void);
  1862. /*! @brief Sets the specified init hint to the desired value.
  1863. *
  1864. * This function sets hints for the next initialization of GLFW.
  1865. *
  1866. * The values you set hints to are never reset by GLFW, but they only take
  1867. * effect during initialization. Once GLFW has been initialized, any values
  1868. * you set will be ignored until the library is terminated and initialized
  1869. * again.
  1870. *
  1871. * Some hints are platform specific. These may be set on any platform but they
  1872. * will only affect their specific platform. Other platforms will ignore them.
  1873. * Setting these hints requires no platform specific headers or functions.
  1874. *
  1875. * @param[in] hint The [init hint](@ref init_hints) to set.
  1876. * @param[in] value The new value of the init hint.
  1877. *
  1878. * @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref
  1879. * GLFW_INVALID_VALUE.
  1880. *
  1881. * @remarks This function may be called before @ref glfwInit.
  1882. *
  1883. * @thread_safety This function must only be called from the main thread.
  1884. *
  1885. * @sa init_hints
  1886. * @sa glfwInit
  1887. *
  1888. * @since Added in version 3.3.
  1889. *
  1890. * @ingroup init
  1891. */
  1892. GLFWAPI void glfwInitHint(int hint, int value);
  1893. /*! @brief Retrieves the version of the GLFW library.
  1894. *
  1895. * This function retrieves the major, minor and revision numbers of the GLFW
  1896. * library. It is intended for when you are using GLFW as a shared library and
  1897. * want to ensure that you are using the minimum required version.
  1898. *
  1899. * Any or all of the version arguments may be `NULL`.
  1900. *
  1901. * @param[out] major Where to store the major version number, or `NULL`.
  1902. * @param[out] minor Where to store the minor version number, or `NULL`.
  1903. * @param[out] rev Where to store the revision number, or `NULL`.
  1904. *
  1905. * @errors None.
  1906. *
  1907. * @remark This function may be called before @ref glfwInit.
  1908. *
  1909. * @thread_safety This function may be called from any thread.
  1910. *
  1911. * @sa @ref intro_version
  1912. * @sa @ref glfwGetVersionString
  1913. *
  1914. * @since Added in version 1.0.
  1915. *
  1916. * @ingroup init
  1917. */
  1918. GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
  1919. /*! @brief Returns a string describing the compile-time configuration.
  1920. *
  1921. * This function returns the compile-time generated
  1922. * [version string](@ref intro_version_string) of the GLFW library binary. It
  1923. * describes the version, platform, compiler and any platform-specific
  1924. * compile-time options. It should not be confused with the OpenGL or OpenGL
  1925. * ES version string, queried with `glGetString`.
  1926. *
  1927. * __Do not use the version string__ to parse the GLFW library version. The
  1928. * @ref glfwGetVersion function provides the version of the running library
  1929. * binary in numerical format.
  1930. *
  1931. * @return The ASCII encoded GLFW version string.
  1932. *
  1933. * @errors None.
  1934. *
  1935. * @remark This function may be called before @ref glfwInit.
  1936. *
  1937. * @pointer_lifetime The returned string is static and compile-time generated.
  1938. *
  1939. * @thread_safety This function may be called from any thread.
  1940. *
  1941. * @sa @ref intro_version
  1942. * @sa @ref glfwGetVersion
  1943. *
  1944. * @since Added in version 3.0.
  1945. *
  1946. * @ingroup init
  1947. */
  1948. GLFWAPI const char* glfwGetVersionString(void);
  1949. /*! @brief Returns and clears the last error for the calling thread.
  1950. *
  1951. * This function returns and clears the [error code](@ref errors) of the last
  1952. * error that occurred on the calling thread, and optionally a UTF-8 encoded
  1953. * human-readable description of it. If no error has occurred since the last
  1954. * call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is
  1955. * set to `NULL`.
  1956. *
  1957. * @param[in] description Where to store the error description pointer, or `NULL`.
  1958. * @return The last error code for the calling thread, or @ref GLFW_NO_ERROR
  1959. * (zero).
  1960. *
  1961. * @errors None.
  1962. *
  1963. * @pointer_lifetime The returned string is allocated and freed by GLFW. You
  1964. * should not free it yourself. It is guaranteed to be valid only until the
  1965. * next error occurs or the library is terminated.
  1966. *
  1967. * @remark This function may be called before @ref glfwInit.
  1968. *
  1969. * @thread_safety This function may be called from any thread.
  1970. *
  1971. * @sa @ref error_handling
  1972. * @sa @ref glfwSetErrorCallback
  1973. *
  1974. * @since Added in version 3.3.
  1975. *
  1976. * @ingroup init
  1977. */
  1978. GLFWAPI int glfwGetError(const char** description);
  1979. /*! @brief Sets the error callback.
  1980. *
  1981. * This function sets the error callback, which is called with an error code
  1982. * and a human-readable description each time a GLFW error occurs.
  1983. *
  1984. * The error code is set before the callback is called. Calling @ref
  1985. * glfwGetError from the error callback will return the same value as the error
  1986. * code argument.
  1987. *
  1988. * The error callback is called on the thread where the error occurred. If you
  1989. * are using GLFW from multiple threads, your error callback needs to be
  1990. * written accordingly.
  1991. *
  1992. * Because the description string may have been generated specifically for that
  1993. * error, it is not guaranteed to be valid after the callback has returned. If
  1994. * you wish to use it after the callback returns, you need to make a copy.
  1995. *
  1996. * Once set, the error callback remains set even after the library has been
  1997. * terminated.
  1998. *
  1999. * @param[in] callback The new callback, or `NULL` to remove the currently set
  2000. * callback.
  2001. * @return The previously set callback, or `NULL` if no callback was set.
  2002. *
  2003. * @callback_signature
  2004. * @code
  2005. * void callback_name(int error_code, const char* description)
  2006. * @endcode
  2007. * For more information about the callback parameters, see the
  2008. * [callback pointer type](@ref GLFWerrorfun).
  2009. *
  2010. * @errors None.
  2011. *
  2012. * @remark This function may be called before @ref glfwInit.
  2013. *
  2014. * @thread_safety This function must only be called from the main thread.
  2015. *
  2016. * @sa @ref error_handling
  2017. * @sa @ref glfwGetError
  2018. *
  2019. * @since Added in version 3.0.
  2020. *
  2021. * @ingroup init
  2022. */
  2023. GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
  2024. /*! @brief Returns the currently connected monitors.
  2025. *
  2026. * This function returns an array of handles for all currently connected
  2027. * monitors. The primary monitor is always first in the returned array. If no
  2028. * monitors were found, this function returns `NULL`.
  2029. *
  2030. * @param[out] count Where to store the number of monitors in the returned
  2031. * array. This is set to zero if an error occurred.
  2032. * @return An array of monitor handles, or `NULL` if no monitors were found or
  2033. * if an [error](@ref error_handling) occurred.
  2034. *
  2035. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  2036. *
  2037. * @pointer_lifetime The returned array is allocated and freed by GLFW. You
  2038. * should not free it yourself. It is guaranteed to be valid only until the
  2039. * monitor configuration changes or the library is terminated.
  2040. *
  2041. * @thread_safety This function must only be called from the main thread.
  2042. *
  2043. * @sa @ref monitor_monitors
  2044. * @sa @ref monitor_event
  2045. * @sa @ref glfwGetPrimaryMonitor
  2046. *
  2047. * @since Added in version 3.0.
  2048. *
  2049. * @ingroup monitor
  2050. */
  2051. GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
  2052. /*! @brief Returns the primary monitor.
  2053. *
  2054. * This function returns the primary monitor. This is usually the monitor
  2055. * where elements like the task bar or global menu bar are located.
  2056. *
  2057. * @return The primary monitor, or `NULL` if no monitors were found or if an
  2058. * [error](@ref error_handling) occurred.
  2059. *
  2060. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  2061. *
  2062. * @thread_safety This function must only be called from the main thread.
  2063. *
  2064. * @remark The primary monitor is always first in the array returned by @ref
  2065. * glfwGetMonitors.
  2066. *
  2067. * @sa @ref monitor_monitors
  2068. * @sa @ref glfwGetMonitors
  2069. *
  2070. * @since Added in version 3.0.
  2071. *
  2072. * @ingroup monitor
  2073. */
  2074. GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
  2075. /*! @brief Returns the position of the monitor's viewport on the virtual screen.
  2076. *
  2077. * This function returns the position, in screen coordinates, of the upper-left
  2078. * corner of the specified monitor.
  2079. *
  2080. * Any or all of the position arguments may be `NULL`. If an error occurs, all
  2081. * non-`NULL` position arguments will be set to zero.
  2082. *
  2083. * @param[in] monitor The monitor to query.
  2084. * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
  2085. * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
  2086. *
  2087. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  2088. * GLFW_PLATFORM_ERROR.
  2089. *
  2090. * @thread_safety This function must only be called from the main thread.
  2091. *
  2092. * @sa @ref monitor_properties
  2093. *
  2094. * @since Added in version 3.0.
  2095. *
  2096. * @ingroup monitor
  2097. */
  2098. GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
  2099. /*! @brief Retrieves the work area of the monitor.
  2100. *
  2101. * This function returns the position, in screen coordinates, of the upper-left
  2102. * corner of the work area of the specified monitor along with the work area
  2103. * size in screen coordinates. The work area is defined as the area of the
  2104. * monitor not occluded by the operating system task bar where present. If no
  2105. * task bar exists then the work area is the monitor resolution in screen
  2106. * coordinates.
  2107. *
  2108. * Any or all of the position and size arguments may be `NULL`. If an error
  2109. * occurs, all non-`NULL` position and size arguments will be set to zero.
  2110. *
  2111. * @param[in] monitor The monitor to query.
  2112. * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
  2113. * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
  2114. * @param[out] width Where to store the monitor width, or `NULL`.
  2115. * @param[out] height Where to store the monitor height, or `NULL`.
  2116. *
  2117. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  2118. * GLFW_PLATFORM_ERROR.
  2119. *
  2120. * @thread_safety This function must only be called from the main thread.
  2121. *
  2122. * @sa @ref monitor_workarea
  2123. *
  2124. * @since Added in version 3.3.
  2125. *
  2126. * @ingroup monitor
  2127. */
  2128. GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
  2129. /*! @brief Returns the physical size of the monitor.
  2130. *
  2131. * This function returns the size, in millimetres, of the display area of the
  2132. * specified monitor.
  2133. *
  2134. * Some systems do not provide accurate monitor size information, either
  2135. * because the monitor
  2136. * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
  2137. * data is incorrect or because the driver does not report it accurately.
  2138. *
  2139. * Any or all of the size arguments may be `NULL`. If an error occurs, all
  2140. * non-`NULL` size arguments will be set to zero.
  2141. *
  2142. * @param[in] monitor The monitor to query.
  2143. * @param[out] widthMM Where to store the width, in millimetres, of the
  2144. * monitor's display area, or `NULL`.
  2145. * @param[out] heightMM Where to store the height, in millimetres, of the
  2146. * monitor's display area, or `NULL`.
  2147. *
  2148. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  2149. *
  2150. * @remark @win32 calculates the returned physical size from the
  2151. * current resolution and system DPI instead of querying the monitor EDID data.
  2152. *
  2153. * @thread_safety This function must only be called from the main thread.
  2154. *
  2155. * @sa @ref monitor_properties
  2156. *
  2157. * @since Added in version 3.0.
  2158. *
  2159. * @ingroup monitor
  2160. */
  2161. GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
  2162. /*! @brief Retrieves the content scale for the specified monitor.
  2163. *
  2164. * This function retrieves the content scale for the specified monitor. The
  2165. * content scale is the ratio between the current DPI and the platform's
  2166. * default DPI. This is especially important for text and any UI elements. If
  2167. * the pixel dimensions of your UI scaled by this look appropriate on your
  2168. * machine then it should appear at a reasonable size on other machines
  2169. * regardless of their DPI and scaling settings. This relies on the system DPI
  2170. * and scaling settings being somewhat correct.
  2171. *
  2172. * The content scale may depend on both the monitor resolution and pixel
  2173. * density and on user settings. It may be very different from the raw DPI
  2174. * calculated from the physical size and current resolution.
  2175. *
  2176. * @param[in] monitor The monitor to query.
  2177. * @param[out] xscale Where to store the x-axis content scale, or `NULL`.
  2178. * @param[out] yscale Where to store the y-axis content scale, or `NULL`.
  2179. *
  2180. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  2181. * GLFW_PLATFORM_ERROR.
  2182. *
  2183. * @thread_safety This function must only be called from the main thread.
  2184. *
  2185. * @sa @ref monitor_scale
  2186. * @sa @ref glfwGetWindowContentScale
  2187. *
  2188. * @since Added in version 3.3.
  2189. *
  2190. * @ingroup monitor
  2191. */
  2192. GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale);
  2193. /*! @brief Returns the name of the specified monitor.
  2194. *
  2195. * This function returns a human-readable name, encoded as UTF-8, of the
  2196. * specified monitor. The name typically reflects the make and model of the
  2197. * monitor and is not guaranteed to be unique among the connected monitors.
  2198. *
  2199. * @param[in] monitor The monitor to query.
  2200. * @return The UTF-8 encoded name of the monitor, or `NULL` if an
  2201. * [error](@ref error_handling) occurred.
  2202. *
  2203. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  2204. *
  2205. * @pointer_lifetime The returned string is allocated and freed by GLFW. You
  2206. * should not free it yourself. It is valid until the specified monitor is
  2207. * disconnected or the library is terminated.
  2208. *
  2209. * @thread_safety This function must only be called from the main thread.
  2210. *
  2211. * @sa @ref monitor_properties
  2212. *
  2213. * @since Added in version 3.0.
  2214. *
  2215. * @ingroup monitor
  2216. */
  2217. GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
  2218. /*! @brief Sets the user pointer of the specified monitor.
  2219. *
  2220. * This function sets the user-defined pointer of the specified monitor. The
  2221. * current value is retained until the monitor is disconnected. The initial
  2222. * value is `NULL`.
  2223. *
  2224. * This function may be called from the monitor callback, even for a monitor
  2225. * that is being disconnected.
  2226. *
  2227. * @param[in] monitor The monitor whose pointer to set.
  2228. * @param[in] pointer The new value.
  2229. *
  2230. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  2231. *
  2232. * @thread_safety This function may be called from any thread. Access is not
  2233. * synchronized.
  2234. *
  2235. * @sa @ref monitor_userptr
  2236. * @sa @ref glfwGetMonitorUserPointer
  2237. *
  2238. * @since Added in version 3.3.
  2239. *
  2240. * @ingroup monitor
  2241. */
  2242. GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer);
  2243. /*! @brief Returns the user pointer of the specified monitor.
  2244. *
  2245. * This function returns the current value of the user-defined pointer of the
  2246. * specified monitor. The initial value is `NULL`.
  2247. *
  2248. * This function may be called from the monitor callback, even for a monitor
  2249. * that is being disconnected.
  2250. *
  2251. * @param[in] monitor The monitor whose pointer to return.
  2252. *
  2253. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  2254. *
  2255. * @thread_safety This function may be called from any thread. Access is not
  2256. * synchronized.
  2257. *
  2258. * @sa @ref monitor_userptr
  2259. * @sa @ref glfwSetMonitorUserPointer
  2260. *
  2261. * @since Added in version 3.3.
  2262. *
  2263. * @ingroup monitor
  2264. */
  2265. GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* monitor);
  2266. /*! @brief Sets the monitor configuration callback.
  2267. *
  2268. * This function sets the monitor configuration callback, or removes the
  2269. * currently set callback. This is called when a monitor is connected to or
  2270. * disconnected from the system.
  2271. *
  2272. * @param[in] callback The new callback, or `NULL` to remove the currently set
  2273. * callback.
  2274. * @return The previously set callback, or `NULL` if no callback was set or the
  2275. * library had not been [initialized](@ref intro_init).
  2276. *
  2277. * @callback_signature
  2278. * @code
  2279. * void function_name(GLFWmonitor* monitor, int event)
  2280. * @endcode
  2281. * For more information about the callback parameters, see the
  2282. * [function pointer type](@ref GLFWmonitorfun).
  2283. *
  2284. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  2285. *
  2286. * @thread_safety This function must only be called from the main thread.
  2287. *
  2288. * @sa @ref monitor_event
  2289. *
  2290. * @since Added in version 3.0.
  2291. *
  2292. * @ingroup monitor
  2293. */
  2294. GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
  2295. /*! @brief Returns the available video modes for the specified monitor.
  2296. *
  2297. * This function returns an array of all video modes supported by the specified
  2298. * monitor. The returned array is sorted in ascending order, first by color
  2299. * bit depth (the sum of all channel depths) and then by resolution area (the
  2300. * product of width and height).
  2301. *
  2302. * @param[in] monitor The monitor to query.
  2303. * @param[out] count Where to store the number of video modes in the returned
  2304. * array. This is set to zero if an error occurred.
  2305. * @return An array of video modes, or `NULL` if an
  2306. * [error](@ref error_handling) occurred.
  2307. *
  2308. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  2309. * GLFW_PLATFORM_ERROR.
  2310. *
  2311. * @pointer_lifetime The returned array is allocated and freed by GLFW. You
  2312. * should not free it yourself. It is valid until the specified monitor is
  2313. * disconnected, this function is called again for that monitor or the library
  2314. * is terminated.
  2315. *
  2316. * @thread_safety This function must only be called from the main thread.
  2317. *
  2318. * @sa @ref monitor_modes
  2319. * @sa @ref glfwGetVideoMode
  2320. *
  2321. * @since Added in version 1.0.
  2322. * @glfw3 Changed to return an array of modes for a specific monitor.
  2323. *
  2324. * @ingroup monitor
  2325. */
  2326. GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
  2327. /*! @brief Returns the current mode of the specified monitor.
  2328. *
  2329. * This function returns the current video mode of the specified monitor. If
  2330. * you have created a full screen window for that monitor, the return value
  2331. * will depend on whether that window is iconified.
  2332. *
  2333. * @param[in] monitor The monitor to query.
  2334. * @return The current mode of the monitor, or `NULL` if an
  2335. * [error](@ref error_handling) occurred.
  2336. *
  2337. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  2338. * GLFW_PLATFORM_ERROR.
  2339. *
  2340. * @pointer_lifetime The returned array is allocated and freed by GLFW. You
  2341. * should not free it yourself. It is valid until the specified monitor is
  2342. * disconnected or the library is terminated.
  2343. *
  2344. * @thread_safety This function must only be called from the main thread.
  2345. *
  2346. * @sa @ref monitor_modes
  2347. * @sa @ref glfwGetVideoModes
  2348. *
  2349. * @since Added in version 3.0. Replaces `glfwGetDesktopMode`.
  2350. *
  2351. * @ingroup monitor
  2352. */
  2353. GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
  2354. /*! @brief Generates a gamma ramp and sets it for the specified monitor.
  2355. *
  2356. * This function generates an appropriately sized gamma ramp from the specified
  2357. * exponent and then calls @ref glfwSetGammaRamp with it. The value must be
  2358. * a finite number greater than zero.
  2359. *
  2360. * The software controlled gamma ramp is applied _in addition_ to the hardware
  2361. * gamma correction, which today is usually an approximation of sRGB gamma.
  2362. * This means that setting a perfectly linear ramp, or gamma 1.0, will produce
  2363. * the default (usually sRGB-like) behavior.
  2364. *
  2365. * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
  2366. * GLFW_SRGB_CAPABLE hint.
  2367. *
  2368. * @param[in] monitor The monitor whose gamma ramp to set.
  2369. * @param[in] gamma The desired exponent.
  2370. *
  2371. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  2372. * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
  2373. *
  2374. * @remark @wayland Gamma handling is a privileged protocol, this function
  2375. * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
  2376. *
  2377. * @thread_safety This function must only be called from the main thread.
  2378. *
  2379. * @sa @ref monitor_gamma
  2380. *
  2381. * @since Added in version 3.0.
  2382. *
  2383. * @ingroup monitor
  2384. */
  2385. GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
  2386. /*! @brief Returns the current gamma ramp for the specified monitor.
  2387. *
  2388. * This function returns the current gamma ramp of the specified monitor.
  2389. *
  2390. * @param[in] monitor The monitor to query.
  2391. * @return The current gamma ramp, or `NULL` if an
  2392. * [error](@ref error_handling) occurred.
  2393. *
  2394. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  2395. * GLFW_PLATFORM_ERROR.
  2396. *
  2397. * @remark @wayland Gamma handling is a privileged protocol, this function
  2398. * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while
  2399. * returning `NULL`.
  2400. *
  2401. * @pointer_lifetime The returned structure and its arrays are allocated and
  2402. * freed by GLFW. You should not free them yourself. They are valid until the
  2403. * specified monitor is disconnected, this function is called again for that
  2404. * monitor or the library is terminated.
  2405. *
  2406. * @thread_safety This function must only be called from the main thread.
  2407. *
  2408. * @sa @ref monitor_gamma
  2409. *
  2410. * @since Added in version 3.0.
  2411. *
  2412. * @ingroup monitor
  2413. */
  2414. GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
  2415. /*! @brief Sets the current gamma ramp for the specified monitor.
  2416. *
  2417. * This function sets the current gamma ramp for the specified monitor. The
  2418. * original gamma ramp for that monitor is saved by GLFW the first time this
  2419. * function is called and is restored by @ref glfwTerminate.
  2420. *
  2421. * The software controlled gamma ramp is applied _in addition_ to the hardware
  2422. * gamma correction, which today is usually an approximation of sRGB gamma.
  2423. * This means that setting a perfectly linear ramp, or gamma 1.0, will produce
  2424. * the default (usually sRGB-like) behavior.
  2425. *
  2426. * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
  2427. * GLFW_SRGB_CAPABLE hint.
  2428. *
  2429. * @param[in] monitor The monitor whose gamma ramp to set.
  2430. * @param[in] ramp The gamma ramp to use.
  2431. *
  2432. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  2433. * GLFW_PLATFORM_ERROR.
  2434. *
  2435. * @remark The size of the specified gamma ramp should match the size of the
  2436. * current ramp for that monitor.
  2437. *
  2438. * @remark @win32 The gamma ramp size must be 256.
  2439. *
  2440. * @remark @wayland Gamma handling is a privileged protocol, this function
  2441. * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
  2442. *
  2443. * @pointer_lifetime The specified gamma ramp is copied before this function
  2444. * returns.
  2445. *
  2446. * @thread_safety This function must only be called from the main thread.
  2447. *
  2448. * @sa @ref monitor_gamma
  2449. *
  2450. * @since Added in version 3.0.
  2451. *
  2452. * @ingroup monitor
  2453. */
  2454. GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
  2455. /*! @brief Resets all window hints to their default values.
  2456. *
  2457. * This function resets all window hints to their
  2458. * [default values](@ref window_hints_values).
  2459. *
  2460. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  2461. *
  2462. * @thread_safety This function must only be called from the main thread.
  2463. *
  2464. * @sa @ref window_hints
  2465. * @sa @ref glfwWindowHint
  2466. * @sa @ref glfwWindowHintString
  2467. *
  2468. * @since Added in version 3.0.
  2469. *
  2470. * @ingroup window
  2471. */
  2472. GLFWAPI void glfwDefaultWindowHints(void);
  2473. /*! @brief Sets the specified window hint to the desired value.
  2474. *
  2475. * This function sets hints for the next call to @ref glfwCreateWindow. The
  2476. * hints, once set, retain their values until changed by a call to this
  2477. * function or @ref glfwDefaultWindowHints, or until the library is terminated.
  2478. *
  2479. * Only integer value hints can be set with this function. String value hints
  2480. * are set with @ref glfwWindowHintString.
  2481. *
  2482. * This function does not check whether the specified hint values are valid.
  2483. * If you set hints to invalid values this will instead be reported by the next
  2484. * call to @ref glfwCreateWindow.
  2485. *
  2486. * Some hints are platform specific. These may be set on any platform but they
  2487. * will only affect their specific platform. Other platforms will ignore them.
  2488. * Setting these hints requires no platform specific headers or functions.
  2489. *
  2490. * @param[in] hint The [window hint](@ref window_hints) to set.
  2491. * @param[in] value The new value of the window hint.
  2492. *
  2493. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  2494. * GLFW_INVALID_ENUM.
  2495. *
  2496. * @thread_safety This function must only be called from the main thread.
  2497. *
  2498. * @sa @ref window_hints
  2499. * @sa @ref glfwWindowHintString
  2500. * @sa @ref glfwDefaultWindowHints
  2501. *
  2502. * @since Added in version 3.0. Replaces `glfwOpenWindowHint`.
  2503. *
  2504. * @ingroup window
  2505. */
  2506. GLFWAPI void glfwWindowHint(int hint, int value);
  2507. /*! @brief Sets the specified window hint to the desired value.
  2508. *
  2509. * This function sets hints for the next call to @ref glfwCreateWindow. The
  2510. * hints, once set, retain their values until changed by a call to this
  2511. * function or @ref glfwDefaultWindowHints, or until the library is terminated.
  2512. *
  2513. * Only string type hints can be set with this function. Integer value hints
  2514. * are set with @ref glfwWindowHint.
  2515. *
  2516. * This function does not check whether the specified hint values are valid.
  2517. * If you set hints to invalid values this will instead be reported by the next
  2518. * call to @ref glfwCreateWindow.
  2519. *
  2520. * Some hints are platform specific. These may be set on any platform but they
  2521. * will only affect their specific platform. Other platforms will ignore them.
  2522. * Setting these hints requires no platform specific headers or functions.
  2523. *
  2524. * @param[in] hint The [window hint](@ref window_hints) to set.
  2525. * @param[in] value The new value of the window hint.
  2526. *
  2527. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  2528. * GLFW_INVALID_ENUM.
  2529. *
  2530. * @pointer_lifetime The specified string is copied before this function
  2531. * returns.
  2532. *
  2533. * @thread_safety This function must only be called from the main thread.
  2534. *
  2535. * @sa @ref window_hints
  2536. * @sa @ref glfwWindowHint
  2537. * @sa @ref glfwDefaultWindowHints
  2538. *
  2539. * @since Added in version 3.3.
  2540. *
  2541. * @ingroup window
  2542. */
  2543. GLFWAPI void glfwWindowHintString(int hint, const char* value);
  2544. /*! @brief Creates a window and its associated context.
  2545. *
  2546. * This function creates a window and its associated OpenGL or OpenGL ES
  2547. * context. Most of the options controlling how the window and its context
  2548. * should be created are specified with [window hints](@ref window_hints).
  2549. *
  2550. * Successful creation does not change which context is current. Before you
  2551. * can use the newly created context, you need to
  2552. * [make it current](@ref context_current). For information about the `share`
  2553. * parameter, see @ref context_sharing.
  2554. *
  2555. * The created window, framebuffer and context may differ from what you
  2556. * requested, as not all parameters and hints are
  2557. * [hard constraints](@ref window_hints_hard). This includes the size of the
  2558. * window, especially for full screen windows. To query the actual attributes
  2559. * of the created window, framebuffer and context, see @ref
  2560. * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
  2561. *
  2562. * To create a full screen window, you need to specify the monitor the window
  2563. * will cover. If no monitor is specified, the window will be windowed mode.
  2564. * Unless you have a way for the user to choose a specific monitor, it is
  2565. * recommended that you pick the primary monitor. For more information on how
  2566. * to query connected monitors, see @ref monitor_monitors.
  2567. *
  2568. * For full screen windows, the specified size becomes the resolution of the
  2569. * window's _desired video mode_. As long as a full screen window is not
  2570. * iconified, the supported video mode most closely matching the desired video
  2571. * mode is set for the specified monitor. For more information about full
  2572. * screen windows, including the creation of so called _windowed full screen_
  2573. * or _borderless full screen_ windows, see @ref window_windowed_full_screen.
  2574. *
  2575. * Once you have created the window, you can switch it between windowed and
  2576. * full screen mode with @ref glfwSetWindowMonitor. This will not affect its
  2577. * OpenGL or OpenGL ES context.
  2578. *
  2579. * By default, newly created windows use the placement recommended by the
  2580. * window system. To create the window at a specific position, make it
  2581. * initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window
  2582. * hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
  2583. * it.
  2584. *
  2585. * As long as at least one full screen window is not iconified, the screensaver
  2586. * is prohibited from starting.
  2587. *
  2588. * Window systems put limits on window sizes. Very large or very small window
  2589. * dimensions may be overridden by the window system on creation. Check the
  2590. * actual [size](@ref window_size) after creation.
  2591. *
  2592. * The [swap interval](@ref buffer_swap) is not set during window creation and
  2593. * the initial value may vary depending on driver settings and defaults.
  2594. *
  2595. * @param[in] width The desired width, in screen coordinates, of the window.
  2596. * This must be greater than zero.
  2597. * @param[in] height The desired height, in screen coordinates, of the window.
  2598. * This must be greater than zero.
  2599. * @param[in] title The initial, UTF-8 encoded window title.
  2600. * @param[in] monitor The monitor to use for full screen mode, or `NULL` for
  2601. * windowed mode.
  2602. * @param[in] share The window whose context to share resources with, or `NULL`
  2603. * to not share resources.
  2604. * @return The handle of the created window, or `NULL` if an
  2605. * [error](@ref error_handling) occurred.
  2606. *
  2607. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  2608. * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
  2609. * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
  2610. * GLFW_PLATFORM_ERROR.
  2611. *
  2612. * @remark @win32 Window creation will fail if the Microsoft GDI software
  2613. * OpenGL implementation is the only one available.
  2614. *
  2615. * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it
  2616. * will be set as the initial icon for the window. If no such icon is present,
  2617. * the `IDI_APPLICATION` icon will be used instead. To set a different icon,
  2618. * see @ref glfwSetWindowIcon.
  2619. *
  2620. * @remark @win32 The context to share resources with must not be current on
  2621. * any other thread.
  2622. *
  2623. * @remark @macos The OS only supports forward-compatible core profile contexts
  2624. * for OpenGL versions 3.2 and later. Before creating an OpenGL context of
  2625. * version 3.2 or later you must set the
  2626. * [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and
  2627. * [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly.
  2628. * OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
  2629. *
  2630. * @remark @macos The GLFW window has no icon, as it is not a document
  2631. * window, but the dock icon will be the same as the application bundle's icon.
  2632. * For more information on bundles, see the
  2633. * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
  2634. * in the Mac Developer Library.
  2635. *
  2636. * @remark @macos The first time a window is created the menu bar is created.
  2637. * If GLFW finds a `MainMenu.nib` it is loaded and assumed to contain a menu
  2638. * bar. Otherwise a minimal menu bar is created manually with common commands
  2639. * like Hide, Quit and About. The About entry opens a minimal about dialog
  2640. * with information from the application's bundle. Menu bar creation can be
  2641. * disabled entirely with the @ref GLFW_COCOA_MENUBAR init hint.
  2642. *
  2643. * @remark @macos On OS X 10.10 and later the window frame will not be rendered
  2644. * at full resolution on Retina displays unless the
  2645. * [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
  2646. * hint is `true` and the `NSHighResolutionCapable` key is enabled in the
  2647. * application bundle's `Info.plist`. For more information, see
  2648. * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
  2649. * in the Mac Developer Library. The GLFW test and example programs use
  2650. * a custom `Info.plist` template for this, which can be found as
  2651. * `CMake/MacOSXBundleInfo.plist.in` in the source tree.
  2652. *
  2653. * @remark @macos When activating frame autosaving with
  2654. * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
  2655. * window size and position may be overridden by previously saved values.
  2656. *
  2657. * @remark @x11 Some window managers will not respect the placement of
  2658. * initially hidden windows.
  2659. *
  2660. * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
  2661. * a window to reach its requested state. This means you may not be able to
  2662. * query the final size, position or other attributes directly after window
  2663. * creation.
  2664. *
  2665. * @remark @x11 The class part of the `WM_CLASS` window property will by
  2666. * default be set to the window title passed to this function. The instance
  2667. * part will use the contents of the `RESOURCE_NAME` environment variable, if
  2668. * present and not empty, or fall back to the window title. Set the
  2669. * [GLFW_X11_CLASS_NAME](@ref GLFW_X11_CLASS_NAME_hint) and
  2670. * [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to
  2671. * override this.
  2672. *
  2673. * @remark @wayland Compositors should implement the xdg-decoration protocol
  2674. * for GLFW to decorate the window properly. If this protocol isn't
  2675. * supported, or if the compositor prefers client-side decorations, a very
  2676. * simple fallback frame will be drawn using the wp_viewporter protocol. A
  2677. * compositor can still emit close, maximize or fullscreen events, using for
  2678. * instance a keybind mechanism. If neither of these protocols is supported,
  2679. * the window won't be decorated.
  2680. *
  2681. * @remark @wayland A full screen window will not attempt to change the mode,
  2682. * no matter what the requested size or refresh rate.
  2683. *
  2684. * @remark @wayland Screensaver inhibition requires the idle-inhibit protocol
  2685. * to be implemented in the user's compositor.
  2686. *
  2687. * @thread_safety This function must only be called from the main thread.
  2688. *
  2689. * @sa @ref window_creation
  2690. * @sa @ref glfwDestroyWindow
  2691. *
  2692. * @since Added in version 3.0. Replaces `glfwOpenWindow`.
  2693. *
  2694. * @ingroup window
  2695. */
  2696. GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
  2697. GLFWAPI bool glfwToggleFullscreen(GLFWwindow *window, unsigned int flags);
  2698. GLFWAPI bool glfwIsFullscreen(GLFWwindow *window, unsigned int flags);
  2699. GLFWAPI bool glfwAreSwapsAllowed(const GLFWwindow* window);
  2700. /*! @brief Destroys the specified window and its context.
  2701. *
  2702. * This function destroys the specified window and its context. On calling
  2703. * this function, no further callbacks will be called for that window.
  2704. *
  2705. * If the context of the specified window is current on the main thread, it is
  2706. * detached before being destroyed.
  2707. *
  2708. * @param[in] window The window to destroy.
  2709. *
  2710. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  2711. * GLFW_PLATFORM_ERROR.
  2712. *
  2713. * @note The context of the specified window must not be current on any other
  2714. * thread when this function is called.
  2715. *
  2716. * @reentrancy This function must not be called from a callback.
  2717. *
  2718. * @thread_safety This function must only be called from the main thread.
  2719. *
  2720. * @sa @ref window_creation
  2721. * @sa @ref glfwCreateWindow
  2722. *
  2723. * @since Added in version 3.0. Replaces `glfwCloseWindow`.
  2724. *
  2725. * @ingroup window
  2726. */
  2727. GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
  2728. /*! @brief Checks the close flag of the specified window.
  2729. *
  2730. * This function returns the value of the close flag of the specified window.
  2731. *
  2732. * @param[in] window The window to query.
  2733. * @return The value of the close flag.
  2734. *
  2735. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  2736. *
  2737. * @thread_safety This function may be called from any thread. Access is not
  2738. * synchronized.
  2739. *
  2740. * @sa @ref window_close
  2741. *
  2742. * @since Added in version 3.0.
  2743. *
  2744. * @ingroup window
  2745. */
  2746. GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
  2747. /*! @brief Sets the close flag of the specified window.
  2748. *
  2749. * This function sets the value of the close flag of the specified window.
  2750. * This can be used to override the user's attempt to close the window, or
  2751. * to signal that it should be closed.
  2752. *
  2753. * @param[in] window The window whose flag to change.
  2754. * @param[in] value The new value.
  2755. *
  2756. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  2757. *
  2758. * @thread_safety This function may be called from any thread. Access is not
  2759. * synchronized.
  2760. *
  2761. * @sa @ref window_close
  2762. *
  2763. * @since Added in version 3.0.
  2764. *
  2765. * @ingroup window
  2766. */
  2767. GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
  2768. /*! @brief Sets the title of the specified window.
  2769. *
  2770. * This function sets the window title, encoded as UTF-8, of the specified
  2771. * window.
  2772. *
  2773. * @param[in] window The window whose title to change.
  2774. * @param[in] title The UTF-8 encoded window title.
  2775. *
  2776. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  2777. * GLFW_PLATFORM_ERROR.
  2778. *
  2779. * @remark @macos The window title will not be updated until the next time you
  2780. * process events.
  2781. *
  2782. * @thread_safety This function must only be called from the main thread.
  2783. *
  2784. * @sa @ref window_title
  2785. *
  2786. * @since Added in version 1.0.
  2787. * @glfw3 Added window handle parameter.
  2788. *
  2789. * @ingroup window
  2790. */
  2791. GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
  2792. /*! @brief Sets the icon for the specified window.
  2793. *
  2794. * This function sets the icon of the specified window. If passed an array of
  2795. * candidate images, those of or closest to the sizes desired by the system are
  2796. * selected. If no images are specified, the window reverts to its default
  2797. * icon.
  2798. *
  2799. * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
  2800. * bits per channel with the red channel first. They are arranged canonically
  2801. * as packed sequential rows, starting from the top-left corner.
  2802. *
  2803. * The desired image sizes varies depending on platform and system settings.
  2804. * The selected images will be rescaled as needed. Good sizes include 16x16,
  2805. * 32x32 and 48x48.
  2806. *
  2807. * @param[in] window The window whose icon to set.
  2808. * @param[in] count The number of images in the specified array, or zero to
  2809. * revert to the default window icon.
  2810. * @param[in] images The images to create the icon from. This is ignored if
  2811. * count is zero.
  2812. *
  2813. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  2814. * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
  2815. *
  2816. * @pointer_lifetime The specified image data is copied before this function
  2817. * returns.
  2818. *
  2819. * @remark @macos Regular windows do not have icons on macOS. This function
  2820. * will emit @ref GLFW_FEATURE_UNAVAILABLE. The dock icon will be the same as
  2821. * the application bundle's icon. For more information on bundles, see the
  2822. * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
  2823. * in the Mac Developer Library.
  2824. *
  2825. * @remark @wayland There is no existing protocol to change an icon, the
  2826. * window will thus inherit the one defined in the application's desktop file.
  2827. * This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
  2828. *
  2829. * @thread_safety This function must only be called from the main thread.
  2830. *
  2831. * @sa @ref window_icon
  2832. *
  2833. * @since Added in version 3.2.
  2834. *
  2835. * @ingroup window
  2836. */
  2837. GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
  2838. /*! @brief Retrieves the position of the content area of the specified window.
  2839. *
  2840. * This function retrieves the position, in screen coordinates, of the
  2841. * upper-left corner of the content area of the specified window.
  2842. *
  2843. * Any or all of the position arguments may be `NULL`. If an error occurs, all
  2844. * non-`NULL` position arguments will be set to zero.
  2845. *
  2846. * @param[in] window The window to query.
  2847. * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
  2848. * the content area, or `NULL`.
  2849. * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
  2850. * the content area, or `NULL`.
  2851. *
  2852. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  2853. * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
  2854. *
  2855. * @remark @wayland There is no way for an application to retrieve the global
  2856. * position of its windows. This function will emit @ref
  2857. * GLFW_FEATURE_UNAVAILABLE.
  2858. *
  2859. * @thread_safety This function must only be called from the main thread.
  2860. *
  2861. * @sa @ref window_pos
  2862. * @sa @ref glfwSetWindowPos
  2863. *
  2864. * @since Added in version 3.0.
  2865. *
  2866. * @ingroup window
  2867. */
  2868. GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
  2869. /*! @brief Sets the position of the content area of the specified window.
  2870. *
  2871. * This function sets the position, in screen coordinates, of the upper-left
  2872. * corner of the content area of the specified windowed mode window. If the
  2873. * window is a full screen window, this function does nothing.
  2874. *
  2875. * __Do not use this function__ to move an already visible window unless you
  2876. * have very good reasons for doing so, as it will confuse and annoy the user.
  2877. *
  2878. * The window manager may put limits on what positions are allowed. GLFW
  2879. * cannot and should not override these limits.
  2880. *
  2881. * @param[in] window The window to query.
  2882. * @param[in] xpos The x-coordinate of the upper-left corner of the content area.
  2883. * @param[in] ypos The y-coordinate of the upper-left corner of the content area.
  2884. *
  2885. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  2886. * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
  2887. *
  2888. * @remark @wayland There is no way for an application to set the global
  2889. * position of its windows. This function will emit @ref
  2890. * GLFW_FEATURE_UNAVAILABLE.
  2891. *
  2892. * @thread_safety This function must only be called from the main thread.
  2893. *
  2894. * @sa @ref window_pos
  2895. * @sa @ref glfwGetWindowPos
  2896. *
  2897. * @since Added in version 1.0.
  2898. * @glfw3 Added window handle parameter.
  2899. *
  2900. * @ingroup window
  2901. */
  2902. GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
  2903. /*! @brief Retrieves the size of the content area of the specified window.
  2904. *
  2905. * This function retrieves the size, in screen coordinates, of the content area
  2906. * of the specified window. If you wish to retrieve the size of the
  2907. * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
  2908. *
  2909. * Any or all of the size arguments may be `NULL`. If an error occurs, all
  2910. * non-`NULL` size arguments will be set to zero.
  2911. *
  2912. * @param[in] window The window whose size to retrieve.
  2913. * @param[out] width Where to store the width, in screen coordinates, of the
  2914. * content area, or `NULL`.
  2915. * @param[out] height Where to store the height, in screen coordinates, of the
  2916. * content area, or `NULL`.
  2917. *
  2918. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  2919. * GLFW_PLATFORM_ERROR.
  2920. *
  2921. * @thread_safety This function must only be called from the main thread.
  2922. *
  2923. * @sa @ref window_size
  2924. * @sa @ref glfwSetWindowSize
  2925. *
  2926. * @since Added in version 1.0.
  2927. * @glfw3 Added window handle parameter.
  2928. *
  2929. * @ingroup window
  2930. */
  2931. GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
  2932. /*! @brief Sets the size limits of the specified window.
  2933. *
  2934. * This function sets the size limits of the content area of the specified
  2935. * window. If the window is full screen, the size limits only take effect
  2936. * once it is made windowed. If the window is not resizable, this function
  2937. * does nothing.
  2938. *
  2939. * The size limits are applied immediately to a windowed mode window and may
  2940. * cause it to be resized.
  2941. *
  2942. * The maximum dimensions must be greater than or equal to the minimum
  2943. * dimensions and all must be greater than or equal to zero.
  2944. *
  2945. * @param[in] window The window to set limits for.
  2946. * @param[in] minwidth The minimum width, in screen coordinates, of the content
  2947. * area, or `GLFW_DONT_CARE`.
  2948. * @param[in] minheight The minimum height, in screen coordinates, of the
  2949. * content area, or `GLFW_DONT_CARE`.
  2950. * @param[in] maxwidth The maximum width, in screen coordinates, of the content
  2951. * area, or `GLFW_DONT_CARE`.
  2952. * @param[in] maxheight The maximum height, in screen coordinates, of the
  2953. * content area, or `GLFW_DONT_CARE`.
  2954. *
  2955. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  2956. * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
  2957. *
  2958. * @remark If you set size limits and an aspect ratio that conflict, the
  2959. * results are undefined.
  2960. *
  2961. * @remark @wayland The size limits will not be applied until the window is
  2962. * actually resized, either by the user or by the compositor.
  2963. *
  2964. * @thread_safety This function must only be called from the main thread.
  2965. *
  2966. * @sa @ref window_sizelimits
  2967. * @sa @ref glfwSetWindowAspectRatio
  2968. *
  2969. * @since Added in version 3.2.
  2970. *
  2971. * @ingroup window
  2972. */
  2973. GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
  2974. /*! @brief Sets the aspect ratio of the specified window.
  2975. *
  2976. * This function sets the required aspect ratio of the content area of the
  2977. * specified window. If the window is full screen, the aspect ratio only takes
  2978. * effect once it is made windowed. If the window is not resizable, this
  2979. * function does nothing.
  2980. *
  2981. * The aspect ratio is specified as a numerator and a denominator and both
  2982. * values must be greater than zero. For example, the common 16:9 aspect ratio
  2983. * is specified as 16 and 9, respectively.
  2984. *
  2985. * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
  2986. * ratio limit is disabled.
  2987. *
  2988. * The aspect ratio is applied immediately to a windowed mode window and may
  2989. * cause it to be resized.
  2990. *
  2991. * @param[in] window The window to set limits for.
  2992. * @param[in] numer The numerator of the desired aspect ratio, or
  2993. * `GLFW_DONT_CARE`.
  2994. * @param[in] denom The denominator of the desired aspect ratio, or
  2995. * `GLFW_DONT_CARE`.
  2996. *
  2997. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  2998. * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
  2999. *
  3000. * @remark If you set size limits and an aspect ratio that conflict, the
  3001. * results are undefined.
  3002. *
  3003. * @remark @wayland The aspect ratio will not be applied until the window is
  3004. * actually resized, either by the user or by the compositor.
  3005. *
  3006. * @thread_safety This function must only be called from the main thread.
  3007. *
  3008. * @sa @ref window_sizelimits
  3009. * @sa @ref glfwSetWindowSizeLimits
  3010. *
  3011. * @since Added in version 3.2.
  3012. *
  3013. * @ingroup window
  3014. */
  3015. GLFWAPI void glfwSetWindowSizeIncrements(GLFWwindow* window, int widthincr, int heightincr);
  3016. /*! @brief Sets the size increments of the specified window.
  3017. *
  3018. * This function sets the size increments of the content area of the specified
  3019. * window. If the window is full screen, the size limits only take effect
  3020. * once it is made windowed. If the window is not resizable, this function
  3021. * does nothing.
  3022. *
  3023. * The size increments are applied immediately to a windowed mode window and
  3024. * may cause it to be resized.
  3025. *
  3026. * The dimension increments must be greater than zero.
  3027. *
  3028. * @param[in] window The window to set limits for.
  3029. * @param[in] widthincr The width increments, in screen coordinates, of the
  3030. * content area, or `GLFW_DONT_CARE`.
  3031. * @param[in] heightincr The height increments, in screen coordinates, of the
  3032. * content area, or `GLFW_DONT_CARE`.
  3033. *
  3034. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  3035. * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
  3036. *
  3037. * @remark If you set size limits and an aspect ratio that conflict, the
  3038. * results are undefined.
  3039. *
  3040. * @remark @wayland The size limits will not be applied until the window is
  3041. * actually resized, either by the user or by the compositor.
  3042. *
  3043. * @thread_safety This function must only be called from the main thread.
  3044. *
  3045. * @sa @ref window_sizelimits
  3046. * @sa @ref glfwSetWindowSizeLimits
  3047. *
  3048. * @since Added in version 3.2.
  3049. *
  3050. * @ingroup window
  3051. */
  3052. GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
  3053. /*! @brief Sets the size of the content area of the specified window.
  3054. *
  3055. * This function sets the size, in screen coordinates, of the content area of
  3056. * the specified window.
  3057. *
  3058. * For full screen windows, this function updates the resolution of its desired
  3059. * video mode and switches to the video mode closest to it, without affecting
  3060. * the window's context. As the context is unaffected, the bit depths of the
  3061. * framebuffer remain unchanged.
  3062. *
  3063. * If you wish to update the refresh rate of the desired video mode in addition
  3064. * to its resolution, see @ref glfwSetWindowMonitor.
  3065. *
  3066. * The window manager may put limits on what sizes are allowed. GLFW cannot
  3067. * and should not override these limits.
  3068. *
  3069. * @param[in] window The window to resize.
  3070. * @param[in] width The desired width, in screen coordinates, of the window
  3071. * content area.
  3072. * @param[in] height The desired height, in screen coordinates, of the window
  3073. * content area.
  3074. *
  3075. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3076. * GLFW_PLATFORM_ERROR.
  3077. *
  3078. * @remark @wayland A full screen window will not attempt to change the mode,
  3079. * no matter what the requested size.
  3080. *
  3081. * @thread_safety This function must only be called from the main thread.
  3082. *
  3083. * @sa @ref window_size
  3084. * @sa @ref glfwGetWindowSize
  3085. * @sa @ref glfwSetWindowMonitor
  3086. *
  3087. * @since Added in version 1.0.
  3088. * @glfw3 Added window handle parameter.
  3089. *
  3090. * @ingroup window
  3091. */
  3092. GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
  3093. /*! @brief Retrieves the size of the framebuffer of the specified window.
  3094. *
  3095. * This function retrieves the size, in pixels, of the framebuffer of the
  3096. * specified window. If you wish to retrieve the size of the window in screen
  3097. * coordinates, see @ref glfwGetWindowSize.
  3098. *
  3099. * Any or all of the size arguments may be `NULL`. If an error occurs, all
  3100. * non-`NULL` size arguments will be set to zero.
  3101. *
  3102. * @param[in] window The window whose framebuffer to query.
  3103. * @param[out] width Where to store the width, in pixels, of the framebuffer,
  3104. * or `NULL`.
  3105. * @param[out] height Where to store the height, in pixels, of the framebuffer,
  3106. * or `NULL`.
  3107. *
  3108. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3109. * GLFW_PLATFORM_ERROR.
  3110. *
  3111. * @thread_safety This function must only be called from the main thread.
  3112. *
  3113. * @sa @ref window_fbsize
  3114. * @sa @ref glfwSetFramebufferSizeCallback
  3115. *
  3116. * @since Added in version 3.0.
  3117. *
  3118. * @ingroup window
  3119. */
  3120. GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
  3121. /*! @brief Retrieves the size of the frame of the window.
  3122. *
  3123. * This function retrieves the size, in screen coordinates, of each edge of the
  3124. * frame of the specified window. This size includes the title bar, if the
  3125. * window has one. The size of the frame may vary depending on the
  3126. * [window-related hints](@ref window_hints_wnd) used to create it.
  3127. *
  3128. * Because this function retrieves the size of each window frame edge and not
  3129. * the offset along a particular coordinate axis, the retrieved values will
  3130. * always be zero or positive.
  3131. *
  3132. * Any or all of the size arguments may be `NULL`. If an error occurs, all
  3133. * non-`NULL` size arguments will be set to zero.
  3134. *
  3135. * @param[in] window The window whose frame size to query.
  3136. * @param[out] left Where to store the size, in screen coordinates, of the left
  3137. * edge of the window frame, or `NULL`.
  3138. * @param[out] top Where to store the size, in screen coordinates, of the top
  3139. * edge of the window frame, or `NULL`.
  3140. * @param[out] right Where to store the size, in screen coordinates, of the
  3141. * right edge of the window frame, or `NULL`.
  3142. * @param[out] bottom Where to store the size, in screen coordinates, of the
  3143. * bottom edge of the window frame, or `NULL`.
  3144. *
  3145. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3146. * GLFW_PLATFORM_ERROR.
  3147. *
  3148. * @thread_safety This function must only be called from the main thread.
  3149. *
  3150. * @sa @ref window_size
  3151. *
  3152. * @since Added in version 3.1.
  3153. *
  3154. * @ingroup window
  3155. */
  3156. GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
  3157. /*! @brief Retrieves the content scale for the specified window.
  3158. *
  3159. * This function retrieves the content scale for the specified window. The
  3160. * content scale is the ratio between the current DPI and the platform's
  3161. * default DPI. This is especially important for text and any UI elements. If
  3162. * the pixel dimensions of your UI scaled by this look appropriate on your
  3163. * machine then it should appear at a reasonable size on other machines
  3164. * regardless of their DPI and scaling settings. This relies on the system DPI
  3165. * and scaling settings being somewhat correct.
  3166. *
  3167. * On systems where each monitors can have its own content scale, the window
  3168. * content scale will depend on which monitor the system considers the window
  3169. * to be on.
  3170. *
  3171. * @param[in] window The window to query.
  3172. * @param[out] xscale Where to store the x-axis content scale, or `NULL`.
  3173. * @param[out] yscale Where to store the y-axis content scale, or `NULL`.
  3174. *
  3175. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3176. * GLFW_PLATFORM_ERROR.
  3177. *
  3178. * @thread_safety This function must only be called from the main thread.
  3179. *
  3180. * @sa @ref window_scale
  3181. * @sa @ref glfwSetWindowContentScaleCallback
  3182. * @sa @ref glfwGetMonitorContentScale
  3183. *
  3184. * @since Added in version 3.3.
  3185. *
  3186. * @ingroup window
  3187. */
  3188. GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale);
  3189. /*! @brief Returns the double click time interval.
  3190. *
  3191. * This function returns the maximum time between clicks to count as a
  3192. * double click.
  3193. *
  3194. * The double click interval is a positive finite number greater than zero,
  3195. * where zero means that no click is ever recognized as a double click. If the
  3196. * system does not support a double click interval, this function always returns one half.
  3197. *
  3198. * @return The double click interval.
  3199. *
  3200. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3201. * GLFW_PLATFORM_ERROR.
  3202. *
  3203. * @thread_safety This function must only be called from the main thread.
  3204. *
  3205. * @sa @ref double_click
  3206. * @sa @ref click_interval
  3207. * @sa @ref double_click_interval
  3208. *
  3209. * @since Added in version 3.3.
  3210. *
  3211. * @ingroup window
  3212. */
  3213. GLFWAPI monotonic_t glfwGetDoubleClickInterval(GLFWwindow* window);
  3214. /*! @brief Returns the opacity of the whole window.
  3215. *
  3216. * This function returns the opacity of the window, including any decorations.
  3217. *
  3218. * The opacity (or alpha) value is a positive finite number between zero and
  3219. * one, where zero is fully transparent and one is fully opaque. If the system
  3220. * does not support whole window transparency, this function always returns one.
  3221. *
  3222. * The initial opacity value for newly created windows is one.
  3223. *
  3224. * @param[in] window The window to query.
  3225. * @return The opacity value of the specified window.
  3226. *
  3227. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3228. * GLFW_PLATFORM_ERROR.
  3229. *
  3230. * @thread_safety This function must only be called from the main thread.
  3231. *
  3232. * @sa @ref window_transparency
  3233. * @sa @ref glfwSetWindowOpacity
  3234. *
  3235. * @since Added in version 3.3.
  3236. *
  3237. * @ingroup window
  3238. */
  3239. GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window);
  3240. /*! @brief Sets the opacity of the whole window.
  3241. *
  3242. * This function sets the opacity of the window, including any decorations.
  3243. *
  3244. * The opacity (or alpha) value is a positive finite number between zero and
  3245. * one, where zero is fully transparent and one is fully opaque.
  3246. *
  3247. * The initial opacity value for newly created windows is one.
  3248. *
  3249. * A window created with framebuffer transparency may not use whole window
  3250. * transparency. The results of doing this are undefined.
  3251. *
  3252. * @param[in] window The window to set the opacity for.
  3253. * @param[in] opacity The desired opacity of the specified window.
  3254. *
  3255. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  3256. * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
  3257. *
  3258. * @remark @wayland There is no way to set an opacity factor for a window.
  3259. * This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
  3260. *
  3261. * @thread_safety This function must only be called from the main thread.
  3262. *
  3263. * @sa @ref window_transparency
  3264. * @sa @ref glfwGetWindowOpacity
  3265. *
  3266. * @since Added in version 3.3.
  3267. *
  3268. * @ingroup window
  3269. */
  3270. GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
  3271. /*! @brief Iconifies the specified window.
  3272. *
  3273. * This function iconifies (minimizes) the specified window if it was
  3274. * previously restored. If the window is already iconified, this function does
  3275. * nothing.
  3276. *
  3277. * If the specified window is a full screen window, the original monitor
  3278. * resolution is restored until the window is restored.
  3279. *
  3280. * @param[in] window The window to iconify.
  3281. *
  3282. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3283. * GLFW_PLATFORM_ERROR.
  3284. *
  3285. * @remark @wayland Once a window is iconified, @ref glfwRestoreWindow won’t
  3286. * be able to restore it. This is a design decision of the xdg-shell
  3287. * protocol.
  3288. *
  3289. * @thread_safety This function must only be called from the main thread.
  3290. *
  3291. * @sa @ref window_iconify
  3292. * @sa @ref glfwRestoreWindow
  3293. * @sa @ref glfwMaximizeWindow
  3294. *
  3295. * @since Added in version 2.1.
  3296. * @glfw3 Added window handle parameter.
  3297. *
  3298. * @ingroup window
  3299. */
  3300. GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
  3301. /*! @brief Restores the specified window.
  3302. *
  3303. * This function restores the specified window if it was previously iconified
  3304. * (minimized) or maximized. If the window is already restored, this function
  3305. * does nothing.
  3306. *
  3307. * If the specified window is a full screen window, the resolution chosen for
  3308. * the window is restored on the selected monitor.
  3309. *
  3310. * @param[in] window The window to restore.
  3311. *
  3312. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3313. * GLFW_PLATFORM_ERROR.
  3314. *
  3315. * @thread_safety This function must only be called from the main thread.
  3316. *
  3317. * @sa @ref window_iconify
  3318. * @sa @ref glfwIconifyWindow
  3319. * @sa @ref glfwMaximizeWindow
  3320. *
  3321. * @since Added in version 2.1.
  3322. * @glfw3 Added window handle parameter.
  3323. *
  3324. * @ingroup window
  3325. */
  3326. GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
  3327. /*! @brief Maximizes the specified window.
  3328. *
  3329. * This function maximizes the specified window if it was previously not
  3330. * maximized. If the window is already maximized, this function does nothing.
  3331. *
  3332. * If the specified window is a full screen window, this function does nothing.
  3333. *
  3334. * @param[in] window The window to maximize.
  3335. *
  3336. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3337. * GLFW_PLATFORM_ERROR.
  3338. *
  3339. * @par Thread Safety
  3340. * This function may only be called from the main thread.
  3341. *
  3342. * @sa @ref window_iconify
  3343. * @sa @ref glfwIconifyWindow
  3344. * @sa @ref glfwRestoreWindow
  3345. *
  3346. * @since Added in GLFW 3.2.
  3347. *
  3348. * @ingroup window
  3349. */
  3350. GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
  3351. /*! @brief Makes the specified window visible.
  3352. *
  3353. * This function makes the specified window visible if it was previously
  3354. * hidden. If the window is already visible or is in full screen mode, this
  3355. * function does nothing.
  3356. *
  3357. * By default, windowed mode windows are focused when shown
  3358. * Set the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint
  3359. * to change this behavior for all newly created windows, or change the
  3360. * behavior for an existing window with @ref glfwSetWindowAttrib.
  3361. *
  3362. * @param[in] window The window to make visible.
  3363. *
  3364. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3365. * GLFW_PLATFORM_ERROR.
  3366. *
  3367. * @thread_safety This function must only be called from the main thread.
  3368. *
  3369. * @sa @ref window_hide
  3370. * @sa @ref glfwHideWindow
  3371. *
  3372. * @since Added in version 3.0.
  3373. *
  3374. * @ingroup window
  3375. */
  3376. GLFWAPI void glfwShowWindow(GLFWwindow* window);
  3377. /*! @brief Hides the specified window.
  3378. *
  3379. * This function hides the specified window if it was previously visible. If
  3380. * the window is already hidden or is in full screen mode, this function does
  3381. * nothing.
  3382. *
  3383. * @param[in] window The window to hide.
  3384. *
  3385. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3386. * GLFW_PLATFORM_ERROR.
  3387. *
  3388. * @thread_safety This function must only be called from the main thread.
  3389. *
  3390. * @sa @ref window_hide
  3391. * @sa @ref glfwShowWindow
  3392. *
  3393. * @since Added in version 3.0.
  3394. *
  3395. * @ingroup window
  3396. */
  3397. GLFWAPI void glfwHideWindow(GLFWwindow* window);
  3398. /*! @brief Brings the specified window to front and sets input focus.
  3399. *
  3400. * This function brings the specified window to front and sets input focus.
  3401. * The window should already be visible and not iconified.
  3402. *
  3403. * By default, both windowed and full screen mode windows are focused when
  3404. * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to
  3405. * disable this behavior.
  3406. *
  3407. * Also by default, windowed mode windows are focused when shown
  3408. * with @ref glfwShowWindow. Set the
  3409. * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) to disable this behavior.
  3410. *
  3411. * __Do not use this function__ to steal focus from other applications unless
  3412. * you are certain that is what the user wants. Focus stealing can be
  3413. * extremely disruptive.
  3414. *
  3415. * For a less disruptive way of getting the user's attention, see
  3416. * [attention requests](@ref window_attention).
  3417. *
  3418. * @param[in] window The window to give input focus.
  3419. *
  3420. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  3421. * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
  3422. *
  3423. * @remark @wayland It is not possible for an application to set the input
  3424. * focus. This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
  3425. *
  3426. * @thread_safety This function must only be called from the main thread.
  3427. *
  3428. * @sa @ref window_focus
  3429. * @sa @ref window_attention
  3430. *
  3431. * @since Added in version 3.2.
  3432. *
  3433. * @ingroup window
  3434. */
  3435. GLFWAPI void glfwFocusWindow(GLFWwindow* window);
  3436. /*! @brief Requests user attention to the specified window.
  3437. *
  3438. * This function requests user attention to the specified window. On
  3439. * platforms where this is not supported, attention is requested to the
  3440. * application as a whole.
  3441. *
  3442. * Once the user has given attention, usually by focusing the window or
  3443. * application, the system will end the request automatically.
  3444. *
  3445. * @param[in] window The window to request attention to.
  3446. *
  3447. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3448. * GLFW_PLATFORM_ERROR.
  3449. *
  3450. * @remark @macos Attention is requested to the application as a whole, not the
  3451. * specific window.
  3452. *
  3453. * @thread_safety This function must only be called from the main thread.
  3454. *
  3455. * @sa @ref window_attention
  3456. *
  3457. * @since Added in version 3.3.
  3458. *
  3459. * @ingroup window
  3460. */
  3461. GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window);
  3462. /*! @brief Sounds an audible bell associated with the window
  3463. *
  3464. * This function sounds an audible bell, on platforms where it is
  3465. * supported. Currently (macOS, Windows, X11 and Wayland).
  3466. *
  3467. * @param[in] window The window with which the bell is associated.
  3468. * @return true if the bell succeeded otherwise false
  3469. *
  3470. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3471. * GLFW_PLATFORM_ERROR.
  3472. *
  3473. * @remark @macos Bell is associated to the application as a whole, not the
  3474. * specific window.
  3475. *
  3476. * @thread_safety This function must only be called from the main thread.
  3477. *
  3478. * @since Added in version 3.3.
  3479. *
  3480. * @ingroup window
  3481. */
  3482. GLFWAPI int glfwWindowBell(GLFWwindow* window);
  3483. /*! @brief Returns the monitor that the window uses for full screen mode.
  3484. *
  3485. * This function returns the handle of the monitor that the specified window is
  3486. * in full screen on.
  3487. *
  3488. * @param[in] window The window to query.
  3489. * @return The monitor, or `NULL` if the window is in windowed mode or an
  3490. * [error](@ref error_handling) occurred.
  3491. *
  3492. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3493. *
  3494. * @thread_safety This function must only be called from the main thread.
  3495. *
  3496. * @sa @ref window_monitor
  3497. * @sa @ref glfwSetWindowMonitor
  3498. *
  3499. * @since Added in version 3.0.
  3500. *
  3501. * @ingroup window
  3502. */
  3503. GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
  3504. /*! @brief Sets the mode, monitor, video mode and placement of a window.
  3505. *
  3506. * This function sets the monitor that the window uses for full screen mode or,
  3507. * if the monitor is `NULL`, makes it windowed mode.
  3508. *
  3509. * When setting a monitor, this function updates the width, height and refresh
  3510. * rate of the desired video mode and switches to the video mode closest to it.
  3511. * The window position is ignored when setting a monitor.
  3512. *
  3513. * When the monitor is `NULL`, the position, width and height are used to
  3514. * place the window content area. The refresh rate is ignored when no monitor
  3515. * is specified.
  3516. *
  3517. * If you only wish to update the resolution of a full screen window or the
  3518. * size of a windowed mode window, see @ref glfwSetWindowSize.
  3519. *
  3520. * When a window transitions from full screen to windowed mode, this function
  3521. * restores any previous window settings such as whether it is decorated,
  3522. * floating, resizable, has size or aspect ratio limits, etc.
  3523. *
  3524. * @param[in] window The window whose monitor, size or video mode to set.
  3525. * @param[in] monitor The desired monitor, or `NULL` to set windowed mode.
  3526. * @param[in] xpos The desired x-coordinate of the upper-left corner of the
  3527. * content area.
  3528. * @param[in] ypos The desired y-coordinate of the upper-left corner of the
  3529. * content area.
  3530. * @param[in] width The desired with, in screen coordinates, of the content
  3531. * area or video mode.
  3532. * @param[in] height The desired height, in screen coordinates, of the content
  3533. * area or video mode.
  3534. * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode,
  3535. * or `GLFW_DONT_CARE`.
  3536. *
  3537. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  3538. * GLFW_PLATFORM_ERROR.
  3539. *
  3540. * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise
  3541. * affected by any resizing or mode switching, although you may need to update
  3542. * your viewport if the framebuffer size has changed.
  3543. *
  3544. * @remark @wayland The desired window position is ignored, as there is no way
  3545. * for an application to set this property.
  3546. *
  3547. * @remark @wayland Setting the window to full screen will not attempt to
  3548. * change the mode, no matter what the requested size or refresh rate.
  3549. *
  3550. * @thread_safety This function must only be called from the main thread.
  3551. *
  3552. * @sa @ref window_monitor
  3553. * @sa @ref window_full_screen
  3554. * @sa @ref glfwGetWindowMonitor
  3555. * @sa @ref glfwSetWindowSize
  3556. *
  3557. * @since Added in version 3.2.
  3558. *
  3559. * @ingroup window
  3560. */
  3561. GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
  3562. /*! @brief Returns an attribute of the specified window.
  3563. *
  3564. * This function returns the value of an attribute of the specified window or
  3565. * its OpenGL or OpenGL ES context.
  3566. *
  3567. * @param[in] window The window to query.
  3568. * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
  3569. * return.
  3570. * @return The value of the attribute, or zero if an
  3571. * [error](@ref error_handling) occurred.
  3572. *
  3573. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  3574. * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
  3575. *
  3576. * @remark Framebuffer related hints are not window attributes. See @ref
  3577. * window_attribs_fb for more information.
  3578. *
  3579. * @remark Zero is a valid value for many window and context related
  3580. * attributes so you cannot use a return value of zero as an indication of
  3581. * errors. However, this function should not fail as long as it is passed
  3582. * valid arguments and the library has been [initialized](@ref intro_init).
  3583. *
  3584. * @thread_safety This function must only be called from the main thread.
  3585. *
  3586. * @sa @ref window_attribs
  3587. * @sa @ref glfwSetWindowAttrib
  3588. *
  3589. * @since Added in version 3.0. Replaces `glfwGetWindowParam` and
  3590. * `glfwGetGLVersion`.
  3591. *
  3592. * @ingroup window
  3593. */
  3594. GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
  3595. /*! @brief Sets an attribute of the specified window.
  3596. *
  3597. * This function sets the value of an attribute of the specified window.
  3598. *
  3599. * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
  3600. * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),
  3601. * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib),
  3602. * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and
  3603. * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib).
  3604. * [GLFW_MOUSE_PASSTHROUGH](@ref GLFW_MOUSE_PASSTHROUGH_attrib)
  3605. *
  3606. * Some of these attributes are ignored for full screen windows. The new
  3607. * value will take effect if the window is later made windowed.
  3608. *
  3609. * Some of these attributes are ignored for windowed mode windows. The new
  3610. * value will take effect if the window is later made full screen.
  3611. *
  3612. * @param[in] window The window to set the attribute for.
  3613. * @param[in] attrib A supported window attribute.
  3614. * @param[in] value `true` or `false`.
  3615. *
  3616. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  3617. * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
  3618. *
  3619. * @remark Calling @ref glfwGetWindowAttrib will always return the latest
  3620. * value, even if that value is ignored by the current mode of the window.
  3621. *
  3622. * @thread_safety This function must only be called from the main thread.
  3623. *
  3624. * @sa @ref window_attribs
  3625. * @sa @ref glfwGetWindowAttrib
  3626. *
  3627. * @since Added in version 3.3.
  3628. *
  3629. * @ingroup window
  3630. */
  3631. GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value);
  3632. GLFWAPI int glfwSetWindowBlur(GLFWwindow* window, int value);
  3633. /*! @brief Sets the user pointer of the specified window.
  3634. *
  3635. * This function sets the user-defined pointer of the specified window. The
  3636. * current value is retained until the window is destroyed. The initial value
  3637. * is `NULL`.
  3638. *
  3639. * @param[in] window The window whose pointer to set.
  3640. * @param[in] pointer The new value.
  3641. *
  3642. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3643. *
  3644. * @thread_safety This function may be called from any thread. Access is not
  3645. * synchronized.
  3646. *
  3647. * @sa @ref window_userptr
  3648. * @sa @ref glfwGetWindowUserPointer
  3649. *
  3650. * @since Added in version 3.0.
  3651. *
  3652. * @ingroup window
  3653. */
  3654. GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
  3655. /*! @brief Returns the user pointer of the specified window.
  3656. *
  3657. * This function returns the current value of the user-defined pointer of the
  3658. * specified window. The initial value is `NULL`.
  3659. *
  3660. * @param[in] window The window whose pointer to return.
  3661. *
  3662. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3663. *
  3664. * @thread_safety This function may be called from any thread. Access is not
  3665. * synchronized.
  3666. *
  3667. * @sa @ref window_userptr
  3668. * @sa @ref glfwSetWindowUserPointer
  3669. *
  3670. * @since Added in version 3.0.
  3671. *
  3672. * @ingroup window
  3673. */
  3674. GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
  3675. /*! @brief Sets the position callback for the specified window.
  3676. *
  3677. * This function sets the position callback of the specified window, which is
  3678. * called when the window is moved. The callback is provided with the
  3679. * position, in screen coordinates, of the upper-left corner of the content
  3680. * area of the window.
  3681. *
  3682. * @param[in] window The window whose callback to set.
  3683. * @param[in] callback The new callback, or `NULL` to remove the currently set
  3684. * callback.
  3685. * @return The previously set callback, or `NULL` if no callback was set or the
  3686. * library had not been [initialized](@ref intro_init).
  3687. *
  3688. * @callback_signature
  3689. * @code
  3690. * void function_name(GLFWwindow* window, int xpos, int ypos)
  3691. * @endcode
  3692. * For more information about the callback parameters, see the
  3693. * [function pointer type](@ref GLFWwindowposfun).
  3694. *
  3695. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3696. *
  3697. * @remark @wayland This callback will never be called, as there is no way for
  3698. * an application to know its global position.
  3699. *
  3700. * @thread_safety This function must only be called from the main thread.
  3701. *
  3702. * @sa @ref window_pos
  3703. *
  3704. * @since Added in version 3.0.
  3705. *
  3706. * @ingroup window
  3707. */
  3708. GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun callback);
  3709. /*! @brief Sets the size callback for the specified window.
  3710. *
  3711. * This function sets the size callback of the specified window, which is
  3712. * called when the window is resized. The callback is provided with the size,
  3713. * in screen coordinates, of the content area of the window.
  3714. *
  3715. * @param[in] window The window whose callback to set.
  3716. * @param[in] callback The new callback, or `NULL` to remove the currently set
  3717. * callback.
  3718. * @return The previously set callback, or `NULL` if no callback was set or the
  3719. * library had not been [initialized](@ref intro_init).
  3720. *
  3721. * @callback_signature
  3722. * @code
  3723. * void function_name(GLFWwindow* window, int width, int height)
  3724. * @endcode
  3725. * For more information about the callback parameters, see the
  3726. * [function pointer type](@ref GLFWwindowsizefun).
  3727. *
  3728. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3729. *
  3730. * @thread_safety This function must only be called from the main thread.
  3731. *
  3732. * @sa @ref window_size
  3733. *
  3734. * @since Added in version 1.0.
  3735. * @glfw3 Added window handle parameter and return value.
  3736. *
  3737. * @ingroup window
  3738. */
  3739. GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun callback);
  3740. /*! @brief Sets the close callback for the specified window.
  3741. *
  3742. * This function sets the close callback of the specified window, which is
  3743. * called when the user attempts to close the window, for example by clicking
  3744. * the close widget in the title bar.
  3745. *
  3746. * The close flag is set before this callback is called, but you can modify it
  3747. * at any time with @ref glfwSetWindowShouldClose.
  3748. *
  3749. * The close callback is not triggered by @ref glfwDestroyWindow.
  3750. *
  3751. * @param[in] window The window whose callback to set.
  3752. * @param[in] callback The new callback, or `NULL` to remove the currently set
  3753. * callback.
  3754. * @return The previously set callback, or `NULL` if no callback was set or the
  3755. * library had not been [initialized](@ref intro_init).
  3756. *
  3757. * @callback_signature
  3758. * @code
  3759. * void function_name(GLFWwindow* window)
  3760. * @endcode
  3761. * For more information about the callback parameters, see the
  3762. * [function pointer type](@ref GLFWwindowclosefun).
  3763. *
  3764. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3765. *
  3766. * @remark @macos Selecting Quit from the application menu will trigger the
  3767. * close callback for all windows.
  3768. *
  3769. * @thread_safety This function must only be called from the main thread.
  3770. *
  3771. * @sa @ref window_close
  3772. *
  3773. * @since Added in version 2.5.
  3774. * @glfw3 Added window handle parameter and return value.
  3775. *
  3776. * @ingroup window
  3777. */
  3778. GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun callback);
  3779. GLFWAPI GLFWapplicationclosefun glfwSetApplicationCloseCallback(GLFWapplicationclosefun callback);
  3780. GLFWAPI GLFWsystemcolorthemechangefun glfwSetSystemColorThemeChangeCallback(GLFWsystemcolorthemechangefun callback);
  3781. GLFWAPI GLFWColorScheme glfwGetCurrentSystemColorTheme(void);
  3782. /*! @brief Sets the refresh callback for the specified window.
  3783. *
  3784. * This function sets the refresh callback of the specified window, which is
  3785. * called when the content area of the window needs to be redrawn, for example
  3786. * if the window has been exposed after having been covered by another window.
  3787. *
  3788. * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
  3789. * the window contents are saved off-screen, this callback may be called only
  3790. * very infrequently or never at all.
  3791. *
  3792. * @param[in] window The window whose callback to set.
  3793. * @param[in] callback The new callback, or `NULL` to remove the currently set
  3794. * callback.
  3795. * @return The previously set callback, or `NULL` if no callback was set or the
  3796. * library had not been [initialized](@ref intro_init).
  3797. *
  3798. * @callback_signature
  3799. * @code
  3800. * void function_name(GLFWwindow* window);
  3801. * @endcode
  3802. * For more information about the callback parameters, see the
  3803. * [function pointer type](@ref GLFWwindowrefreshfun).
  3804. *
  3805. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3806. *
  3807. * @thread_safety This function must only be called from the main thread.
  3808. *
  3809. * @sa @ref window_refresh
  3810. *
  3811. * @since Added in version 2.5.
  3812. * @glfw3 Added window handle parameter and return value.
  3813. *
  3814. * @ingroup window
  3815. */
  3816. GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun callback);
  3817. /*! @brief Sets the focus callback for the specified window.
  3818. *
  3819. * This function sets the focus callback of the specified window, which is
  3820. * called when the window gains or loses input focus.
  3821. *
  3822. * After the focus callback is called for a window that lost input focus,
  3823. * synthetic key and mouse button release events will be generated for all such
  3824. * that had been pressed. For more information, see @ref glfwSetKeyCallback
  3825. * and @ref glfwSetMouseButtonCallback.
  3826. *
  3827. * @param[in] window The window whose callback to set.
  3828. * @param[in] callback The new callback, or `NULL` to remove the currently set
  3829. * callback.
  3830. * @return The previously set callback, or `NULL` if no callback was set or the
  3831. * library had not been [initialized](@ref intro_init).
  3832. *
  3833. * @callback_signature
  3834. * @code
  3835. * void function_name(GLFWwindow* window, int focused)
  3836. * @endcode
  3837. * For more information about the callback parameters, see the
  3838. * [function pointer type](@ref GLFWwindowfocusfun).
  3839. *
  3840. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3841. *
  3842. * @thread_safety This function must only be called from the main thread.
  3843. *
  3844. * @sa @ref window_focus
  3845. *
  3846. * @since Added in version 3.0.
  3847. *
  3848. * @ingroup window
  3849. */
  3850. GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun callback);
  3851. /*! @brief Sets the occlusion callback for the specified window.
  3852. *
  3853. * This function sets the occlusion callback of the specified window, which is
  3854. * called when the window becomes (fully) occluded by other windows or when (a
  3855. * part of) the window becomes visible again because an overlapping window is
  3856. * moved away.
  3857. *
  3858. * @param[in] window The window whose callback to set.
  3859. * @param[in] callback The new callback, or `NULL` to remove the currently set
  3860. * callback.
  3861. * @return The previously set callback, or `NULL` if no callback was set or the
  3862. * library had not been [initialized](@ref intro_init).
  3863. *
  3864. * @callback_signature
  3865. * @code
  3866. * void function_name(GLFWwindow* window, int iconified)
  3867. * @endcode
  3868. * For more information about the callback parameters, see the
  3869. * [function pointer type](@ref GLFWwindowiconifyfun).
  3870. *
  3871. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3872. *
  3873. * @thread_safety This function must only be called from the main thread.
  3874. *
  3875. * @sa @ref window_occlusion
  3876. *
  3877. * @since Added in version 3.3.
  3878. *
  3879. * @ingroup window
  3880. */
  3881. GLFWAPI GLFWwindowocclusionfun glfwSetWindowOcclusionCallback(GLFWwindow* window, GLFWwindowocclusionfun callback);
  3882. /*! @brief Sets the iconify callback for the specified window.
  3883. *
  3884. * This function sets the iconification callback of the specified window, which
  3885. * is called when the window is iconified or restored.
  3886. *
  3887. * @param[in] window The window whose callback to set.
  3888. * @param[in] callback The new callback, or `NULL` to remove the currently set
  3889. * callback.
  3890. * @return The previously set callback, or `NULL` if no callback was set or the
  3891. * library had not been [initialized](@ref intro_init).
  3892. *
  3893. * @callback_signature
  3894. * @code
  3895. * void function_name(GLFWwindow* window, int iconified)
  3896. * @endcode
  3897. * For more information about the callback parameters, see the
  3898. * [function pointer type](@ref GLFWwindowiconifyfun).
  3899. *
  3900. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3901. *
  3902. * @thread_safety This function must only be called from the main thread.
  3903. *
  3904. * @sa @ref window_iconify
  3905. *
  3906. * @since Added in version 3.0.
  3907. *
  3908. * @ingroup window
  3909. */
  3910. GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun callback);
  3911. /*! @brief Sets the maximize callback for the specified window.
  3912. *
  3913. * This function sets the maximization callback of the specified window, which
  3914. * is called when the window is maximized or restored.
  3915. *
  3916. * @param[in] window The window whose callback to set.
  3917. * @param[in] callback The new callback, or `NULL` to remove the currently set
  3918. * callback.
  3919. * @return The previously set callback, or `NULL` if no callback was set or the
  3920. * library had not been [initialized](@ref intro_init).
  3921. *
  3922. * @callback_signature
  3923. * @code
  3924. * void function_name(GLFWwindow* window, int maximized)
  3925. * @endcode
  3926. * For more information about the callback parameters, see the
  3927. * [function pointer type](@ref GLFWwindowmaximizefun).
  3928. *
  3929. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3930. *
  3931. * @thread_safety This function must only be called from the main thread.
  3932. *
  3933. * @sa @ref window_maximize
  3934. *
  3935. * @since Added in version 3.3.
  3936. *
  3937. * @ingroup window
  3938. */
  3939. GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun callback);
  3940. /*! @brief Sets the framebuffer resize callback for the specified window.
  3941. *
  3942. * This function sets the framebuffer resize callback of the specified window,
  3943. * which is called when the framebuffer of the specified window is resized.
  3944. *
  3945. * @param[in] window The window whose callback to set.
  3946. * @param[in] callback The new callback, or `NULL` to remove the currently set
  3947. * callback.
  3948. * @return The previously set callback, or `NULL` if no callback was set or the
  3949. * library had not been [initialized](@ref intro_init).
  3950. *
  3951. * @callback_signature
  3952. * @code
  3953. * void function_name(GLFWwindow* window, int width, int height)
  3954. * @endcode
  3955. * For more information about the callback parameters, see the
  3956. * [function pointer type](@ref GLFWframebuffersizefun).
  3957. *
  3958. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3959. *
  3960. * @thread_safety This function must only be called from the main thread.
  3961. *
  3962. * @sa @ref window_fbsize
  3963. *
  3964. * @since Added in version 3.0.
  3965. *
  3966. * @ingroup window
  3967. */
  3968. GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun callback);
  3969. /*! @brief Sets the window content scale callback for the specified window.
  3970. *
  3971. * This function sets the window content scale callback of the specified window,
  3972. * which is called when the content scale of the specified window changes.
  3973. *
  3974. * @param[in] window The window whose callback to set.
  3975. * @param[in] callback The new callback, or `NULL` to remove the currently set
  3976. * callback.
  3977. * @return The previously set callback, or `NULL` if no callback was set or the
  3978. * library had not been [initialized](@ref intro_init).
  3979. *
  3980. * @callback_signature
  3981. * @code
  3982. * void function_name(GLFWwindow* window, float xscale, float yscale)
  3983. * @endcode
  3984. * For more information about the callback parameters, see the
  3985. * [function pointer type](@ref GLFWwindowcontentscalefun).
  3986. *
  3987. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3988. *
  3989. * @thread_safety This function must only be called from the main thread.
  3990. *
  3991. * @sa @ref window_scale
  3992. * @sa @ref glfwGetWindowContentScale
  3993. *
  3994. * @since Added in version 3.3.
  3995. *
  3996. * @ingroup window
  3997. */
  3998. GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun callback);
  3999. /*! @brief Posts an empty event to the event queue.
  4000. *
  4001. * This function posts an empty event from the current thread to the event
  4002. * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return.
  4003. *
  4004. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  4005. * GLFW_PLATFORM_ERROR.
  4006. *
  4007. * @thread_safety This function may be called from any thread.
  4008. *
  4009. * @sa @ref events
  4010. * @sa @ref glfwWaitEvents
  4011. * @sa @ref glfwWaitEventsTimeout
  4012. *
  4013. * @since Added in version 3.1.
  4014. *
  4015. * @ingroup window
  4016. */
  4017. GLFWAPI void glfwPostEmptyEvent(void);
  4018. GLFWAPI bool glfwGetIgnoreOSKeyboardProcessing(void);
  4019. GLFWAPI void glfwSetIgnoreOSKeyboardProcessing(bool enabled);
  4020. /*! @brief Returns the value of an input option for the specified window.
  4021. *
  4022. * This function returns the value of an input option for the specified window.
  4023. * The mode must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS,
  4024. * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or
  4025. * @ref GLFW_RAW_MOUSE_MOTION.
  4026. *
  4027. * @param[in] window The window to query.
  4028. * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`,
  4029. * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or
  4030. * `GLFW_RAW_MOUSE_MOTION`.
  4031. *
  4032. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  4033. * GLFW_INVALID_ENUM.
  4034. *
  4035. * @thread_safety This function must only be called from the main thread.
  4036. *
  4037. * @sa @ref glfwSetInputMode
  4038. *
  4039. * @since Added in version 3.0.
  4040. *
  4041. * @ingroup input
  4042. */
  4043. GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
  4044. /*! @brief Sets an input option for the specified window.
  4045. *
  4046. * This function sets an input mode option for the specified window. The mode
  4047. * must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS,
  4048. * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or
  4049. * @ref GLFW_RAW_MOUSE_MOTION.
  4050. *
  4051. * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
  4052. * modes:
  4053. * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
  4054. * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the
  4055. * content area of the window but does not restrict the cursor from leaving.
  4056. * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
  4057. * and unlimited cursor movement. This is useful for implementing for
  4058. * example 3D camera controls.
  4059. *
  4060. * If the mode is `GLFW_STICKY_KEYS`, the value must be either `true` to
  4061. * enable sticky keys, or `false` to disable it. If sticky keys are
  4062. * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
  4063. * the next time it is called even if the key had been released before the
  4064. * call. This is useful when you are only interested in whether keys have been
  4065. * pressed but not when or in which order.
  4066. *
  4067. * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
  4068. * `true` to enable sticky mouse buttons, or `false` to disable it.
  4069. * If sticky mouse buttons are enabled, a mouse button press will ensure that
  4070. * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
  4071. * if the mouse button had been released before the call. This is useful when
  4072. * you are only interested in whether mouse buttons have been pressed but not
  4073. * when or in which order.
  4074. *
  4075. * If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `true` to
  4076. * enable lock key modifier bits, or `false` to disable them. If enabled,
  4077. * callbacks that receive modifier bits will also have the @ref
  4078. * GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on,
  4079. * and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on.
  4080. *
  4081. * If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `true`
  4082. * to enable raw (unscaled and unaccelerated) mouse motion when the cursor is
  4083. * disabled, or `false` to disable it. If raw motion is not supported,
  4084. * attempting to set this will emit @ref GLFW_FEATURE_UNAVAILABLE. Call @ref
  4085. * glfwRawMouseMotionSupported to check for support.
  4086. *
  4087. * @param[in] window The window whose input mode to set.
  4088. * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`,
  4089. * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or
  4090. * `GLFW_RAW_MOUSE_MOTION`.
  4091. * @param[in] value The new value of the specified input mode.
  4092. *
  4093. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  4094. * GLFW_INVALID_ENUM, @ref GLFW_PLATFORM_ERROR and @ref
  4095. * GLFW_FEATURE_UNAVAILABLE (see above).
  4096. *
  4097. * @thread_safety This function must only be called from the main thread.
  4098. *
  4099. * @sa @ref glfwGetInputMode
  4100. *
  4101. * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`.
  4102. *
  4103. * @ingroup input
  4104. */
  4105. GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
  4106. /*! @brief Returns whether raw mouse motion is supported.
  4107. *
  4108. * This function returns whether raw mouse motion is supported on the current
  4109. * system. This status does not change after GLFW has been initialized so you
  4110. * only need to check this once. If you attempt to enable raw motion on
  4111. * a system that does not support it, @ref GLFW_PLATFORM_ERROR will be emitted.
  4112. *
  4113. * Raw mouse motion is closer to the actual motion of the mouse across
  4114. * a surface. It is not affected by the scaling and acceleration applied to
  4115. * the motion of the desktop cursor. That processing is suitable for a cursor
  4116. * while raw motion is better for controlling for example a 3D camera. Because
  4117. * of this, raw mouse motion is only provided when the cursor is disabled.
  4118. *
  4119. * @return `true` if raw mouse motion is supported on the current machine,
  4120. * or `false` otherwise.
  4121. *
  4122. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  4123. *
  4124. * @thread_safety This function must only be called from the main thread.
  4125. *
  4126. * @sa @ref raw_mouse_motion
  4127. * @sa @ref glfwSetInputMode
  4128. *
  4129. * @since Added in version 3.3.
  4130. *
  4131. * @ingroup input
  4132. */
  4133. GLFWAPI int glfwRawMouseMotionSupported(void);
  4134. /*! @brief Returns the layout-specific name of the specified printable key.
  4135. *
  4136. * This function returns the name of the specified printable key, encoded as
  4137. * UTF-8. This is typically the character that key would produce without any
  4138. * modifier keys, intended for displaying key bindings to the user. For dead
  4139. * keys, it is typically the diacritic it would add to a character.
  4140. *
  4141. * __Do not use this function__ for [text input](@ref input_char). You will
  4142. * break text input for many languages even if it happens to work for yours.
  4143. *
  4144. * If the key is `0`, the keycode is used to identify the key,
  4145. * otherwise the keycode is ignored. If you specify a non-printable key, or
  4146. * `0` and a keycode that maps to a non-printable key, this
  4147. * function returns `NULL` but does not emit an error.
  4148. *
  4149. * This behavior allows you to always pass in the arguments in the
  4150. * [key callback](@ref input_key) without modification.
  4151. *
  4152. * Names for printable keys depend on keyboard layout, while names for
  4153. * non-printable keys are the same across layouts but depend on the application
  4154. * language and should be localized along with other user interface text.
  4155. *
  4156. * @param[in] key The key to query, or `0`.
  4157. * @param[in] native_key The platform-specifc identifier of the key to query.
  4158. * @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
  4159. *
  4160. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  4161. * GLFW_PLATFORM_ERROR.
  4162. *
  4163. * @remark The contents of the returned string may change when a keyboard
  4164. * layout change event is received.
  4165. *
  4166. * @pointer_lifetime The returned string is allocated and freed by GLFW. You
  4167. * should not free it yourself. It is valid until the library is terminated.
  4168. *
  4169. * @thread_safety This function must only be called from the main thread.
  4170. *
  4171. * @sa @ref input_key_name
  4172. *
  4173. * @since Added in version 3.2.
  4174. *
  4175. * @ingroup input
  4176. */
  4177. GLFWAPI const char* glfwGetKeyName(uint32_t key, int native_key);
  4178. /*! @brief Returns the platform-specific identifier of the specified key.
  4179. *
  4180. * This function returns the platform-specific identifier of the specified key.
  4181. *
  4182. * If the key is `0` or does not exist on the keyboard this
  4183. * method will return `-1`.
  4184. *
  4185. * @param[in] key Any [named key](@ref keys).
  4186. * @return The platform-specific identifier for the key, or `-1` if an
  4187. * [error](@ref error_handling) occurred.
  4188. *
  4189. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  4190. * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
  4191. *
  4192. * @thread_safety This function may be called from any thread.
  4193. *
  4194. * @sa @ref input_key
  4195. *
  4196. * @since Added in version 3.3.
  4197. *
  4198. * @ingroup input
  4199. */
  4200. GLFWAPI int glfwGetNativeKeyForKey(uint32_t key);
  4201. /*! @brief Returns the last reported state of a keyboard key for the specified
  4202. * window.
  4203. *
  4204. * This function returns the last state reported for the specified key to the
  4205. * specified window. The returned state is one of `GLFW_PRESS` or
  4206. * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
  4207. * the key callback.
  4208. *
  4209. * If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns
  4210. * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
  4211. * that key has already been released.
  4212. *
  4213. * The key functions deal with physical keys, with [key tokens](@ref keys)
  4214. * named after their use on the standard US keyboard layout. If you want to
  4215. * input text, use the Unicode character callback instead.
  4216. *
  4217. * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
  4218. * used with this function.
  4219. *
  4220. * __Do not use this function__ to implement [text input](@ref input_char).
  4221. *
  4222. * @param[in] window The desired window.
  4223. * @param[in] key The desired [keyboard key](@ref keys). `0` is
  4224. * not a valid key for this function.
  4225. * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
  4226. *
  4227. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  4228. * GLFW_INVALID_ENUM.
  4229. *
  4230. * @thread_safety This function must only be called from the main thread.
  4231. *
  4232. * @sa @ref input_key
  4233. *
  4234. * @since Added in version 1.0.
  4235. * @glfw3 Added window handle parameter.
  4236. *
  4237. * @ingroup input
  4238. */
  4239. GLFWAPI GLFWKeyAction glfwGetKey(GLFWwindow* window, uint32_t key);
  4240. /*! @brief Returns the last reported state of a mouse button for the specified
  4241. * window.
  4242. *
  4243. * This function returns the last state reported for the specified mouse button
  4244. * to the specified window. The returned state is one of `GLFW_PRESS` or
  4245. * `GLFW_RELEASE`.
  4246. *
  4247. * If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function
  4248. * returns `GLFW_PRESS` the first time you call it for a mouse button that was
  4249. * pressed, even if that mouse button has already been released.
  4250. *
  4251. * @param[in] window The desired window.
  4252. * @param[in] button The desired [mouse button](@ref buttons).
  4253. * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
  4254. *
  4255. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  4256. * GLFW_INVALID_ENUM.
  4257. *
  4258. * @thread_safety This function must only be called from the main thread.
  4259. *
  4260. * @sa @ref input_mouse_button
  4261. *
  4262. * @since Added in version 1.0.
  4263. * @glfw3 Added window handle parameter.
  4264. *
  4265. * @ingroup input
  4266. */
  4267. GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
  4268. /*! @brief Retrieves the position of the cursor relative to the content area of
  4269. * the window.
  4270. *
  4271. * This function returns the position of the cursor, in screen coordinates,
  4272. * relative to the upper-left corner of the content area of the specified
  4273. * window.
  4274. *
  4275. * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
  4276. * position is unbounded and limited only by the minimum and maximum values of
  4277. * a `double`.
  4278. *
  4279. * The coordinate can be converted to their integer equivalents with the
  4280. * `floor` function. Casting directly to an integer type works for positive
  4281. * coordinates, but fails for negative ones.
  4282. *
  4283. * Any or all of the position arguments may be `NULL`. If an error occurs, all
  4284. * non-`NULL` position arguments will be set to zero.
  4285. *
  4286. * @param[in] window The desired window.
  4287. * @param[out] xpos Where to store the cursor x-coordinate, relative to the
  4288. * left edge of the content area, or `NULL`.
  4289. * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
  4290. * top edge of the content area, or `NULL`.
  4291. *
  4292. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  4293. * GLFW_PLATFORM_ERROR.
  4294. *
  4295. * @thread_safety This function must only be called from the main thread.
  4296. *
  4297. * @sa @ref cursor_pos
  4298. * @sa @ref glfwSetCursorPos
  4299. *
  4300. * @since Added in version 3.0. Replaces `glfwGetMousePos`.
  4301. *
  4302. * @ingroup input
  4303. */
  4304. GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
  4305. /*! @brief Sets the position of the cursor, relative to the content area of the
  4306. * window.
  4307. *
  4308. * This function sets the position, in screen coordinates, of the cursor
  4309. * relative to the upper-left corner of the content area of the specified
  4310. * window. The window must have input focus. If the window does not have
  4311. * input focus when this function is called, it fails silently.
  4312. *
  4313. * __Do not use this function__ to implement things like camera controls. GLFW
  4314. * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
  4315. * cursor, transparently re-centers it and provides unconstrained cursor
  4316. * motion. See @ref glfwSetInputMode for more information.
  4317. *
  4318. * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
  4319. * unconstrained and limited only by the minimum and maximum values of
  4320. * a `double`.
  4321. *
  4322. * @param[in] window The desired window.
  4323. * @param[in] xpos The desired x-coordinate, relative to the left edge of the
  4324. * content area.
  4325. * @param[in] ypos The desired y-coordinate, relative to the top edge of the
  4326. * content area.
  4327. *
  4328. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  4329. * GLFW_PLATFORM_ERROR.
  4330. *
  4331. * @remark @wayland This function will only work when the cursor mode is
  4332. * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing.
  4333. *
  4334. * @thread_safety This function must only be called from the main thread.
  4335. *
  4336. * @sa @ref cursor_pos
  4337. * @sa @ref glfwGetCursorPos
  4338. *
  4339. * @since Added in version 3.0. Replaces `glfwSetMousePos`.
  4340. *
  4341. * @ingroup input
  4342. */
  4343. GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
  4344. /*! @brief Creates a custom cursor.
  4345. *
  4346. * Creates a new custom cursor image that can be set for a window with @ref
  4347. * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
  4348. * Any remaining cursors are destroyed by @ref glfwTerminate.
  4349. *
  4350. * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
  4351. * bits per channel with the red channel first. They are arranged canonically
  4352. * as packed sequential rows, starting from the top-left corner.
  4353. *
  4354. * The cursor hotspot is specified in pixels, relative to the upper-left corner
  4355. * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
  4356. * points to the right and the Y-axis points down.
  4357. *
  4358. * @param[in] image The desired cursor image.
  4359. * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
  4360. * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
  4361. * @param[in] count The number of images. Used on Cocoa for retina cursors. The first image should be the 1:1 scale image.
  4362. * @return The handle of the created cursor, or `NULL` if an
  4363. * [error](@ref error_handling) occurred.
  4364. *
  4365. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  4366. * GLFW_PLATFORM_ERROR.
  4367. *
  4368. * @pointer_lifetime The specified image data is copied before this function
  4369. * returns.
  4370. *
  4371. * @thread_safety This function must only be called from the main thread.
  4372. *
  4373. * @sa @ref cursor_object
  4374. * @sa @ref glfwDestroyCursor
  4375. * @sa @ref glfwCreateStandardCursor
  4376. *
  4377. * @since Added in version 3.1. Changed in 4.0 to add the count parameter.
  4378. *
  4379. * @ingroup input
  4380. */
  4381. GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot, int count);
  4382. /*! @brief Creates a cursor with a standard shape.
  4383. *
  4384. * Returns a cursor with a [standard shape](@ref shapes), that can be set for
  4385. * a window with @ref glfwSetCursor.
  4386. *
  4387. * @param[in] shape One of the [standard shapes](@ref shapes).
  4388. * @return A new cursor ready to use or `NULL` if an
  4389. * [error](@ref error_handling) occurred.
  4390. *
  4391. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  4392. * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
  4393. *
  4394. * @thread_safety This function must only be called from the main thread.
  4395. *
  4396. * @sa @ref cursor_object
  4397. * @sa @ref glfwCreateCursor
  4398. *
  4399. * @since Added in version 3.1.
  4400. *
  4401. * @ingroup input
  4402. */
  4403. GLFWAPI GLFWcursor* glfwCreateStandardCursor(GLFWCursorShape shape);
  4404. /*! @brief Destroys a cursor.
  4405. *
  4406. * This function destroys a cursor previously created with @ref
  4407. * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
  4408. * glfwTerminate.
  4409. *
  4410. * If the specified cursor is current for any window, that window will be
  4411. * reverted to the default cursor. This does not affect the cursor mode.
  4412. *
  4413. * @param[in] cursor The cursor object to destroy.
  4414. *
  4415. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  4416. * GLFW_PLATFORM_ERROR.
  4417. *
  4418. * @reentrancy This function must not be called from a callback.
  4419. *
  4420. * @thread_safety This function must only be called from the main thread.
  4421. *
  4422. * @sa @ref cursor_object
  4423. * @sa @ref glfwCreateCursor
  4424. *
  4425. * @since Added in version 3.1.
  4426. *
  4427. * @ingroup input
  4428. */
  4429. GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
  4430. /*! @brief Sets the cursor for the window.
  4431. *
  4432. * This function sets the cursor image to be used when the cursor is over the
  4433. * content area of the specified window. The set cursor will only be visible
  4434. * when the [cursor mode](@ref cursor_mode) of the window is
  4435. * `GLFW_CURSOR_NORMAL`.
  4436. *
  4437. * On some platforms, the set cursor may not be visible unless the window also
  4438. * has input focus.
  4439. *
  4440. * @param[in] window The window to set the cursor for.
  4441. * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
  4442. * arrow cursor.
  4443. *
  4444. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  4445. * GLFW_PLATFORM_ERROR.
  4446. *
  4447. * @thread_safety This function must only be called from the main thread.
  4448. *
  4449. * @sa @ref cursor_object
  4450. *
  4451. * @since Added in version 3.1.
  4452. *
  4453. * @ingroup input
  4454. */
  4455. GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
  4456. /*! @brief Sets the callback for handling keyboard events.
  4457. *
  4458. * @ingroup input
  4459. */
  4460. GLFWAPI GLFWkeyboardfun glfwSetKeyboardCallback(GLFWwindow* window, GLFWkeyboardfun callback);
  4461. /*! @brief Notifies the OS Input Method Event system of changes to application input state
  4462. *
  4463. * Used to notify the IME system of changes in state such as focus gained/lost
  4464. * and text cursor position.
  4465. *
  4466. * @param ev: What data to notify.
  4467. *
  4468. * @ingroup input
  4469. * @since Added in version 4.0
  4470. */
  4471. GLFWAPI void glfwUpdateIMEState(GLFWwindow* window, const GLFWIMEUpdateEvent *ev);
  4472. /*! @brief Sets the mouse button callback.
  4473. *
  4474. * This function sets the mouse button callback of the specified window, which
  4475. * is called when a mouse button is pressed or released.
  4476. *
  4477. * When a window loses input focus, it will generate synthetic mouse button
  4478. * release events for all pressed mouse buttons. You can tell these events
  4479. * from user-generated events by the fact that the synthetic ones are generated
  4480. * after the focus loss event has been processed, i.e. after the
  4481. * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
  4482. *
  4483. * @param[in] window The window whose callback to set.
  4484. * @param[in] callback The new callback, or `NULL` to remove the currently set
  4485. * callback.
  4486. * @return The previously set callback, or `NULL` if no callback was set or the
  4487. * library had not been [initialized](@ref intro_init).
  4488. *
  4489. * @callback_signature
  4490. * @code
  4491. * void function_name(GLFWwindow* window, int button, int action, int mods)
  4492. * @endcode
  4493. * For more information about the callback parameters, see the
  4494. * [function pointer type](@ref GLFWmousebuttonfun).
  4495. *
  4496. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  4497. *
  4498. * @thread_safety This function must only be called from the main thread.
  4499. *
  4500. * @sa @ref input_mouse_button
  4501. *
  4502. * @since Added in version 1.0.
  4503. * @glfw3 Added window handle parameter and return value.
  4504. *
  4505. * @ingroup input
  4506. */
  4507. GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun callback);
  4508. /*! @brief Sets the cursor position callback.
  4509. *
  4510. * This function sets the cursor position callback of the specified window,
  4511. * which is called when the cursor is moved. The callback is provided with the
  4512. * position, in screen coordinates, relative to the upper-left corner of the
  4513. * content area of the window.
  4514. *
  4515. * @param[in] window The window whose callback to set.
  4516. * @param[in] callback The new callback, or `NULL` to remove the currently set
  4517. * callback.
  4518. * @return The previously set callback, or `NULL` if no callback was set or the
  4519. * library had not been [initialized](@ref intro_init).
  4520. *
  4521. * @callback_signature
  4522. * @code
  4523. * void function_name(GLFWwindow* window, double xpos, double ypos);
  4524. * @endcode
  4525. * For more information about the callback parameters, see the
  4526. * [function pointer type](@ref GLFWcursorposfun).
  4527. *
  4528. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  4529. *
  4530. * @thread_safety This function must only be called from the main thread.
  4531. *
  4532. * @sa @ref cursor_pos
  4533. *
  4534. * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`.
  4535. *
  4536. * @ingroup input
  4537. */
  4538. GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun callback);
  4539. /*! @brief Sets the cursor enter/leave callback.
  4540. *
  4541. * This function sets the cursor boundary crossing callback of the specified
  4542. * window, which is called when the cursor enters or leaves the content area of
  4543. * the window.
  4544. *
  4545. * @param[in] window The window whose callback to set.
  4546. * @param[in] callback The new callback, or `NULL` to remove the currently set
  4547. * callback.
  4548. * @return The previously set callback, or `NULL` if no callback was set or the
  4549. * library had not been [initialized](@ref intro_init).
  4550. *
  4551. * @callback_signature
  4552. * @code
  4553. * void function_name(GLFWwindow* window, int entered)
  4554. * @endcode
  4555. * For more information about the callback parameters, see the
  4556. * [function pointer type](@ref GLFWcursorenterfun).
  4557. *
  4558. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  4559. *
  4560. * @thread_safety This function must only be called from the main thread.
  4561. *
  4562. * @sa @ref cursor_enter
  4563. *
  4564. * @since Added in version 3.0.
  4565. *
  4566. * @ingroup input
  4567. */
  4568. GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun callback);
  4569. /*! @brief Sets the scroll callback.
  4570. *
  4571. * This function sets the scroll callback of the specified window, which is
  4572. * called when a scrolling device is used, such as a mouse wheel or scrolling
  4573. * area of a touchpad.
  4574. *
  4575. * The scroll callback receives all scrolling input, like that from a mouse
  4576. * wheel or a touchpad scrolling area.
  4577. *
  4578. * @param[in] window The window whose callback to set.
  4579. * @param[in] callback The new scroll callback, or `NULL` to remove the
  4580. * currently set callback.
  4581. * @return The previously set callback, or `NULL` if no callback was set or the
  4582. * library had not been [initialized](@ref intro_init).
  4583. *
  4584. * @callback_signature
  4585. * @code
  4586. * void function_name(GLFWwindow* window, double xoffset, double yoffset)
  4587. * @endcode
  4588. * For more information about the callback parameters, see the
  4589. * [function pointer type](@ref GLFWscrollfun).
  4590. *
  4591. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  4592. *
  4593. * @thread_safety This function must only be called from the main thread.
  4594. *
  4595. * @sa @ref scrolling
  4596. *
  4597. * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`.
  4598. *
  4599. * @ingroup input
  4600. */
  4601. GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback);
  4602. /*! @brief Sets the path drop callback.
  4603. *
  4604. * This function sets the path drop callback of the specified window, which is
  4605. * called when one or more dragged paths are dropped on the window.
  4606. *
  4607. * Because the path array and its strings may have been generated specifically
  4608. * for that event, they are not guaranteed to be valid after the callback has
  4609. * returned. If you wish to use them after the callback returns, you need to
  4610. * make a deep copy.
  4611. *
  4612. * @param[in] window The window whose callback to set.
  4613. * @param[in] callback The new file drop callback, or `NULL` to remove the
  4614. * currently set callback.
  4615. * @return The previously set callback, or `NULL` if no callback was set or the
  4616. * library had not been [initialized](@ref intro_init).
  4617. *
  4618. * @callback_signature
  4619. * @code
  4620. * void function_name(GLFWwindow* window, int path_count, const char* paths[])
  4621. * @endcode
  4622. * For more information about the callback parameters, see the
  4623. * [function pointer type](@ref GLFWdropfun).
  4624. *
  4625. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  4626. *
  4627. * @remark @wayland File drop is currently unimplemented.
  4628. *
  4629. * @thread_safety This function must only be called from the main thread.
  4630. *
  4631. * @sa @ref path_drop
  4632. *
  4633. * @since Added in version 3.1.
  4634. *
  4635. * @ingroup input
  4636. */
  4637. GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun callback);
  4638. GLFWAPI GLFWliveresizefun glfwSetLiveResizeCallback(GLFWwindow* window, GLFWliveresizefun callback);
  4639. /*! @brief Returns whether the specified joystick is present.
  4640. *
  4641. * This function returns whether the specified joystick is present.
  4642. *
  4643. * There is no need to call this function before other functions that accept
  4644. * a joystick ID, as they all check for presence before performing any other
  4645. * work.
  4646. *
  4647. * @param[in] jid The [joystick](@ref joysticks) to query.
  4648. * @return `true` if the joystick is present, or `false` otherwise.
  4649. *
  4650. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  4651. * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
  4652. *
  4653. * @thread_safety This function must only be called from the main thread.
  4654. *
  4655. * @sa @ref joystick
  4656. *
  4657. * @since Added in version 3.0. Replaces `glfwGetJoystickParam`.
  4658. *
  4659. * @ingroup input
  4660. */
  4661. GLFWAPI int glfwJoystickPresent(int jid);
  4662. /*! @brief Returns the values of all axes of the specified joystick.
  4663. *
  4664. * This function returns the values of all axes of the specified joystick.
  4665. * Each element in the array is a value between -1.0 and 1.0.
  4666. *
  4667. * If the specified joystick is not present this function will return `NULL`
  4668. * but will not generate an error. This can be used instead of first calling
  4669. * @ref glfwJoystickPresent.
  4670. *
  4671. * @param[in] jid The [joystick](@ref joysticks) to query.
  4672. * @param[out] count Where to store the number of axis values in the returned
  4673. * array. This is set to zero if the joystick is not present or an error
  4674. * occurred.
  4675. * @return An array of axis values, or `NULL` if the joystick is not present or
  4676. * an [error](@ref error_handling) occurred.
  4677. *
  4678. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  4679. * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
  4680. *
  4681. * @pointer_lifetime The returned array is allocated and freed by GLFW. You
  4682. * should not free it yourself. It is valid until the specified joystick is
  4683. * disconnected or the library is terminated.
  4684. *
  4685. * @thread_safety This function must only be called from the main thread.
  4686. *
  4687. * @sa @ref joystick_axis
  4688. *
  4689. * @since Added in version 3.0. Replaces `glfwGetJoystickPos`.
  4690. *
  4691. * @ingroup input
  4692. */
  4693. GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);
  4694. /*! @brief Returns the state of all buttons of the specified joystick.
  4695. *
  4696. * This function returns the state of all buttons of the specified joystick.
  4697. * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
  4698. *
  4699. * For backward compatibility with earlier versions that did not have @ref
  4700. * glfwGetJoystickHats, the button array also includes all hats, each
  4701. * represented as four buttons. The hats are in the same order as returned by
  4702. * __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and
  4703. * _left_. To disable these extra buttons, set the @ref
  4704. * GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization.
  4705. *
  4706. * If the specified joystick is not present this function will return `NULL`
  4707. * but will not generate an error. This can be used instead of first calling
  4708. * @ref glfwJoystickPresent.
  4709. *
  4710. * @param[in] jid The [joystick](@ref joysticks) to query.
  4711. * @param[out] count Where to store the number of button states in the returned
  4712. * array. This is set to zero if the joystick is not present or an error
  4713. * occurred.
  4714. * @return An array of button states, or `NULL` if the joystick is not present
  4715. * or an [error](@ref error_handling) occurred.
  4716. *
  4717. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  4718. * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
  4719. *
  4720. * @pointer_lifetime The returned array is allocated and freed by GLFW. You
  4721. * should not free it yourself. It is valid until the specified joystick is
  4722. * disconnected or the library is terminated.
  4723. *
  4724. * @thread_safety This function must only be called from the main thread.
  4725. *
  4726. * @sa @ref joystick_button
  4727. *
  4728. * @since Added in version 2.2.
  4729. * @glfw3 Changed to return a dynamic array.
  4730. *
  4731. * @ingroup input
  4732. */
  4733. GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count);
  4734. /*! @brief Returns the state of all hats of the specified joystick.
  4735. *
  4736. * This function returns the state of all hats of the specified joystick.
  4737. * Each element in the array is one of the following values:
  4738. *
  4739. * Name | Value
  4740. * ---- | -----
  4741. * `GLFW_HAT_CENTERED` | 0
  4742. * `GLFW_HAT_UP` | 1
  4743. * `GLFW_HAT_RIGHT` | 2
  4744. * `GLFW_HAT_DOWN` | 4
  4745. * `GLFW_HAT_LEFT` | 8
  4746. * `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP`
  4747. * `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN`
  4748. * `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP`
  4749. * `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN`
  4750. *
  4751. * The diagonal directions are bitwise combinations of the primary (up, right,
  4752. * down and left) directions and you can test for these individually by ANDing
  4753. * it with the corresponding direction.
  4754. *
  4755. * @code
  4756. * if (hats[2] & GLFW_HAT_RIGHT)
  4757. * {
  4758. * // State of hat 2 could be right-up, right or right-down
  4759. * }
  4760. * @endcode
  4761. *
  4762. * If the specified joystick is not present this function will return `NULL`
  4763. * but will not generate an error. This can be used instead of first calling
  4764. * @ref glfwJoystickPresent.
  4765. *
  4766. * @param[in] jid The [joystick](@ref joysticks) to query.
  4767. * @param[out] count Where to store the number of hat states in the returned
  4768. * array. This is set to zero if the joystick is not present or an error
  4769. * occurred.
  4770. * @return An array of hat states, or `NULL` if the joystick is not present
  4771. * or an [error](@ref error_handling) occurred.
  4772. *
  4773. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  4774. * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
  4775. *
  4776. * @pointer_lifetime The returned array is allocated and freed by GLFW. You
  4777. * should not free it yourself. It is valid until the specified joystick is
  4778. * disconnected, this function is called again for that joystick or the library
  4779. * is terminated.
  4780. *
  4781. * @thread_safety This function must only be called from the main thread.
  4782. *
  4783. * @sa @ref joystick_hat
  4784. *
  4785. * @since Added in version 3.3.
  4786. *
  4787. * @ingroup input
  4788. */
  4789. GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count);
  4790. /*! @brief Returns the name of the specified joystick.
  4791. *
  4792. * This function returns the name, encoded as UTF-8, of the specified joystick.
  4793. * The returned string is allocated and freed by GLFW. You should not free it
  4794. * yourself.
  4795. *
  4796. * If the specified joystick is not present this function will return `NULL`
  4797. * but will not generate an error. This can be used instead of first calling
  4798. * @ref glfwJoystickPresent.
  4799. *
  4800. * @param[in] jid The [joystick](@ref joysticks) to query.
  4801. * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
  4802. * is not present or an [error](@ref error_handling) occurred.
  4803. *
  4804. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  4805. * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
  4806. *
  4807. * @pointer_lifetime The returned string is allocated and freed by GLFW. You
  4808. * should not free it yourself. It is valid until the specified joystick is
  4809. * disconnected or the library is terminated.
  4810. *
  4811. * @thread_safety This function must only be called from the main thread.
  4812. *
  4813. * @sa @ref joystick_name
  4814. *
  4815. * @since Added in version 3.0.
  4816. *
  4817. * @ingroup input
  4818. */
  4819. GLFWAPI const char* glfwGetJoystickName(int jid);
  4820. /*! @brief Returns the SDL compatible GUID of the specified joystick.
  4821. *
  4822. * This function returns the SDL compatible GUID, as a UTF-8 encoded
  4823. * hexadecimal string, of the specified joystick. The returned string is
  4824. * allocated and freed by GLFW. You should not free it yourself.
  4825. *
  4826. * The GUID is what connects a joystick to a gamepad mapping. A connected
  4827. * joystick will always have a GUID even if there is no gamepad mapping
  4828. * assigned to it.
  4829. *
  4830. * If the specified joystick is not present this function will return `NULL`
  4831. * but will not generate an error. This can be used instead of first calling
  4832. * @ref glfwJoystickPresent.
  4833. *
  4834. * The GUID uses the format introduced in SDL 2.0.5. This GUID tries to
  4835. * uniquely identify the make and model of a joystick but does not identify
  4836. * a specific unit, e.g. all wired Xbox 360 controllers will have the same
  4837. * GUID on that platform. The GUID for a unit may vary between platforms
  4838. * depending on what hardware information the platform specific APIs provide.
  4839. *
  4840. * @param[in] jid The [joystick](@ref joysticks) to query.
  4841. * @return The UTF-8 encoded GUID of the joystick, or `NULL` if the joystick
  4842. * is not present or an [error](@ref error_handling) occurred.
  4843. *
  4844. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  4845. * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
  4846. *
  4847. * @pointer_lifetime The returned string is allocated and freed by GLFW. You
  4848. * should not free it yourself. It is valid until the specified joystick is
  4849. * disconnected or the library is terminated.
  4850. *
  4851. * @thread_safety This function must only be called from the main thread.
  4852. *
  4853. * @sa @ref gamepad
  4854. *
  4855. * @since Added in version 3.3.
  4856. *
  4857. * @ingroup input
  4858. */
  4859. GLFWAPI const char* glfwGetJoystickGUID(int jid);
  4860. /*! @brief Sets the user pointer of the specified joystick.
  4861. *
  4862. * This function sets the user-defined pointer of the specified joystick. The
  4863. * current value is retained until the joystick is disconnected. The initial
  4864. * value is `NULL`.
  4865. *
  4866. * This function may be called from the joystick callback, even for a joystick
  4867. * that is being disconnected.
  4868. *
  4869. * @param[in] jid The joystick whose pointer to set.
  4870. * @param[in] pointer The new value.
  4871. *
  4872. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  4873. *
  4874. * @thread_safety This function may be called from any thread. Access is not
  4875. * synchronized.
  4876. *
  4877. * @sa @ref joystick_userptr
  4878. * @sa @ref glfwGetJoystickUserPointer
  4879. *
  4880. * @since Added in version 3.3.
  4881. *
  4882. * @ingroup input
  4883. */
  4884. GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer);
  4885. /*! @brief Returns the user pointer of the specified joystick.
  4886. *
  4887. * This function returns the current value of the user-defined pointer of the
  4888. * specified joystick. The initial value is `NULL`.
  4889. *
  4890. * This function may be called from the joystick callback, even for a joystick
  4891. * that is being disconnected.
  4892. *
  4893. * @param[in] jid The joystick whose pointer to return.
  4894. *
  4895. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  4896. *
  4897. * @thread_safety This function may be called from any thread. Access is not
  4898. * synchronized.
  4899. *
  4900. * @sa @ref joystick_userptr
  4901. * @sa @ref glfwSetJoystickUserPointer
  4902. *
  4903. * @since Added in version 3.3.
  4904. *
  4905. * @ingroup input
  4906. */
  4907. GLFWAPI void* glfwGetJoystickUserPointer(int jid);
  4908. /*! @brief Returns whether the specified joystick has a gamepad mapping.
  4909. *
  4910. * This function returns whether the specified joystick is both present and has
  4911. * a gamepad mapping.
  4912. *
  4913. * If the specified joystick is present but does not have a gamepad mapping
  4914. * this function will return `false` but will not generate an error. Call
  4915. * @ref glfwJoystickPresent to check if a joystick is present regardless of
  4916. * whether it has a mapping.
  4917. *
  4918. * @param[in] jid The [joystick](@ref joysticks) to query.
  4919. * @return `true` if a joystick is both present and has a gamepad mapping,
  4920. * or `false` otherwise.
  4921. *
  4922. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  4923. * GLFW_INVALID_ENUM.
  4924. *
  4925. * @thread_safety This function must only be called from the main thread.
  4926. *
  4927. * @sa @ref gamepad
  4928. * @sa @ref glfwGetGamepadState
  4929. *
  4930. * @since Added in version 3.3.
  4931. *
  4932. * @ingroup input
  4933. */
  4934. GLFWAPI int glfwJoystickIsGamepad(int jid);
  4935. /*! @brief Sets the joystick configuration callback.
  4936. *
  4937. * This function sets the joystick configuration callback, or removes the
  4938. * currently set callback. This is called when a joystick is connected to or
  4939. * disconnected from the system.
  4940. *
  4941. * For joystick connection and disconnection events to be delivered on all
  4942. * platforms, you need to call one of the [event processing](@ref events)
  4943. * functions. Joystick disconnection may also be detected and the callback
  4944. * called by joystick functions. The function will then return whatever it
  4945. * returns if the joystick is not present.
  4946. *
  4947. * @param[in] callback The new callback, or `NULL` to remove the currently set
  4948. * callback.
  4949. * @return The previously set callback, or `NULL` if no callback was set or the
  4950. * library had not been [initialized](@ref intro_init).
  4951. *
  4952. * @callback_signature
  4953. * @code
  4954. * void function_name(int jid, int event)
  4955. * @endcode
  4956. * For more information about the callback parameters, see the
  4957. * [function pointer type](@ref GLFWjoystickfun).
  4958. *
  4959. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  4960. *
  4961. * @thread_safety This function must only be called from the main thread.
  4962. *
  4963. * @sa @ref joystick_event
  4964. *
  4965. * @since Added in version 3.2.
  4966. *
  4967. * @ingroup input
  4968. */
  4969. GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback);
  4970. /*! @brief Adds the specified SDL_GameControllerDB gamepad mappings.
  4971. *
  4972. * This function parses the specified ASCII encoded string and updates the
  4973. * internal list with any gamepad mappings it finds. This string may
  4974. * contain either a single gamepad mapping or many mappings separated by
  4975. * newlines. The parser supports the full format of the `gamecontrollerdb.txt`
  4976. * source file including empty lines and comments.
  4977. *
  4978. * See @ref gamepad_mapping for a description of the format.
  4979. *
  4980. * If there is already a gamepad mapping for a given GUID in the internal list,
  4981. * it will be replaced by the one passed to this function. If the library is
  4982. * terminated and re-initialized the internal list will revert to the built-in
  4983. * default.
  4984. *
  4985. * @param[in] string The string containing the gamepad mappings.
  4986. * @return `true` if successful, or `false` if an
  4987. * [error](@ref error_handling) occurred.
  4988. *
  4989. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  4990. * GLFW_INVALID_VALUE.
  4991. *
  4992. * @thread_safety This function must only be called from the main thread.
  4993. *
  4994. * @sa @ref gamepad
  4995. * @sa @ref glfwJoystickIsGamepad
  4996. * @sa @ref glfwGetGamepadName
  4997. *
  4998. * @since Added in version 3.3.
  4999. *
  5000. * @ingroup input
  5001. */
  5002. GLFWAPI int glfwUpdateGamepadMappings(const char* string);
  5003. /*! @brief Returns the human-readable gamepad name for the specified joystick.
  5004. *
  5005. * This function returns the human-readable name of the gamepad from the
  5006. * gamepad mapping assigned to the specified joystick.
  5007. *
  5008. * If the specified joystick is not present or does not have a gamepad mapping
  5009. * this function will return `NULL` but will not generate an error. Call
  5010. * @ref glfwJoystickPresent to check whether it is present regardless of
  5011. * whether it has a mapping.
  5012. *
  5013. * @param[in] jid The [joystick](@ref joysticks) to query.
  5014. * @return The UTF-8 encoded name of the gamepad, or `NULL` if the
  5015. * joystick is not present, does not have a mapping or an
  5016. * [error](@ref error_handling) occurred.
  5017. *
  5018. * @pointer_lifetime The returned string is allocated and freed by GLFW. You
  5019. * should not free it yourself. It is valid until the specified joystick is
  5020. * disconnected, the gamepad mappings are updated or the library is terminated.
  5021. *
  5022. * @thread_safety This function must only be called from the main thread.
  5023. *
  5024. * @sa @ref gamepad
  5025. * @sa @ref glfwJoystickIsGamepad
  5026. *
  5027. * @since Added in version 3.3.
  5028. *
  5029. * @ingroup input
  5030. */
  5031. GLFWAPI const char* glfwGetGamepadName(int jid);
  5032. /*! @brief Retrieves the state of the specified joystick remapped as a gamepad.
  5033. *
  5034. * This function retrieves the state of the specified joystick remapped to
  5035. * an Xbox-like gamepad.
  5036. *
  5037. * If the specified joystick is not present or does not have a gamepad mapping
  5038. * this function will return `false` but will not generate an error. Call
  5039. * @ref glfwJoystickPresent to check whether it is present regardless of
  5040. * whether it has a mapping.
  5041. *
  5042. * The Guide button may not be available for input as it is often hooked by the
  5043. * system or the Steam client.
  5044. *
  5045. * Not all devices have all the buttons or axes provided by @ref
  5046. * GLFWgamepadstate. Unavailable buttons and axes will always report
  5047. * `GLFW_RELEASE` and 0.0 respectively.
  5048. *
  5049. * @param[in] jid The [joystick](@ref joysticks) to query.
  5050. * @param[out] state The gamepad input state of the joystick.
  5051. * @return `true` if successful, or `false` if no joystick is
  5052. * connected, it has no gamepad mapping or an [error](@ref error_handling)
  5053. * occurred.
  5054. *
  5055. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  5056. * GLFW_INVALID_ENUM.
  5057. *
  5058. * @thread_safety This function must only be called from the main thread.
  5059. *
  5060. * @sa @ref gamepad
  5061. * @sa @ref glfwUpdateGamepadMappings
  5062. * @sa @ref glfwJoystickIsGamepad
  5063. *
  5064. * @since Added in version 3.3.
  5065. *
  5066. * @ingroup input
  5067. */
  5068. GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
  5069. GLFWAPI void glfwSetClipboardDataTypes(GLFWClipboardType clipboard_type, const char* const *mime_types, size_t num_mime_types, GLFWclipboarditerfun get_iter);
  5070. GLFWAPI void glfwGetClipboard(GLFWClipboardType clipboard_type, const char* mime_type, GLFWclipboardwritedatafun write_data, void *object);
  5071. /*! @brief Returns the GLFW time.
  5072. *
  5073. * This function returns the current GLFW time, in seconds. Unless the time
  5074. * has been set using @ref glfwSetTime it measures time elapsed since GLFW was
  5075. * initialized.
  5076. *
  5077. * The resolution of the timer is system dependent, but is usually on the order
  5078. * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
  5079. * time source on each supported platform.
  5080. *
  5081. * @return The current time, in seconds, or zero if an
  5082. * [error](@ref error_handling) occurred.
  5083. *
  5084. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  5085. *
  5086. * @thread_safety This function may be called from any thread. Reading and
  5087. * writing of the internal base time is not atomic, so it needs to be
  5088. * externally synchronized with calls to @ref glfwSetTime.
  5089. *
  5090. * @sa @ref time
  5091. *
  5092. * @since Added in version 1.0.
  5093. *
  5094. * @ingroup input
  5095. */
  5096. GLFWAPI monotonic_t glfwGetTime(void);
  5097. /*! @brief Makes the context of the specified window current for the calling
  5098. * thread.
  5099. *
  5100. * This function makes the OpenGL or OpenGL ES context of the specified window
  5101. * current on the calling thread. A context must only be made current on
  5102. * a single thread at a time and each thread can have only a single current
  5103. * context at a time.
  5104. *
  5105. * When moving a context between threads, you must make it non-current on the
  5106. * old thread before making it current on the new one.
  5107. *
  5108. * By default, making a context non-current implicitly forces a pipeline flush.
  5109. * On machines that support `GL_KHR_context_flush_control`, you can control
  5110. * whether a context performs this flush by setting the
  5111. * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint)
  5112. * hint.
  5113. *
  5114. * The specified window must have an OpenGL or OpenGL ES context. Specifying
  5115. * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
  5116. * error.
  5117. *
  5118. * @param[in] window The window whose context to make current, or `NULL` to
  5119. * detach the current context.
  5120. *
  5121. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  5122. * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
  5123. *
  5124. * @thread_safety This function may be called from any thread.
  5125. *
  5126. * @sa @ref context_current
  5127. * @sa @ref glfwGetCurrentContext
  5128. *
  5129. * @since Added in version 3.0.
  5130. *
  5131. * @ingroup context
  5132. */
  5133. GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
  5134. /*! @brief Returns the window whose context is current on the calling thread.
  5135. *
  5136. * This function returns the window whose OpenGL or OpenGL ES context is
  5137. * current on the calling thread.
  5138. *
  5139. * @return The window whose context is current, or `NULL` if no window's
  5140. * context is current.
  5141. *
  5142. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  5143. *
  5144. * @thread_safety This function may be called from any thread.
  5145. *
  5146. * @sa @ref context_current
  5147. * @sa @ref glfwMakeContextCurrent
  5148. *
  5149. * @since Added in version 3.0.
  5150. *
  5151. * @ingroup context
  5152. */
  5153. GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
  5154. /*! @brief Swaps the front and back buffers of the specified window.
  5155. *
  5156. * This function swaps the front and back buffers of the specified window when
  5157. * rendering with OpenGL or OpenGL ES. If the swap interval is greater than
  5158. * zero, the GPU driver waits the specified number of screen updates before
  5159. * swapping the buffers.
  5160. *
  5161. * The specified window must have an OpenGL or OpenGL ES context. Specifying
  5162. * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
  5163. * error.
  5164. *
  5165. * This function does not apply to Vulkan. If you are rendering with Vulkan,
  5166. * see `vkQueuePresentKHR` instead.
  5167. *
  5168. * @param[in] window The window whose buffers to swap.
  5169. *
  5170. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  5171. * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
  5172. *
  5173. * @remark __EGL:__ The context of the specified window must be current on the
  5174. * calling thread.
  5175. *
  5176. * @thread_safety This function may be called from any thread.
  5177. *
  5178. * @sa @ref buffer_swap
  5179. * @sa @ref glfwSwapInterval
  5180. *
  5181. * @since Added in version 1.0.
  5182. * @glfw3 Added window handle parameter.
  5183. *
  5184. * @ingroup window
  5185. */
  5186. GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
  5187. /*! @brief Sets the swap interval for the current context.
  5188. *
  5189. * This function sets the swap interval for the current OpenGL or OpenGL ES
  5190. * context, i.e. the number of screen updates to wait from the time @ref
  5191. * glfwSwapBuffers was called before swapping the buffers and returning. This
  5192. * is sometimes called _vertical synchronization_, _vertical retrace
  5193. * synchronization_ or just _vsync_.
  5194. *
  5195. * A context that supports either of the `WGL_EXT_swap_control_tear` and
  5196. * `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap
  5197. * intervals, which allows the driver to swap immediately even if a frame
  5198. * arrives a little bit late. You can check for these extensions with @ref
  5199. * glfwExtensionSupported.
  5200. *
  5201. * A context must be current on the calling thread. Calling this function
  5202. * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
  5203. *
  5204. * This function does not apply to Vulkan. If you are rendering with Vulkan,
  5205. * see the present mode of your swapchain instead.
  5206. *
  5207. * @param[in] interval The minimum number of screen updates to wait for
  5208. * until the buffers are swapped by @ref glfwSwapBuffers.
  5209. *
  5210. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  5211. * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
  5212. *
  5213. * @remark This function is not called during context creation, leaving the
  5214. * swap interval set to whatever is the default on that platform. This is done
  5215. * because some swap interval extensions used by GLFW do not allow the swap
  5216. * interval to be reset to zero once it has been set to a non-zero value.
  5217. *
  5218. * @remark Some GPU drivers do not honor the requested swap interval, either
  5219. * because of a user setting that overrides the application's request or due to
  5220. * bugs in the driver.
  5221. *
  5222. * @thread_safety This function may be called from any thread.
  5223. *
  5224. * @sa @ref buffer_swap
  5225. * @sa @ref glfwSwapBuffers
  5226. *
  5227. * @since Added in version 1.0.
  5228. *
  5229. * @ingroup context
  5230. */
  5231. GLFWAPI void glfwSwapInterval(int interval);
  5232. /*! @brief Returns whether the specified extension is available.
  5233. *
  5234. * This function returns whether the specified
  5235. * [API extension](@ref context_glext) is supported by the current OpenGL or
  5236. * OpenGL ES context. It searches both for client API extension and context
  5237. * creation API extensions.
  5238. *
  5239. * A context must be current on the calling thread. Calling this function
  5240. * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
  5241. *
  5242. * As this functions retrieves and searches one or more extension strings each
  5243. * call, it is recommended that you cache its results if it is going to be used
  5244. * frequently. The extension strings will not change during the lifetime of
  5245. * a context, so there is no danger in doing this.
  5246. *
  5247. * This function does not apply to Vulkan. If you are using Vulkan, see @ref
  5248. * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
  5249. * and `vkEnumerateDeviceExtensionProperties` instead.
  5250. *
  5251. * @param[in] extension The ASCII encoded name of the extension.
  5252. * @return `true` if the extension is available, or `false`
  5253. * otherwise.
  5254. *
  5255. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  5256. * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
  5257. * GLFW_PLATFORM_ERROR.
  5258. *
  5259. * @thread_safety This function may be called from any thread.
  5260. *
  5261. * @sa @ref context_glext
  5262. * @sa @ref glfwGetProcAddress
  5263. *
  5264. * @since Added in version 1.0.
  5265. *
  5266. * @ingroup context
  5267. */
  5268. GLFWAPI int glfwExtensionSupported(const char* extension);
  5269. /*! @brief Returns the address of the specified function for the current
  5270. * context.
  5271. *
  5272. * This function returns the address of the specified OpenGL or OpenGL ES
  5273. * [core or extension function](@ref context_glext), if it is supported
  5274. * by the current context.
  5275. *
  5276. * A context must be current on the calling thread. Calling this function
  5277. * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
  5278. *
  5279. * This function does not apply to Vulkan. If you are rendering with Vulkan,
  5280. * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
  5281. * `vkGetDeviceProcAddr` instead.
  5282. *
  5283. * @param[in] procname The ASCII encoded name of the function.
  5284. * @return The address of the function, or `NULL` if an
  5285. * [error](@ref error_handling) occurred.
  5286. *
  5287. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  5288. * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
  5289. *
  5290. * @remark The address of a given function is not guaranteed to be the same
  5291. * between contexts.
  5292. *
  5293. * @remark This function may return a non-`NULL` address despite the
  5294. * associated version or extension not being available. Always check the
  5295. * context version or extension string first.
  5296. *
  5297. * @pointer_lifetime The returned function pointer is valid until the context
  5298. * is destroyed or the library is terminated.
  5299. *
  5300. * @thread_safety This function may be called from any thread.
  5301. *
  5302. * @sa @ref context_glext
  5303. * @sa @ref glfwExtensionSupported
  5304. *
  5305. * @since Added in version 1.0.
  5306. *
  5307. * @ingroup context
  5308. */
  5309. GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
  5310. /*! @brief Returns whether the Vulkan loader and an ICD have been found.
  5311. *
  5312. * This function returns whether the Vulkan loader and any minimally functional
  5313. * ICD have been found.
  5314. *
  5315. * The availability of a Vulkan loader and even an ICD does not by itself
  5316. * guarantee that surface creation or even instance creation is possible.
  5317. * For example, on Fermi systems Nvidia will install an ICD that provides no
  5318. * actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check
  5319. * whether the extensions necessary for Vulkan surface creation are available
  5320. * and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue
  5321. * family of a physical device supports image presentation.
  5322. *
  5323. * @return `true` if Vulkan is minimally available, or `false`
  5324. * otherwise.
  5325. *
  5326. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  5327. *
  5328. * @thread_safety This function may be called from any thread.
  5329. *
  5330. * @sa @ref vulkan_support
  5331. *
  5332. * @since Added in version 3.2.
  5333. *
  5334. * @ingroup vulkan
  5335. */
  5336. GLFWAPI int glfwVulkanSupported(void);
  5337. /*! @brief Returns the Vulkan instance extensions required by GLFW.
  5338. *
  5339. * This function returns an array of names of Vulkan instance extensions required
  5340. * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the
  5341. * list will always contain `VK_KHR_surface`, so if you don't require any
  5342. * additional extensions you can pass this list directly to the
  5343. * `VkInstanceCreateInfo` struct.
  5344. *
  5345. * If Vulkan is not available on the machine, this function returns `NULL` and
  5346. * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
  5347. * to check whether Vulkan is at least minimally available.
  5348. *
  5349. * If Vulkan is available but no set of extensions allowing window surface
  5350. * creation was found, this function returns `NULL`. You may still use Vulkan
  5351. * for off-screen rendering and compute work.
  5352. *
  5353. * @param[out] count Where to store the number of extensions in the returned
  5354. * array. This is set to zero if an error occurred.
  5355. * @return An array of ASCII encoded extension names, or `NULL` if an
  5356. * [error](@ref error_handling) occurred.
  5357. *
  5358. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  5359. * GLFW_API_UNAVAILABLE.
  5360. *
  5361. * @remark Additional extensions may be required by future versions of GLFW.
  5362. * You should check if any extensions you wish to enable are already in the
  5363. * returned array, as it is an error to specify an extension more than once in
  5364. * the `VkInstanceCreateInfo` struct.
  5365. *
  5366. * @remark @macos This function currently supports either the
  5367. * `VK_MVK_macos_surface` extension from MoltenVK or `VK_EXT_metal_surface`
  5368. * extension.
  5369. *
  5370. * @pointer_lifetime The returned array is allocated and freed by GLFW. You
  5371. * should not free it yourself. It is guaranteed to be valid only until the
  5372. * library is terminated.
  5373. *
  5374. * @thread_safety This function may be called from any thread.
  5375. *
  5376. * @sa @ref vulkan_ext
  5377. * @sa @ref glfwCreateWindowSurface
  5378. *
  5379. * @since Added in version 3.2.
  5380. *
  5381. * @ingroup vulkan
  5382. */
  5383. GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
  5384. #if defined(VK_VERSION_1_0)
  5385. /*! @brief Returns the address of the specified Vulkan instance function.
  5386. *
  5387. * This function returns the address of the specified Vulkan core or extension
  5388. * function for the specified instance. If instance is set to `NULL` it can
  5389. * return any function exported from the Vulkan loader, including at least the
  5390. * following functions:
  5391. *
  5392. * - `vkEnumerateInstanceExtensionProperties`
  5393. * - `vkEnumerateInstanceLayerProperties`
  5394. * - `vkCreateInstance`
  5395. * - `vkGetInstanceProcAddr`
  5396. *
  5397. * If Vulkan is not available on the machine, this function returns `NULL` and
  5398. * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
  5399. * to check whether Vulkan is at least minimally available.
  5400. *
  5401. * This function is equivalent to calling `vkGetInstanceProcAddr` with
  5402. * a platform-specific query of the Vulkan loader as a fallback.
  5403. *
  5404. * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
  5405. * functions related to instance creation.
  5406. * @param[in] procname The ASCII encoded name of the function.
  5407. * @return The address of the function, or `NULL` if an
  5408. * [error](@ref error_handling) occurred.
  5409. *
  5410. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  5411. * GLFW_API_UNAVAILABLE.
  5412. *
  5413. * @pointer_lifetime The returned function pointer is valid until the library
  5414. * is terminated.
  5415. *
  5416. * @thread_safety This function may be called from any thread.
  5417. *
  5418. * @sa @ref vulkan_proc
  5419. *
  5420. * @since Added in version 3.2.
  5421. *
  5422. * @ingroup vulkan
  5423. */
  5424. GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
  5425. /*! @brief Returns whether the specified queue family can present images.
  5426. *
  5427. * This function returns whether the specified queue family of the specified
  5428. * physical device supports presentation to the platform GLFW was built for.
  5429. *
  5430. * If Vulkan or the required window surface creation instance extensions are
  5431. * not available on the machine, or if the specified instance was not created
  5432. * with the required extensions, this function returns `false` and
  5433. * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
  5434. * to check whether Vulkan is at least minimally available and @ref
  5435. * glfwGetRequiredInstanceExtensions to check what instance extensions are
  5436. * required.
  5437. *
  5438. * @param[in] instance The instance that the physical device belongs to.
  5439. * @param[in] device The physical device that the queue family belongs to.
  5440. * @param[in] queuefamily The index of the queue family to query.
  5441. * @return `true` if the queue family supports presentation, or
  5442. * `false` otherwise.
  5443. *
  5444. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  5445. * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
  5446. *
  5447. * @remark @macos This function currently always returns `true`, as the
  5448. * `VK_MVK_macos_surface` extension does not provide
  5449. * a `vkGetPhysicalDevice*PresentationSupport` type function.
  5450. *
  5451. * @thread_safety This function may be called from any thread. For
  5452. * synchronization details of Vulkan objects, see the Vulkan specification.
  5453. *
  5454. * @sa @ref vulkan_present
  5455. *
  5456. * @since Added in version 3.2.
  5457. *
  5458. * @ingroup vulkan
  5459. */
  5460. GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
  5461. /*! @brief Creates a Vulkan surface for the specified window.
  5462. *
  5463. * This function creates a Vulkan surface for the specified window.
  5464. *
  5465. * If the Vulkan loader or at least one minimally functional ICD were not found,
  5466. * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref
  5467. * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether
  5468. * Vulkan is at least minimally available.
  5469. *
  5470. * If the required window surface creation instance extensions are not
  5471. * available or if the specified instance was not created with these extensions
  5472. * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
  5473. * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref
  5474. * glfwGetRequiredInstanceExtensions to check what instance extensions are
  5475. * required.
  5476. *
  5477. * The window surface cannot be shared with another API so the window must
  5478. * have been created with the [client api hint](@ref GLFW_CLIENT_API_attrib)
  5479. * set to `GLFW_NO_API` otherwise it generates a @ref GLFW_INVALID_VALUE error
  5480. * and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`.
  5481. *
  5482. * The window surface must be destroyed before the specified Vulkan instance.
  5483. * It is the responsibility of the caller to destroy the window surface. GLFW
  5484. * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the
  5485. * surface.
  5486. *
  5487. * @param[in] instance The Vulkan instance to create the surface in.
  5488. * @param[in] window The window to create the surface for.
  5489. * @param[in] allocator The allocator to use, or `NULL` to use the default
  5490. * allocator.
  5491. * @param[out] surface Where to store the handle of the surface. This is set
  5492. * to `VK_NULL_HANDLE` if an error occurred.
  5493. * @return `VK_SUCCESS` if successful, or a Vulkan error code if an
  5494. * [error](@ref error_handling) occurred.
  5495. *
  5496. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  5497. * GLFW_API_UNAVAILABLE, @ref GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE
  5498. *
  5499. * @remark If an error occurs before the creation call is made, GLFW returns
  5500. * the Vulkan error code most appropriate for the error. Appropriate use of
  5501. * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
  5502. * eliminate almost all occurrences of these errors.
  5503. *
  5504. * @remark @macos This function currently only supports the
  5505. * `VK_MVK_macos_surface` extension from MoltenVK.
  5506. *
  5507. * @remark @macos This function creates and sets a `CAMetalLayer` instance for
  5508. * the window content view, which is required for MoltenVK to function.
  5509. *
  5510. * @thread_safety This function may be called from any thread. For
  5511. * synchronization details of Vulkan objects, see the Vulkan specification.
  5512. *
  5513. * @sa @ref vulkan_surface
  5514. * @sa @ref glfwGetRequiredInstanceExtensions
  5515. *
  5516. * @since Added in version 3.2.
  5517. *
  5518. * @ingroup vulkan
  5519. */
  5520. GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
  5521. #endif /*VK_VERSION_1_0*/
  5522. /*************************************************************************
  5523. * Global definition cleanup
  5524. *************************************************************************/
  5525. /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
  5526. #ifdef GLFW_WINGDIAPI_DEFINED
  5527. #undef WINGDIAPI
  5528. #undef GLFW_WINGDIAPI_DEFINED
  5529. #endif
  5530. #ifdef GLFW_CALLBACK_DEFINED
  5531. #undef CALLBACK
  5532. #undef GLFW_CALLBACK_DEFINED
  5533. #endif
  5534. /* Some OpenGL related headers need GLAPIENTRY, but it is unconditionally
  5535. * defined by some gl.h variants (OpenBSD) so define it after if needed.
  5536. */
  5537. #ifndef GLAPIENTRY
  5538. #define GLAPIENTRY APIENTRY
  5539. #endif
  5540. /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
  5541. #ifdef __cplusplus
  5542. }
  5543. #endif
  5544. #endif /* _glfw3_h_ */