win: always track property changes
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
3ba7a2aa4d
commit
ee35bd873a
11
src/c2.c
11
src/c2.c
|
@ -1028,17 +1028,6 @@ static bool c2_l_postprocess(session_t *ps, c2_l_t *pleaf) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable specific tracking options, if needed by the condition
|
|
||||||
// TODO: Add track_leader
|
|
||||||
switch (pleaf->predef) {
|
|
||||||
// case C2_L_PROUNDED: ps->o.detect_rounded_corners = true; break;
|
|
||||||
case C2_L_PNAME:
|
|
||||||
case C2_L_PCLASSG:
|
|
||||||
case C2_L_PCLASSI:
|
|
||||||
case C2_L_PROLE: ps->o.track_wdata = true; break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warn about lower case characters in target name
|
// Warn about lower case characters in target name
|
||||||
if (pleaf->predef == C2_L_PUNDEFINED) {
|
if (pleaf->predef == C2_L_PUNDEFINED) {
|
||||||
for (const char *pc = pleaf->tgt; *pc; ++pc) {
|
for (const char *pc = pleaf->tgt; *pc; ++pc) {
|
||||||
|
|
|
@ -559,7 +559,6 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable,
|
||||||
.detect_client_leader = false,
|
.detect_client_leader = false,
|
||||||
.no_ewmh_fullscreen = false,
|
.no_ewmh_fullscreen = false,
|
||||||
|
|
||||||
.track_wdata = false,
|
|
||||||
.track_leader = false,
|
.track_leader = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -228,8 +228,6 @@ typedef struct options {
|
||||||
bool detect_client_leader;
|
bool detect_client_leader;
|
||||||
|
|
||||||
// === Calculated ===
|
// === Calculated ===
|
||||||
/// Whether we need to track window name and class.
|
|
||||||
bool track_wdata;
|
|
||||||
/// Whether we need to track window leaders.
|
/// Whether we need to track window leaders.
|
||||||
bool track_leader;
|
bool track_leader;
|
||||||
|
|
||||||
|
|
|
@ -1047,7 +1047,6 @@ static bool cdbus_process_opts_get(session_t *ps, DBusMessage *msg) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cdbus_m_opts_get_stub(track_focus, cdbus_reply_bool, true);
|
cdbus_m_opts_get_stub(track_focus, cdbus_reply_bool, true);
|
||||||
cdbus_m_opts_get_do(track_wdata, cdbus_reply_bool);
|
|
||||||
cdbus_m_opts_get_do(track_leader, cdbus_reply_bool);
|
cdbus_m_opts_get_do(track_leader, cdbus_reply_bool);
|
||||||
#undef cdbus_m_opts_get_do
|
#undef cdbus_m_opts_get_do
|
||||||
#undef cdbus_m_opts_get_stub
|
#undef cdbus_m_opts_get_stub
|
||||||
|
|
|
@ -495,8 +495,7 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
|
||||||
}
|
}
|
||||||
|
|
||||||
// If name changes
|
// If name changes
|
||||||
if (ps->o.track_wdata &&
|
if (ps->atoms->aWM_NAME == ev->atom || ps->atoms->a_NET_WM_NAME == ev->atom) {
|
||||||
(ps->atoms->aWM_NAME == ev->atom || ps->atoms->a_NET_WM_NAME == ev->atom)) {
|
|
||||||
auto w = find_toplevel(ps, ev->window);
|
auto w = find_toplevel(ps, ev->window);
|
||||||
if (w && win_update_name(ps, w) == 1) {
|
if (w && win_update_name(ps, w) == 1) {
|
||||||
win_on_factor_change(ps, w);
|
win_on_factor_change(ps, w);
|
||||||
|
@ -504,7 +503,7 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
|
||||||
}
|
}
|
||||||
|
|
||||||
// If class changes
|
// If class changes
|
||||||
if (ps->o.track_wdata && ps->atoms->aWM_CLASS == ev->atom) {
|
if (ps->atoms->aWM_CLASS == ev->atom) {
|
||||||
auto w = find_toplevel(ps, ev->window);
|
auto w = find_toplevel(ps, ev->window);
|
||||||
if (w) {
|
if (w) {
|
||||||
win_get_class(ps, w);
|
win_get_class(ps, w);
|
||||||
|
@ -513,7 +512,7 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
|
||||||
}
|
}
|
||||||
|
|
||||||
// If role changes
|
// If role changes
|
||||||
if (ps->o.track_wdata && ps->atoms->aWM_WINDOW_ROLE == ev->atom) {
|
if (ps->atoms->aWM_WINDOW_ROLE == ev->atom) {
|
||||||
auto w = find_toplevel(ps, ev->window);
|
auto w = find_toplevel(ps, ev->window);
|
||||||
if (w && 1 == win_get_role(ps, w)) {
|
if (w && 1 == win_get_role(ps, w)) {
|
||||||
win_on_factor_change(ps, w);
|
win_on_factor_change(ps, w);
|
||||||
|
|
|
@ -309,10 +309,8 @@ uint32_t determine_evmask(session_t *ps, xcb_window_t wid, win_evmode_t mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it's a mapped client window
|
// Check if it's a mapped client window
|
||||||
if (WIN_EVMODE_CLIENT == mode ||
|
if (mode == WIN_EVMODE_CLIENT ||
|
||||||
((w = find_toplevel(ps, wid)) && w->a.map_state == XCB_MAP_STATE_VIEWABLE)) {
|
((w = find_toplevel(ps, wid)) && w->a.map_state == XCB_MAP_STATE_VIEWABLE)) {
|
||||||
if (ps->o.frame_opacity > 0 || ps->o.track_wdata || ps->track_atom_lst ||
|
|
||||||
ps->o.detect_client_opacity)
|
|
||||||
evmask |= XCB_EVENT_MASK_PROPERTY_CHANGE;
|
evmask |= XCB_EVENT_MASK_PROPERTY_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1008,11 +1008,9 @@ void win_mark_client(session_t *ps, struct managed_win *w, xcb_window_t client)
|
||||||
win_update_leader(ps, w);
|
win_update_leader(ps, w);
|
||||||
|
|
||||||
// Get window name and class if we are tracking them
|
// Get window name and class if we are tracking them
|
||||||
if (ps->o.track_wdata) {
|
|
||||||
win_update_name(ps, w);
|
win_update_name(ps, w);
|
||||||
win_get_class(ps, w);
|
win_get_class(ps, w);
|
||||||
win_get_role(ps, w);
|
win_get_role(ps, w);
|
||||||
}
|
|
||||||
|
|
||||||
// Update everything related to conditions
|
// Update everything related to conditions
|
||||||
win_on_factor_change(ps, w);
|
win_on_factor_change(ps, w);
|
||||||
|
|
Loading…
Reference in New Issue