Diff for /chimera/ContentClickListener.mm between versions 1.3 and 1.7

version 1.3, 2002/03/08 01:43:01 version 1.7, 2002/03/09 23:14:00
Line 49 Line 49
 #include "nsIDOMHTMLAnchorElement.h"  #include "nsIDOMHTMLAnchorElement.h"
 #include "nsIDOMHTMLAreaElement.h"  #include "nsIDOMHTMLAreaElement.h"
 #include "nsIDOMHTMLLinkElement.h"  #include "nsIDOMHTMLLinkElement.h"
   #include "nsIDOMHTMLImageElement.h"
   #include "nsIDOMCharacterData.h"
   
   // Common helper routines (also used by the context menu code)
   #include "GeckoUtils.h"
   
 NS_IMPL_ISUPPORTS2(ContentClickListener, nsIDOMMouseListener, nsIDOMEventListener);  NS_IMPL_ISUPPORTS2(ContentClickListener, nsIDOMMouseListener, nsIDOMEventListener);
   
Line 145  ContentClickListener::MouseClick(nsIDOME Line 150  ContentClickListener::MouseClick(nsIDOME
   PRUint16 button;    PRUint16 button;
   nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aEvent));    nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aEvent));
   mouseEvent->GetButton(&button);    mouseEvent->GetButton(&button);
  switch (button) {
    case 0: {  PRBool metaKey, shiftKey, altKey;
      PRBool metaKey, shiftKey;  mouseEvent->GetMetaKey(&metaKey);
      mouseEvent->GetMetaKey(&metaKey);  mouseEvent->GetShiftKey(&shiftKey);
      mouseEvent->GetShiftKey(&shiftKey);  mouseEvent->GetAltKey(&altKey);
      if (metaKey) {  if ((metaKey && button == 0) || button == 1) {
        // The command key is down.  Open the link in a new window or tab.    // The command key is down or we got a middle click.  Open the link in a new window or tab.
        PRBool useTab;    PRBool useTab;
        pref->GetBoolPref("browser.tabs.opentabfor.middleclick", &useTab);    pref->GetBoolPref("browser.tabs.opentabfor.middleclick", &useTab);
        PRBool loadInBackground;    PRBool loadInBackground;
        pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);    pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
        if (shiftKey)    if (shiftKey)
          loadInBackground = !loadInBackground;      loadInBackground = !loadInBackground;
        if (useTab) {    if (useTab)
                [mBrowserController openNewTabWithURL: urlToLoad loadInBackground: loadInBackground];
        }    else
        else      [mBrowserController openNewWindowWithURL: urlToLoad loadInBackground: loadInBackground];
          [mBrowserController openNewWindowWithURL: urlToLoad loadInBackground: loadInBackground]; 
      } 
    } 
   }    }
      else if (altKey) {
     // The user wants to save this link.
     nsAutoString text;
     GeckoUtils::GatherTextUnder(content, text);
   }
 
   return NS_OK;    return NS_OK;
 }  }

Removed from v.1.3  
changed lines
  Added in v.1.7


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>