mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-25 06:33:09 +00:00
Cleanup previous PR
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
This commit is contained in:
parent
7e647774d1
commit
4b55d5985e
3 changed files with 5 additions and 32 deletions
|
|
@ -1525,8 +1525,8 @@ write_escape_code_to_child(Screen *self, unsigned char which, const char *data)
|
|||
}
|
||||
|
||||
static void
|
||||
send_visibility_report(Screen *self, bool potentially_visible) {
|
||||
write_escape_code_to_child(self, ESC_CSI, potentially_visible ? "?999;1n" : "?999;2n");
|
||||
send_visibility_report(Screen *self) {
|
||||
write_escape_code_to_child(self, ESC_CSI, self->visibility_state != 2 ? "?999;1n" : "?999;2n");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1534,17 +1534,10 @@ screen_visibility_changed(Screen *self, bool potentially_visible) {
|
|||
const uint8_t state = potentially_visible ? 1 : 2;
|
||||
if (self->visibility_state != state) {
|
||||
self->visibility_state = state;
|
||||
if (self->modes.mVISIBILITY_REPORTS) send_visibility_report(self, potentially_visible);
|
||||
if (self->modes.mVISIBILITY_REPORTS) send_visibility_report(self);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
report_current_visibility(Screen *self) {
|
||||
const bool potentially_visible = is_kitty_window_visible(self->window_id);
|
||||
self->visibility_state = potentially_visible ? 1 : 2;
|
||||
send_visibility_report(self, potentially_visible);
|
||||
}
|
||||
|
||||
static bool
|
||||
write_escape_code_to_child_python(Screen *self, unsigned char which, PyObject *data) {
|
||||
bool written = false;
|
||||
|
|
@ -1822,7 +1815,7 @@ set_mode_from_const(Screen *self, unsigned int mode, bool val) {
|
|||
break;
|
||||
case VISIBILITY_REPORTS:
|
||||
self->modes.mVISIBILITY_REPORTS = val;
|
||||
if (val) report_current_visibility(self);
|
||||
if (val) send_visibility_report(self);
|
||||
break;
|
||||
default:
|
||||
private = mode >= 1 << 5;
|
||||
|
|
@ -2965,7 +2958,7 @@ report_device_status(Screen *self, unsigned int which, bool private) {
|
|||
CALLBACK("report_color_scheme_preference", NULL);
|
||||
} break;
|
||||
case 998: // https://rockorager.dev/misc/visibility-reports/
|
||||
if (private) report_current_visibility(self);
|
||||
if (private) send_visibility_report(self);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,25 +165,6 @@ window_for_window_id(id_type kitty_window_id) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
is_kitty_window_visible(id_type kitty_window_id) {
|
||||
for (size_t i = 0; i < global_state.num_os_windows; i++) {
|
||||
OSWindow *os_window = global_state.os_windows + i;
|
||||
for (size_t t = 0; t < os_window->num_tabs; t++) {
|
||||
Tab *tab = os_window->tabs + t;
|
||||
for (size_t w = 0; w < tab->num_windows; w++) {
|
||||
Window *window = tab->windows + w;
|
||||
if (window->id == kitty_window_id) {
|
||||
return is_os_window_potentially_visible(os_window) && t == os_window->active_tab && window->visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// If the view cannot be found, its visibility is unknown and must be
|
||||
// treated conservatively as potentially visible.
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
update_os_window_visibility_reports(OSWindow *os_window) {
|
||||
const bool os_window_is_visible = is_os_window_potentially_visible(os_window);
|
||||
|
|
|
|||
|
|
@ -567,7 +567,6 @@ void mark_os_window_for_close(OSWindow* w, CloseRequest cr);
|
|||
void update_os_window_viewport(OSWindow *window, bool notify_boss);
|
||||
bool should_os_window_be_rendered(OSWindow* w);
|
||||
bool is_os_window_potentially_visible(OSWindow* w);
|
||||
bool is_kitty_window_visible(id_type kitty_window_id);
|
||||
void update_os_window_visibility_reports(OSWindow *w);
|
||||
void wakeup_main_loop(void);
|
||||
bool make_window_context_current(id_type);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue