mirror of https://github.com/yshui/picom.git
core: update stale images AFTER checking focus
Partially revert 32754b0262
.
We start with mapping the window (`win_process_update_flags()`). Then check
if focus has changed and process focus updates. Finally refresh stale images
(`win_process_image_flags`) because rules based on focus may have invalidated
them or require them to be created.
Fixes #465 with the following rule:
```
shadow-exclude = [
"focused" != 1"
]
```
This commit is contained in:
parent
f6780cb394
commit
c9ca9de55e
13
src/picom.c
13
src/picom.c
|
@ -1318,7 +1318,13 @@ static void handle_new_windows(session_t *ps) {
|
|||
|
||||
static void refresh_windows(session_t *ps) {
|
||||
win_stack_foreach_managed(w, &ps->window_stack) {
|
||||
win_process_flags(ps, w);
|
||||
win_process_update_flags(ps, w);
|
||||
}
|
||||
}
|
||||
|
||||
static void refresh_images(session_t *ps) {
|
||||
win_stack_foreach_managed(w, &ps->window_stack) {
|
||||
win_process_image_flags(ps, w);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1359,7 +1365,7 @@ static void handle_pending_updates(EV_P_ struct session *ps) {
|
|||
// stale.
|
||||
handle_root_flags(ps);
|
||||
|
||||
// Process window flags
|
||||
// Process window flags (window mapping)
|
||||
refresh_windows(ps);
|
||||
|
||||
{
|
||||
|
@ -1371,6 +1377,9 @@ static void handle_pending_updates(EV_P_ struct session *ps) {
|
|||
free(r);
|
||||
}
|
||||
|
||||
// Process window flags (stale images)
|
||||
refresh_images(ps);
|
||||
|
||||
e = xcb_request_check(ps->c, xcb_ungrab_server_checked(ps->c));
|
||||
if (e) {
|
||||
log_fatal_x_error(e, "failed to ungrab x server");
|
||||
|
|
|
@ -320,11 +320,15 @@ void win_release_images(struct backend_base *backend, struct managed_win *w) {
|
|||
}
|
||||
}
|
||||
|
||||
void win_process_flags(session_t *ps, struct managed_win *w) {
|
||||
void win_process_update_flags(session_t *ps, struct managed_win *w) {
|
||||
if (win_check_flags_all(w, WIN_FLAGS_MAPPED)) {
|
||||
map_win_start(ps, w);
|
||||
win_clear_flags(w, WIN_FLAGS_MAPPED);
|
||||
}
|
||||
}
|
||||
|
||||
void win_process_image_flags(session_t *ps, struct managed_win *w) {
|
||||
assert(!win_check_flags_all(w, WIN_FLAGS_MAPPED));
|
||||
|
||||
// Not a loop
|
||||
while (win_check_flags_any(w, WIN_FLAGS_IMAGES_STALE) &&
|
||||
|
|
|
@ -254,8 +254,10 @@ struct managed_win {
|
|||
#endif
|
||||
};
|
||||
|
||||
/// Process pending images flags on a window. Has to be called in X critical section
|
||||
void win_process_flags(session_t *ps, struct managed_win *w);
|
||||
/// Process pending updates/images flags on a window. Has to be called in X critical
|
||||
/// section
|
||||
void win_process_update_flags(session_t *ps, struct managed_win *w);
|
||||
void win_process_image_flags(session_t *ps, struct managed_win *w);
|
||||
/// Bind a shadow to the window, with color `c` and shadow kernel `kernel`
|
||||
bool win_bind_shadow(struct backend_base *b, struct managed_win *w, struct color c,
|
||||
struct conv *kernel);
|
||||
|
|
Loading…
Reference in New Issue