[polari/wip/fmuellner/window-experiments: 18/30] chatView: Only show notifications for the active window



commit dd3f6a4465ced171a7b2715d4c202f27b7a1035b
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jul 15 21:17:29 2016 +0200

    chatView: Only show notifications for the active window

 src/chatView.js |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 23260a7..f673261 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -1212,8 +1212,6 @@ const ChatView = new Lang.Class({
 
     _insertTpMessage: function(tpMessage) {
         let message = this._createMessage(tpMessage);
-        let shouldHighlight = this._room.should_highlight_message(message.nick,
-                                                                  message.text);
 
         this._ensureNewLine();
 
@@ -1221,8 +1219,12 @@ const ChatView = new Lang.Class({
         this._insertMessage(iter, message, this._state);
         this._trackContact(tpMessage.sender);
 
-        if (shouldHighlight &&
-            !(this._toplevelFocus && this._active)) {
+        let highlight = this._room.should_highlight_message(message.nick,
+                                                            message.text);
+        let visible = this._toplevelFocus && this._active && this._autoscroll;
+        let toplevelActive = this.get_toplevel() == this._app.active_window;
+
+        if (highlight && !visible && toplevelActive) {
             let summary = '%s %s'.format(this._room.display_name, message.nick);
             let notification = new Gio.Notification();
             notification.set_title(summary);


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