Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Manager::CreateNotifyEvent(XCreateWindowEvent *new_client) {
- DEBUG() << new_client->window;
- XWindowAttributes attributes;
- if (new_client->override_redirect || !XGetWindowAttributes(dpy, new_client->window, &attributes))
- return;
- if (attributes.c_class == InputOnly || new_client->parent == root && isCubeName(new_client->window))
- return;
- auto *client = new Client(dpy, new_client->window, attributes);
- auto parent = new_client->parent;
- if (parent == root) {
- if (app1_list.empty()) {
- app1_list.push_front(client);
- lastInFirstVec = true;
- } else if (app2_list.empty()){
- app2_list.push_front(client);
- lastInFirstVec = false;
- } else {
- DEBUG() << "WARNING: added more then 2 clients";
- if (lastInFirstVec) {
- app2_list.push_front(client);
- } else {
- app1_list.push_front(client);
- }
- }
- } else {
- std::list<Client *>::iterator parent_it = findIterFirstApp(parent);
- if (parent_it != app1_list.end()) {
- app1_list.insert(parent_it, client);
- } else {
- parent_it = findIterSecondApp(parent);
- if (parent_it != app2_list.end()) {
- app2_list.insert(parent_it, client);
- } else {
- DEBUG() << "WARNING: unknown parent for current client";
- if (lastInFirstVec) {
- app2_list.push_front(client);
- } else {
- app1_list.push_front(client);
- }
- }
- }
- }
- DEBUG() << attributes.visual;
- client_list.push_front(client);
- }
- std::list<Client *>::iterator Manager::findIterFirstApp(const Window &window) {
- for (auto cli : app1_list) {
- if (cli->getWindow() == window)
- return std::find(app1_list.begin(), app1_list.end(), cli);
- }
- return app1_list.end();
- }
- std::list<Client *>::iterator Manager::findIterSecondApp(const Window &window) {
- for (auto cli : app2_list) {
- if (cli->getWindow() == window)
- return std::find(app2_list.begin(), app2_list.end(), cli);
- }
- return app2_list.end();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement