1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2025-04-07 17:44:04 -04:00

core: move configure_root out of the critical section

It doesn't really make any X requests besides querying the root window
geometry.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-06-27 13:49:34 +01:00
parent 0f6ffae91c
commit d812647903
No known key found for this signature in database
GPG key ID: D3A4405BE6CC17F4
3 changed files with 4 additions and 26 deletions

View file

@ -405,7 +405,8 @@ static inline void ev_configure_notify(session_t *ps, xcb_configure_notify_event
}
if (ev->window == ps->c.screen_info->root) {
set_root_flags(ps, ROOT_FLAGS_CONFIGURED);
configure_root(ps);
ps->pending_updates = true;
} else {
configure_win(ps, ev);
}

View file

@ -125,12 +125,6 @@ const char *const BACKEND_STRS[] = {[BKEND_XRENDER] = "xrender",
/// XXX Limit what xerror can access by not having this pointer
session_t *ps_g = NULL;
void set_root_flags(session_t *ps, uint64_t flags) {
log_debug("Setting root flags: %" PRIu64, flags);
ps->root_flags |= flags;
ps->pending_updates = true;
}
void quit(session_t *ps) {
ps->quit = true;
ev_break(ps->loop, EVBREAK_ALL);
@ -652,7 +646,7 @@ static inline void invalidate_reg_ignore(session_t *ps) {
}
/// Handle configure event of the root window
static void configure_root(session_t *ps) {
void configure_root(session_t *ps) {
// TODO(yshui) re-initializing backend should be done outside of the
// critical section. Probably set a flag and do it in draw_callback_impl.
auto r = XCB_AWAIT(xcb_get_geometry, ps->c.c, ps->c.screen_info->root);
@ -733,13 +727,6 @@ static void configure_root(session_t *ps) {
}
}
static void handle_root_flags(session_t *ps) {
if ((ps->root_flags & ROOT_FLAGS_CONFIGURED) != 0) {
configure_root(ps);
ps->root_flags &= ~(uint64_t)ROOT_FLAGS_CONFIGURED;
}
}
/**
* Go through the window stack and calculate some parameters for rendering.
*
@ -1597,12 +1584,6 @@ static void handle_pending_updates(struct session *ps, double delta_t) {
// Process new windows, and maybe allocate struct managed_win for them
handle_new_windows(ps);
// Handle screen changes
// This HAS TO be called before refresh_windows, as handle_root_flags
// could call configure_root, which will release images and mark them
// stale.
handle_root_flags(ps);
// Process window flags
refresh_windows(ps);
}

View file

@ -24,10 +24,6 @@
#include "wm/win.h"
#include "x.h"
enum root_flags {
ROOT_FLAGS_CONFIGURED = 2 // Received configure notify on the root window
};
// == Functions ==
// TODO(yshui) move static inline functions that are only used in picom.c, into picom.c
@ -41,7 +37,7 @@ void queue_redraw(session_t *ps);
void discard_pending(session_t *ps, uint32_t sequence);
void set_root_flags(session_t *ps, uint64_t flags);
void configure_root(session_t *ps);
void quit(session_t *ps);