a
    ij                     @   sh   d Z ddlZddlZddlmZ ddlmZ dZdZdZ	dZ
dd Ze  d	d
 Zdd ZdddZdS )a  Abstraction for the platform-specific code in PyOpenGL

Each supported platform has a module which provides the
specific functionality required to support the base OpenGL 
functionality on that platform.  These modules are 
registered using plugins in the:

    OpenGL.plugin.PlatformPlugin

objects.  To support a new platform you'll need to create
a new PlatformPlugin instance *before* you import 
OpenGL.platform .  Once you have a working platform 
module, please consider contributing it back to the project.

See baseplatform.BasePlatform for the core functionality 
of a platform implementation.  See the various platform 
specific modules for examples to use when porting.
    N)PlatformPlugin)_configflagsXDG_SESSION_TYPEWAYLAND_DISPLAYc                  C   s   d} t jdv r6dtjvr6dtjv r(d} ndtjv r6d} tjdtjdd	 | t jtjf}t|}|	 }d
|_
| }|t  |S )z6Load the os.name plugin for the platform functionalityN)linuxZlinux2ZPYOPENGL_PLATFORMr   ZwaylandZDISPLAYr   r    T)sysplatformosenvirongetlowernamer   matchloadZloadedinstallglobals)Zguessing_keykeypluginZplugin_class r   V/home/ghrups/robot-bench/.venv/lib/python3.9/site-packages/OpenGL/platform/__init__.py_load   s$    



r   c                    s    fdd}|S )z@Decorator to add returnType, argTypes and argNames to a functionc                    s`   | _  | _t| dr"| jj| _n
| jj| _tjr\di| _	t
| j D ]\}}|| j	|< qH| S )zOAdds the given metadata to the function, introspects var names from declaration	func_codereturn)
resultTypeargTypeshasattrr   co_varnamesargNames__code__r   ZTYPE_ANNOTATIONS__annotations__zip)functionr   typr   r   r   r   	add_typesA   s    

ztypes.<locals>.add_typesr   )r   r   r%   r   r$   r   types>   s    r&   c                 C   sJ   ddl m} |  D ]0}|r| r| \}}||t|d||< qdS )z)Create constants and add to the namespacer   )Constant   N)ZOpenGL.constantr'   
splitlinessplitint)	constants	namespacer'   liner   valuer   r   r   unpack_constantsT   s
    r0   Fc                 C   s:   t | j|ptj| j| jd| j||| j||p4t| d|dS )zKAllows the more compact declaration format to use the old-style constructorNforce_extension)	r   r   docr   	extension
deprecatedmoduleerror_checkerr1   )	nullFunction__name__PLATFORMZGLr   r   r   
__module__getattr)r"   Zdllr3   r4   r6   r1   r   r   r   createFunction^   s    	
r<   )FNF)__doc__r
   r   ZOpenGL.pluginsr   ZOpenGLr   ZXDGr   r9   r7   r   r&   r0   r<   r   r   r   r   <module>   s      