dbus: simplify getting focused window
Remove find_focused Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
20e60a87fa
commit
51476cafa4
16
src/common.h
16
src/common.h
|
@ -437,22 +437,6 @@ static inline bool bkend_use_glx(session_t *ps) {
|
|||
return BKEND_GLX == ps->o.backend || BKEND_XR_GLX_HYBRID == ps->o.backend;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find out the currently focused window.
|
||||
*
|
||||
* @return struct win object of the found window, NULL if not found
|
||||
*/
|
||||
static inline struct managed_win *find_focused(session_t *ps) {
|
||||
if (!ps->o.track_focus) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ps->active_win && win_is_focused_real(ps, ps->active_win)) {
|
||||
return ps->active_win;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void set_ignore(session_t *ps, unsigned long sequence) {
|
||||
if (ps->o.show_all_xerrors)
|
||||
return;
|
||||
|
|
|
@ -931,9 +931,8 @@ static bool cdbus_process_find_win(session_t *ps, DBusMessage *msg) {
|
|||
}
|
||||
// Find focused window
|
||||
else if (!strcmp("focused", target)) {
|
||||
auto w = find_focused(ps);
|
||||
if (w) {
|
||||
wid = w->base.id;
|
||||
if (ps->active_win && ps->active_win->state != WSTATE_UNMAPPED) {
|
||||
wid = ps->active_win->base.id;
|
||||
}
|
||||
} else {
|
||||
log_error(CDBUS_ERROR_BADTGT_S, target);
|
||||
|
|
Loading…
Reference in New Issue