Explorar el Código

enumerate engine windows based on horizontal position

Fabian Peter Hammerle hace 4 años
padre
commit
22eb1cbc76
Se han modificado 1 ficheros con 8 adiciones y 2 borrados
  1. 8 2
      rescriptoon/__init__.py

+ 8 - 2
rescriptoon/__init__.py

@@ -237,11 +237,17 @@ class Overlay:
             window.ungrab_key(keycode, X.AnyModifier)
 
     def _find_engine_windows(self) -> typing.List["Xlib.display.Window"]:
-        return list(
+        return sorted(
             filter(
                 lambda w: w.get_wm_name() == _TOONTOWN_ENGINE_WINDOW_NAME,
                 _x_walk_children_windows(self.xdisplay.screen().root),
-            )
+            ),
+            # relative x
+            # won't work when using a reparenting window manager
+            # https://stackoverflow.com/a/12854004/5894777
+            # possible workaround:
+            # http://science.su/stuff/so/print_frame_geometry_of_all_windows.py
+            key=lambda w: w.get_geometry().x,
         )
 
     def _update_active_key_registry(self, xkeyevent):