<commit_before>using Eto.Drawing;
using Eto.Forms;
using Eto.WinForms.Forms;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using System;

namespace Eto.Gl.Windows
{
    public class WinGLSurfaceHandler : WindowsControl<WinGLUserControl, GLSurface, GLSurface.ICallback>, GLSurface.IHandler
    {
        public void CreateWithParams(GraphicsMode mode, int major, int minor, GraphicsContextFlags flags)
        {
            Control = new WinGLUserControl(mode, major, minor, flags);
        }

        protected override void Initialize()
        {
            base.Initialize();
            HandleEvent(GLSurface.GLDrawEvent);
        }

        public bool IsInitialized
        {
            get { return Control.IsInitialized; }
        }

        public void MakeCurrent()
        {
            Control.MakeCurrent();
        }

        public void SwapBuffers()
        {
            Control.SwapBuffers();
        }

        public override void AttachEvent(string id)
        {
            switch (id)
            {
                case GLSurface.GLInitializedEvent:
                    Control.Initialized += (sender, e) => Callback.OnInitialized(Widget, EventArgs.Empty);
                    break;

                case GLSurface.GLShuttingDownEvent:
                    Control.ShuttingDown += (sender, e) => Callback.OnShuttingDown(Widget, e);
                    break;

                case GLSurface.GLDrawEvent:
                    Control.Resize += (sender, e) => Callback.OnDraw(Widget, EventArgs.Empty);
                    break;

                default:
                    base.AttachEvent(id);<commit_msg>WinForms fix up.<commit_after>using Eto.Drawing;
using Eto.Forms;
using Eto.WinForms.Forms;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using System;

namespace Eto.Gl.Windows
{
    public class WinGLSurfaceHandler : WindowsControl<WinGLUserControl, GLSurface, GLSurface.ICallback>, GLSurface.IHandler
    {
        public void CreateWithParams(GraphicsMode mode, int major, int minor, GraphicsContextFlags flags)
        {
            Control = new WinGLUserControl(mode, major, minor, flags);
        }

        protected override void Initialize()
        {
            base.Initialize();
            HandleEvent(GLSurface.GLDrawEvent);
        }

        public bool IsInitialized
        {
            get { return Control.IsInitialized; }
        }

        public void MakeCurrent()
        {
            Control.MakeCurrent();
        }

        public void SwapBuffers()
        {
            Control.SwapBuffers();
        }

		public void updateViewHandler(object sender, EventArgs e)
		{
			updateView();
		}

		public void updateView()
		{
			Control.MakeCurrent();
			GL.Viewport(Control.ClientSize);
			Callback.OnDraw(Widget, EventArgs.Empty);
			Control.SwapBuffers();
			Control.MakeCurrent();
		}

		public override void AttachEvent(string id)
        {
            switch (id)
            {
                case GLSurface.GLInitializedEvent:
                    Control.Initialized += (sender, e) => Callback.OnInitialized(Widget, EventArgs.Empty);
                    break;

                case GLSurface.GLShuttingDownEvent:
                    Control.ShuttingDown += (sender, e) => Callback.OnShuttingDown(Widget, e);
                    break;

				case GLSurface.ShownEvent:
				case GLSurface.SizeChangedEvent:
				case GLSurface.GLDrawEvent:
					Control.Paint += updateViewHandler;
					//Control.Resize += (sender, e) => Callback.OnDraw(Widget, EventArgs.Empty);
					break;

				default:
                    base.AttachEvent(id);
{'fraction_non_alphanumeric': 0.08858321870701513, 'fraction_numerical': 0.0, 'mean_word_length': 1.980327868852459, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1442326', 'n_tokens_mistral': 1056, 'n_tokens_neox': 962, 'n_words': 207}