/*--------------------------------------------------------------------------------------------- * (function: getNodeTable) *-------------------------------------------------------------------------------------------*/ QHash<QString, nnode_t *> OdinInterface::getNodeTable() { int i, items; items = 0; for (i = 0; i < verilog_netlist->num_top_input_nodes; i++){ nodequeue.enqueue(verilog_netlist->top_input_nodes[i]); //enqueue_node_if_ready(queue,netlist->top_input_nodes[i],cycle); } // Enqueue constant nodes. nnode_t *constant_nodes[] = {verilog_netlist->gnd_node, verilog_netlist->vcc_node, verilog_netlist->pad_node}; int num_constant_nodes = 3; for (i = 0; i < num_constant_nodes; i++){ nodequeue.enqueue(constant_nodes[i]); //enqueue_node_if_ready(queue,constant_nodes[i],cycle); } // go through the netlist. While doing so // remove nodes from the queue and add followup nodes nnode_t *node; QHash<QString, nnode_t *> result; while(!nodequeue.isEmpty()){ node = nodequeue.dequeue(); items++; //remember name of the node so it is not processed again QString nodeName(node->name); //save node in hash, so it will be processed only once result[nodeName] = node; //Enqueue child nodes which are ready int num_children = 0; nnode_t **children = get_children_of(node, &num_children); //make sure children are not already done or in queue for(i=0; i< num_children; i++){ nnode_t *nodeKid = children[i]; QString kidName(nodeKid->name); //if not in queue and not yet processed if(!nodequeue.contains(nodeKid) && !result.contains(kidName)){ nodequeue.enqueue(nodeKid); } } } return result; }
/** * Handles an existing client that was unmapped, and is now being re-mapped. */ void ClientModel::remap_client(Window client) { if (!is_client(client)) return; std::vector<Window> children; get_children_of(client, children); Desktop *desktop = find_desktop(client); if (desktop->is_user_desktop()) { UserDesktop *user_desktop = dynamic_cast<UserDesktop*>(desktop); user_desktop->focus_cycle.add(client); for (std::vector<Window>::iterator child = children.begin(); child != children.end(); child++) { user_desktop->focus_cycle.add(*child); } focus(client); } else if (desktop->is_all_desktop()) { AllDesktops *all_desktop = dynamic_cast<AllDesktops*>(ALL_DESKTOPS); all_desktop->focus_cycle.add(client); for (std::vector<Window>::iterator child = children.begin(); child != children.end(); child++) { all_desktop->focus_cycle.add(*child); } focus(client); } // The event processor also needs to know that it should update the current // layering, since the window could have been raised since it was remapped Layer current_layer = m_layers.get_category_of(client); m_changes.push(new ChangeLayer(client, current_layer)); }
/** * This is just a way of directly sending an event to the ClientModel - we * don't do anything with it. */ void ClientModel::unmap_client(Window client) { if (!is_client(client)) return; std::vector<Window> children; get_children_of(client, children); Desktop *desktop = find_desktop(client); if (desktop->is_user_desktop()) { UserDesktop *user_desktop = dynamic_cast<UserDesktop*>(desktop); for (std::vector<Window>::iterator child = children.begin(); child != children.end(); child++) { user_desktop->focus_cycle.remove(*child, false); } user_desktop->focus_cycle.remove(client, false); sync_focus_to_cycle(); } else if (desktop->is_all_desktop()) { AllDesktops *all_desktop = dynamic_cast<AllDesktops*>(ALL_DESKTOPS); for (std::vector<Window>::iterator child = children.begin(); child != children.end(); child++) { all_desktop->focus_cycle.remove(*child, false); } all_desktop->focus_cycle.remove(client, false); sync_focus_to_cycle(); } m_changes.push(new UnmapChange(client)); }
/** * Converts all the information about a client window to a textual * representation, which is written to the output stream. */ void ClientModel::dump_client_info(Window client, std::ostream &output) { output << " Window: " << std::hex << client << "\n"; output << " Screen: " << std::dec << m_screen[client] << "\n"; output << " Layer: " << std::dec << static_cast<int>(m_layers.get_category_of(client)) << "\n"; Dimension2D &location = m_location[client]; output << " Location: X=" << DIM2D_X(location) << " Y=" << DIM2D_Y(location) << "\n"; Dimension2D &size = m_size[client]; output << " Size: W=" << DIM2D_WIDTH(size) << " H=" << DIM2D_HEIGHT(size) << "\n"; ClientPosScale mode = m_cps_mode[client]; output << " Mode: "; switch (mode) { case CPS_FLOATING: output << "floating"; break; case CPS_SPLIT_LEFT: output << "left-split"; break; case CPS_SPLIT_RIGHT: output << "right-split"; break; case CPS_SPLIT_TOP: output << "top-split"; break; case CPS_SPLIT_BOTTOM: output << "bottom-split"; break; case CPS_MAX: output << "maximized"; break; } output << "\n"; output << " Can autofocus? " << (m_autofocus[client] ? "yes" : "no") << "\n"; output << " Packing info: "; if (m_pack_corners.count(client) == 0) { output << "not packed"; } else { output << "Dir="; switch (m_pack_corners[client]) { case PACK_NORTHEAST: output << "NE"; break; case PACK_NORTHWEST: output << "NW"; break; case PACK_SOUTHEAST: output << "SE"; break; case PACK_SOUTHWEST: output << "SW"; break; } output << " Priority=" << m_pack_priority[client]; } output << "\n"; std::vector<Window> children; output << " Children\n"; get_children_of(client, children); for (std::vector<Window>::iterator childiter = children.begin(); childiter != children.end(); childiter++) { output << " " << std::hex << *childiter << "\n"; } }