fix mouseclicks on GL viewport

This commit is contained in:
zeromus 2014-01-27 02:06:05 +00:00
parent ce9f282d67
commit be49f6fa33
2 changed files with 15 additions and 0 deletions

View File

@ -49,6 +49,12 @@ namespace BizHawk.Client.EmuHawk
//gl shouldnt be disposed! it should be a global resource! probably managed elsewhere
}
private void HandleFullscreenToggle(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
GlobalWin.MainForm.ToggleFullscreen();
}
class FontWrapper : IBlitterFont
{
public FontWrapper(StringRenderer font)
@ -67,6 +73,11 @@ namespace BizHawk.Client.EmuHawk
GraphicsControl = gl.CreateGraphicsControl();
Renderer = new GuiRenderer(gl);
//pass through these events to the form. we might need a more scalable solution for mousedown etc. for zapper and whatnot.
//http://stackoverflow.com/questions/547172/pass-through-mouse-events-to-parent-control (HTTRANSPARENT)
GraphicsControl.Control.MouseDoubleClick += (o, e) => HandleFullscreenToggle(o, e);
GraphicsControl.Control.MouseClick += (o, e) => GlobalWin.MainForm.MainForm_MouseClick(o, e);
using (var xml = typeof(Program).Assembly.GetManifestResourceStream("BizHawk.Client.EmuHawk.Resources.courier16px.fnt"))
using (var tex = typeof(Program).Assembly.GetManifestResourceStream("BizHawk.Client.EmuHawk.Resources.courier16px_0.png"))
TheOneFont = new StringRenderer(gl,xml,tex);

View File

@ -10,6 +10,7 @@
//http://www.opentk.com/node/437 (AGG#, codes on Tao forums)
using System;
using System.Reflection;
using System.Threading;
using System.IO;
using System.Collections.Generic;
@ -121,6 +122,9 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
GLControlWrapper wrapper = new GLControlWrapper(this);
wrapper.MyControl = glc;
//this might be important.. or it might not. it's ready, in case we need it
//glc.GetType().GetMethod("SetStyle", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(glc, new object[] { System.Windows.Forms.ControlStyles.UserMouse, true });
return wrapper;
}