Changeset View
Changeset View
Standalone View
Standalone View
group.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
49 | namespace KWin | 49 | namespace KWin | ||
50 | { | 50 | { | ||
51 | 51 | | |||
52 | //******************************************** | 52 | //******************************************** | ||
53 | // Group | 53 | // Group | ||
54 | //******************************************** | 54 | //******************************************** | ||
55 | 55 | | |||
56 | Group::Group(Window leader_P) | 56 | Group::Group(Window leader_P) | ||
57 | : leader_client(NULL), | 57 | : leader_client(nullptr), | ||
58 | leader_wid(leader_P), | 58 | leader_wid(leader_P), | ||
59 | leader_info(NULL), | 59 | leader_info(nullptr), | ||
60 | user_time(-1U), | 60 | user_time(-1U), | ||
61 | refcount(0) | 61 | refcount(0) | ||
62 | { | 62 | { | ||
63 | if (leader_P != None) { | 63 | if (leader_P != None) { | ||
64 | leader_client = workspace()->findClient(Predicate::WindowMatch, leader_P); | 64 | leader_client = workspace()->findClient(Predicate::WindowMatch, leader_P); | ||
65 | leader_info = new NETWinInfo(connection(), leader_P, rootWindow(), | 65 | leader_info = new NETWinInfo(connection(), leader_P, rootWindow(), | ||
66 | 0, NET::WM2StartupId); | 66 | 0, NET::WM2StartupId); | ||
67 | } | 67 | } | ||
68 | effect_group = new EffectWindowGroupImpl(this); | 68 | effect_group = new EffectWindowGroupImpl(this); | ||
69 | workspace()->addGroup(this); | 69 | workspace()->addGroup(this); | ||
70 | } | 70 | } | ||
71 | 71 | | |||
72 | Group::~Group() | 72 | Group::~Group() | ||
73 | { | 73 | { | ||
74 | delete leader_info; | 74 | delete leader_info; | ||
75 | delete effect_group; | 75 | delete effect_group; | ||
76 | } | 76 | } | ||
77 | 77 | | |||
78 | QIcon Group::icon() const | 78 | QIcon Group::icon() const | ||
79 | { | 79 | { | ||
80 | if (leader_client != NULL) | 80 | if (leader_client != nullptr) | ||
81 | return leader_client->icon(); | 81 | return leader_client->icon(); | ||
82 | else if (leader_wid != None) { | 82 | else if (leader_wid != None) { | ||
83 | QIcon ic; | 83 | QIcon ic; | ||
84 | NETWinInfo info(connection(), leader_wid, rootWindow(), NET::WMIcon, NET::WM2IconPixmap); | 84 | NETWinInfo info(connection(), leader_wid, rootWindow(), NET::WMIcon, NET::WM2IconPixmap); | ||
85 | auto readIcon = [&ic, &info, this](int size, bool scale = true) { | 85 | auto readIcon = [&ic, &info, this](int size, bool scale = true) { | ||
86 | const QPixmap pix = KWindowSystem::icon(leader_wid, size, size, scale, KWindowSystem::NETWM | KWindowSystem::WMHints, &info); | 86 | const QPixmap pix = KWindowSystem::icon(leader_wid, size, size, scale, KWindowSystem::NETWM | KWindowSystem::WMHints, &info); | ||
87 | if (!pix.isNull()) { | 87 | if (!pix.isNull()) { | ||
88 | ic.addPixmap(pix); | 88 | ic.addPixmap(pix); | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | |||||
138 | { | 138 | { | ||
139 | Q_ASSERT(leader_P->window() == leader_wid); | 139 | Q_ASSERT(leader_P->window() == leader_wid); | ||
140 | leader_client = leader_P; | 140 | leader_client = leader_P; | ||
141 | } | 141 | } | ||
142 | 142 | | |||
143 | void Group::lostLeader() | 143 | void Group::lostLeader() | ||
144 | { | 144 | { | ||
145 | Q_ASSERT(!_members.contains(leader_client)); | 145 | Q_ASSERT(!_members.contains(leader_client)); | ||
146 | leader_client = NULL; | 146 | leader_client = nullptr; | ||
147 | if (_members.isEmpty()) { | 147 | if (_members.isEmpty()) { | ||
148 | workspace()->removeGroup(this); | 148 | workspace()->removeGroup(this); | ||
149 | delete this; | 149 | delete this; | ||
150 | } | 150 | } | ||
151 | } | 151 | } | ||
152 | 152 | | |||
153 | //*************************************** | 153 | //*************************************** | ||
154 | // Workspace | 154 | // Workspace | ||
155 | //*************************************** | 155 | //*************************************** | ||
156 | 156 | | |||
157 | Group* Workspace::findGroup(xcb_window_t leader) const | 157 | Group* Workspace::findGroup(xcb_window_t leader) const | ||
158 | { | 158 | { | ||
159 | Q_ASSERT(leader != None); | 159 | Q_ASSERT(leader != None); | ||
160 | for (GroupList::ConstIterator it = groups.constBegin(); | 160 | for (GroupList::ConstIterator it = groups.constBegin(); | ||
161 | it != groups.constEnd(); | 161 | it != groups.constEnd(); | ||
162 | ++it) | 162 | ++it) | ||
163 | if ((*it)->leader() == leader) | 163 | if ((*it)->leader() == leader) | ||
164 | return *it; | 164 | return *it; | ||
165 | return NULL; | 165 | return nullptr; | ||
166 | } | 166 | } | ||
167 | 167 | | |||
168 | // Client is group transient, but has no group set. Try to find | 168 | // Client is group transient, but has no group set. Try to find | ||
169 | // group with windows with the same client leader. | 169 | // group with windows with the same client leader. | ||
170 | Group* Workspace::findClientLeaderGroup(const Client* c) const | 170 | Group* Workspace::findClientLeaderGroup(const Client* c) const | ||
171 | { | 171 | { | ||
172 | Group* ret = NULL; | 172 | Group* ret = nullptr; | ||
173 | for (ClientList::ConstIterator it = clients.constBegin(); | 173 | for (ClientList::ConstIterator it = clients.constBegin(); | ||
174 | it != clients.constEnd(); | 174 | it != clients.constEnd(); | ||
175 | ++it) { | 175 | ++it) { | ||
176 | if (*it == c) | 176 | if (*it == c) | ||
177 | continue; | 177 | continue; | ||
178 | if ((*it)->wmClientLeader() == c->wmClientLeader()) { | 178 | if ((*it)->wmClientLeader() == c->wmClientLeader()) { | ||
179 | if (ret == NULL || ret == (*it)->group()) | 179 | if (ret == nullptr || ret == (*it)->group()) | ||
180 | ret = (*it)->group(); | 180 | ret = (*it)->group(); | ||
181 | else { | 181 | else { | ||
182 | // There are already two groups with the same client leader. | 182 | // There are already two groups with the same client leader. | ||
183 | // This most probably means the app uses group transients without | 183 | // This most probably means the app uses group transients without | ||
184 | // setting group for its windows. Merging the two groups is a bad | 184 | // setting group for its windows. Merging the two groups is a bad | ||
185 | // hack, but there's no really good solution for this case. | 185 | // hack, but there's no really good solution for this case. | ||
186 | ClientList old_group = (*it)->group()->members(); | 186 | ClientList old_group = (*it)->group()->members(); | ||
187 | // old_group autodeletes when being empty | 187 | // old_group autodeletes when being empty | ||
▲ Show 20 Lines • Show All 246 Lines • ▼ Show 20 Line(s) | |||||
434 | void Client::setTransient(xcb_window_t new_transient_for_id) | 434 | void Client::setTransient(xcb_window_t new_transient_for_id) | ||
435 | { | 435 | { | ||
436 | if (new_transient_for_id != m_transientForId) { | 436 | if (new_transient_for_id != m_transientForId) { | ||
437 | removeFromMainClients(); | 437 | removeFromMainClients(); | ||
438 | Client *transient_for = nullptr; | 438 | Client *transient_for = nullptr; | ||
439 | m_transientForId = new_transient_for_id; | 439 | m_transientForId = new_transient_for_id; | ||
440 | if (m_transientForId != XCB_WINDOW_NONE && !groupTransient()) { | 440 | if (m_transientForId != XCB_WINDOW_NONE && !groupTransient()) { | ||
441 | transient_for = workspace()->findClient(Predicate::WindowMatch, m_transientForId); | 441 | transient_for = workspace()->findClient(Predicate::WindowMatch, m_transientForId); | ||
442 | Q_ASSERT(transient_for != NULL); // verifyTransient() had to check this | 442 | Q_ASSERT(transient_for != nullptr); // verifyTransient() had to check this | ||
443 | transient_for->addTransient(this); | 443 | transient_for->addTransient(this); | ||
444 | } // checkGroup() will check 'check_active_modal' | 444 | } // checkGroup() will check 'check_active_modal' | ||
445 | setTransientFor(transient_for); | 445 | setTransientFor(transient_for); | ||
446 | checkGroup(NULL, true); // force, because transiency has changed | 446 | checkGroup(nullptr, true); // force, because transiency has changed | ||
447 | workspace()->updateClientLayer(this); | 447 | workspace()->updateClientLayer(this); | ||
448 | workspace()->resetUpdateToolWindowsTimer(); | 448 | workspace()->resetUpdateToolWindowsTimer(); | ||
449 | emit transientChanged(); | 449 | emit transientChanged(); | ||
450 | } | 450 | } | ||
451 | } | 451 | } | ||
452 | 452 | | |||
453 | void Client::removeFromMainClients() | 453 | void Client::removeFromMainClients() | ||
454 | { | 454 | { | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | |||||
511 | // qDebug() << "MN3:" << *it; | 511 | // qDebug() << "MN3:" << *it; | ||
512 | // HACK | 512 | // HACK | ||
513 | // removeFromMainClients() did remove 'this' from transient | 513 | // removeFromMainClients() did remove 'this' from transient | ||
514 | // lists of all group members, but then made windows that | 514 | // lists of all group members, but then made windows that | ||
515 | // were transient for 'this' group transient, which again | 515 | // were transient for 'this' group transient, which again | ||
516 | // added 'this' to those transient lists :( | 516 | // added 'this' to those transient lists :( | ||
517 | ClientList group_members = group()->members(); | 517 | ClientList group_members = group()->members(); | ||
518 | group()->removeMember(this); | 518 | group()->removeMember(this); | ||
519 | in_group = NULL; | 519 | in_group = nullptr; | ||
520 | for (ClientList::ConstIterator it = group_members.constBegin(); | 520 | for (ClientList::ConstIterator it = group_members.constBegin(); | ||
521 | it != group_members.constEnd(); | 521 | it != group_members.constEnd(); | ||
522 | ++it) | 522 | ++it) | ||
523 | (*it)->removeTransient(this); | 523 | (*it)->removeTransient(this); | ||
524 | // qDebug() << "CLEANGROUPING4:" << this; | 524 | // qDebug() << "CLEANGROUPING4:" << this; | ||
525 | // for ( ClientList::ConstIterator it = group_members.begin(); | 525 | // for ( ClientList::ConstIterator it = group_members.begin(); | ||
526 | // it != group_members.end(); | 526 | // it != group_members.end(); | ||
527 | // ++it ) | 527 | // ++it ) | ||
Show All 14 Lines | 541 | if (!(*it1)->groupTransient()) // check all group transients in the group | |||
542 | continue; // TODO optimize to check only the changed ones? | 542 | continue; // TODO optimize to check only the changed ones? | ||
543 | for (ClientList::ConstIterator it2 = group()->members().constBegin(); | 543 | for (ClientList::ConstIterator it2 = group()->members().constBegin(); | ||
544 | it2 != group()->members().constEnd(); | 544 | it2 != group()->members().constEnd(); | ||
545 | ++it2) { // group transients can be transient only for others in the group, | 545 | ++it2) { // group transients can be transient only for others in the group, | ||
546 | // so don't make them transient for the ones that are transient for it | 546 | // so don't make them transient for the ones that are transient for it | ||
547 | if (*it1 == *it2) | 547 | if (*it1 == *it2) | ||
548 | continue; | 548 | continue; | ||
549 | for (AbstractClient* cl = (*it2)->transientFor(); | 549 | for (AbstractClient* cl = (*it2)->transientFor(); | ||
550 | cl != NULL; | 550 | cl != nullptr; | ||
551 | cl = cl->transientFor()) { | 551 | cl = cl->transientFor()) { | ||
552 | if (cl == *it1) { | 552 | if (cl == *it1) { | ||
553 | // don't use removeTransient(), that would modify *it2 too | 553 | // don't use removeTransient(), that would modify *it2 too | ||
554 | (*it2)->removeTransientFromList(*it1); | 554 | (*it2)->removeTransientFromList(*it1); | ||
555 | continue; | 555 | continue; | ||
556 | } | 556 | } | ||
557 | } | 557 | } | ||
558 | // if *it1 and *it2 are both group transients, and are transient for each other, | 558 | // if *it1 and *it2 are both group transients, and are transient for each other, | ||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 625 | } else | |||
626 | new_transient_for = before_search; // nice try | 626 | new_transient_for = before_search; // nice try | ||
627 | // loop detection | 627 | // loop detection | ||
628 | // group transients cannot cause loops, because they're considered transient only for non-transient | 628 | // group transients cannot cause loops, because they're considered transient only for non-transient | ||
629 | // windows in the group | 629 | // windows in the group | ||
630 | int count = 20; | 630 | int count = 20; | ||
631 | xcb_window_t loop_pos = new_transient_for; | 631 | xcb_window_t loop_pos = new_transient_for; | ||
632 | while (loop_pos != XCB_WINDOW_NONE && loop_pos != rootWindow()) { | 632 | while (loop_pos != XCB_WINDOW_NONE && loop_pos != rootWindow()) { | ||
633 | Client* pos = workspace()->findClient(Predicate::WindowMatch, loop_pos); | 633 | Client* pos = workspace()->findClient(Predicate::WindowMatch, loop_pos); | ||
634 | if (pos == NULL) | 634 | if (pos == nullptr) | ||
635 | break; | 635 | break; | ||
636 | loop_pos = pos->m_transientForId; | 636 | loop_pos = pos->m_transientForId; | ||
637 | if (--count == 0 || pos == this) { | 637 | if (--count == 0 || pos == this) { | ||
638 | qCWarning(KWIN_CORE) << "Client " << this << " caused WM_TRANSIENT_FOR loop." ; | 638 | qCWarning(KWIN_CORE) << "Client " << this << " caused WM_TRANSIENT_FOR loop." ; | ||
639 | new_transient_for = rootWindow(); | 639 | new_transient_for = rootWindow(); | ||
640 | } | 640 | } | ||
641 | } | 641 | } | ||
642 | if (new_transient_for != rootWindow() | 642 | if (new_transient_for != rootWindow() | ||
643 | && workspace()->findClient(Predicate::WindowMatch, new_transient_for) == NULL) { | 643 | && workspace()->findClient(Predicate::WindowMatch, new_transient_for) == nullptr) { | ||
644 | // it's transient for a specific window, but that window is not mapped | 644 | // it's transient for a specific window, but that window is not mapped | ||
645 | new_transient_for = rootWindow(); | 645 | new_transient_for = rootWindow(); | ||
646 | } | 646 | } | ||
647 | if (new_property_value != m_originalTransientForId) | 647 | if (new_property_value != m_originalTransientForId) | ||
648 | Xcb::setTransientFor(window(), new_property_value); | 648 | Xcb::setTransientFor(window(), new_property_value); | ||
649 | return new_transient_for; | 649 | return new_transient_for; | ||
650 | } | 650 | } | ||
651 | 651 | | |||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | |||||
757 | { | 757 | { | ||
758 | for (auto it = transients().constBegin(); | 758 | for (auto it = transients().constBegin(); | ||
759 | it != transients().constEnd(); | 759 | it != transients().constEnd(); | ||
760 | ++it) | 760 | ++it) | ||
761 | if (AbstractClient* ret = (*it)->findModal(true)) | 761 | if (AbstractClient* ret = (*it)->findModal(true)) | ||
762 | return ret; | 762 | return ret; | ||
763 | if (isModal() && allow_itself) | 763 | if (isModal() && allow_itself) | ||
764 | return this; | 764 | return this; | ||
765 | return NULL; | 765 | return nullptr; | ||
766 | } | 766 | } | ||
767 | 767 | | |||
768 | // Client::window_group only holds the contents of the hint, | 768 | // Client::window_group only holds the contents of the hint, | ||
769 | // but it should be used only to find the group, not for anything else | 769 | // but it should be used only to find the group, not for anything else | ||
770 | // Argument is only when some specific group needs to be set. | 770 | // Argument is only when some specific group needs to be set. | ||
771 | void Client::checkGroup(Group* set_group, bool force) | 771 | void Client::checkGroup(Group* set_group, bool force) | ||
772 | { | 772 | { | ||
773 | Group* old_group = in_group; | 773 | Group* old_group = in_group; | ||
774 | if (old_group != NULL) | 774 | if (old_group != nullptr) | ||
775 | old_group->ref(); // turn off automatic deleting | 775 | old_group->ref(); // turn off automatic deleting | ||
776 | if (set_group != NULL) { | 776 | if (set_group != nullptr) { | ||
777 | if (set_group != in_group) { | 777 | if (set_group != in_group) { | ||
778 | if (in_group != NULL) | 778 | if (in_group != nullptr) | ||
779 | in_group->removeMember(this); | 779 | in_group->removeMember(this); | ||
780 | in_group = set_group; | 780 | in_group = set_group; | ||
781 | in_group->addMember(this); | 781 | in_group->addMember(this); | ||
782 | } | 782 | } | ||
783 | } else if (info->groupLeader() != XCB_WINDOW_NONE) { | 783 | } else if (info->groupLeader() != XCB_WINDOW_NONE) { | ||
784 | Group* new_group = workspace()->findGroup(info->groupLeader()); | 784 | Group* new_group = workspace()->findGroup(info->groupLeader()); | ||
785 | Client *t = qobject_cast<Client*>(transientFor()); | 785 | Client *t = qobject_cast<Client*>(transientFor()); | ||
786 | if (t != NULL && t->group() != new_group) { | 786 | if (t != nullptr && t->group() != new_group) { | ||
787 | // move the window to the right group (e.g. a dialog provided | 787 | // move the window to the right group (e.g. a dialog provided | ||
788 | // by different app, but transient for this one, so make it part of that group) | 788 | // by different app, but transient for this one, so make it part of that group) | ||
789 | new_group = t->group(); | 789 | new_group = t->group(); | ||
790 | } | 790 | } | ||
791 | if (new_group == NULL) // doesn't exist yet | 791 | if (new_group == nullptr) // doesn't exist yet | ||
792 | new_group = new Group(info->groupLeader()); | 792 | new_group = new Group(info->groupLeader()); | ||
793 | if (new_group != in_group) { | 793 | if (new_group != in_group) { | ||
794 | if (in_group != NULL) | 794 | if (in_group != nullptr) | ||
795 | in_group->removeMember(this); | 795 | in_group->removeMember(this); | ||
796 | in_group = new_group; | 796 | in_group = new_group; | ||
797 | in_group->addMember(this); | 797 | in_group->addMember(this); | ||
798 | } | 798 | } | ||
799 | } else { | 799 | } else { | ||
800 | if (Client *t = qobject_cast<Client*>(transientFor())) { | 800 | if (Client *t = qobject_cast<Client*>(transientFor())) { | ||
801 | // doesn't have window group set, but is transient for something | 801 | // doesn't have window group set, but is transient for something | ||
802 | // so make it part of that group | 802 | // so make it part of that group | ||
803 | Group* new_group = t->group(); | 803 | Group* new_group = t->group(); | ||
804 | if (new_group != in_group) { | 804 | if (new_group != in_group) { | ||
805 | if (in_group != NULL) | 805 | if (in_group != nullptr) | ||
806 | in_group->removeMember(this); | 806 | in_group->removeMember(this); | ||
807 | in_group = t->group(); | 807 | in_group = t->group(); | ||
808 | in_group->addMember(this); | 808 | in_group->addMember(this); | ||
809 | } | 809 | } | ||
810 | } else if (groupTransient()) { | 810 | } else if (groupTransient()) { | ||
811 | // group transient which actually doesn't have a group :( | 811 | // group transient which actually doesn't have a group :( | ||
812 | // try creating group with other windows with the same client leader | 812 | // try creating group with other windows with the same client leader | ||
813 | Group* new_group = workspace()->findClientLeaderGroup(this); | 813 | Group* new_group = workspace()->findClientLeaderGroup(this); | ||
814 | if (new_group == NULL) | 814 | if (new_group == nullptr) | ||
815 | new_group = new Group(None); | 815 | new_group = new Group(None); | ||
816 | if (new_group != in_group) { | 816 | if (new_group != in_group) { | ||
817 | if (in_group != NULL) | 817 | if (in_group != nullptr) | ||
818 | in_group->removeMember(this); | 818 | in_group->removeMember(this); | ||
819 | in_group = new_group; | 819 | in_group = new_group; | ||
820 | in_group->addMember(this); | 820 | in_group->addMember(this); | ||
821 | } | 821 | } | ||
822 | } else { // Not transient without a group, put it in its client leader group. | 822 | } else { // Not transient without a group, put it in its client leader group. | ||
823 | // This might be stupid if grouping was used for e.g. taskbar grouping | 823 | // This might be stupid if grouping was used for e.g. taskbar grouping | ||
824 | // or minimizing together the whole group, but as long as it is used | 824 | // or minimizing together the whole group, but as long as it is used | ||
825 | // only for dialogs it's better to keep windows from one app in one group. | 825 | // only for dialogs it's better to keep windows from one app in one group. | ||
826 | Group* new_group = workspace()->findClientLeaderGroup(this); | 826 | Group* new_group = workspace()->findClientLeaderGroup(this); | ||
827 | if (in_group != NULL && in_group != new_group) { | 827 | if (in_group != nullptr && in_group != new_group) { | ||
828 | in_group->removeMember(this); | 828 | in_group->removeMember(this); | ||
829 | in_group = NULL; | 829 | in_group = nullptr; | ||
830 | } | 830 | } | ||
831 | if (new_group == NULL) | 831 | if (new_group == nullptr) | ||
832 | new_group = new Group(None); | 832 | new_group = new Group(None); | ||
833 | if (in_group != new_group) { | 833 | if (in_group != new_group) { | ||
834 | in_group = new_group; | 834 | in_group = new_group; | ||
835 | in_group->addMember(this); | 835 | in_group->addMember(this); | ||
836 | } | 836 | } | ||
837 | } | 837 | } | ||
838 | } | 838 | } | ||
839 | if (in_group != old_group || force) { | 839 | if (in_group != old_group || force) { | ||
840 | for (auto it = transients().constBegin(); | 840 | for (auto it = transients().constBegin(); | ||
841 | it != transients().constEnd(); | 841 | it != transients().constEnd(); | ||
842 | ) { | 842 | ) { | ||
843 | auto *c = *it; | 843 | auto *c = *it; | ||
844 | // group transients in the old group are no longer transient for it | 844 | // group transients in the old group are no longer transient for it | ||
845 | if (c->groupTransient() && c->group() != group()) { | 845 | if (c->groupTransient() && c->group() != group()) { | ||
846 | removeTransientFromList(c); | 846 | removeTransientFromList(c); | ||
847 | it = transients().constBegin(); // restart, just in case something more has changed with the list | 847 | it = transients().constBegin(); // restart, just in case something more has changed with the list | ||
848 | } else | 848 | } else | ||
849 | ++it; | 849 | ++it; | ||
850 | } | 850 | } | ||
851 | if (groupTransient()) { | 851 | if (groupTransient()) { | ||
852 | // no longer transient for ones in the old group | 852 | // no longer transient for ones in the old group | ||
853 | if (old_group != NULL) { | 853 | if (old_group != nullptr) { | ||
854 | for (ClientList::ConstIterator it = old_group->members().constBegin(); | 854 | for (ClientList::ConstIterator it = old_group->members().constBegin(); | ||
855 | it != old_group->members().constEnd(); | 855 | it != old_group->members().constEnd(); | ||
856 | ++it) | 856 | ++it) | ||
857 | (*it)->removeTransient(this); | 857 | (*it)->removeTransient(this); | ||
858 | } | 858 | } | ||
859 | // and make transient for all in the new group | 859 | // and make transient for all in the new group | ||
860 | for (ClientList::ConstIterator it = group()->members().constBegin(); | 860 | for (ClientList::ConstIterator it = group()->members().constBegin(); | ||
861 | it != group()->members().constEnd(); | 861 | it != group()->members().constEnd(); | ||
Show All 12 Lines | 873 | if (!(*it)->isSplash()) | |||
874 | continue; | 874 | continue; | ||
875 | if (!(*it)->groupTransient()) | 875 | if (!(*it)->groupTransient()) | ||
876 | continue; | 876 | continue; | ||
877 | if (*it == this || hasTransient(*it, true)) // TODO indirect? | 877 | if (*it == this || hasTransient(*it, true)) // TODO indirect? | ||
878 | continue; | 878 | continue; | ||
879 | addTransient(*it); | 879 | addTransient(*it); | ||
880 | } | 880 | } | ||
881 | } | 881 | } | ||
882 | if (old_group != NULL) | 882 | if (old_group != nullptr) | ||
883 | old_group->deref(); // can be now deleted if empty | 883 | old_group->deref(); // can be now deleted if empty | ||
884 | checkGroupTransients(); | 884 | checkGroupTransients(); | ||
885 | checkActiveModal(); | 885 | checkActiveModal(); | ||
886 | workspace()->updateClientLayer(this); | 886 | workspace()->updateClientLayer(this); | ||
887 | } | 887 | } | ||
888 | 888 | | |||
889 | // used by Workspace::findClientLeaderGroup() | 889 | // used by Workspace::findClientLeaderGroup() | ||
890 | void Client::changeClientLeaderGroup(Group* gr) | 890 | void Client::changeClientLeaderGroup(Group* gr) | ||
891 | { | 891 | { | ||
892 | // transientFor() != NULL are in the group of their mainwindow, so keep them there | 892 | // transientFor() != NULL are in the group of their mainwindow, so keep them there | ||
893 | if (transientFor() != NULL) | 893 | if (transientFor() != nullptr) | ||
894 | return; | 894 | return; | ||
895 | // also don't change the group for window which have group set | 895 | // also don't change the group for window which have group set | ||
896 | if (info->groupLeader()) | 896 | if (info->groupLeader()) | ||
897 | return; | 897 | return; | ||
898 | checkGroup(gr); // change group | 898 | checkGroup(gr); // change group | ||
899 | } | 899 | } | ||
900 | 900 | | |||
901 | bool Client::check_active_modal = false; | 901 | bool Client::check_active_modal = false; | ||
902 | 902 | | |||
903 | void Client::checkActiveModal() | 903 | void Client::checkActiveModal() | ||
904 | { | 904 | { | ||
905 | // if the active window got new modal transient, activate it. | 905 | // if the active window got new modal transient, activate it. | ||
906 | // cannot be done in AddTransient(), because there may temporarily | 906 | // cannot be done in AddTransient(), because there may temporarily | ||
907 | // exist loops, breaking findModal | 907 | // exist loops, breaking findModal | ||
908 | Client* check_modal = dynamic_cast<Client*>(workspace()->mostRecentlyActivatedClient()); | 908 | Client* check_modal = dynamic_cast<Client*>(workspace()->mostRecentlyActivatedClient()); | ||
909 | if (check_modal != NULL && check_modal->check_active_modal) { | 909 | if (check_modal != nullptr && check_modal->check_active_modal) { | ||
910 | Client* new_modal = dynamic_cast<Client*>(check_modal->findModal()); | 910 | Client* new_modal = dynamic_cast<Client*>(check_modal->findModal()); | ||
911 | if (new_modal != NULL && new_modal != check_modal) { | 911 | if (new_modal != nullptr && new_modal != check_modal) { | ||
912 | if (!new_modal->isManaged()) | 912 | if (!new_modal->isManaged()) | ||
913 | return; // postpone check until end of manage() | 913 | return; // postpone check until end of manage() | ||
914 | workspace()->activateClient(new_modal); | 914 | workspace()->activateClient(new_modal); | ||
915 | } | 915 | } | ||
916 | check_modal->check_active_modal = false; | 916 | check_modal->check_active_modal = false; | ||
917 | } | 917 | } | ||
918 | } | 918 | } | ||
919 | 919 | | |||
920 | } // namespace | 920 | } // namespace |