Changeset View
Changeset View
Standalone View
Standalone View
manage.cpp
Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Line(s) | 217 | if ((*it)->isOnCurrentDesktop()) | |||
---|---|---|---|---|---|
218 | on_current = true; | 218 | on_current = true; | ||
219 | if ((*it)->isOnAllDesktops()) | 219 | if ((*it)->isOnAllDesktops()) | ||
220 | on_all = true; | 220 | on_all = true; | ||
221 | } | 221 | } | ||
222 | if (on_all) | 222 | if (on_all) | ||
223 | desk = NET::OnAllDesktops; | 223 | desk = NET::OnAllDesktops; | ||
224 | else if (on_current) | 224 | else if (on_current) | ||
225 | desk = VirtualDesktopManager::self()->current(); | 225 | desk = VirtualDesktopManager::self()->current(); | ||
226 | else if (maincl != NULL) | 226 | else if (maincl != nullptr) | ||
227 | desk = maincl->desktop(); | 227 | desk = maincl->desktop(); | ||
228 | 228 | | |||
229 | if (maincl) | 229 | if (maincl) | ||
230 | setOnActivities(maincl->activities()); | 230 | setOnActivities(maincl->activities()); | ||
231 | } else { // a transient shall appear on its leader and not drag that around | 231 | } else { // a transient shall appear on its leader and not drag that around | ||
232 | if (info->desktop()) | 232 | if (info->desktop()) | ||
233 | desk = info->desktop(); // Window had the initial desktop property, force it | 233 | desk = info->desktop(); // Window had the initial desktop property, force it | ||
234 | if (desktop() == 0 && asn_valid && asn_data.desktop() != 0) | 234 | if (desktop() == 0 && asn_valid && asn_data.desktop() != 0) | ||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 308 | #endif | |||
335 | if (isMovable() && (geom.x() > area.right() || geom.y() > area.bottom())) | 335 | if (isMovable() && (geom.x() > area.right() || geom.y() > area.bottom())) | ||
336 | placementDone = false; // Weird, do not trust. | 336 | placementDone = false; // Weird, do not trust. | ||
337 | 337 | | |||
338 | if (placementDone) | 338 | if (placementDone) | ||
339 | move(geom.x(), geom.y()); // Before gravitating | 339 | move(geom.x(), geom.y()); // Before gravitating | ||
340 | 340 | | |||
341 | // Create client group if the window will have a decoration | 341 | // Create client group if the window will have a decoration | ||
342 | bool dontKeepInArea = false; | 342 | bool dontKeepInArea = false; | ||
343 | setTabGroup(NULL); | 343 | setTabGroup(nullptr); | ||
344 | if (!noBorder() && false) { | 344 | if (!noBorder() && false) { | ||
345 | const bool autogrouping = rules()->checkAutogrouping(options->isAutogroupSimilarWindows()); | 345 | const bool autogrouping = rules()->checkAutogrouping(options->isAutogroupSimilarWindows()); | ||
346 | const bool autogroupInFg = rules()->checkAutogroupInForeground(options->isAutogroupInForeground()); | 346 | const bool autogroupInFg = rules()->checkAutogroupInForeground(options->isAutogroupInForeground()); | ||
347 | // Automatically add to previous groups on session restore | 347 | // Automatically add to previous groups on session restore | ||
348 | if (session && session->tabGroupClient && !workspace()->hasClient(session->tabGroupClient)) | 348 | if (session && session->tabGroupClient && !workspace()->hasClient(session->tabGroupClient)) | ||
349 | session->tabGroupClient = NULL; | 349 | session->tabGroupClient = nullptr; | ||
350 | if (session && session->tabGroupClient && session->tabGroupClient != this) { | 350 | if (session && session->tabGroupClient && session->tabGroupClient != this) { | ||
351 | tabBehind(session->tabGroupClient, autogroupInFg); | 351 | tabBehind(session->tabGroupClient, autogroupInFg); | ||
352 | } else if (isMapped && autogrouping) { | 352 | } else if (isMapped && autogrouping) { | ||
353 | // If the window is already mapped (Restarted KWin) add any windows that already have the | 353 | // If the window is already mapped (Restarted KWin) add any windows that already have the | ||
354 | // same geometry to the same client group. (May incorrectly handle maximized windows) | 354 | // same geometry to the same client group. (May incorrectly handle maximized windows) | ||
355 | foreach (Client *other, workspace()->clientList()) { | 355 | foreach (Client *other, workspace()->clientList()) { | ||
356 | if (other->maximizeMode() != MaximizeFull && | 356 | if (other->maximizeMode() != MaximizeFull && | ||
357 | geom == QRect(other->pos(), other->clientSize()) && | 357 | geom == QRect(other->pos(), other->clientSize()) && | ||
▲ Show 20 Lines • Show All 197 Lines • ▼ Show 20 Line(s) | 554 | if (info->state() & NET::Modal) | |||
555 | setModal(true); | 555 | setModal(true); | ||
556 | 556 | | |||
557 | setFullScreen(rules()->checkFullScreen(info->state() & NET::FullScreen, !isMapped), false); | 557 | setFullScreen(rules()->checkFullScreen(info->state() & NET::FullScreen, !isMapped), false); | ||
558 | } | 558 | } | ||
559 | 559 | | |||
560 | updateAllowedActions(true); | 560 | updateAllowedActions(true); | ||
561 | 561 | | |||
562 | // Set initial user time directly | 562 | // Set initial user time directly | ||
563 | m_userTime = readUserTimeMapTimestamp(asn_valid ? &asn_id : NULL, asn_valid ? &asn_data : NULL, session); | 563 | m_userTime = readUserTimeMapTimestamp(asn_valid ? &asn_id : nullptr, asn_valid ? &asn_data : nullptr, session); | ||
564 | group()->updateUserTime(m_userTime); // And do what Client::updateUserTime() does | 564 | group()->updateUserTime(m_userTime); // And do what Client::updateUserTime() does | ||
565 | 565 | | |||
566 | // This should avoid flicker, because real restacking is done | 566 | // This should avoid flicker, because real restacking is done | ||
567 | // only after manage() finishes because of blocking, but the window is shown sooner | 567 | // only after manage() finishes because of blocking, but the window is shown sooner | ||
568 | m_frame.lower(); | 568 | m_frame.lower(); | ||
569 | if (session && session->stackingOrder != -1) { | 569 | if (session && session->stackingOrder != -1) { | ||
570 | sm_stacking_order = session->stackingOrder; | 570 | sm_stacking_order = session->stackingOrder; | ||
571 | workspace()->restoreSessionStackingOrder(this); | 571 | workspace()->restoreSessionStackingOrder(this); | ||
572 | } | 572 | } | ||
573 | 573 | | |||
574 | if (compositing()) | 574 | if (compositing()) | ||
575 | // Sending ConfigureNotify is done when setting mapping state below, | 575 | // Sending ConfigureNotify is done when setting mapping state below, | ||
576 | // Getting the first sync response means window is ready for compositing | 576 | // Getting the first sync response means window is ready for compositing | ||
577 | sendSyncRequest(); | 577 | sendSyncRequest(); | ||
578 | else | 578 | else | ||
579 | ready_for_painting = true; // set to true in case compositing is turned on later. bug #160393 | 579 | ready_for_painting = true; // set to true in case compositing is turned on later. bug #160393 | ||
580 | 580 | | |||
581 | if (isShown(true)) { | 581 | if (isShown(true)) { | ||
582 | bool allow; | 582 | bool allow; | ||
583 | if (session) | 583 | if (session) | ||
584 | allow = session->active && | 584 | allow = session->active && | ||
585 | (!workspace()->wasUserInteraction() || workspace()->activeClient() == NULL || | 585 | (!workspace()->wasUserInteraction() || workspace()->activeClient() == nullptr || | ||
586 | workspace()->activeClient()->isDesktop()); | 586 | workspace()->activeClient()->isDesktop()); | ||
587 | else | 587 | else | ||
588 | allow = workspace()->allowClientActivation(this, userTime(), false); | 588 | allow = workspace()->allowClientActivation(this, userTime(), false); | ||
589 | 589 | | |||
590 | // If session saving, force showing new windows (i.e. "save file?" dialogs etc.) | 590 | // If session saving, force showing new windows (i.e. "save file?" dialogs etc.) | ||
591 | // also force if activation is allowed | 591 | // also force if activation is allowed | ||
592 | if( !isOnCurrentDesktop() && !isMapped && !session && ( allow || workspace()->sessionSaving() )) | 592 | if( !isOnCurrentDesktop() && !isMapped && !session && ( allow || workspace()->sessionSaving() )) | ||
593 | VirtualDesktopManager::self()->setCurrent( desktop()); | 593 | VirtualDesktopManager::self()->setCurrent( desktop()); | ||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Line(s) | 739 | { | |||
744 | b.truncate(i); | 744 | b.truncate(i); | ||
745 | return b; | 745 | return b; | ||
746 | } | 746 | } | ||
747 | 747 | | |||
748 | Client* Client::findAutogroupCandidate() const | 748 | Client* Client::findAutogroupCandidate() const | ||
749 | { | 749 | { | ||
750 | // Attempt to find a similar window to the input. If we find multiple possibilities that are in | 750 | // Attempt to find a similar window to the input. If we find multiple possibilities that are in | ||
751 | // different groups then ignore all of them. This function is for automatic window grouping. | 751 | // different groups then ignore all of them. This function is for automatic window grouping. | ||
752 | Client *found = NULL; | 752 | Client *found = nullptr; | ||
753 | 753 | | |||
754 | // See if the window has a group ID to match with | 754 | // See if the window has a group ID to match with | ||
755 | QString wGId = rules()->checkAutogroupById(QString()); | 755 | QString wGId = rules()->checkAutogroupById(QString()); | ||
756 | if (!wGId.isEmpty()) { | 756 | if (!wGId.isEmpty()) { | ||
757 | foreach (Client *c, workspace()->clientList()) { | 757 | foreach (Client *c, workspace()->clientList()) { | ||
758 | if (activities() != c->activities()) | 758 | if (activities() != c->activities()) | ||
759 | continue; // don't cross activities | 759 | continue; // don't cross activities | ||
760 | if (wGId == c->rules()->checkAutogroupById(QString())) { | 760 | if (wGId == c->rules()->checkAutogroupById(QString())) { | ||
761 | if (found && found->tabGroup() != c->tabGroup()) { // We've found two, ignore both | 761 | if (found && found->tabGroup() != c->tabGroup()) { // We've found two, ignore both | ||
762 | found = NULL; | 762 | found = nullptr; | ||
763 | break; // Continue to the next test | 763 | break; // Continue to the next test | ||
764 | } | 764 | } | ||
765 | found = c; | 765 | found = c; | ||
766 | } | 766 | } | ||
767 | } | 767 | } | ||
768 | if (found) | 768 | if (found) | ||
769 | return found; | 769 | return found; | ||
770 | } | 770 | } | ||
771 | 771 | | |||
772 | // If this is a transient window don't take a guess | 772 | // If this is a transient window don't take a guess | ||
773 | if (isTransient()) | 773 | if (isTransient()) | ||
774 | return NULL; | 774 | return nullptr; | ||
775 | 775 | | |||
776 | // If we don't have an ID take a guess | 776 | // If we don't have an ID take a guess | ||
777 | if (rules()->checkAutogrouping(options->isAutogroupSimilarWindows())) { | 777 | if (rules()->checkAutogrouping(options->isAutogroupSimilarWindows())) { | ||
778 | QByteArray wRole = truncatedWindowRole(windowRole()); | 778 | QByteArray wRole = truncatedWindowRole(windowRole()); | ||
779 | foreach (Client *c, workspace()->clientList()) { | 779 | foreach (Client *c, workspace()->clientList()) { | ||
780 | if (desktop() != c->desktop() || activities() != c->activities()) | 780 | if (desktop() != c->desktop() || activities() != c->activities()) | ||
781 | continue; | 781 | continue; | ||
782 | QByteArray wRoleB = truncatedWindowRole(c->windowRole()); | 782 | QByteArray wRoleB = truncatedWindowRole(c->windowRole()); | ||
783 | if (resourceClass() == c->resourceClass() && // Same resource class | 783 | if (resourceClass() == c->resourceClass() && // Same resource class | ||
784 | wRole == wRoleB && // Same window role | 784 | wRole == wRoleB && // Same window role | ||
785 | c->isNormalWindow()) { // Normal window TODO: Can modal windows be "normal"? | 785 | c->isNormalWindow()) { // Normal window TODO: Can modal windows be "normal"? | ||
786 | if (found && found->tabGroup() != c->tabGroup()) // We've found two, ignore both | 786 | if (found && found->tabGroup() != c->tabGroup()) // We've found two, ignore both | ||
787 | return NULL; | 787 | return nullptr; | ||
788 | found = c; | 788 | found = c; | ||
789 | } | 789 | } | ||
790 | } | 790 | } | ||
791 | } | 791 | } | ||
792 | 792 | | |||
793 | return found; | 793 | return found; | ||
794 | } | 794 | } | ||
795 | 795 | | |||
796 | } // namespace | 796 | } // namespace |