Focus tracking
This commit is contained in:
parent
7b83d37cbf
commit
2b7d3d0a54
1 changed files with 9 additions and 0 deletions
|
|
@ -49,11 +49,20 @@ def __init__(self, window, window_width, window_height, opts, args):
|
|||
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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue