void switch_to_desktop(int desktop) { xcb_atom_t atom = get_atom("_NET_CURRENT_DESKTOP"); uint32_t data[5] = {desktop, 0, 0, 0, 0}; send_client_message(scrn->root, scrn->root, atom, data); xcb_flush(conn); }
void focus_window(xcb_window_t window) { xcb_atom_t atom = get_atom("_NET_ACTIVE_WINDOW"); uint32_t data[5] = {2, 0, 0, 0, 0}; send_client_message(scrn->root, window, atom, data); xcb_flush(conn); }
void window_close(node_t *n) { if (n == NULL) { return; } else if (n->client != NULL) { send_client_message(n->id, ewmh->WM_PROTOCOLS, WM_DELETE_WINDOW); } else { window_close(n->first_child); window_close(n->second_child); } }
void Server::send_message_to_all_other_clients(std::string name, std::string buff) { typedef std::map< std::string, TCPsocket >::iterator it_type; for(it_type i = clients.begin(); i != clients.end(); i++) { if (i->first != name) { send_client_message(i->first, buff); } } }
void set_input_focus(node_t *n) { if (n == NULL || n->client == NULL) { clear_input_focus(); } else { if (n->client->icccm_input) { xcb_set_input_focus(dpy, XCB_INPUT_FOCUS_PARENT, n->id, XCB_CURRENT_TIME); } else if (n->client->icccm_focus) { send_client_message(n->id, ewmh->WM_PROTOCOLS, WM_TAKE_FOCUS); } } }
void foreign_callback_call(const char *id) { fl_open_display(); init_foreign_callback_atom_once(); ::Window dummy, root, *children = 0; unsigned int nchildren, id_hash; root = RootWindow(fl_display, fl_screen); XQueryTree(fl_display, root, &dummy, &dummy, &children, &nchildren); if(!nchildren) return; id_hash = str_hash(id); for(unsigned int i = 0; i < nchildren; i++) { if(children[i] != root) send_client_message(children[i], _XA_EDELIB_FOREIGN_CALLBACK, id_hash); } XFree(children); XSync(fl_display, False); }
/** * Sends a dummy event to the specified window * Used to interrupt blocking wait call * * @XXX: Find the proper way to interrupt the blocking wait * except the obvious event polling */ void connection::send_dummy_event(xcb_window_t target, uint32_t event) const { if (target == XCB_NONE) target = root(); auto message = make_client_message(XCB_NONE, target); send_client_message(message, target, event); }