Changeset View
Changeset View
Standalone View
Standalone View
workspace.cpp
Show First 20 Lines • Show All 531 Lines • ▼ Show 20 Line(s) | |||||
532 | 532 | | |||
533 | Workspace::~Workspace() | 533 | Workspace::~Workspace() | ||
534 | { | 534 | { | ||
535 | blockStackingUpdates(true); | 535 | blockStackingUpdates(true); | ||
536 | 536 | | |||
537 | // TODO: grabXServer(); | 537 | // TODO: grabXServer(); | ||
538 | 538 | | |||
539 | // Use stacking_order, so that kwin --replace keeps stacking order | 539 | // Use stacking_order, so that kwin --replace keeps stacking order | ||
540 | const ToplevelList stack = stacking_order; | 540 | const QList<Toplevel *> stack = stacking_order; | ||
541 | // "mutex" the stackingorder, since anything trying to access it from now on will find | 541 | // "mutex" the stackingorder, since anything trying to access it from now on will find | ||
542 | // many dangeling pointers and crash | 542 | // many dangeling pointers and crash | ||
543 | stacking_order.clear(); | 543 | stacking_order.clear(); | ||
544 | 544 | | |||
545 | for (ToplevelList::const_iterator it = stack.constBegin(), end = stack.constEnd(); it != end; ++it) { | 545 | for (auto it = stack.constBegin(), end = stack.constEnd(); it != end; ++it) { | ||
546 | X11Client *c = qobject_cast<X11Client *>(const_cast<Toplevel*>(*it)); | 546 | X11Client *c = qobject_cast<X11Client *>(const_cast<Toplevel*>(*it)); | ||
547 | if (!c) { | 547 | if (!c) { | ||
548 | continue; | 548 | continue; | ||
549 | } | 549 | } | ||
550 | // Only release the window | 550 | // Only release the window | ||
551 | c->releaseWindow(true); | 551 | c->releaseWindow(true); | ||
552 | // No removeClient() is called, it does more than just removing. | 552 | // No removeClient() is called, it does more than just removing. | ||
553 | // However, remove from some lists to e.g. prevent performTransiencyCheck() | 553 | // However, remove from some lists to e.g. prevent performTransiencyCheck() | ||
554 | // from crashing. | 554 | // from crashing. | ||
555 | clients.removeAll(c); | 555 | clients.removeAll(c); | ||
556 | m_allClients.removeAll(c); | 556 | m_allClients.removeAll(c); | ||
557 | desktops.removeAll(c); | 557 | desktops.removeAll(c); | ||
558 | } | 558 | } | ||
559 | X11Client::cleanupX11(); | 559 | X11Client::cleanupX11(); | ||
560 | 560 | | |||
561 | if (waylandServer()) { | 561 | if (waylandServer()) { | ||
562 | const QList<XdgShellClient *> shellClients = waylandServer()->clients(); | 562 | const QList<XdgShellClient *> shellClients = waylandServer()->clients(); | ||
563 | for (XdgShellClient *shellClient : shellClients) { | 563 | for (XdgShellClient *shellClient : shellClients) { | ||
564 | shellClient->destroyClient(); | 564 | shellClient->destroyClient(); | ||
565 | } | 565 | } | ||
566 | } | 566 | } | ||
567 | 567 | | |||
568 | for (UnmanagedList::iterator it = unmanaged.begin(), end = unmanaged.end(); it != end; ++it) | 568 | for (auto it = unmanaged.begin(), end = unmanaged.end(); it != end; ++it) | ||
569 | (*it)->release(ReleaseReason::KWinShutsDown); | 569 | (*it)->release(ReleaseReason::KWinShutsDown); | ||
570 | 570 | | |||
571 | for (InternalClient *client : m_internalClients) { | 571 | for (InternalClient *client : m_internalClients) { | ||
572 | client->destroyClient(); | 572 | client->destroyClient(); | ||
573 | } | 573 | } | ||
574 | 574 | | |||
575 | if (auto c = kwinApp()->x11Connection()) { | 575 | if (auto c = kwinApp()->x11Connection()) { | ||
576 | xcb_delete_property(c, kwinApp()->x11RootWindow(), atoms->kwin_running); | 576 | xcb_delete_property(c, kwinApp()->x11RootWindow(), atoms->kwin_running); | ||
▲ Show 20 Lines • Show All 195 Lines • ▼ Show 20 Line(s) | 771 | if (X11Compositor *compositor = X11Compositor::self()) { | |||
772 | compositor->updateClientCompositeBlocking(); | 772 | compositor->updateClientCompositeBlocking(); | ||
773 | } | 773 | } | ||
774 | } | 774 | } | ||
775 | 775 | | |||
776 | void Workspace::updateToolWindows(bool also_hide) | 776 | void Workspace::updateToolWindows(bool also_hide) | ||
777 | { | 777 | { | ||
778 | // TODO: What if Client's transiency/group changes? should this be called too? (I'm paranoid, am I not?) | 778 | // TODO: What if Client's transiency/group changes? should this be called too? (I'm paranoid, am I not?) | ||
779 | if (!options->isHideUtilityWindowsForInactive()) { | 779 | if (!options->isHideUtilityWindowsForInactive()) { | ||
780 | for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it) | 780 | for (auto it = clients.constBegin(); it != clients.constEnd(); ++it) | ||
781 | (*it)->hideClient(false); | 781 | (*it)->hideClient(false); | ||
782 | return; | 782 | return; | ||
783 | } | 783 | } | ||
784 | const Group* group = nullptr; | 784 | const Group* group = nullptr; | ||
785 | auto client = active_client; | 785 | auto client = active_client; | ||
786 | // Go up in transiency hiearchy, if the top is found, only tool transients for the top mainwindow | 786 | // Go up in transiency hiearchy, if the top is found, only tool transients for the top mainwindow | ||
787 | // will be shown; if a group transient is group, all tools in the group will be shown | 787 | // will be shown; if a group transient is group, all tools in the group will be shown | ||
788 | while (client != nullptr) { | 788 | while (client != nullptr) { | ||
789 | if (!client->isTransient()) | 789 | if (!client->isTransient()) | ||
790 | break; | 790 | break; | ||
791 | if (client->groupTransient()) { | 791 | if (client->groupTransient()) { | ||
792 | group = client->group(); | 792 | group = client->group(); | ||
793 | break; | 793 | break; | ||
794 | } | 794 | } | ||
795 | client = client->transientFor(); | 795 | client = client->transientFor(); | ||
796 | } | 796 | } | ||
797 | // Use stacking order only to reduce flicker, it doesn't matter if block_stacking_updates == 0, | 797 | // Use stacking order only to reduce flicker, it doesn't matter if block_stacking_updates == 0, | ||
798 | // I.e. if it's not up to date | 798 | // I.e. if it's not up to date | ||
799 | 799 | | |||
800 | // SELI TODO: But maybe it should - what if a new client has been added that's not in stacking order yet? | 800 | // SELI TODO: But maybe it should - what if a new client has been added that's not in stacking order yet? | ||
801 | QVector<AbstractClient*> to_show, to_hide; | 801 | QVector<AbstractClient*> to_show, to_hide; | ||
802 | for (ToplevelList::ConstIterator it = stacking_order.constBegin(); | 802 | for (auto it = stacking_order.constBegin(); | ||
803 | it != stacking_order.constEnd(); | 803 | it != stacking_order.constEnd(); | ||
804 | ++it) { | 804 | ++it) { | ||
805 | auto c = qobject_cast<AbstractClient*>(*it); | 805 | auto c = qobject_cast<AbstractClient*>(*it); | ||
806 | if (!c) { | 806 | if (!c) { | ||
807 | continue; | 807 | continue; | ||
808 | } | 808 | } | ||
809 | if (c->isUtility() || c->isMenu() || c->isToolbar()) { | 809 | if (c->isUtility() || c->isMenu() || c->isToolbar()) { | ||
810 | bool show = true; | 810 | bool show = true; | ||
▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Line(s) | 923 | { | |||
929 | --block_focus; | 929 | --block_focus; | ||
930 | 930 | | |||
931 | activateClientOnNewDesktop(newDesktop); | 931 | activateClientOnNewDesktop(newDesktop); | ||
932 | emit currentDesktopChanged(oldDesktop, movingClient); | 932 | emit currentDesktopChanged(oldDesktop, movingClient); | ||
933 | } | 933 | } | ||
934 | 934 | | |||
935 | void Workspace::updateClientVisibilityOnDesktopChange(uint newDesktop) | 935 | void Workspace::updateClientVisibilityOnDesktopChange(uint newDesktop) | ||
936 | { | 936 | { | ||
937 | for (ToplevelList::ConstIterator it = stacking_order.constBegin(); | 937 | for (auto it = stacking_order.constBegin(); | ||
938 | it != stacking_order.constEnd(); | 938 | it != stacking_order.constEnd(); | ||
939 | ++it) { | 939 | ++it) { | ||
940 | X11Client *c = qobject_cast<X11Client *>(*it); | 940 | X11Client *c = qobject_cast<X11Client *>(*it); | ||
941 | if (!c) { | 941 | if (!c) { | ||
942 | continue; | 942 | continue; | ||
943 | } | 943 | } | ||
944 | if (!c->isOnDesktop(newDesktop) && c != movingClient && c->isOnCurrentActivity()) { | 944 | if (!c->isOnDesktop(newDesktop) && c != movingClient && c->isOnCurrentActivity()) { | ||
945 | (c)->updateVisibility(); | 945 | (c)->updateVisibility(); | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 996 | { | |||
997 | if (movingClient != nullptr && active_client == movingClient && | 997 | if (movingClient != nullptr && active_client == movingClient && | ||
998 | FocusChain::self()->contains(active_client, desktop) && | 998 | FocusChain::self()->contains(active_client, desktop) && | ||
999 | active_client->isShown(true) && active_client->isOnCurrentDesktop()) { | 999 | active_client->isShown(true) && active_client->isOnCurrentDesktop()) { | ||
1000 | // A requestFocus call will fail, as the client is already active | 1000 | // A requestFocus call will fail, as the client is already active | ||
1001 | return active_client; | 1001 | return active_client; | ||
1002 | } | 1002 | } | ||
1003 | // from actiavtion.cpp | 1003 | // from actiavtion.cpp | ||
1004 | if (options->isNextFocusPrefersMouse()) { | 1004 | if (options->isNextFocusPrefersMouse()) { | ||
1005 | ToplevelList::const_iterator it = stackingOrder().constEnd(); | 1005 | auto it = stackingOrder().constEnd(); | ||
1006 | while (it != stackingOrder().constBegin()) { | 1006 | while (it != stackingOrder().constBegin()) { | ||
1007 | X11Client *client = qobject_cast<X11Client *>(*(--it)); | 1007 | X11Client *client = qobject_cast<X11Client *>(*(--it)); | ||
1008 | if (!client) { | 1008 | if (!client) { | ||
1009 | continue; | 1009 | continue; | ||
1010 | } | 1010 | } | ||
1011 | 1011 | | |||
1012 | if (!(client->isShown(false) && client->isOnDesktop(desktop) && | 1012 | if (!(client->isShown(false) && client->isOnDesktop(desktop) && | ||
1013 | client->isOnCurrentActivity() && client->isOnActiveScreen())) | 1013 | client->isOnCurrentActivity() && client->isOnActiveScreen())) | ||
Show All 26 Lines | 1035 | #ifdef KWIN_BUILD_ACTIVITIES | |||
1040 | ++block_focus; | 1040 | ++block_focus; | ||
1041 | // TODO: Q_ASSERT( block_stacking_updates == 0 ); // Make sure stacking_order is up to date | 1041 | // TODO: Q_ASSERT( block_stacking_updates == 0 ); // Make sure stacking_order is up to date | ||
1042 | StackingUpdatesBlocker blocker(this); | 1042 | StackingUpdatesBlocker blocker(this); | ||
1043 | 1043 | | |||
1044 | // Optimized Desktop switching: unmapping done from back to front | 1044 | // Optimized Desktop switching: unmapping done from back to front | ||
1045 | // mapping done from front to back => less exposure events | 1045 | // mapping done from front to back => less exposure events | ||
1046 | //Notify::raise((Notify::Event) (Notify::DesktopChange+new_desktop)); | 1046 | //Notify::raise((Notify::Event) (Notify::DesktopChange+new_desktop)); | ||
1047 | 1047 | | |||
1048 | for (ToplevelList::ConstIterator it = stacking_order.constBegin(); | 1048 | for (auto it = stacking_order.constBegin(); | ||
1049 | it != stacking_order.constEnd(); | 1049 | it != stacking_order.constEnd(); | ||
1050 | ++it) { | 1050 | ++it) { | ||
1051 | X11Client *c = qobject_cast<X11Client *>(*it); | 1051 | X11Client *c = qobject_cast<X11Client *>(*it); | ||
1052 | if (!c) { | 1052 | if (!c) { | ||
1053 | continue; | 1053 | continue; | ||
1054 | } | 1054 | } | ||
1055 | if (!c->isOnActivity(new_activity) && c != movingClient && c->isOnCurrentDesktop()) { | 1055 | if (!c->isOnActivity(new_activity) && c != movingClient && c->isOnCurrentDesktop()) { | ||
1056 | c->updateVisibility(); | 1056 | c->updateVisibility(); | ||
▲ Show 20 Lines • Show All 270 Lines • ▼ Show 20 Line(s) | 1326 | QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kglobalaccel"), | |||
1327 | QStringLiteral("/kglobalaccel"), | 1327 | QStringLiteral("/kglobalaccel"), | ||
1328 | QStringLiteral("org.kde.KGlobalAccel"), | 1328 | QStringLiteral("org.kde.KGlobalAccel"), | ||
1329 | QStringLiteral("blockGlobalShortcuts")); | 1329 | QStringLiteral("blockGlobalShortcuts")); | ||
1330 | message.setArguments(QList<QVariant>() << disable); | 1330 | message.setArguments(QList<QVariant>() << disable); | ||
1331 | QDBusConnection::sessionBus().asyncCall(message); | 1331 | QDBusConnection::sessionBus().asyncCall(message); | ||
1332 | 1332 | | |||
1333 | global_shortcuts_disabled_for_client = disable; | 1333 | global_shortcuts_disabled_for_client = disable; | ||
1334 | // Update also Alt+LMB actions etc. | 1334 | // Update also Alt+LMB actions etc. | ||
1335 | for (ClientList::ConstIterator it = clients.constBegin(); | 1335 | for (auto it = clients.constBegin(); | ||
1336 | it != clients.constEnd(); | 1336 | it != clients.constEnd(); | ||
1337 | ++it) | 1337 | ++it) | ||
1338 | (*it)->updateMouseGrab(); | 1338 | (*it)->updateMouseGrab(); | ||
1339 | } | 1339 | } | ||
1340 | 1340 | | |||
1341 | QString Workspace::supportInformation() const | 1341 | QString Workspace::supportInformation() const | ||
1342 | { | 1342 | { | ||
1343 | QString support; | 1343 | QString support; | ||
▲ Show 20 Lines • Show All 481 Lines • Show Last 20 Lines |