Author: toshok
Date: 2007-07-05 15:23:02 -0400 (Thu, 05 Jul 2007)
New Revision: 81427

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/clock.cpp
   trunk/moon/src/clock.h
   trunk/moon/src/runtime.cpp
   trunk/moon/src/runtime.h
Log:
        * runtime.cpp, runtime.h: store the last mouse position of events
        so that we can continue to update after the clock tick (and
        provide motion/enter/leave events to elements that might have
        moved under the pointer).

        The "update-input" event isn't presently emitted (see clock.cpp)
        because it results in this code calling HandleMotion on every
        tick, which ends up emitting the C# event (which is wrong).

        * clock.h, clock.cpp: add a (presently unused) phase to the clock
        tick to update the current mouse over after we've updated our
        clocks (and therefore possibly updated the transforms on
        elements).

2007-07-05  Chris Toshok  <[EMAIL PROTECTED]>



Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-07-05 19:20:27 UTC (rev 81426)
+++ trunk/moon/src/ChangeLog    2007-07-05 19:23:02 UTC (rev 81427)
@@ -1,5 +1,21 @@
 2007-07-05  Chris Toshok  <[EMAIL PROTECTED]>
 
+       * runtime.cpp, runtime.h: store the last mouse position of events
+       so that we can continue to update after the clock tick (and
+       provide motion/enter/leave events to elements that might have
+       moved under the pointer).
+
+       The "update-input" event isn't presently emitted (see clock.cpp)
+       because it results in this code calling HandleMotion on every
+       tick, which ends up emitting the C# event (which is wrong).
+
+       * clock.h, clock.cpp: add a (presently unused) phase to the clock
+       tick to update the current mouse over after we've updated our
+       clocks (and therefore possibly updated the transforms on
+       elements).
+
+2007-07-05  Chris Toshok  <[EMAIL PROTECTED]>
+
        * dependencyobject.cpp (dependency_object_get_name): change this
        to return the x:Name value if there is one (and "(null)" if not).
        (dependency_object_get_type_name): and make this function do the

Modified: trunk/moon/src/clock.cpp
===================================================================
--- trunk/moon/src/clock.cpp    2007-07-05 19:20:27 UTC (rev 81426)
+++ trunk/moon/src/clock.cpp    2007-07-05 19:23:02 UTC (rev 81427)
@@ -66,7 +66,7 @@
   : child_clocks (NULL),
     tick_id (-1),
     current_timeout (FPS_TO_DELAY (DESIRED_FPS)),  /* something suitably small 
*/
-    flags (TimeManagerOp (TIME_MANAGER_UPDATE_CLOCKS | TIME_MANAGER_RENDER | 
TIME_MANAGER_TICK_CALL)),
+    flags (TimeManagerOp (TIME_MANAGER_UPDATE_CLOCKS | TIME_MANAGER_RENDER | 
TIME_MANAGER_TICK_CALL /*| TIME_MANAGER_UPDATE_INPUT*/)),
     tick_calls (NULL)
 {
        start_time = get_now ();
@@ -170,6 +170,12 @@
                ENDTICKTIMER (tick_update_clocks, "TimeManager::Tick - 
UpdateClocks");
        }
 
+       if (flags & TIME_MANAGER_UPDATE_INPUT) {
+               STARTTICKTIMER (tick_input, "TimeManager::Tick - Input");
+               Emit ("update-input");
+               ENDTICKTIMER (tick_input, "TimeManager::Tick - Input");
+       }
+
        if (flags & TIME_MANAGER_RENDER) {
                STARTTICKTIMER (tick_render, "TimeManager::Tick - Render");
                Emit ("render");

Modified: trunk/moon/src/clock.h
===================================================================
--- trunk/moon/src/clock.h      2007-07-05 19:20:27 UTC (rev 81426)
+++ trunk/moon/src/clock.h      2007-07-05 19:23:02 UTC (rev 81427)
@@ -194,7 +194,8 @@
        enum TimeManagerOp {
                TIME_MANAGER_UPDATE_CLOCKS = 0x01,
                TIME_MANAGER_RENDER = 0x02,
-               TIME_MANAGER_TICK_CALL = 0x04
+               TIME_MANAGER_TICK_CALL = 0x04,
+               TIME_MANAGER_UPDATE_INPUT = 0x08
        };
 
        TimeManagerOp flags;

Modified: trunk/moon/src/runtime.cpp
===================================================================
--- trunk/moon/src/runtime.cpp  2007-07-05 19:20:27 UTC (rev 81426)
+++ trunk/moon/src/runtime.cpp  2007-07-05 19:23:02 UTC (rev 81427)
@@ -121,6 +121,13 @@
        gdk_window_process_updates (GTK_WIDGET (s->drawing_area)->window, 
FALSE);
 }
 
+static void
+update_input (gpointer data)
+{
+       Surface *s = (Surface*)data;
+       s->toplevel->HandleMotion (s, s->last_event_state, s->last_event_x, 
s->last_event_y);
+}
+
 gboolean
 realized_callback (GtkWidget *widget, gpointer data)
 {
@@ -129,7 +136,7 @@
        create_similar (s, widget);
        s->cairo = s->cairo_xlib;
 
-       TimeManager::Instance()->AddHandler ("render", render_surface, s);
+       TimeManager::Instance()->AddHandler ("update-input", update_input, s);
        return TRUE;
 }
 
@@ -145,6 +152,7 @@
 
        s->cairo = s->cairo_buffer;
        TimeManager::Instance()->RemoveHandler ("render", render_surface, s);
+       TimeManager::Instance()->RemoveHandler ("update-input", update_input, 
s);
        return TRUE;
 }
 
@@ -256,6 +264,10 @@
                state = (GdkModifierType)event->state;
        }
 
+       s->last_event_x = x;
+       s->last_event_y = y;
+       s->last_event_state = state;
+
        s->toplevel->HandleMotion (s, state, x, y);
        return TRUE;
 }
@@ -279,10 +291,15 @@
                
                s->toplevel->HandleMotion (s, event->state, x, y);
                s->toplevel->Enter (s, event->state, x, y);
+
+               s->last_event_x = x;
+               s->last_event_y = y;
+               s->last_event_state = event->state;
+       
        } else {
                s->toplevel->Leave (s);
        }
-       
+
        return TRUE;
 }
 
@@ -475,6 +492,7 @@
        // very useful
        //
        TimeManager::Instance()->RemoveHandler ("render", render_surface, this);
+       TimeManager::Instance()->RemoveHandler ("update-input", update_input, 
this);
 
        if (toplevel) {
                toplevel->unref ();

Modified: trunk/moon/src/runtime.h
===================================================================
--- trunk/moon/src/runtime.h    2007-07-05 19:20:27 UTC (rev 81426)
+++ trunk/moon/src/runtime.h    2007-07-05 19:23:02 UTC (rev 81427)
@@ -80,6 +80,9 @@
 
        int frames;
 
+       int last_event_state;
+       double last_event_x, last_event_y;
+
        callback_mouse_event cb_motion, cb_down, cb_up, cb_enter;
        callback_plain_event cb_got_focus, cb_lost_focus, cb_loaded, 
cb_mouse_leave, cb_surface_resize;
        callback_keyboard_event cb_keydown, cb_keyup;

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

Reply via email to