MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / handleWindowZOrder

Method handleWindowZOrder

src/ui/manager.cpp:559–600  ·  view source on GitHub ↗

Handles Z order: Send the window to top (only when you click in a window that aren't the desktop).

Source from the content-addressed store, hash-verified

557// Handles Z order: Send the window to top (only when you click in a
558// window that aren't the desktop).
559void 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
602void Manager::dispatchMessages()
603{

Callers

nothing calls this directly

Calls 10

windowMethod · 0.80
managerMethod · 0.80
isDesktopMethod · 0.80
isForegroundMethod · 0.80
getTopWindowMethod · 0.80
removeChildMethod · 0.80
isOnTopMethod · 0.80
insertChildMethod · 0.80
sizeMethod · 0.45
invalidateMethod · 0.45

Tested by

no test coverage detected