Handles Z order: Send the window to top (only when you click in a window that aren't the desktop).
| 557 | // Handles Z order: Send the window to top (only when you click in a |
| 558 | // window that aren't the desktop). |
| 559 | void Manager::handleWindowZOrder() |
| 560 | { |
| 561 | if (capture_widget || !mouse_widget) |
| 562 | return; |
| 563 | |
| 564 | // The clicked window |
| 565 | Window* window = mouse_widget->window(); |
| 566 | Manager* win_manager = (window ? window->manager(): NULL); |
| 567 | |
| 568 | if ((window) && |
| 569 | // We cannot change Z-order of desktop windows |
| 570 | (!window->isDesktop()) && |
| 571 | // We cannot change Z order of foreground windows because a |
| 572 | // foreground window can launch other background windows |
| 573 | // which should be kept on top of the foreground one. |
| 574 | (!window->isForeground()) && |
| 575 | // If the window is not already the top window of the manager. |
| 576 | (window != win_manager->getTopWindow())) { |
| 577 | base::ScopedValue<Widget*> scoped(m_lockedWindow, window, NULL); |
| 578 | |
| 579 | // Put it in the top of the list |
| 580 | win_manager->removeChild(window); |
| 581 | |
| 582 | if (window->isOnTop()) |
| 583 | win_manager->insertChild(0, window); |
| 584 | else { |
| 585 | int pos = (int)win_manager->children().size(); |
| 586 | UI_FOREACH_WIDGET_BACKWARD(win_manager->children(), it) { |
| 587 | if (static_cast<Window*>(*it)->isOnTop()) |
| 588 | break; |
| 589 | |
| 590 | --pos; |
| 591 | } |
| 592 | win_manager->insertChild(pos, window); |
| 593 | } |
| 594 | |
| 595 | window->invalidate(); |
| 596 | } |
| 597 | |
| 598 | // Put the focus |
| 599 | setFocus(mouse_widget); |
| 600 | } |
| 601 | |
| 602 | void Manager::dispatchMessages() |
| 603 | { |
nothing calls this directly
no test coverage detected