|
10 | 10 |
|
11 | 11 | import sublime |
12 | 12 |
|
13 | | -from ..state import CtrlPoller |
14 | | -from ._availability import set_unavailable |
15 | | -from .keystate_helper import HelperCtrlReleasePoller, HelperStatus, get_helper_probe |
16 | | -from .keystate_helper import plugin_unloaded as _helper_plugin_unloaded |
| 13 | +from .._availability import set_unavailable |
17 | 14 |
|
18 | 15 | _XK_Control_L = 0xFFE3 |
19 | 16 | _XK_Control_R = 0xFFE4 |
@@ -114,30 +111,8 @@ def _open_x11_state(self) -> Optional[_X11State]: |
114 | 111 | ) |
115 | 112 |
|
116 | 113 |
|
117 | | -def is_native_wayland() -> bool: |
118 | | - return bool(os.environ.get("WAYLAND_DISPLAY")) and os.environ.get("GDK_BACKEND") != "x11" |
119 | | - |
120 | | - |
121 | | -def create_poller(on_release: Callable[[], None], interval_ms: int) -> CtrlPoller: |
122 | | - path = _working_helper_path() |
123 | | - if path is not None: |
124 | | - return HelperCtrlReleasePoller(on_release, interval_ms, path) |
125 | | - return X11CtrlReleasePoller(on_release, interval_ms) |
126 | | - |
127 | | - |
128 | | -def probe() -> bool: |
129 | | - if _working_helper_path() is not None: |
130 | | - return True |
131 | | - # Under native Wayland, XWayland reports Ctrl as released while Sublime has focus, |
132 | | - # which would commit every session immediately. |
133 | | - return not is_native_wayland() and _get_x11() is not None |
134 | | - |
135 | | - |
136 | | -def _working_helper_path() -> Optional[str]: |
137 | | - helper_probe = get_helper_probe() |
138 | | - if helper_probe is None or helper_probe.status is not HelperStatus.OK: |
139 | | - return None |
140 | | - return helper_probe.path |
| 114 | +def is_x11_available() -> bool: |
| 115 | + return _get_x11() is not None |
141 | 116 |
|
142 | 117 |
|
143 | 118 | def _keycode_is_down(keymap: ctypes.Array[ctypes.c_ubyte], keycode: int) -> bool: |
@@ -179,4 +154,3 @@ def _get_x11() -> Optional[ctypes.CDLL]: |
179 | 154 | def plugin_unloaded() -> None: |
180 | 155 | global _x11 |
181 | 156 | _x11 = None |
182 | | - _helper_plugin_unloaded() |
0 commit comments