title: Activate/deactivate events when moving the window
body: <p>Within my Firefox extension I'm trying to keep track when the window is actually the active window. For this, I add the following two listener to the window:</p>
  
  <pre><code>  window.addEventListener("deactivate", function(event) { alert("deactivate"); }, false);
    window.addEventListener("activate", function(event) { alert("activate");  }, false);
  </code></pre>
  
  <p>Basically everything works fine. When I toggle between different windows, or minimize/maximize Firefox, the events fire quite as I would expect it. However, both events also fired when I move the window even if it is already active. When I start moving the window, the "deactivate" event is fired; when I stop moving and release the mouse button, the "activate" event is fired. I have no idea how can I detect and ignore this behavior. Intuitively, the window is all the time active. </p>
  
  <p>I tried to check before I handle the "deactivate" event if the mouse button is pressed. However, adding a "click" event listener to the window seem not to include the window's title bar. Anyone any idea how I can distinguish beween "really" de-/activating the window and moving the window? Thanks a lot in advance!</p>