void CreateEvent(Gdk.EventButton refEvent) { int rx, ry; tree.BinWindow.GetOrigin(out rx, out ry); NativeEventButtonStruct nativeEvent = new NativeEventButtonStruct(); nativeEvent.type = refEvent.Type; nativeEvent.send_event = 1; nativeEvent.window = tree.BinWindow.Handle; nativeEvent.x = refEvent.XRoot - rx; nativeEvent.y = refEvent.YRoot - ry; nativeEvent.x_root = refEvent.XRoot; nativeEvent.y_root = refEvent.YRoot; nativeEvent.time = refEvent.Time; nativeEvent.state = (uint)refEvent.State; nativeEvent.button = refEvent.Button; nativeEvent.device = refEvent.Device.Handle; IntPtr ptr = GLib.Marshaller.StructureToPtrAlloc(nativeEvent); try { Gdk.EventButton evnt = new Gdk.EventButton(ptr); Gdk.EventHelper.Put(evnt); } finally { Marshal.FreeHGlobal(ptr); } }
void CreateEvent(Gdk.EventButton refEvent) { int rx, ry; tree.BinWindow.GetOrigin (out rx, out ry); NativeEventButtonStruct nativeEvent = new NativeEventButtonStruct (); nativeEvent.type = refEvent.Type; nativeEvent.send_event = 1; nativeEvent.window = tree.BinWindow.Handle; nativeEvent.x = refEvent.XRoot - rx; nativeEvent.y = refEvent.YRoot - ry; nativeEvent.x_root = refEvent.XRoot; nativeEvent.y_root = refEvent.YRoot; nativeEvent.time = refEvent.Time; nativeEvent.state = (uint) refEvent.State; nativeEvent.button = refEvent.Button; nativeEvent.device = refEvent.Device.Handle; IntPtr ptr = GLib.Marshaller.StructureToPtrAlloc (nativeEvent); try { Gdk.EventButton evnt = new Gdk.EventButton (ptr); Gdk.EventHelper.Put (evnt); } finally { Marshal.FreeHGlobal (ptr); } }