diff --git a/dbus-examples/cdbus-driver.sh b/dbus-examples/cdbus-driver.sh index 6215816..fd8741a 100755 --- a/dbus-examples/cdbus-driver.sh +++ b/dbus-examples/cdbus-driver.sh @@ -25,9 +25,6 @@ type_enum='uint16' # List all window ID compton manages (except destroyed ones) dbus-send --print-reply --dest="$service" "$object" "${interface}.list_win" -# Ensure we are tracking focus -dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_set" string:track_focus boolean:true - # Get window ID of currently focused window focused=$(dbus-send --print-reply --dest="$service" "$object" "${interface}.find_win" string:focused | $SED -n 's/^[[:space:]]*'${type_win}'[[:space:]]*\([[:digit:]]*\).*/\1/p') diff --git a/dbus-examples/inverter.sh b/dbus-examples/inverter.sh index 8cb7d46..3513f92 100755 --- a/dbus-examples/inverter.sh +++ b/dbus-examples/inverter.sh @@ -43,7 +43,6 @@ if [ -z "$1" -o "$1" = "selected" ]; then window=$(xwininfo -frame | sed -n 's/^xwininfo: Window id: \(0x[[:xdigit:]][[:xdigit:]]*\).*/\1/p') # Select window by mouse elif [ "$1" = "focused" ]; then # Ensure we are tracking focus - ${compton_dbus}opts_set string:track_focus boolean:true & window=$(${compton_dbus}find_win string:focused | $SED -n 's/^[[:space:]]*'${type_win}'[[:space:]]*\([[:digit:]]*\).*/\1/p') # Query compton for the active window elif echo "$1" | grep -Eiq '^([[:digit:]][[:digit:]]*|0x[[:xdigit:]][[:xdigit:]]*)$'; then window="$1" # Accept user-specified window-id if the format is correct diff --git a/src/c2.c b/src/c2.c index ad484a4..f2db608 100644 --- a/src/c2.c +++ b/src/c2.c @@ -1031,7 +1031,6 @@ static bool c2_l_postprocess(session_t *ps, c2_l_t *pleaf) { // Enable specific tracking options in compton if needed by the condition // TODO: Add track_leader switch (pleaf->predef) { - case C2_L_PFOCUSED: ps->o.track_focus = true; break; // case C2_L_PROUNDED: ps->o.detect_rounded_corners = true; break; case C2_L_PNAME: case C2_L_PCLASSG: diff --git a/src/common.h b/src/common.h index 6adbd19..63019fb 100644 --- a/src/common.h +++ b/src/common.h @@ -491,9 +491,6 @@ void force_repaint(session_t *ps); /** @name DBus hooks */ ///@{ - -void opts_init_track_focus(session_t *ps); - void opts_set_no_fading_openclose(session_t *ps, bool newval); //!@} #endif diff --git a/src/compton.c b/src/compton.c index cb6489e..27b0aef 100644 --- a/src/compton.c +++ b/src/compton.c @@ -297,8 +297,9 @@ uint32_t determine_evmask(session_t *ps, xcb_window_t wid, win_evmode_t mode) { if (WIN_EVMODE_FRAME == mode || ((w = find_managed_win(ps, wid)) && w->a.map_state == XCB_MAP_STATE_VIEWABLE)) { evmask |= XCB_EVENT_MASK_PROPERTY_CHANGE; - if (ps->o.track_focus && !ps->o.use_ewmh_active_win) + if (!ps->o.use_ewmh_active_win) { evmask |= XCB_EVENT_MASK_FOCUS_CHANGE; + } } // Check if it's a mapped client window @@ -807,36 +808,6 @@ void force_repaint(session_t *ps) { */ ///@{ -/** - * Enable focus tracking. - */ -void opts_init_track_focus(session_t *ps) { - // Already tracking focus - if (ps->o.track_focus) - return; - - ps->o.track_focus = true; - - if (!ps->o.use_ewmh_active_win) { - // Start listening to FocusChange events - HASH_ITER2(ps->windows, w) { - if (!w->managed) { - continue; - } - auto mw = (struct managed_win *)w; - if (mw->a.map_state == XCB_MAP_STATE_VIEWABLE) { - xcb_change_window_attributes( - ps->c, w->id, XCB_CW_EVENT_MASK, - (const uint32_t[]){ - determine_evmask(ps, w->id, WIN_EVMODE_FRAME)}); - } - } - } - - // Recheck focus - recheck_focus(ps); -} - /** * Set no_fading_openclose option. * @@ -1506,7 +1477,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy, .detect_transient = false, .detect_client_leader = false, - .track_focus = false, .track_wdata = false, .track_leader = false, }, @@ -1991,9 +1961,7 @@ static session_t *session_init(int argc, char **argv, Display *dpy, } } - if (ps->o.track_focus) { - recheck_focus(ps); - } + recheck_focus(ps); e = xcb_request_check(ps->c, xcb_ungrab_server(ps->c)); if (e) { diff --git a/src/config.h b/src/config.h index 685bfd9..075c98c 100644 --- a/src/config.h +++ b/src/config.h @@ -217,8 +217,6 @@ typedef struct options_t { bool detect_client_leader; // === Calculated === - /// Whether compton needs to track focus changes. - bool track_focus; /// Whether compton needs to track window name and class. bool track_wdata; /// Whether compton needs to track window leaders. diff --git a/src/dbus.c b/src/dbus.c index 07af63c..d06c596 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -1042,7 +1042,7 @@ static bool cdbus_process_opts_get(session_t *ps, DBusMessage *msg) { cdbus_m_opts_get_do(use_damage, cdbus_reply_bool); #endif - cdbus_m_opts_get_do(track_focus, cdbus_reply_bool); + 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); #undef cdbus_m_opts_get_do @@ -1128,18 +1128,12 @@ static bool cdbus_process_opts_set(session_t *ps, DBusMessage *msg) { } // clear_shadow - if (!strcmp("clear_shadow", target)) + if (!strcmp("clear_shadow", target)) { goto cdbus_process_opts_set_success; + } // track_focus if (!strcmp("track_focus", target)) { - dbus_bool_t val = FALSE; - if (!cdbus_msg_get_arg(msg, 1, DBUS_TYPE_BOOLEAN, &val)) - return false; - // You could enable this option, but never turn if off - if (val) { - opts_init_track_focus(ps); - } goto cdbus_process_opts_set_success; } diff --git a/src/event.c b/src/event.c index d29be49..16fc60a 100644 --- a/src/event.c +++ b/src/event.c @@ -266,9 +266,7 @@ static inline void ev_map_notify(session_t *ps, xcb_map_notify_event_t *ev) { map_win_by_id(ps, ev->window); // FocusIn/Out may be ignored when the window is unmapped, so we must // recheck focus here - if (ps->o.track_focus) { - recheck_focus(ps); - } + recheck_focus(ps); } static inline void ev_unmap_notify(session_t *ps, xcb_unmap_notify_event_t *ev) { @@ -402,7 +400,7 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t } if (ps->root == ev->window) { - if (ps->o.track_focus && ps->o.use_ewmh_active_win && + if (ps->o.use_ewmh_active_win && ps->atoms->a_NET_ACTIVE_WINDOW == ev->atom) { update_ewmh_active_win(ps); } else { diff --git a/src/options.c b/src/options.c index d9969ef..80f4540 100644 --- a/src/options.c +++ b/src/options.c @@ -806,11 +806,6 @@ void get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, // Other variables determined by options - // Determine whether we need to track focus changes - if (opt->inactive_opacity != opt->active_opacity || opt->inactive_dim > 0) { - opt->track_focus = true; - } - // Determine whether we track window grouping if (opt->detect_transient || opt->detect_client_leader) { opt->track_leader = true;