When reporting unused activity in a window, ignore activity that occurs soon after a window resize
Fixes #5881
This commit is contained in:
parent
45b0788f28
commit
865fc24975
@ -87,6 +87,8 @@ Detailed list of changes
|
|||||||
|
|
||||||
- broadcast kitten: Allow pressing a key to stop echoing of input into the broadcast window itself (:disc:`5868`)
|
- broadcast kitten: Allow pressing a key to stop echoing of input into the broadcast window itself (:disc:`5868`)
|
||||||
|
|
||||||
|
- When reporting unused activity in a window, ignore activity that occurs soon after a window resize (:iss:`5881`)
|
||||||
|
|
||||||
|
|
||||||
0.26.5 [2022-11-07]
|
0.26.5 [2022-11-07]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|||||||
@ -658,9 +658,13 @@ draw_combining_char(Screen *self, char_type ch) {
|
|||||||
static void
|
static void
|
||||||
draw_codepoint(Screen *self, char_type och, bool from_input_stream) {
|
draw_codepoint(Screen *self, char_type och, bool from_input_stream) {
|
||||||
if (is_ignored_char(och)) return;
|
if (is_ignored_char(och)) return;
|
||||||
if (!self->has_activity_since_last_focus && !self->has_focus) {
|
if (!self->has_activity_since_last_focus && !self->has_focus && self->callbacks != Py_None) {
|
||||||
self->has_activity_since_last_focus = true;
|
PyObject *ret = PyObject_CallMethod(self->callbacks, "on_activity_since_last_focus", NULL);
|
||||||
CALLBACK("on_activity_since_last_focus", NULL);
|
if (ret == NULL) PyErr_Print();
|
||||||
|
else {
|
||||||
|
if (ret == Py_True) self->has_activity_since_last_focus = true;
|
||||||
|
Py_DECREF(ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
uint32_t ch = och < 256 ? self->g_charset[och] : och;
|
uint32_t ch = och < 256 ? self->g_charset[och] : och;
|
||||||
if (UNLIKELY(is_combining_char(ch))) {
|
if (UNLIKELY(is_combining_char(ch))) {
|
||||||
|
|||||||
@ -555,6 +555,7 @@ class Window:
|
|||||||
else:
|
else:
|
||||||
self.watchers = global_watchers().copy()
|
self.watchers = global_watchers().copy()
|
||||||
self.last_focused_at = 0.
|
self.last_focused_at = 0.
|
||||||
|
self.last_resized_at = 0.
|
||||||
self.started_at = monotonic()
|
self.started_at = monotonic()
|
||||||
self.current_remote_data: List[str] = []
|
self.current_remote_data: List[str] = []
|
||||||
self.current_mouse_event_button = 0
|
self.current_mouse_event_button = 0
|
||||||
@ -831,6 +832,7 @@ class Window:
|
|||||||
update_ime_position = False
|
update_ime_position = False
|
||||||
if current_pty_size != self.last_reported_pty_size:
|
if current_pty_size != self.last_reported_pty_size:
|
||||||
get_boss().child_monitor.resize_pty(self.id, *current_pty_size)
|
get_boss().child_monitor.resize_pty(self.id, *current_pty_size)
|
||||||
|
self.last_resized_at = monotonic()
|
||||||
if not self.pty_resized_once:
|
if not self.pty_resized_once:
|
||||||
self.pty_resized_once = True
|
self.pty_resized_once = True
|
||||||
self.child.mark_terminal_ready()
|
self.child.mark_terminal_ready()
|
||||||
@ -1023,9 +1025,12 @@ class Window:
|
|||||||
def has_activity_since_last_focus(self) -> bool:
|
def has_activity_since_last_focus(self) -> bool:
|
||||||
return self.screen.has_activity_since_last_focus()
|
return self.screen.has_activity_since_last_focus()
|
||||||
|
|
||||||
def on_activity_since_last_focus(self) -> None:
|
def on_activity_since_last_focus(self) -> bool:
|
||||||
if get_options().tab_activity_symbol:
|
if get_options().tab_activity_symbol and (monotonic() - self.last_resized_at) > 0.5:
|
||||||
|
# Ignore activity soon after a resize as the child program is probably redrawing the screen
|
||||||
get_boss().on_activity_since_last_focus(self)
|
get_boss().on_activity_since_last_focus(self)
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def on_bell(self) -> None:
|
def on_bell(self) -> None:
|
||||||
cb = get_options().command_on_bell
|
cb = get_options().command_on_bell
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user