mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-23 05:35:53 -04:00
opt: optimize frame skip logic
This commit is contained in:
parent
d2d5cfc5c8
commit
ebdfb14654
3 changed files with 31 additions and 48 deletions
|
|
@ -243,34 +243,6 @@ static inline int32_t client_is_rendered_on_mon(Client *c, Monitor *m) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int32_t client_is_stopped(Client *c) {
|
||||
int32_t pid;
|
||||
siginfo_t in = {0};
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL);
|
||||
if (waitid(P_PID, pid, &in, WNOHANG | WCONTINUED | WSTOPPED | WNOWAIT) <
|
||||
0) {
|
||||
/* This process is not our child process. We cannot determine its
|
||||
* stopped state; assume it is not stopped to avoid blocking frame skip.
|
||||
*/
|
||||
if (errno == ECHILD)
|
||||
return 0; // if not our child, assume not stopped
|
||||
/* Other errors, also assume not stopped. */
|
||||
return 0;
|
||||
} else if (in.si_pid) {
|
||||
if (in.si_code == CLD_STOPPED || in.si_code == CLD_TRAPPED)
|
||||
return 1;
|
||||
if (in.si_code == CLD_CONTINUED)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int32_t client_is_unmanaged(Client *c) {
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue