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



commit c6d89965b8eac0862ef766aed6945273ca7578b0
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 e6a72da..6b0ca6d 100644
--- a/src/application.js
+++ b/src/application.js
@@ -344,7 +344,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]