Focus tracking

This commit is contained in:
Kovid Goyal 2016-10-30 21:12:01 +05:30
parent 7b83d37cbf
commit 2b7d3d0a54

View File

@ -49,11 +49,20 @@ class Boss(Thread):
glfw.glfwSetCharModsCallback(window, self.on_text_input)
glfw.glfwSetKeyCallback(window, self.on_key)
glfw.glfwSetMouseButtonCallback(window, self.on_mouse_button)
glfw.glfwSetWindowFocusCallback(window, self.on_focus)
def initialize(self):
self.char_grid.initialize()
glfw.glfwPostEmptyEvent()
def on_focus(self, window, focused):
if focused:
if self.screen.enable_focus_tracking:
self.write_to_child(b'\x1b[I')
else:
if self.screen.enable_focus_tracking:
self.write_to_child(b'\x1b[O')
def on_mouse_button(self, window, button, action, mods):
if action == glfw.GLFW_RELEASE:
if button == glfw.GLFW_MOUSE_BUTTON_MIDDLE: