1. 13 Nov, 2017 1 commit
    • Eike Hein's avatar
      When used by QML, only populate after component is complete · b40c0de0
      Eike Hein authored
      Summary:
      This introduces the use of QQmlParserStatus to delay populating
      the model until all properties have been set, to avoid delegate
      churn.
      
      TasksModel is also meant to be used by C++. There's no good way
      to determine whether an object is being instanciated by QML
      during construction time, therefore this patch also introduces a
      delay in initial population of the model after construction via
      a single-shot timer. At the time the slot is invoked we know if
      we're used by QML (because QQmlParserStatus::classBegin has
      either been called or not by then) so we can decide to populate
      or wait more for QQmlParserStatus::componentComplete.
      
      I'm not super happy with this behavior change for C++ users,
      however as the model is usually used via QML currently, it's
      pragmatic to optimize performance for the common case, and it
      doesn't technically break QAbstractItemModel semantics, as model
      population isn't required to be sync.
      
      There's a decent change this fixes a recently-reported crash as a
      by-product:
      CCBUG:386630
      
      Reviewers: #plasma, davidedmundson, mart
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D8723
      b40c0de0
  2. 25 Sep, 2017 1 commit
  3. 14 Aug, 2017 1 commit
  4. 24 Jul, 2017 1 commit
  5. 30 May, 2017 1 commit
  6. 24 May, 2017 1 commit
  7. 22 May, 2017 1 commit
  8. 20 Apr, 2017 2 commits
    • Eike Hein's avatar
      Delay these HasLauncher updates until the launcher tasks model is lazy-initialized. · faca0710
      Eike Hein authored
      Also makes the emits more targeted.
      faca0710
    • Eike Hein's avatar
      Introduce a HasLauncher data role. · 3546de22
      Eike Hein authored
      Summary:
      This is implemented by TasksModel and allows clients to reliably
      query whether a row has an associated launcher. Useful for things
      like Pin/Unpin action state or layout decisions.
      
      Previously clients would have to reimplement something like
      TaskTools::appsMatch on top of the model, which we absolutely do
      not want to do - there should only be one copy of the app matching
      logic for consistency's sake. In practice clients would do things
      like fetch LauncherUrl and run it by launcherPosition(), which
      omits appsMatch's AppId comparision, as an example of such unwated
      drift. This approach also avoids the large performance overhead
      involved.
      
      The role is not implemented by the single-type or munging tasks
      models as it has no use there.
      
      Reviewers: #plasma, davidedmundson
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D5504
      3546de22
  9. 31 Mar, 2017 1 commit
    • Eike Hein's avatar
      Fix TasksModel.anyTaskDemandsAttention not updating on window closure. · 628593db
      Eike Hein authored
      Summary:
      Previously we updated the prop after checking for
      AbstractTasksModel::IsDemandingAttention on window closure, but
      as the window is gone, we can't actually get state for it anymore,
      so we always need to update.
      
      To make up for it, this patch also optimizes the prop updates to occur
      only once per insert/remove batch - this is a bit academic because
      the source models currently only insert single rows at a time, but
      it's good hygiene.
      
      BUG:378254
      
      Reviewers: #plasma, mart
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D5261
      628593db
  10. 16 Feb, 2017 6 commits
    • Eike Hein's avatar
      Fix merge of dda4d42e. · 1a1d6445
      Eike Hein authored
      1a1d6445
    • Eike Hein's avatar
      eaf5c71e
    • Eike Hein's avatar
      Fix up merge mistake. · adb954ef
      Eike Hein authored
      adb954ef
    • Eike Hein's avatar
      Add comment laying out goals. · 62b803b4
      Eike Hein authored
      62b803b4
    • Eike Hein's avatar
      Fix crash when switching activities. · 05826bd5
      Eike Hein authored
      Summary:
      What happens:
      * Activity switch calls invalidateFilter on TaskFilterProxyModel,
        which may remove rows in response.
      * Up the proxy chain, TasksModel may ask LauncherTasksModel to
        emit dataChanged for its contents in response to the row removal,
        to cause its own filtering to re-evaluate the launchers for the
        life cycle logic.
      * This can cause TFPM to do more filtering before invalidateFilter
        has actually returned, causing trip-ups such as duplicated rows
        in the proxy.
      * Eventually the corrupted maps cause a memory corruption crash.
      
      This patch changes step 2 to "find the launchers in the TFPM (the
      direct source model) and ask for a dataChanged for each". This
      costs us a loop and accesses to IsLauncher, but on the other hand
      fixes the crash and avoids a lot of filtering and mapping work
      between LTM and up to and including TFPM. It's also just better
      code to ask for the dataChanged only from the model we need it
      from.
      
      BUG:376055
      
      Reviewers: #plasma, davidedmundson
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D4631
      05826bd5
    • Eike Hein's avatar
      Tweak alphabetic (default) sort behavior. · 410086d0
      Eike Hein authored
      Summary:
      Alphabetical sorting currently compares a concatenation of
      "AppName" (determined by heuristic) and Qt::DisplayRole (usually
      the window title) using QString::localeAwareSort. This reflects
      that the motivation behind alphabetical sorting is generally to
      keep windows belonging to the same app grouped together and then
      order those groups alphabetically.
      
      The current code achieves this, but the particulars turn out to
      negatively impact users of multi-windowed apps that frequently
      change window titles in ways that impact sorting, particularly
      tabbed web browsers. Switching between tabs may change the order
      of browser windows on the Task Manager. Multiple instances of
      feedback suggest this is jarring and unexpected, despite
      technically being alphabetical.
      
      This patch changes behavior as follows:
      1. Instead of comparing "<App Name><DisplayRole>" it will try to only
         compare "<App Name>", falling back to "<DisplayRole>" if the app
         name can't be determined.
      2. If two tasks compare to equal in the above, it will fall back to
         source model row order, i.e. creation/append sorting.
      
      This still achieves the primary goal laid out above while
      keeping the sort order within an app "group" stable when using
      alphabetical sorting.
      
      BUG:373698
      
      An alternative means to achive this behavior would be via existing
      Task Manager settings. To wit:
      1. Enable grouping
      2. Disable group popups, so groups are instead maintained inline
         on the widget
      
      I'm actually considering suggesting the above (plus changing
      sorting to Manual) as new default settings for 5.10 - but in
      the meantime it still makes sense to tune the alphabetical
      sorting mode in this way, and put the improved behavior into
      5.8 and 5.9 to address user feedback earlier.
      
      Reviewers: #plasma, davidedmundson
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D4469
      410086d0
  11. 14 Feb, 2017 1 commit
    • Eike Hein's avatar
      Fix manually reordering launchers. · dda4d42e
      Eike Hein authored
      Summary:
      syncLaunchers() is called after drag operations end to write the order
      of launchers in the all-capping TasksModel to the LauncherTaskModel
      source model. The per-activity launcher pinning work recently broke
      this by changing the model that's looped over.
      
      Reviewers: #plasma, ivan, davidedmundson
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D4608
      dda4d42e
  12. 25 Jan, 2017 1 commit
  13. 06 Jan, 2017 2 commits
    • Eike Hein's avatar
      Fix "Pinned Chrome disappears when all Chrome windows are closed" · cf6d8ab0
      Eike Hein authored
      Summary:
      It turns out that Chrome under certain conditions will change its
      window metadata as it quits, causing a race we sometimes lose, failing
      to reveal the associated launcher because we can no longer match it
      to the window at window closing time. Instead we are now forced to
      re-check all launchers after the window is gone. As a speed optimi-
      zation we only consider top-level windows (and startups) as being in
      a group implies matching siblings.
      
      In addition this refactoring eliminates a use of Qt::QueuedConnection
      that allowed for an unpredictable event loop spin inbetween things.
      
      BUG:365617
      
      Reviewers: davidedmundson
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D3950
      cf6d8ab0
    • Eike Hein's avatar
      Fix "Pinned Chrome disappears when all Chrome windows are closed" · 09ab6cdf
      Eike Hein authored
      Summary:
      It turns out that Chrome under certain conditions will change its
      window metadata as it quits, causing a race we sometimes lose, failing
      to reveal the associated launcher because we can no longer match it
      to the window at window closing time. Instead we are now forced to
      re-check all launchers after the window is gone. As a speed optimi-
      zation we only consider top-level windows (and startups) as being in
      a group implies matching siblings.
      
      In addition this refactoring eliminates a use of Qt::QueuedConnection
      that allowed for an unpredictable event loop spin inbetween things.
      
      BUG:365617
      
      Reviewers: davidedmundson
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D3950
      09ab6cdf
  14. 18 Oct, 2016 1 commit
  15. 17 Oct, 2016 1 commit
  16. 10 Oct, 2016 4 commits
  17. 12 Aug, 2016 1 commit
  18. 09 Aug, 2016 2 commits
    • Eike Hein's avatar
      Factor windowing system arbitration out of TasksModel. · acfbcb4f
      Eike Hein authored
      Summary:
      This introduces a new WindowTasksModel which is a QIdentityProxyModel
      around an instance of either WaylandTasksModel or XWindowsTasksModel.
      
      This arbitration was previously done directly in TasksModel, along with
      refcounting to share a single window tasks sub-model between TasksModel
      instances. Factoring out both of these things has two goals:
      - It allows users of libtaskmanager which are solely interested in
        window data (e.g. the Pager) to skip the unnecessary complexity
        of TasksModel, while still sharing the windowing monitoring with
        users of TasksModel.
      - TasksModel becomes fully free of windowing system-specific code
        and calls to KWindowSystem (to query the platform), making its
        code a little cleaner.
      
      The downside is another layer of indirection (the QIdentityProxyModel),
      but the upside is clear: The Pager wants to share window data and
      window monitoring with the Task Manager, but is not interested in
      startup notifications, does its own sorting (using the window stacking
      order), does not need grouping and has different filtering needs.
      
      The Pager backend will use QSortFilterProxyModel around WindowTasksModel
      to mix in its own data and sort by stacking order.
      
      Reviewers: #plasma, mart, davidedmundson
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D2379
      acfbcb4f
    • Eike Hein's avatar
      Instanciate the launcher tasks model only when needed. · c802bb87
      Eike Hein authored
      Summary:
      Previously the launcher tasks model was always instanciated; with
      this change it's only done once a launcher list gets set or a
      request to add a launcher happens. This avoids an unnecessary model
      in TasksModel instances that will never store any launchers (e.g.
      in the Window List applet).
      
      Reviewers: #plasma, davidedmundson
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D2378
      c802bb87
  19. 04 Aug, 2016 1 commit
  20. 29 Jul, 2016 1 commit
  21. 14 Jul, 2016 1 commit
  22. 13 Jul, 2016 3 commits
  23. 12 Jul, 2016 2 commits
  24. 07 Jul, 2016 3 commits
    • Eike Hein's avatar
      Don't recurse. · f631964f
      Eike Hein authored
      f631964f
    • Eike Hein's avatar
      Return LegacyWinIdList for groups in final proxy sort order. · 313aede0
      Eike Hein authored
      TaskGroupingProxyModel appends; the proxy may sort differently
      (e.g. alphabetically by default). The win id list was returned
      in TGPM sort order, which meant the tooltips had the thumbnails
      in the wrong order, and clicking them would activate the wrong
      window.
      
      BUG:365181
      313aede0
    • Eike Hein's avatar
      Avoid side-channeling through shared static source models. · e2b07027
      Eike Hein authored
      Fixes a nasty bug causing two TasksModel instances to interfere
      with each other.
      BUG:365011
      
      Also removes an assumption that the launcher list will pass
      through LauncherTasksModel unharmed -- if launchers become
      activity-silo'd, that might not be the case any longer.
      e2b07027