dbus: simplify getting focused window

Remove find_focused

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-05-24 22:53:11 +01:00
parent 20e60a87fa
commit 51476cafa4
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
2 changed files with 2 additions and 19 deletions

View File

@ -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;

View File

@ -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);