[polari/wip/fmuellner/misc-fixes: 3/8] app: Always use a timestamp of 0 when requesting channels



commit d91934364d455048c432c741cb9d9e3e4602b2fd
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Aug 5 15:31:20 2016 +0200

    app: Always use a timestamp of 0 when requesting channels
    
    Whether a join/query action should switch to the corresponding room is
    determined by a timestamp contained in the action's parameter. We handle
    that timestamp immediately to be responsive to user action, but currently
    also pass it on to telepathy. As a result, mission-control will ask us to
    present the room (again) when the channel is ready, which is pointless in
    the best case. In the worst case when channel creation is slow (as during
    startup, when joining multiple channels at once), the user might have
    selected a different room while waiting for the connection to finish, in
    which case the focus stealing is unexpected and rude.
    
    Just use a timestamp of 0 for all channel requests we make ourselves, so
    that we only present externally created channels that are handed over to
    us (for example from GNOME Shell's builtin chat integration).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769584

 src/application.js |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 4df0cbb..9e431ab 100644
--- a/src/application.js
+++ b/src/application.js
@@ -347,7 +347,10 @@ const Application = new Lang.Class({
         let cancellable = new Gio.Cancellable();
         this._pendingRequests.set(roomId, cancellable);
 
-        let req = Tp.AccountChannelRequest.new_text(account, time);
+        // We already focused the room, so passing on the time to telepathy
+        // would have no effect at best, but could steal the focus when the
+        // user switched to a different room before the request completes
+        let req = Tp.AccountChannelRequest.new_text(account, 0);
         req.set_target_id(targetType, targetId);
         req.set_delegate_to_preferred_handler(true);
         let preferredHandler = Tp.CLIENT_BUS_NAME_BASE + 'Polari';


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]