]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/baseui.js
Yet another merge.
[irc/quakenet/qwebirc.git] / js / ui / baseui.js
index 3801b4c503a155f4d13f09405b5f9f2a13693d99..71c503ec04ae15069cd4e8bf7f8cb9a7e884d5b6 100644 (file)
@@ -3,7 +3,7 @@ qwebirc.ui.WINDOW_QUERY =    0x02;
 qwebirc.ui.WINDOW_CHANNEL =  0x04;
 qwebirc.ui.WINDOW_CUSTOM =   0x08;
 qwebirc.ui.WINDOW_CONNECT =  0x10;
-qwebirc.ui.WINDOW_MESSAGES = 0x32;
+qwebirc.ui.WINDOW_MESSAGES = 0x20;
 
 qwebirc.ui.CUSTOM_CLIENT = "custom";
 
@@ -23,6 +23,10 @@ qwebirc.ui.BaseUI = new Class({
     this.firstClient = false;
     this.commandhistory = new qwebirc.irc.CommandHistory();
     this.clientId = 0;
+    
+    this.windowFocused = true;
+    window.addEvent("blur", function() { if(this.windowFocused) { this.windowFocused = false; this.focusChange(false); } }.bind(this));
+    window.addEvent("focus", function() { if(!this.windowFocused) { this.windowFocused = true; this.focusChange(true); } }.bind(this));
   },
   newClient: function(client) {
     client.id = this.clientId++;
@@ -151,6 +155,11 @@ qwebirc.ui.BaseUI = new Class({
     */
   loginBox: function(callback, initialNickname, initialChannels, autoConnect, autoNick) {
     qwebirc.ui.GenericLoginBox(this.parentElement, callback, initialNickname, initialChannels, autoConnect, autoNick, this.options.networkName);
+  },
+  focusChange: function(newValue) {
+    var window_ = this.getActiveWindow();
+    if($defined(window_))
+      window_.focusChange(newValue);
   }
 });
 
@@ -325,6 +334,10 @@ qwebirc.ui.NotificationUI = new Class({
   updateTitle: function(text) {
     if(this.__flasher.updateTitle(text))
       this.parent(text);
+  },
+  focusChange: function(value) {
+    this.parent(value);
+    this.__flasher.focusChange(value);
   }
 });