Author: jackson
Date: 2007-08-24 12:37:35 -0400 (Fri, 24 Aug 2007)
New Revision: 84809

Modified:
   trunk/moon/plugin/ChangeLog
   trunk/moon/plugin/plugin-class.cpp
   trunk/moon/plugin/plugin-class.h
Log:

        * plugin-class.cpp|h: Now that getPosition works as intended, we
        don't need to store the position as an NPObject on the
        MouseEventArgs.



Modified: trunk/moon/plugin/ChangeLog
===================================================================
--- trunk/moon/plugin/ChangeLog 2007-08-24 15:04:33 UTC (rev 84808)
+++ trunk/moon/plugin/ChangeLog 2007-08-24 16:37:35 UTC (rev 84809)
@@ -1,3 +1,9 @@
+2007-08-24  Jackson Harper  <[EMAIL PROTECTED]>
+
+       * plugin-class.cpp|h: Now that getPosition works as intended, we
+       don't need to store the position as an NPObject on the
+       MouseEventArgs.
+
 2007-08-24  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
 
        * plugin-class.cpp: mouse_event_invoke (getPosition):

Modified: trunk/moon/plugin/plugin-class.cpp
===================================================================
--- trunk/moon/plugin/plugin-class.cpp  2007-08-24 15:04:33 UTC (rev 84808)
+++ trunk/moon/plugin/plugin-class.cpp  2007-08-24 16:37:35 UTC (rev 84809)
@@ -258,7 +258,8 @@
 {
        MouseEventArgs *ea = (MouseEventArgs*)calldata;
        MoonlightMouseEventArgsObject *jsea = 
(MoonlightMouseEventArgsObject*)NPN_CreateObject (instance, 
MoonlightMouseEventArgsClass);
-       MouseEventArgsPopulate (jsea, ea);
+       jsea->x = ea->x;
+       jsea->y = ea->y;
 
        OBJECT_TO_NPVARIANT (jsea, *value);
 }
@@ -726,7 +727,8 @@
 // XXX apparently we don't need to do this?
 //     if (ea->position)
 //             NPN_ReleaseObject (ea->position);
-       ea->position = NULL;
+       ea->x = -1;
+       ea->y = -1;
 }
 
 static bool
@@ -778,7 +780,8 @@
                Value* varg = NULL;
                variant_to_value (&args[0], &varg);
 
-               Point origin = Point (0, 0);
+               double x = ea->x;
+               double y = ea->y;
                DependencyObject *dob = NULL;
 
                //printf ("mouse_event_invoke (varg: %s, kind: %s)\n", varg == 
NULL ? "null" : "something", varg == NULL ? "n/a" : Type::Find (varg->GetKind 
())->name);
@@ -794,30 +797,13 @@
                        }
                }
                if (dob != NULL && dob->Is (Type::UIELEMENT)) {
-                       UIElement *uielement = (UIElement*) dob;
-                       //printf ("mouse_event_invoke (element: %s)\n", 
uielement != NULL ? "something" : "null");
-                       if (uielement != NULL) {
-                               Rect bounds = uielement->GetBounds ();
-                               origin.x = bounds.x;
-                               origin.y = bounds.y;
-                               //printf ("mouse_event_invoke (bounds: %f, %f, 
%f, %f)\n", bounds.x, bounds.y, bounds.w, bounds.h);
-                       }
+                       uielement_transform_point ((UIElement*) dob, &x, &y);
                }
        
                delete varg;
 
-               //printf ("mouse_event_invoke (origin: %f, %f)\n", origin.x, 
origin.y);
-
-               MoonlightPoint *mouse_location = (MoonlightPoint*) ea->position;
-               Point position = origin;
-               if (mouse_location != NULL) {
-                       position.x = mouse_location->point.x - origin.x;
-                       position.y = mouse_location->point.y - origin.y;
-                       //printf ("mouse_event_invoke (position: %f, %f)\n", 
position.x, position.y);
-               }
-
                MoonlightPoint *point = (MoonlightPoint*)NPN_CreateObject 
(((MoonlightObject*)npobj)->instance, MoonlightPointClass);
-               point->point = position;
+               point->point = Point (x, y);
 
                OBJECT_TO_NPVARIANT (point, *result);
 
@@ -843,17 +829,6 @@
 
 MoonlightMouseEventArgsType* MoonlightMouseEventArgsClass;
 
-void
-MouseEventArgsPopulate (MoonlightMouseEventArgsObject *ea, MouseEventArgs 
*args)
-{
-       ea->state = args->state;
-
-       MoonlightPoint *point = (MoonlightPoint*)NPN_CreateObject 
(((MoonlightObject*)ea)->instance, MoonlightPointClass);
-
-       point->point = Point (args->x, args->y);
-       ea->position = point;
-}
-
 /*** MoonlightKeyboardEventArgsClass  
**************************************************************/
 
 static NPObject*

Modified: trunk/moon/plugin/plugin-class.h
===================================================================
--- trunk/moon/plugin/plugin-class.h    2007-08-24 15:04:33 UTC (rev 84808)
+++ trunk/moon/plugin/plugin-class.h    2007-08-24 16:37:35 UTC (rev 84809)
@@ -161,15 +161,13 @@
 
 struct MoonlightMouseEventArgsObject : MoonlightObject {
        MoonlightMouseEventArgsObject (NPP instance)
-         : MoonlightObject (instance), state (0), position (NULL) { }
+         : MoonlightObject (instance), state (0), x (-1), y (-1) { }
 
        int state;
-
-       NPObject *position;
+       double x;
+       double y;
 };
 
-extern void MouseEventArgsPopulate (MoonlightMouseEventArgsObject *ea, 
MouseEventArgs *args);
-
 /*** MoonlightKeyboardEventArgsClass  
**************************************************************/
 struct MoonlightKeyboardEventArgsType : MoonlightObjectType {
        MoonlightKeyboardEventArgsType ();

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to