Author: miguel
Date: 2007-06-13 02:16:46 -0400 (Wed, 13 Jun 2007)
New Revision: 79381
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/runtime.cpp
trunk/moon/src/runtime.h
trunk/moon/src/shape.cpp
Log:
2007-06-13 Miguel de Icaza <[EMAIL PROTECTED]>
* runtime.cpp: Various new events are now sent.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-06-13 06:06:33 UTC (rev 79380)
+++ trunk/moon/src/ChangeLog 2007-06-13 06:16:46 UTC (rev 79381)
@@ -1,3 +1,7 @@
+2007-06-13 Miguel de Icaza <[EMAIL PROTECTED]>
+
+ * runtime.cpp: Various new events are now sent.
+
2007-06-13 Jackson Harper <[EMAIL PROTECTED]>
* xaml.cpp: When using the xaml_create_from_str we automatically
Modified: trunk/moon/src/runtime.cpp
===================================================================
--- trunk/moon/src/runtime.cpp 2007-06-13 06:06:33 UTC (rev 79380)
+++ trunk/moon/src/runtime.cpp 2007-06-13 06:16:46 UTC (rev 79381)
@@ -1034,7 +1034,7 @@
if (!s->cb_motion)
return FALSE;
- s->toplevel->handle_motion (s, event->state & (GDK_SHIFT_MASK |
GDK_CONTROL_MASK), event->x, event->y);
+ s->toplevel->handle_motion (s, event->state, event->x, event->y);
return TRUE;
}
@@ -1043,7 +1043,14 @@
{
Surface *s = (Surface *) data;
- printf ("key press\n");
+ if (!s->cb_keydown)
+ return FALSE;
+
+ //
+ // I could not write a test that would send the output elsewhere, for
now
+ // just send to the toplevel
+ //
+ return s->cb_keydown (s->toplevel, key->state, key->keyval,
key->hardware_keycode);
}
static gboolean
@@ -1051,19 +1058,39 @@
{
Surface *s = (Surface *) data;
- printf ("key release\n");
+ //
+ // I could not write a test that would send the output elsewhere, for
now
+ // just send to the toplevel
+ //
+ return s->cb_keyup (s->toplevel, key->state, key->keyval,
key->hardware_keycode);
+
}
static gboolean
button_release_callback (GtkWidget *widget, GdkEventButton *button, gpointer
data)
{
- printf ("%d released\n", button->button);
+ Surface *s = (Surface *) data;
+
+ if (button->button != 1)
+ return FALSE;
+
+ // Again, I cant get this to go to anything but the toplevel, this is
odd.
+ s->cb_up (s->toplevel, button->state, button->x, button->y);
+ return TRUE;
}
static gboolean
button_press_callback (GtkWidget *widget, GdkEventButton *button, gpointer
data)
{
- printf ("%d pressed\n", button->button);
+ Surface *s = (Surface *) data;
+
+ gtk_widget_grab_focus (widget);
+ if (button->button != 1)
+ return FALSE;
+
+ // Again, I cant get this to go to anything but the toplevel, this is
odd.
+ s->cb_down (s->toplevel, button->state, button->x, button->y);
+ return TRUE;
}
void
Modified: trunk/moon/src/runtime.h
===================================================================
--- trunk/moon/src/runtime.h 2007-06-13 06:06:33 UTC (rev 79380)
+++ trunk/moon/src/runtime.h 2007-06-13 06:16:46 UTC (rev 79381)
@@ -588,7 +588,7 @@
// might want it
//
virtual void handle_motion (Surface *s, int state, double x, double y);
-
+
~UIElement ();
virtual void OnPropertyChanged (DependencyProperty *prop);
@@ -682,7 +682,7 @@
virtual void update_xform ();
virtual void get_xform_for (UIElement *item, cairo_matrix_t *result);
virtual void handle_motion (Surface *s, int state, double x, double y);
-
+
virtual void OnSubPropertyChanged (DependencyProperty *prop,
DependencyProperty *subprop);
static DependencyProperty* TopProperty;
@@ -698,7 +698,8 @@
//
typedef void (*callback_mouse_event) (UIElement *target, int state, double
x, double y);
typedef void (*callback_plain_event) (UIElement *target);
-typedef void (*callback_keyboard_event) (UIElement *target, int state, int
platformcode, int key);
+typedef bool (*callback_keyboard_event) (UIElement *target, int state, int
platformcode, int key);
+
class Surface {
public:
Surface () : width (0), height (0), buffer (0),
Modified: trunk/moon/src/shape.cpp
===================================================================
--- trunk/moon/src/shape.cpp 2007-06-13 06:06:33 UTC (rev 79380)
+++ trunk/moon/src/shape.cpp 2007-06-13 06:16:46 UTC (rev 79381)
@@ -20,6 +20,7 @@
#include "shape.h"
#include "cutil.h"
+#include <sys/time.h>
//
// SL-Cairo convertion and helper routines
//
@@ -219,14 +220,19 @@
cairo_save (s->cairo);
DoDraw (s, FALSE);
-
double nx = x;
double ny = y;
- cairo_matrix_transform_point (&absolute_xform, &nx, &ny);
+ cairo_matrix_t inverse = absolute_xform;
+ cairo_matrix_invert (&inverse);
+
+ cairo_matrix_transform_point (&inverse, &nx, &ny);
+
if (cairo_in_stroke (s->cairo, nx, ny) || (CanFill () && cairo_in_fill
(s->cairo, nx, ny)))
ret = TRUE;
+ cairo_new_path (s->cairo);
+
cairo_restore (s->cairo);
return ret;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches