Tighten up relase and reclaim clode for terminals.
This commit is contained in:
@@ -63,6 +63,15 @@ class CompositorStateAdapter:
|
||||
def get_snapshot(self) -> DesktopContextSnapshot:
|
||||
return self._snapshot
|
||||
|
||||
def refresh_workspace_context(self, reason: str) -> DesktopContextSnapshot:
|
||||
"""Refreshes and returns the selected backend's current workspace context."""
|
||||
|
||||
backend = self._workspaceBackend
|
||||
refreshContext = getattr(backend, "refresh_context", None)
|
||||
if callable(refreshContext):
|
||||
refreshContext(reason)
|
||||
return self._snapshot
|
||||
|
||||
def get_session_type(self) -> str:
|
||||
return get_session_type()
|
||||
|
||||
|
||||
@@ -92,6 +92,11 @@ class I3WorkspaceBackend:
|
||||
self._emitSignal = None
|
||||
self._lastContext = None
|
||||
|
||||
def refresh_context(self, reason: str) -> None:
|
||||
"""Refreshes the cached i3 focus context without emitting a transition."""
|
||||
|
||||
self._refresh_context(reason, transition=False)
|
||||
|
||||
def _ensure_connection(self) -> bool:
|
||||
if self._connection is not None:
|
||||
return True
|
||||
|
||||
@@ -174,6 +174,7 @@ class EventManager:
|
||||
|
||||
debug.printMessage(debug.LEVEL_INFO, 'EVENT MANAGER: Activating keyboard handling', True)
|
||||
self._inputEventManager = input_event_manager.get_manager()
|
||||
self._inputEventManager.set_compositor_state_adapter(self._compositorStateAdapter)
|
||||
self._inputEventManager.start_key_watcher()
|
||||
cthulhu_state.device = self._inputEventManager._device
|
||||
self._keyHandlingActive = True
|
||||
@@ -277,6 +278,8 @@ class EventManager:
|
||||
self._compositorStateAdapter.remove_listener(self._handle_compositor_signal)
|
||||
|
||||
self._compositorStateAdapter = adapter
|
||||
if self._inputEventManager is not None:
|
||||
self._inputEventManager.set_compositor_state_adapter(adapter)
|
||||
if adapter is not None and hasattr(adapter, "add_listener"):
|
||||
adapter.add_listener(self._handle_compositor_signal)
|
||||
|
||||
|
||||
@@ -134,6 +134,12 @@ class InputEventManager:
|
||||
self._xtermRecoverySourceId: int = 0
|
||||
self._xtermRecoveryPollCount: int = 0
|
||||
self._xtermHandoffHistory: List[str] = []
|
||||
self._compositorStateAdapter: Optional[Any] = None
|
||||
|
||||
def set_compositor_state_adapter(self, adapter: Optional[Any]) -> None:
|
||||
"""Stores the compositor adapter used to refresh XTerm handoff state."""
|
||||
|
||||
self._compositorStateAdapter = adapter
|
||||
|
||||
def activate_device(self) -> Atspi.Device:
|
||||
"""Creates and returns the AT-SPI device used by this manager."""
|
||||
@@ -847,9 +853,17 @@ class InputEventManager:
|
||||
|
||||
snapshot = cthulhu_state.compositorSnapshot
|
||||
usingI3Context = snapshot is not None and snapshot.backend_name == "i3-ipc"
|
||||
if usingI3Context and self._lastEwmhXtermMatch is True:
|
||||
adapter = self._compositorStateAdapter
|
||||
refreshContext = getattr(adapter, "refresh_workspace_context", None)
|
||||
if callable(refreshContext):
|
||||
snapshot = refreshContext("xterm-handoff-check")
|
||||
usingI3Context = snapshot is not None and snapshot.backend_name == "i3-ipc"
|
||||
if usingI3Context and snapshot.focused_workspace_empty is True:
|
||||
self._record_xterm_handoff_action("i3:confirmed-empty-workspace")
|
||||
self._lastEwmhReadWindowId = None
|
||||
self._lastEwmhActiveWindowId = None
|
||||
self._lastEwmhXtermMatch = False
|
||||
return False
|
||||
|
||||
if usingI3Context and snapshot.focused_window_id is not None:
|
||||
|
||||
Reference in New Issue
Block a user