[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.0/kdelibs/khtml/ecma
From:       David Faure <faure () kde ! org>
Date:       2008-03-17 20:57:53
Message-ID: 1205787473.586098.13769.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 786743 by dfaure:

The DOM (and khtml) use 0 for LMB, 1 for MMB and 2 for RMB but MSIE uses 1=LMB, \
2=RMB, 4=MMB, as a bitfield. => let's be a good browser and let's use the DOM values \
in event.button, unless emulating IE.


 M  +7 -7      kjs_events.cpp  


--- branches/KDE/4.0/kdelibs/khtml/ecma/kjs_events.cpp #786742:786743
@@ -644,14 +644,14 @@
     return jsBoolean(event.metaKey());
   case Button:
   {
-    if ( exec->dynamicInterpreter()->compatMode() == Interpreter::NetscapeCompat ) {
-        return jsNumber(event.button());
+    if ( exec->dynamicInterpreter()->compatMode() == Interpreter::IECompat ) {
+      // Tricky. The DOM (and khtml) use 0 for LMB, 1 for MMB and 2 for RMB
+      // but MSIE uses 1=LMB, 2=RMB, 4=MMB, as a bitfield
+      int domButton = event.button();
+      int button = domButton==0 ? 1 : domButton==1 ? 4 : domButton==2 ? 2 : 0;
+      return jsNumber( (unsigned int)button );
     }
-    // Tricky. The DOM (and khtml) use 0 for LMB, 1 for MMB and 2 for RMB
-    // but MSIE uses 1=LMB, 2=RMB, 4=MMB, as a bitfield
-    int domButton = event.button();
-    int button = domButton==0 ? 1 : domButton==1 ? 4 : domButton==2 ? 2 : 0;
-    return jsNumber( (unsigned int)button );
+    return jsNumber(event.button());
   }
   case ToElement:
     // MSIE extension - "the object toward which the user is moving the mouse \
pointer"


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic