Changeset View
Changeset View
Standalone View
Standalone View
activation.cpp
Show First 20 Lines • Show All 234 Lines • ▼ Show 20 Line(s) | 231 | { | |||
---|---|---|---|---|---|
235 | if (active_popup && active_popup_client != c && set_active_client_recursion == 0) | 235 | if (active_popup && active_popup_client != c && set_active_client_recursion == 0) | ||
236 | closeActivePopup(); | 236 | closeActivePopup(); | ||
237 | if (m_userActionsMenu->hasClient() && !m_userActionsMenu->isMenuClient(c) && set_active_client_recursion == 0) { | 237 | if (m_userActionsMenu->hasClient() && !m_userActionsMenu->isMenuClient(c) && set_active_client_recursion == 0) { | ||
238 | m_userActionsMenu->close(); | 238 | m_userActionsMenu->close(); | ||
239 | } | 239 | } | ||
240 | StackingUpdatesBlocker blocker(this); | 240 | StackingUpdatesBlocker blocker(this); | ||
241 | ++set_active_client_recursion; | 241 | ++set_active_client_recursion; | ||
242 | updateFocusMousePosition(Cursor::pos()); | 242 | updateFocusMousePosition(Cursor::pos()); | ||
243 | if (active_client != NULL) { | 243 | if (active_client != nullptr) { | ||
244 | // note that this may call setActiveClient( NULL ), therefore the recursion counter | 244 | // note that this may call setActiveClient( NULL ), therefore the recursion counter | ||
245 | active_client->setActive(false); | 245 | active_client->setActive(false); | ||
246 | } | 246 | } | ||
247 | active_client = c; | 247 | active_client = c; | ||
248 | Q_ASSERT(c == NULL || c->isActive()); | 248 | Q_ASSERT(c == nullptr || c->isActive()); | ||
249 | 249 | | |||
250 | if (active_client) { | 250 | if (active_client) { | ||
251 | last_active_client = active_client; | 251 | last_active_client = active_client; | ||
252 | FocusChain::self()->update(active_client, FocusChain::MakeFirst); | 252 | FocusChain::self()->update(active_client, FocusChain::MakeFirst); | ||
253 | active_client->demandAttention(false); | 253 | active_client->demandAttention(false); | ||
254 | 254 | | |||
255 | // activating a client can cause a non active fullscreen window to loose the ActiveLayer status on > 1 screens | 255 | // activating a client can cause a non active fullscreen window to loose the ActiveLayer status on > 1 screens | ||
256 | if (screens()->count() > 1) { | 256 | if (screens()->count() > 1) { | ||
Show All 30 Lines | |||||
287 | * setActiveClient() and the operation is complete. This may not happen | 287 | * setActiveClient() and the operation is complete. This may not happen | ||
288 | * with certain focus policies, though. | 288 | * with certain focus policies, though. | ||
289 | * | 289 | * | ||
290 | * @see setActiveClient | 290 | * @see setActiveClient | ||
291 | * @see requestFocus | 291 | * @see requestFocus | ||
292 | */ | 292 | */ | ||
293 | void Workspace::activateClient(AbstractClient* c, bool force) | 293 | void Workspace::activateClient(AbstractClient* c, bool force) | ||
294 | { | 294 | { | ||
295 | if (c == NULL) { | 295 | if (c == nullptr) { | ||
296 | focusToNull(); | 296 | focusToNull(); | ||
297 | setActiveClient(NULL); | 297 | setActiveClient(nullptr); | ||
298 | return; | 298 | return; | ||
299 | } | 299 | } | ||
300 | raiseClient(c); | 300 | raiseClient(c); | ||
301 | if (!c->isOnCurrentDesktop()) { | 301 | if (!c->isOnCurrentDesktop()) { | ||
302 | ++block_focus; | 302 | ++block_focus; | ||
303 | VirtualDesktopManager::self()->setCurrent(c->desktop()); | 303 | VirtualDesktopManager::self()->setCurrent(c->desktop()); | ||
304 | --block_focus; | 304 | --block_focus; | ||
305 | } | 305 | } | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 350 | { | |||
354 | 354 | | |||
355 | if (!c) { | 355 | if (!c) { | ||
356 | focusToNull(); | 356 | focusToNull(); | ||
357 | return; | 357 | return; | ||
358 | } | 358 | } | ||
359 | 359 | | |||
360 | if (flags & ActivityFocus) { | 360 | if (flags & ActivityFocus) { | ||
361 | AbstractClient* modal = c->findModal(); | 361 | AbstractClient* modal = c->findModal(); | ||
362 | if (modal != NULL && modal != c) { | 362 | if (modal != nullptr && modal != c) { | ||
363 | if (!modal->isOnDesktop(c->desktop())) | 363 | if (!modal->isOnDesktop(c->desktop())) | ||
364 | modal->setDesktop(c->desktop()); | 364 | modal->setDesktop(c->desktop()); | ||
365 | if (!modal->isShown(true) && !modal->isMinimized()) // forced desktop or utility window | 365 | if (!modal->isShown(true) && !modal->isMinimized()) // forced desktop or utility window | ||
366 | activateClient(modal); // activating a minimized blocked window will unminimize its modal implicitly | 366 | activateClient(modal); // activating a minimized blocked window will unminimize its modal implicitly | ||
367 | // if the click was inside the window (i.e. handled is set), | 367 | // if the click was inside the window (i.e. handled is set), | ||
368 | // but it has a modal, there's no need to use handled mode, because | 368 | // but it has a modal, there's no need to use handled mode, because | ||
369 | // the modal doesn't get the click anyway | 369 | // the modal doesn't get the click anyway | ||
370 | // raising of the original window needs to be still done | 370 | // raising of the original window needs to be still done | ||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 424 | while (it != stackingOrder().constBegin()) { | |||
432 | if (!(client->isShown(false) && client->isOnCurrentDesktop() && | 432 | if (!(client->isShown(false) && client->isOnCurrentDesktop() && | ||
433 | client->isOnCurrentActivity() && client->isOnScreen(screen))) | 433 | client->isOnCurrentActivity() && client->isOnScreen(screen))) | ||
434 | continue; | 434 | continue; | ||
435 | 435 | | |||
436 | if (client->geometry().contains(Cursor::pos())) { | 436 | if (client->geometry().contains(Cursor::pos())) { | ||
437 | return client; | 437 | return client; | ||
438 | } | 438 | } | ||
439 | } | 439 | } | ||
440 | return 0; | 440 | return nullptr; | ||
441 | } | 441 | } | ||
442 | 442 | | |||
443 | // deactivates 'c' and activates next client | 443 | // deactivates 'c' and activates next client | ||
444 | bool Workspace::activateNextClient(AbstractClient* c) | 444 | bool Workspace::activateNextClient(AbstractClient* c) | ||
445 | { | 445 | { | ||
446 | // if 'c' is not the active or the to-become active one, do nothing | 446 | // if 'c' is not the active or the to-become active one, do nothing | ||
447 | if (!(c == active_client || (should_get_focus.count() > 0 && c == should_get_focus.last()))) | 447 | if (!(c == active_client || (should_get_focus.count() > 0 && c == should_get_focus.last()))) | ||
448 | return false; | 448 | return false; | ||
449 | 449 | | |||
450 | closeActivePopup(); | 450 | closeActivePopup(); | ||
451 | 451 | | |||
452 | if (c != NULL) { | 452 | if (c != nullptr) { | ||
453 | if (c == active_client) | 453 | if (c == active_client) | ||
454 | setActiveClient(NULL); | 454 | setActiveClient(nullptr); | ||
455 | should_get_focus.removeAll(c); | 455 | should_get_focus.removeAll(c); | ||
456 | } | 456 | } | ||
457 | 457 | | |||
458 | // if blocking focus, move focus to the desktop later if needed | 458 | // if blocking focus, move focus to the desktop later if needed | ||
459 | // in order to avoid flickering | 459 | // in order to avoid flickering | ||
460 | if (!focusChangeEnabled()) { | 460 | if (!focusChangeEnabled()) { | ||
461 | focusToNull(); | 461 | focusToNull(); | ||
462 | return true; | 462 | return true; | ||
463 | } | 463 | } | ||
464 | 464 | | |||
465 | if (!options->focusPolicyIsReasonable()) | 465 | if (!options->focusPolicyIsReasonable()) | ||
466 | return false; | 466 | return false; | ||
467 | 467 | | |||
468 | AbstractClient* get_focus = NULL; | 468 | AbstractClient* get_focus = nullptr; | ||
469 | 469 | | |||
470 | // precedence on keeping the current tabgroup active. to the user that's the same window | 470 | // precedence on keeping the current tabgroup active. to the user that's the same window | ||
471 | if (c && c->tabGroup() && c->isShown(false)) { | 471 | if (c && c->tabGroup() && c->isShown(false)) { | ||
472 | if (c == c->tabGroup()->current()) | 472 | if (c == c->tabGroup()->current()) | ||
473 | c->tabGroup()->activateNext(); | 473 | c->tabGroup()->activateNext(); | ||
474 | get_focus = c->tabGroup()->current(); | 474 | get_focus = c->tabGroup()->current(); | ||
475 | if (get_focus == c) // single tab case - should not happen | 475 | if (get_focus == c) // single tab case - should not happen | ||
476 | get_focus = NULL; | 476 | get_focus = nullptr; | ||
477 | } | 477 | } | ||
478 | 478 | | |||
479 | const int desktop = VirtualDesktopManager::self()->current(); | 479 | const int desktop = VirtualDesktopManager::self()->current(); | ||
480 | 480 | | |||
481 | if (!get_focus && showingDesktop()) | 481 | if (!get_focus && showingDesktop()) | ||
482 | get_focus = findDesktop(true, desktop); // to not break the state | 482 | get_focus = findDesktop(true, desktop); // to not break the state | ||
483 | 483 | | |||
484 | if (!get_focus && options->isNextFocusPrefersMouse()) { | 484 | if (!get_focus && options->isNextFocusPrefersMouse()) { | ||
485 | get_focus = clientUnderMouse(c ? c->screen() : screens()->current()); | 485 | get_focus = clientUnderMouse(c ? c->screen() : screens()->current()); | ||
486 | if (get_focus && (get_focus == c || get_focus->isDesktop())) { | 486 | if (get_focus && (get_focus == c || get_focus->isDesktop())) { | ||
487 | // should rather not happen, but it cannot get the focus. rest of usability is tested above | 487 | // should rather not happen, but it cannot get the focus. rest of usability is tested above | ||
488 | get_focus = NULL; | 488 | get_focus = nullptr; | ||
489 | } | 489 | } | ||
490 | } | 490 | } | ||
491 | 491 | | |||
492 | if (!get_focus) { // no suitable window under the mouse -> find sth. else | 492 | if (!get_focus) { // no suitable window under the mouse -> find sth. else | ||
493 | // first try to pass the focus to the (former) active clients leader | 493 | // first try to pass the focus to the (former) active clients leader | ||
494 | if (c && c->isTransient()) { | 494 | if (c && c->isTransient()) { | ||
495 | auto leaders = c->mainClients(); | 495 | auto leaders = c->mainClients(); | ||
496 | if (leaders.count() == 1 && FocusChain::self()->isUsableFocusCandidate(leaders.at(0), c)) { | 496 | if (leaders.count() == 1 && FocusChain::self()->isUsableFocusCandidate(leaders.at(0), c)) { | ||
497 | get_focus = leaders.at(0); | 497 | get_focus = leaders.at(0); | ||
498 | raiseClient(get_focus); // also raise - we don't know where it came from | 498 | raiseClient(get_focus); // also raise - we don't know where it came from | ||
499 | } | 499 | } | ||
500 | } | 500 | } | ||
501 | if (!get_focus) { | 501 | if (!get_focus) { | ||
502 | // nope, ask the focus chain for the next candidate | 502 | // nope, ask the focus chain for the next candidate | ||
503 | get_focus = FocusChain::self()->nextForDesktop(c, desktop); | 503 | get_focus = FocusChain::self()->nextForDesktop(c, desktop); | ||
504 | } | 504 | } | ||
505 | } | 505 | } | ||
506 | 506 | | |||
507 | if (get_focus == NULL) // last chance: focus the desktop | 507 | if (get_focus == nullptr) // last chance: focus the desktop | ||
508 | get_focus = findDesktop(true, desktop); | 508 | get_focus = findDesktop(true, desktop); | ||
509 | 509 | | |||
510 | if (get_focus != NULL) | 510 | if (get_focus != nullptr) | ||
511 | requestFocus(get_focus); | 511 | requestFocus(get_focus); | ||
512 | else | 512 | else | ||
513 | focusToNull(); | 513 | focusToNull(); | ||
514 | 514 | | |||
515 | return true; | 515 | return true; | ||
516 | 516 | | |||
517 | } | 517 | } | ||
518 | 518 | | |||
519 | void Workspace::setCurrentScreen(int new_screen) | 519 | void Workspace::setCurrentScreen(int new_screen) | ||
520 | { | 520 | { | ||
521 | if (new_screen < 0 || new_screen >= screens()->count()) | 521 | if (new_screen < 0 || new_screen >= screens()->count()) | ||
522 | return; | 522 | return; | ||
523 | if (!options->focusPolicyIsReasonable()) | 523 | if (!options->focusPolicyIsReasonable()) | ||
524 | return; | 524 | return; | ||
525 | closeActivePopup(); | 525 | closeActivePopup(); | ||
526 | const int desktop = VirtualDesktopManager::self()->current(); | 526 | const int desktop = VirtualDesktopManager::self()->current(); | ||
527 | AbstractClient *get_focus = FocusChain::self()->getForActivation(desktop, new_screen); | 527 | AbstractClient *get_focus = FocusChain::self()->getForActivation(desktop, new_screen); | ||
528 | if (get_focus == NULL) | 528 | if (get_focus == nullptr) | ||
529 | get_focus = findDesktop(true, desktop); | 529 | get_focus = findDesktop(true, desktop); | ||
530 | if (get_focus != NULL && get_focus != mostRecentlyActivatedClient()) | 530 | if (get_focus != nullptr && get_focus != mostRecentlyActivatedClient()) | ||
531 | requestFocus(get_focus); | 531 | requestFocus(get_focus); | ||
532 | screens()->setCurrent(new_screen); | 532 | screens()->setCurrent(new_screen); | ||
533 | } | 533 | } | ||
534 | 534 | | |||
535 | void Workspace::gotFocusIn(const AbstractClient* c) | 535 | void Workspace::gotFocusIn(const AbstractClient* c) | ||
536 | { | 536 | { | ||
537 | if (should_get_focus.contains(const_cast< AbstractClient* >(c))) { | 537 | if (should_get_focus.contains(const_cast< AbstractClient* >(c))) { | ||
538 | // remove also all sooner elements that should have got FocusIn, | 538 | // remove also all sooner elements that should have got FocusIn, | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 595 | if (level == FSP::Extreme || protection == FSP::Extreme) | |||
596 | return false; | 596 | return false; | ||
597 | 597 | | |||
598 | // Desktop switching is only allowed in the "no protection" case | 598 | // Desktop switching is only allowed in the "no protection" case | ||
599 | if (!ignore_desktop && !c->isOnCurrentDesktop()) | 599 | if (!ignore_desktop && !c->isOnCurrentDesktop()) | ||
600 | return false; // allow only with level == 0 | 600 | return false; // allow only with level == 0 | ||
601 | 601 | | |||
602 | // No active client, it's ok to pass focus | 602 | // No active client, it's ok to pass focus | ||
603 | // NOTICE that extreme protection needs to be handled before to allow protection on unmanged windows | 603 | // NOTICE that extreme protection needs to be handled before to allow protection on unmanged windows | ||
604 | if (ac == NULL || ac->isDesktop()) { | 604 | if (ac == nullptr || ac->isDesktop()) { | ||
605 | qCDebug(KWIN_CORE) << "Activation: No client active, allowing"; | 605 | qCDebug(KWIN_CORE) << "Activation: No client active, allowing"; | ||
606 | return true; // no active client -> always allow | 606 | return true; // no active client -> always allow | ||
607 | } | 607 | } | ||
608 | 608 | | |||
609 | // TODO window urgency -> return true? | 609 | // TODO window urgency -> return true? | ||
610 | 610 | | |||
611 | // Unconditionally allow intra-client passing around for lower stealing protections | 611 | // Unconditionally allow intra-client passing around for lower stealing protections | ||
612 | // unless the active client has High interest | 612 | // unless the active client has High interest | ||
Show All 37 Lines | 648 | { | |||
650 | if (session_saving && level <= 2) { // <= normal | 650 | if (session_saving && level <= 2) { // <= normal | ||
651 | return true; | 651 | return true; | ||
652 | } | 652 | } | ||
653 | AbstractClient* ac = mostRecentlyActivatedClient(); | 653 | AbstractClient* ac = mostRecentlyActivatedClient(); | ||
654 | if (level == 0) // none | 654 | if (level == 0) // none | ||
655 | return true; | 655 | return true; | ||
656 | if (level == 4) // extreme | 656 | if (level == 4) // extreme | ||
657 | return false; | 657 | return false; | ||
658 | if (ac == NULL || ac->isDesktop()) { | 658 | if (ac == nullptr || ac->isDesktop()) { | ||
659 | qCDebug(KWIN_CORE) << "Raising: No client active, allowing"; | 659 | qCDebug(KWIN_CORE) << "Raising: No client active, allowing"; | ||
660 | return true; // no active client -> always allow | 660 | return true; // no active client -> always allow | ||
661 | } | 661 | } | ||
662 | // TODO window urgency -> return true? | 662 | // TODO window urgency -> return true? | ||
663 | if (AbstractClient::belongToSameApplication(c, ac, AbstractClient::SameApplicationCheck::RelaxedForActive)) { | 663 | if (AbstractClient::belongToSameApplication(c, ac, AbstractClient::SameApplicationCheck::RelaxedForActive)) { | ||
664 | qCDebug(KWIN_CORE) << "Raising: Belongs to active application"; | 664 | qCDebug(KWIN_CORE) << "Raising: Belongs to active application"; | ||
665 | return true; | 665 | return true; | ||
666 | } | 666 | } | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 711 | { | |||
713 | if (time == XCB_TIME_CURRENT_TIME) { | 713 | if (time == XCB_TIME_CURRENT_TIME) { | ||
714 | updateXTime(); | 714 | updateXTime(); | ||
715 | time = xTime(); | 715 | time = xTime(); | ||
716 | } | 716 | } | ||
717 | if (time != -1U | 717 | if (time != -1U | ||
718 | && (m_userTime == XCB_TIME_CURRENT_TIME | 718 | && (m_userTime == XCB_TIME_CURRENT_TIME | ||
719 | || NET::timestampCompare(time, m_userTime) > 0)) { // time > user_time | 719 | || NET::timestampCompare(time, m_userTime) > 0)) { // time > user_time | ||
720 | m_userTime = time; | 720 | m_userTime = time; | ||
721 | shade_below = NULL; // do not hover re-shade a window after it got interaction | 721 | shade_below = nullptr; // do not hover re-shade a window after it got interaction | ||
722 | } | 722 | } | ||
723 | group()->updateUserTime(m_userTime); | 723 | group()->updateUserTime(m_userTime); | ||
724 | } | 724 | } | ||
725 | 725 | | |||
726 | xcb_timestamp_t Client::readUserCreationTime() const | 726 | xcb_timestamp_t Client::readUserCreationTime() const | ||
727 | { | 727 | { | ||
728 | Xcb::Property prop(false, window(), atoms->kde_net_wm_user_creation_time, XCB_ATOM_CARDINAL, 0, 1); | 728 | Xcb::Property prop(false, window(), atoms->kde_net_wm_user_creation_time, XCB_ATOM_CARDINAL, 0, 1); | ||
729 | return prop.value<xcb_timestamp_t>(-1); | 729 | return prop.value<xcb_timestamp_t>(-1); | ||
730 | } | 730 | } | ||
731 | 731 | | |||
732 | xcb_timestamp_t Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id, const KStartupInfoData *asn_data, | 732 | xcb_timestamp_t Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id, const KStartupInfoData *asn_data, | ||
733 | bool session) const | 733 | bool session) const | ||
734 | { | 734 | { | ||
735 | xcb_timestamp_t time = info->userTime(); | 735 | xcb_timestamp_t time = info->userTime(); | ||
736 | //qDebug() << "User timestamp, initial:" << time; | 736 | //qDebug() << "User timestamp, initial:" << time; | ||
737 | //^^ this deadlocks kwin --replace sometimes. | 737 | //^^ this deadlocks kwin --replace sometimes. | ||
738 | 738 | | |||
739 | // newer ASN timestamp always replaces user timestamp, unless user timestamp is 0 | 739 | // newer ASN timestamp always replaces user timestamp, unless user timestamp is 0 | ||
740 | // helps e.g. with konqy reusing | 740 | // helps e.g. with konqy reusing | ||
741 | if (asn_data != NULL && time != 0) { | 741 | if (asn_data != nullptr && time != 0) { | ||
742 | if (asn_id->timestamp() != 0 | 742 | if (asn_id->timestamp() != 0 | ||
743 | && (time == -1U || NET::timestampCompare(asn_id->timestamp(), time) > 0)) { | 743 | && (time == -1U || NET::timestampCompare(asn_id->timestamp(), time) > 0)) { | ||
744 | time = asn_id->timestamp(); | 744 | time = asn_id->timestamp(); | ||
745 | } | 745 | } | ||
746 | } | 746 | } | ||
747 | qCDebug(KWIN_CORE) << "User timestamp, ASN:" << time; | 747 | qCDebug(KWIN_CORE) << "User timestamp, ASN:" << time; | ||
748 | if (time == -1U) { | 748 | if (time == -1U) { | ||
749 | // The window doesn't have any timestamp. | 749 | // The window doesn't have any timestamp. | ||
750 | // If it's the first window for its application | 750 | // If it's the first window for its application | ||
751 | // (i.e. there's no other window from the same app), | 751 | // (i.e. there's no other window from the same app), | ||
752 | // use the _KDE_NET_WM_USER_CREATION_TIME trick. | 752 | // use the _KDE_NET_WM_USER_CREATION_TIME trick. | ||
753 | // Otherwise, refuse activation of a window | 753 | // Otherwise, refuse activation of a window | ||
754 | // from already running application if this application | 754 | // from already running application if this application | ||
755 | // is not the active one (unless focus stealing prevention is turned off). | 755 | // is not the active one (unless focus stealing prevention is turned off). | ||
756 | Client* act = dynamic_cast<Client*>(workspace()->mostRecentlyActivatedClient()); | 756 | Client* act = dynamic_cast<Client*>(workspace()->mostRecentlyActivatedClient()); | ||
757 | if (act != NULL && !belongToSameApplication(act, this, SameApplicationCheck::RelaxedForActive)) { | 757 | if (act != nullptr && !belongToSameApplication(act, this, SameApplicationCheck::RelaxedForActive)) { | ||
758 | bool first_window = true; | 758 | bool first_window = true; | ||
759 | auto sameApplicationActiveHackPredicate = [this](const Client *cl) { | 759 | auto sameApplicationActiveHackPredicate = [this](const Client *cl) { | ||
760 | // ignore already existing splashes, toolbars, utilities and menus, | 760 | // ignore already existing splashes, toolbars, utilities and menus, | ||
761 | // as the app may show those before the main window | 761 | // as the app may show those before the main window | ||
762 | return !cl->isSplash() && !cl->isToolbar() && !cl->isUtility() && !cl->isMenu() | 762 | return !cl->isSplash() && !cl->isToolbar() && !cl->isUtility() && !cl->isMenu() | ||
763 | && cl != this && Client::belongToSameApplication(cl, this, SameApplicationCheck::RelaxedForActive); | 763 | && cl != this && Client::belongToSameApplication(cl, this, SameApplicationCheck::RelaxedForActive); | ||
764 | }; | 764 | }; | ||
765 | if (isTransient()) { | 765 | if (isTransient()) { | ||
766 | auto clientMainClients = [this] () -> ClientList { | 766 | auto clientMainClients = [this] () -> ClientList { | ||
767 | ClientList ret; | 767 | ClientList ret; | ||
768 | const auto mcs = mainClients(); | 768 | const auto mcs = mainClients(); | ||
769 | for (auto mc: mcs) { | 769 | for (auto mc: mcs) { | ||
770 | if (Client *c = dynamic_cast<Client*>(mc)) { | 770 | if (Client *c = dynamic_cast<Client*>(mc)) { | ||
771 | ret << c; | 771 | ret << c; | ||
772 | } | 772 | } | ||
773 | } | 773 | } | ||
774 | return ret; | 774 | return ret; | ||
775 | }; | 775 | }; | ||
776 | if (act->hasTransient(this, true)) | 776 | if (act->hasTransient(this, true)) | ||
777 | ; // is transient for currently active window, even though it's not | 777 | ; // is transient for currently active window, even though it's not | ||
778 | // the same app (e.g. kcookiejar dialog) -> allow activation | 778 | // the same app (e.g. kcookiejar dialog) -> allow activation | ||
779 | else if (groupTransient() && | 779 | else if (groupTransient() && | ||
780 | findInList<Client, Client>(clientMainClients(), sameApplicationActiveHackPredicate) == NULL) | 780 | findInList<Client, Client>(clientMainClients(), sameApplicationActiveHackPredicate) == nullptr) | ||
781 | ; // standalone transient | 781 | ; // standalone transient | ||
782 | else | 782 | else | ||
783 | first_window = false; | 783 | first_window = false; | ||
784 | } else { | 784 | } else { | ||
785 | if (workspace()->findClient(sameApplicationActiveHackPredicate)) | 785 | if (workspace()->findClient(sameApplicationActiveHackPredicate)) | ||
786 | first_window = false; | 786 | first_window = false; | ||
787 | } | 787 | } | ||
788 | // don't refuse if focus stealing prevention is turned off | 788 | // don't refuse if focus stealing prevention is turned off | ||
Show All 19 Lines | |||||
808 | return time; | 808 | return time; | ||
809 | } | 809 | } | ||
810 | 810 | | |||
811 | xcb_timestamp_t Client::userTime() const | 811 | xcb_timestamp_t Client::userTime() const | ||
812 | { | 812 | { | ||
813 | xcb_timestamp_t time = m_userTime; | 813 | xcb_timestamp_t time = m_userTime; | ||
814 | if (time == 0) // doesn't want focus after showing | 814 | if (time == 0) // doesn't want focus after showing | ||
815 | return 0; | 815 | return 0; | ||
816 | Q_ASSERT(group() != NULL); | 816 | Q_ASSERT(group() != nullptr); | ||
817 | if (time == -1U | 817 | if (time == -1U | ||
818 | || (group()->userTime() != -1U | 818 | || (group()->userTime() != -1U | ||
819 | && NET::timestampCompare(group()->userTime(), time) > 0)) | 819 | && NET::timestampCompare(group()->userTime(), time) > 0)) | ||
820 | time = group()->userTime(); | 820 | time = group()->userTime(); | ||
821 | return time; | 821 | return time; | ||
822 | } | 822 | } | ||
823 | 823 | | |||
824 | void Client::doSetActive() | 824 | void Client::doSetActive() | ||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |