mirror of https://github.com/yshui/picom.git
x: remove more of session_t parameters
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
d61fa6eb0c
commit
f5fb2648fd
|
@ -636,7 +636,7 @@ backend_t *backend_xrender_init(session_t *ps) {
|
||||||
}
|
}
|
||||||
xd->curr_back = 0;
|
xd->curr_back = 0;
|
||||||
|
|
||||||
xcb_pixmap_t root_pixmap = x_get_root_back_pixmap(ps);
|
xcb_pixmap_t root_pixmap = x_get_root_back_pixmap(ps->c, ps->root, ps->atoms);
|
||||||
if (root_pixmap == XCB_NONE) {
|
if (root_pixmap == XCB_NONE) {
|
||||||
xd->root_pict = solid_picture(ps->c, ps->root, false, 1, 0.5, 0.5, 0.5);
|
xd->root_pict = solid_picture(ps->c, ps->root, false, 1, 0.5, 0.5, 0.5);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -454,7 +454,7 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
|
||||||
ps->pending_updates = true;
|
ps->pending_updates = true;
|
||||||
} else {
|
} else {
|
||||||
// Destroy the root "image" if the wallpaper probably changed
|
// Destroy the root "image" if the wallpaper probably changed
|
||||||
if (x_is_root_back_pixmap_atom(ps, ev->atom)) {
|
if (x_is_root_back_pixmap_atom(ps->atoms, ev->atom)) {
|
||||||
root_damaged(ps);
|
root_damaged(ps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,7 +337,8 @@ uint32_t determine_evmask(session_t *ps, xcb_window_t wid, win_evmode_t mode) {
|
||||||
*/
|
*/
|
||||||
void update_ewmh_active_win(session_t *ps) {
|
void update_ewmh_active_win(session_t *ps) {
|
||||||
// Search for the window
|
// Search for the window
|
||||||
xcb_window_t wid = wid_get_prop_window(ps, ps->root, ps->atoms->a_NET_ACTIVE_WINDOW);
|
xcb_window_t wid =
|
||||||
|
wid_get_prop_window(ps->c, ps->root, ps->atoms->a_NET_ACTIVE_WINDOW);
|
||||||
auto w = find_win_all(ps, wid);
|
auto w = find_win_all(ps, wid);
|
||||||
|
|
||||||
// Mark the window focused. No need to unfocus the previous one.
|
// Mark the window focused. No need to unfocus the previous one.
|
||||||
|
@ -888,7 +889,7 @@ void root_damaged(session_t *ps) {
|
||||||
if (ps->root_image) {
|
if (ps->root_image) {
|
||||||
ps->backend_data->ops->release_image(ps->backend_data, ps->root_image);
|
ps->backend_data->ops->release_image(ps->backend_data, ps->root_image);
|
||||||
}
|
}
|
||||||
auto pixmap = x_get_root_back_pixmap(ps);
|
auto pixmap = x_get_root_back_pixmap(ps->c, ps->root, ps->atoms);
|
||||||
if (pixmap != XCB_NONE) {
|
if (pixmap != XCB_NONE) {
|
||||||
ps->root_image = ps->backend_data->ops->bind_pixmap(
|
ps->root_image = ps->backend_data->ops->bind_pixmap(
|
||||||
ps->backend_data, pixmap, x_get_visual_info(ps->c, ps->vis), false);
|
ps->backend_data, pixmap, x_get_visual_info(ps->c, ps->vis), false);
|
||||||
|
|
|
@ -595,7 +595,7 @@ static bool get_root_tile(session_t *ps) {
|
||||||
ps->root_tile_fill = false;
|
ps->root_tile_fill = false;
|
||||||
|
|
||||||
bool fill = false;
|
bool fill = false;
|
||||||
xcb_pixmap_t pixmap = x_get_root_back_pixmap(ps);
|
xcb_pixmap_t pixmap = x_get_root_back_pixmap(ps->c, ps->root, ps->atoms);
|
||||||
|
|
||||||
// Make sure the pixmap we got is valid
|
// Make sure the pixmap we got is valid
|
||||||
if (pixmap && !x_validate_pixmap(ps->c, pixmap))
|
if (pixmap && !x_validate_pixmap(ps->c, pixmap))
|
||||||
|
|
|
@ -1649,11 +1649,13 @@ void win_update_leader(session_t *ps, struct managed_win *w) {
|
||||||
|
|
||||||
// Read the leader properties
|
// Read the leader properties
|
||||||
if (ps->o.detect_transient && !leader) {
|
if (ps->o.detect_transient && !leader) {
|
||||||
leader = wid_get_prop_window(ps, w->client_win, ps->atoms->aWM_TRANSIENT_FOR);
|
leader =
|
||||||
|
wid_get_prop_window(ps->c, w->client_win, ps->atoms->aWM_TRANSIENT_FOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps->o.detect_client_leader && !leader) {
|
if (ps->o.detect_client_leader && !leader) {
|
||||||
leader = wid_get_prop_window(ps, w->client_win, ps->atoms->aWM_CLIENT_LEADER);
|
leader =
|
||||||
|
wid_get_prop_window(ps->c, w->client_win, ps->atoms->aWM_CLIENT_LEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
win_set_leader(ps, w, leader);
|
win_set_leader(ps, w, leader);
|
||||||
|
|
16
src/x.c
16
src/x.c
|
@ -93,10 +93,10 @@ winprop_info_t x_get_prop_info(xcb_connection_t *c, xcb_window_t w, xcb_atom_t a
|
||||||
*
|
*
|
||||||
* @return the value if successful, 0 otherwise
|
* @return the value if successful, 0 otherwise
|
||||||
*/
|
*/
|
||||||
xcb_window_t wid_get_prop_window(session_t *ps, xcb_window_t wid, xcb_atom_t aprop) {
|
xcb_window_t wid_get_prop_window(xcb_connection_t *c, xcb_window_t wid, xcb_atom_t aprop) {
|
||||||
// Get the attribute
|
// Get the attribute
|
||||||
xcb_window_t p = XCB_NONE;
|
xcb_window_t p = XCB_NONE;
|
||||||
winprop_t prop = x_get_prop(ps->c, wid, aprop, 1L, XCB_ATOM_WINDOW, 32);
|
winprop_t prop = x_get_prop(c, wid, aprop, 1L, XCB_ATOM_WINDOW, 32);
|
||||||
|
|
||||||
// Return it
|
// Return it
|
||||||
if (prop.nitems) {
|
if (prop.nitems) {
|
||||||
|
@ -590,14 +590,14 @@ static const char *background_props_str[] = {
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
xcb_pixmap_t x_get_root_back_pixmap(session_t *ps) {
|
xcb_pixmap_t
|
||||||
|
x_get_root_back_pixmap(xcb_connection_t *c, xcb_window_t root, struct atom *atoms) {
|
||||||
xcb_pixmap_t pixmap = XCB_NONE;
|
xcb_pixmap_t pixmap = XCB_NONE;
|
||||||
|
|
||||||
// Get the values of background attributes
|
// Get the values of background attributes
|
||||||
for (int p = 0; background_props_str[p]; p++) {
|
for (int p = 0; background_props_str[p]; p++) {
|
||||||
xcb_atom_t prop_atom = get_atom(ps->atoms, background_props_str[p]);
|
xcb_atom_t prop_atom = get_atom(atoms, background_props_str[p]);
|
||||||
winprop_t prop =
|
winprop_t prop = x_get_prop(c, root, prop_atom, 1, XCB_ATOM_PIXMAP, 32);
|
||||||
x_get_prop(ps->c, ps->root, prop_atom, 1, XCB_ATOM_PIXMAP, 32);
|
|
||||||
if (prop.nitems) {
|
if (prop.nitems) {
|
||||||
pixmap = (xcb_pixmap_t)*prop.p32;
|
pixmap = (xcb_pixmap_t)*prop.p32;
|
||||||
free_winprop(&prop);
|
free_winprop(&prop);
|
||||||
|
@ -609,9 +609,9 @@ xcb_pixmap_t x_get_root_back_pixmap(session_t *ps) {
|
||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool x_is_root_back_pixmap_atom(session_t *ps, xcb_atom_t atom) {
|
bool x_is_root_back_pixmap_atom(struct atom *atoms, xcb_atom_t atom) {
|
||||||
for (int p = 0; background_props_str[p]; p++) {
|
for (int p = 0; background_props_str[p]; p++) {
|
||||||
xcb_atom_t prop_atom = get_atom(ps->atoms, background_props_str[p]);
|
xcb_atom_t prop_atom = get_atom(atoms, background_props_str[p]);
|
||||||
if (prop_atom == atom) {
|
if (prop_atom == atom) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
9
src/x.h
9
src/x.h
|
@ -16,6 +16,7 @@
|
||||||
#include "region.h"
|
#include "region.h"
|
||||||
|
|
||||||
typedef struct session session_t;
|
typedef struct session session_t;
|
||||||
|
struct atom;
|
||||||
|
|
||||||
/// Structure representing Window property value.
|
/// Structure representing Window property value.
|
||||||
typedef struct winprop {
|
typedef struct winprop {
|
||||||
|
@ -152,7 +153,7 @@ static inline void x_discard_events(xcb_connection_t *c) {
|
||||||
*
|
*
|
||||||
* @return the value if successful, 0 otherwise
|
* @return the value if successful, 0 otherwise
|
||||||
*/
|
*/
|
||||||
xcb_window_t wid_get_prop_window(session_t *ps, xcb_window_t wid, xcb_atom_t aprop);
|
xcb_window_t wid_get_prop_window(xcb_connection_t *c, xcb_window_t wid, xcb_atom_t aprop);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of a text property of a window.
|
* Get the value of a text property of a window.
|
||||||
|
@ -247,12 +248,14 @@ static inline void free_winprop(winprop_t *pprop) {
|
||||||
pprop->r = NULL;
|
pprop->r = NULL;
|
||||||
pprop->nitems = 0;
|
pprop->nitems = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the back pixmap of the root window
|
/// Get the back pixmap of the root window
|
||||||
xcb_pixmap_t x_get_root_back_pixmap(session_t *ps);
|
xcb_pixmap_t
|
||||||
|
x_get_root_back_pixmap(xcb_connection_t *c, xcb_window_t root, struct atom *atoms);
|
||||||
|
|
||||||
/// Return true if the atom refers to a property name that is used for the
|
/// Return true if the atom refers to a property name that is used for the
|
||||||
/// root window background pixmap
|
/// root window background pixmap
|
||||||
bool x_is_root_back_pixmap_atom(session_t *ps, xcb_atom_t atom);
|
bool x_is_root_back_pixmap_atom(struct atom *atoms, xcb_atom_t atom);
|
||||||
|
|
||||||
bool x_fence_sync(xcb_connection_t *, xcb_sync_fence_t);
|
bool x_fence_sync(xcb_connection_t *, xcb_sync_fence_t);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue