glfw3.h 206 KB

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