
    Mh                        d Z ddlZddlZddlZddlmZ ddlmZ ddl	m
Z dZej        ej        z  ej        z  ZdZej        dk    r9	  ej        dej        dg dd	          Zn# e$ rZ ed
          edZ[ww xY weZnej        rej        Zn ed
          d Zd Zd Zd Z ej        ej                    ej        e            eej                   r ej         ej!        ej"                    ej#        d            ej$        dd            ej%                      ej&        e            ej'        e            ej(        e           d Z)dS )z8GLUT Input hook for interactive use with prompt_toolkit
    N)default_timer<   darwinglutCheckLoopzglutCheckLoop(  ) -> None )dll
resultTypeargTypesdocargNamesz[Your glut implementation does not allow interactive sessions. Consider installing freeglut.c                      d S Nr   r       c/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/IPython/terminal/pt_inputhooks/glut.pyglut_displayr   <       Dr   c                      d S r   r   r   r   r   	glut_idler   @   r   r   c                  H    t          j                     t                       d S r   )glutglutHideWindowglutMainLoopEventr   r   r   
glut_closer   D   s#    r   c                 v    t          j         t           j        t           j                   t          d           d S )Nz
KeyboardInterrupt)signalSIGINTdefault_int_handlerprint)signumframes     r   glut_int_handlerr!   I   s.    
M&-!;<<<	
     r   s   ipython   c                 *   t          j         t           j        t                     	 t                      }t	          j                    dk    r$t	          j        d           t                       dS |                                 st                       t                      |z
  }|dk    rt          j
        d           n/|dk    rt          j
        d           nt          j
        d           |                                 }dS dS # t          $ r Y dS w xY w)	aE  Run the pyglet event loop by processing pending events only.

    This keeps processing pending events until stdin is ready.  After
    processing all pending events, a call to time.sleep is inserted.  This is
    needed, otherwise, CPU usage is at 100%.  This sleep time should be tuned
    though for best performance.
    r   r"   g      $@g      ?g?g?gMbP?N)r   r   r!   clockr   glutGetWindowglutSetWindowr   input_is_readytimesleepKeyboardInterrupt)contextt	used_times      r   	inputhookr.   ^   s&    M&-!1222!GG 1$$###1((** 	" !I4
3S 
4     
5!!!- ((** 	" 	" 	" 	" 	".    s   AD /BD 
DD)*__doc__sysr(   r   OpenGL.GLUTGLUTr   OpenGL.platformplatformtimeitr   r$   glut_fpsGLUT_DOUBLE	GLUT_RGBA
GLUT_DEPTHglut_display_moder   createBaseFunctionr   AttributeErroreRuntimeErrorHAVE_FREEGLUTr   r   r   r!   glutInitargvglutInitDisplayModeboolglutSetOptionGLUT_ACTION_ON_WINDOW_CLOSE GLUT_ACTION_GLUTMAINLOOP_RETURNSglutCreateWindowglutReshapeWindowr   glutWMCloseFuncglutDisplayFuncglutIdleFuncr.   r   r   r   <module>rL      ss   ( 


         " " " " " " ) ) ) ) ) )  %^$_%   <8
8334+	    8 8 8l01 167	88 &	 -.
,	,- - -
	 	 		 	 	  
! ! ! sx     + - - -4 @D8=@ @ @  z # # #  1          j " " "  l $ $ $  9   . . . . .s   A$ $A:)A55A: