void Client::focus() { const bool takeFocus = mProtocols.count(Atoms::WM_TAKE_FOCUS) > 0; if (mNoFocus && !takeFocus) return; WindowManager *wm = WindowManager::instance(); if (takeFocus) { xcb_client_message_event_t event; memset(&event, '\0', sizeof(event)); event.response_type = XCB_CLIENT_MESSAGE; event.window = mWindow; event.format = 32; event.type = Atoms::WM_PROTOCOLS; event.data.data32[0] = Atoms::WM_TAKE_FOCUS; event.data.data32[1] = wm->timestamp(); xcb_send_event(wm->connection(), false, mWindow, XCB_EVENT_MASK_NO_EVENT, reinterpret_cast<char*>(&event)); } xcb_set_input_focus(wm->connection(), XCB_INPUT_FOCUS_PARENT, mWindow, wm->timestamp()); //error() << "Setting input focus to client" << mWindow << mClass.className; xcb_ewmh_set_active_window(wm->ewmhConnection(), mScreenNumber, mWindow); wm->setFocusedClient(this); if (mWorkspace) mWorkspace->updateFocus(this); }
void ewmh_update_active_window(void) { xcb_window_t win = ((mon->desk->focus == NULL || mon->desk->focus->client == NULL) ? XCB_NONE : mon->desk->focus->id); xcb_ewmh_set_active_window(ewmh, default_screen, win); }
inline void ewmh_update_active_window(const xcb_window_t win) { xcb_ewmh_set_active_window(cfg.ewmh, cfg.def_screen, (win == 0) ? XCB_NONE : win); }