Пример #1
0
        void CreateEvent(Gdk.EventScroll refEvent)
        {
            int rx, ry;

            tree.BinWindow.GetOrigin(out rx, out ry);
            NativeEventScrollStruct nativeEvent = new NativeEventScrollStruct();

            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.direction  = refEvent.Direction;
            nativeEvent.state      = (uint)refEvent.State;
            nativeEvent.device     = refEvent.Device.Handle;

            IntPtr ptr = GLib.Marshaller.StructureToPtrAlloc(nativeEvent);

            try {
                Gdk.EventScroll evnt = new Gdk.EventScroll(ptr);
                Gdk.EventHelper.Put(evnt);
            } finally {
                Marshal.FreeHGlobal(ptr);
            }
        }
Пример #2
0
        void CreateEvent(Gdk.EventScroll refEvent)
        {
            int rx, ry;
            tree.BinWindow.GetOrigin (out rx, out ry);
            NativeEventScrollStruct nativeEvent = new NativeEventScrollStruct ();
            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.direction = refEvent.Direction;
            nativeEvent.state = (uint) refEvent.State;
            nativeEvent.device = refEvent.Device.Handle;

            IntPtr ptr = GLib.Marshaller.StructureToPtrAlloc (nativeEvent);
            try {
                Gdk.EventScroll evnt = new Gdk.EventScroll (ptr);
                Gdk.EventHelper.Put (evnt);
            } finally {
                Marshal.FreeHGlobal (ptr);
            }
        }