Changeset View
Changeset View
Standalone View
Standalone View
placement.cpp
Show First 20 Lines • Show All 601 Lines • ▼ Show 20 Line(s) | |||||
602 | { | 602 | { | ||
603 | if (nextPlacement == Unknown) | 603 | if (nextPlacement == Unknown) | ||
604 | nextPlacement = Smart; | 604 | nextPlacement = Smart; | ||
605 | if (c->isMaximizable() && c->maxSize().width() >= area.width() && c->maxSize().height() >= area.height()) { | 605 | if (c->isMaximizable() && c->maxSize().width() >= area.width() && c->maxSize().height() >= area.height()) { | ||
606 | if (workspace()->clientArea(MaximizeArea, c) == area) | 606 | if (workspace()->clientArea(MaximizeArea, c) == area) | ||
607 | c->maximize(MaximizeFull); | 607 | c->maximize(MaximizeFull); | ||
608 | else { // if the geometry doesn't match default maximize area (xinerama case?), | 608 | else { // if the geometry doesn't match default maximize area (xinerama case?), | ||
609 | // it's probably better to use the given area | 609 | // it's probably better to use the given area | ||
610 | if (Client *client = qobject_cast<Client*>(c)) { | 610 | c->setGeometry(area); | ||
611 | client->setGeometry(area); | | |||
612 | } | | |||
613 | } | 611 | } | ||
614 | } else { | 612 | } else { | ||
615 | c->resizeWithChecks(c->maxSize().boundedTo(area.size())); | 613 | c->resizeWithChecks(c->maxSize().boundedTo(area.size())); | ||
616 | place(c, area, nextPlacement); | 614 | place(c, area, nextPlacement); | ||
617 | } | 615 | } | ||
618 | } | 616 | } | ||
619 | 617 | | |||
620 | void Placement::cascadeDesktop() | 618 | void Placement::cascadeDesktop() | ||
621 | { | 619 | { | ||
622 | // TODO XINERAMA this probably is not right for xinerama | 620 | // TODO XINERAMA this probably is not right for xinerama | ||
623 | Workspace *ws = Workspace::self(); | 621 | Workspace *ws = Workspace::self(); | ||
624 | const int desktop = VirtualDesktopManager::self()->current(); | 622 | const int desktop = VirtualDesktopManager::self()->current(); | ||
625 | reinitCascading(desktop); | 623 | reinitCascading(desktop); | ||
626 | // TODO: make area const once placeFoo methods are fixed to take a const QRect& | 624 | // TODO: make area const once placeFoo methods are fixed to take a const QRect& | ||
627 | QRect area = ws->clientArea(PlacementArea, QPoint(0, 0), desktop); | 625 | QRect area = ws->clientArea(PlacementArea, QPoint(0, 0), desktop); | ||
628 | foreach (Toplevel *toplevel, ws->stackingOrder()) { | 626 | foreach (Toplevel *toplevel, ws->stackingOrder()) { | ||
629 | Client *client = qobject_cast<Client*>(toplevel); | 627 | auto client = qobject_cast<AbstractClient*>(toplevel); | ||
630 | if (!client || | 628 | if (!client || | ||
631 | (!client->isOnCurrentDesktop()) || | 629 | (!client->isOnCurrentDesktop()) || | ||
632 | (client->isMinimized()) || | 630 | (client->isMinimized()) || | ||
633 | (client->isOnAllDesktops()) || | 631 | (client->isOnAllDesktops()) || | ||
634 | (!client->isMovable())) | 632 | (!client->isMovable())) | ||
635 | continue; | 633 | continue; | ||
636 | placeCascaded(client, area); | 634 | placeCascaded(client, area); | ||
637 | } | 635 | } | ||
638 | } | 636 | } | ||
639 | 637 | | |||
640 | void Placement::unclutterDesktop() | 638 | void Placement::unclutterDesktop() | ||
641 | { | 639 | { | ||
642 | const ClientList &clients = Workspace::self()->clientList(); | 640 | const auto &clients = Workspace::self()->allClientList(); | ||
643 | for (int i = clients.size() - 1; i >= 0; i--) { | 641 | for (int i = clients.size() - 1; i >= 0; i--) { | ||
644 | Client *client = clients.at(i); | 642 | auto client = clients.at(i); | ||
645 | if ((!client->isOnCurrentDesktop()) || | 643 | if ((!client->isOnCurrentDesktop()) || | ||
646 | (client->isMinimized()) || | 644 | (client->isMinimized()) || | ||
647 | (client->isOnAllDesktops()) || | 645 | (client->isOnAllDesktops()) || | ||
648 | (!client->isMovable())) | 646 | (!client->isMovable())) | ||
649 | continue; | 647 | continue; | ||
650 | placeSmart(client, QRect()); | 648 | placeSmart(client, QRect()); | ||
651 | } | 649 | } | ||
652 | } | 650 | } | ||
▲ Show 20 Lines • Show All 371 Lines • Show Last 20 Lines |