Exemplo n.º 1
0
 def _take_focus(self):
     focuslog("Take Focus -> world window")
     assert is_realized(self)
     # Weird hack: we are a GDK window, and the only way to properly get
     # input focus to a GDK window is to send it WM_TAKE_FOCUS.  So this is
     # sending a WM_TAKE_FOCUS to our own window, which will go to the X
     # server and then come back to our own process, which will then issue
     # an XSetInputFocus on itself.
     now = x11_get_server_time(self.window)
     send_wm_take_focus(self.window, now)
Exemplo n.º 2
0
 def gl_context(self):
     if not self._backing:
         log("Error: no OpenGL backing")
         return None
     if not is_realized(self._backing):
         log.error("Error: OpenGL backing is not realized")
         return None
     w, h = self.size
     if w<=0 or h<=0:
         log.error("Error: invalid OpenGL backing size: %ix%i", w, h)
         return None
     context = GLContextManager(self._backing)
     log("%s.gl_context() GL Pixmap backing size: %d x %d, context=%s", self, w, h, context)
     return context
Exemplo n.º 3
0
 def gl_context(self):
     if not self._backing:
         log("Error: no OpenGL backing")
         return None
     if not is_realized(self._backing):
         log.error("Error: OpenGL backing is not realized")
         return None
     w, h = self.size
     if w<=0 or h<=0:
         log.error("Error: invalid OpenGL backing size: %ix%i", w, h)
         return None
     context = GLContextManager(self._backing)
     log("%s.gl_context() GL Pixmap backing size: %d x %d, context=%s", self, w, h, context)
     return context
Exemplo n.º 4
0
 def gl_context(self):
     b = self._backing
     if not b:
         log("Error: no OpenGL backing")
         return None
     if not is_realized(b):
         log.error("Error: OpenGL backing is not realized")
         return None
     w, h = self.size
     if w<=0 or h<=0:
         log.error("Error: invalid OpenGL backing size: %ix%i", w, h)
         return None
     try:
         context = GLContextManager(b)
     except Exception as e:
         log.error("Error: %s", e)
         return None
     log("%s.gl_context() GL Pixmap backing size: %d x %d, context=%s", self, w, h, context)
     return context
Exemplo n.º 5
0
 def gl_context(self):
     b = self._backing
     if not b:
         log("Error: no OpenGL backing")
         return None
     if not is_realized(b):
         log.error("Error: OpenGL backing is not realized")
         return None
     w, h = self.size
     if w<=0 or h<=0:
         log.error("Error: invalid OpenGL backing size: %ix%i", w, h)
         return None
     try:
         context = GLContextManager(b)
     except Exception as e:
         log.error("Error: %s", e)
         return None
     log("%s.gl_context() GL Pixmap backing size: %d x %d, context=%s", self, w, h, context)
     return context
Exemplo n.º 6
0
 def gl_context(self):
     b = self._backing
     if not b:
         log("cannot get an OpenGL context: no backing defined")
         return None
     if not is_realized(b):
         log.error("Error: OpenGL backing %s is not realized", b)
         return None
     w, h = self.size
     if w<=0 or h<=0:
         log.error("Error: invalid OpenGL backing size: %ix%i", w, h)
         return None
     try:
         context = GtkGLExtContext(b)
     except Exception as e:
         log("gl_context()", exc_info=True)
         log.error("Error: %s", e)
         return None
     log("%s.gl_context() GL Pixmap backing size: %d x %d, context=%s", self, w, h, context)
     return context
Exemplo n.º 7
0
 def is_realized(self):
     return is_realized(self)